1var debug; 2var user_id; 3var at_replies = []; 4var default_num_invites = 25; 5var base_message = 'What are your favorite words?'; 6 7String.prototype.capitalize = function() { 8 return this.charAt(0).toUpperCase() + this.slice(1); 9}; 10 11function sharefacebook(shareURL, user_id, send_or_share) { 12 if(send_or_share == 'send') { 13 if(_is_mobile()){ 14 FB.ui({ 15 method: 'share', 16 href: shareURL + '/?ref=' + user_id 17 }); 18 }else{ 19 FB.ui({ 20 method: send_or_share, 21 link: shareURL + '/?ref=' + user_id, 22 }); 23 } 24 } else { 25 FB.ui({ 26 method: send_or_share, 27 href: shareURL + '/?ref=' + user_id, 28 }); 29 } 30 $('#tutorial-dialog').dialog('close'); 31} 32 33function sharetwitter(shareURL, user_id) { 34 window.open('/social.php?provider=twitter&invite=yes','twitter-share-dialog', 'width=700,height=500'); 35 $('#tutorial-dialog').dialog('close'); 36} 37 38function sharelinkedin(shareURL, user_id) { 39 window.open('http://www.linkedin.com/shareArticle?mini=true&title=slova.ru&summary=' + base_message + '&url='+shareURL+'%2F%3Fref%3D'+user_id,'linkedin-share-dialog', 'width=840,height=570'); 40 $('#tutorial-dialog').dialog('close'); 41} 42 43function sharegoogle(shareURL, user_id) { 44 window.open('https://plus.google.com/share?url='+shareURL+'/?ref='+user_id,'google-share-dialog', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,width=600,height=60u'); 45 $('#tutorial-dialog').dialog('close'); 46} 47 48 49 50window.fbAsyncInit = function() { 51 FB.init({ 52 appId : '798038646980395', 53 xfbml : true, 54 version : 'v2.3' 55 }); 56}; 57 58(function(d, s, id){ 59 var js, fjs = d.getElementsByTagName(s)[0]; 60 if (d.getElementById(id)) {return;} 61 js = d.createElement(s); js.id = id; 62 js.src = "//connect.facebook.net/en_US/sdk.js"; 63 fjs.parentNode.insertBefore(js, fjs); 64}(document, 'script', 'facebook-jssdk')); 65 66function activate_social_buttons () { 67 var socialMediaLinks = $('.social-media-sharing'); 68 var socialMediaLogins = $('.social-media-login'); 69 socialMediaLogins.find('.facebook').on('click', function () { 70 $("#email_notice, #password_notice").remove(); 71 var termsBOX = $("#termsBOX"); 72 if(termsBOX.prop("checked")) { 73 window.open("/social.php?provider=facebook", 'facebook-login-dialog', 'width=626,height=436'); 74 } else { 75 var password = $(".password"); 76 password.after('<div id="password_notice">You must agree to our terms in order to sign up.</div>'); 77 } 78 return false; 79 }); 80 socialMediaLinks.find('.facebook').on('click', function () { 81 window.open("/social.php?provider=facebook", 'facebook-login-dialog', 'width=626,height=436'); 82 return false; 83 }); 84 85 socialMediaLogins.find('.twitter').on('click', function () { 86 $("#email_notice, #password_notice").remove(); 87 var termsBOX = $("#termsBOX"); 88 if(termsBOX.prop("checked")) { 89 window.open("/social.php?provider=twitter", 'twitter-login-dialog', 'width=680,height=500'); 90 } else { 91 var password = $(".password"); 92 password.after('<div id="password_notice">You must agree to our terms in order to sign up.</div>'); 93 } 94 return false; 95 }); 96 socialMediaLinks.find('.twitter').on('click', function () { 97 if(twitterFriends) { 98 inviteWindow('twitterinvite',user_id); 99 } else { 100 window.open("/social.php?provider=twitter&invite=yes", 'twitter-login-dialog', 'width=680,height=500'); 101 } 102 return false; 103 }); 104 105 socialMediaLogins.find('.linkedin').on('click', function () { 106 $("#email_notice, #password_notice").remove(); 107 var termsBOX = $("#termsBOX"); 108 if(termsBOX.prop("checked")) { 109 window.open("/social.php?provider=linkedin", 'linkedin-login-dialog', 'width=680,height=400'); 110 } else { 111 var password = $(".password"); 112 password.after('<div id="password_notice">You must agree to our terms in order to sign up.</div>'); 113 } 114 return false; 115 }); 116 socialMediaLinks.find('.linkedin').on('click', function () { 117 window.open("/social.php?provider=linkedin", 'linkedin-login-dialog', 'width=680,height=400'); 118 return false; 119 }); 120 121 socialMediaLogins.find('.googleplus').on('click', function () { 122 $("#email_notice, #password_notice").remove(); 123 var termsBOX = $("#termsBOX"); 124 if(termsBOX.prop("checked")) { 125 window.open("/social.php?provider=google", 'google-login-dialog', 'width=680,height=500'); 126 } else { 127 var password = $(".password"); 128 password.after('<div id="password_notice">You must agree to our terms in order to sign up.</div>'); 129 } 130 return false;
131 }); 132 socialMediaLinks.find('.googleplus').on('click', function () { 133 window.open("/social.php?provider=google", 'google-login-dialog', 'width=680,height=500'); 134 return false; 135 }); 136} 137 138$(document).ready(function() { 139 activate_social_buttons (); 140}); 141 142function inviteWindow(provider,uid) { 143 user_id = uid; 144 var i = null; 145 var Cprovider = provider.capitalize(); 146 var defaultURL = encodeURIComponent(window.location.protocol + '//' + window.location.host); 147 148 var dialogWidth = null; 149 if($(window).width() >= 1000) { 150 dialogWidth = 465; 151 } else { 152 dialogWidth = 0.75 * $(window).width(); 153 } 154 155 var tutorial_title = null; 156 var content = null; 157 if(provider == 'twitterinvite') { 158 var maxFriends = 200; // we don't want to show the whole list 159 tutorial_title = "Invite Your Twitter Friends"; 160 content = '<div id="tutorial-invite"><div id="tweetLong" style="font-size:1.6em;padding-bottom:10px;"></div>'; 161 if(twitterFriends == 'Rate limit exceeded') { 162 content += '<p>Twitter puts a limit on how often we can ask for a list of your friends. We recommend you wait fifteen minutes and try again.</p>'; 163 } else { 164 dialogWidth = 0.75 * $(window).width(); 165 var limit = Math.min(maxFriends, twitterFriends.length); 166 for(i = 0; i < limit; i++) { 167 var name = twitterFriends[i].name; 168 var uname = twitterFriends[i].uname; 169 var pic = twitterFriends[i].pic; 170 var user_data = 171 '<div style="float:left;padding:5px;" title="' + uname + '" id="twitter-' + i + '">' + 172 '<img height="30" width="30" src="' + pic + '" id="twitterpic-' + uname + '" class="twitterUser"/>' + 173 '<span style="font-size:1.6em;" id="twittername-' + uname + '" class="twitterUser">' + name + '</span>' + 174 '</div>'; 175 content += user_data; 176 } 177 } 178 content += "</div>"; 179 180 } else if (provider == 'facebook') { 181 tutorial_title = "Invite Your " + provider + " Friends"; 182 content = 183 '<div id="tutorial-invite">' + 184 '<a href="javascript:share' + provider + '(\'' + defaultURL + '\',\'' + uid + '\',\'send\');">' + 185 '<input class="btn-general btn-custom-blue btn-click-here" style="padding-left: 15px;margin: 0px auto;width: auto;" type="submit" value="Click Here">' + 186 '</a>' + 187 '<p> to invite your ' + Cprovider + ' friends to use slova.ru</p>' + 188 '<input class="save back-to-options btn-custom-blue" style="padding-left: 15px;margin: 0px auto;width: auto;" type="submit" value="Invite friends from other places too!""> <br/><br/>' + 189 '<input class="btn-general btn-custom-blue lets-start" style="padding-left: 15px;margin: 0px auto;" type="submit" value="Or just start using the site">' + 190 '</div>'; 191 192 } else { 193 tutorial_title = "Invite Your " + provider + " Friends"; 194 content = 195 '<div id="tutorial-invite">' + 196 '<a href="javascript:share' + provider + '(\'' + defaultURL + '\',\'' + uid + '\');">' + 197 '<input class="btn-general btn-custom-blue btn-click-here" style="padding-left: 15px;margin: 0px auto;width: auto;" type="submit" value="Click Here">' + 198 '</a>' + 199 '<p>to invite your ' + Cprovider + ' friends to use slova.ru</p>' + 200 '<input class="save back-to-options btn-custom-blue" style="padding-left: 15px;margin: 0px auto;width: auto;" type="submit" value="Invite friends from other places too!""> <br/><br/>' + 201 '<input class="btn-general btn-custom-blue lets-start" style="padding-left: 15px;margin: 0px auto;" type="submit" value="Or just start using the site">' + 202 '</div>'; 203 } 204 $('<div id="tutorial-dialog">'+ content +'</div>').appendTo('body'); 205 206 if(twitterFriends) { 207 for(i = 0; i < twitterFriends.length; i++) { 208 if (i > default_num_invites) { 209 $("#twitter-" + i).hide(); 210 } 211 } 212 } 213 $("#tweetLong").hide(); 214 $("#tweetNow").hide(); 215 $("#tutorial-dialog").dialog({ 216 modal: true, 217 width: '100%', 218 dialogClass: "tutorial-modal", 219 title: tutorial_title, 220 resizable: false, 221 open: function() { 222 $('.ui-widget-overlay').bind('click',function() { 223 $('#tutorial-dialog').dialog('close'); 224 }); 225 }, 226 close: function() { 227 at_replies = []; 228 $(this).dialog('destroy'); 229 $(this).remove(); 230 } 231 }); 232 233 $(document).on("click",".ui-dialog-titlebar-close",function(){ 234 window.top.location = 'start?back=yes'; 235 }); 236 $(document).on("click",".lets-start",function(){ 237 window.top.location = 'start'; 238 }); 239 $(document).on("click",".back-to-options",function(){ 240 window.top.location = 'start?back=yes'; 241 }); 242 243 $(window).resize(function() { 244 $("#tutorial-dialog").dialog("option", "position", {my: "center", at: "center", of: window}
244); 245 }); 246 $("#tutorial-invite").find('.twitterUser').on('click', function (el) { 247 var clickedEl = el.target; 248 var user_name = clickedEl.id.split('-')[1]; 249 var invitedUserDiv = clickedEl.parentElement; 250 at_replies.push(user_name); 251 var nextUserIndex = default_num_invites + at_replies.length; 252 invitedUserDiv.innerHTML = "User added to tweet."; 253 $(invitedUserDiv).delay(100).fadeOut(); 254 $("#twitter-" + nextUserIndex).delay(110).fadeIn(); 255 var tweet_length = base_message.length + at_replies.join(' @').length + 2; 256 var num_friends = at_replies.length; 257 var friend_string = num_friends + " friend"; 258 if (num_friends > 1) { 259 friend_string += 's'; 260 } 261 if(tweet_length > 100) { 262 $("#tweetLong").html('Please stop adding people and <a href="javascript:void(tweet('+uid+'))">tweet now!</a><br/>You will be able to add more followers with your next tweet.'); 263 } else { 264 $("#tweetLong").html('You have added ' + friend_string + '. Keep adding, or <a href="javascript:void(tweet('+uid+'))">Tweet Now</a>'); 265 } 266 $("#tweetLong").fadeIn(); 267 $("#tweetNow").fadeIn(); 268 }); 269 return false; 270} 271 272function tweet(uid) { 273 $("#tweetLong").hide(); 274 $("#tweetNow").hide(); 275 var base_url = 'https://twitter.com/intent/tweet?text='; 276 var ref_link = 'https%3A%2F%2Fslova.ru%2F%3Fref%3D' + uid; 277 var message = base_message + ' %40' + at_replies.join('+%40') + ' '; 278 at_replies = []; 279 window.open(base_url + message + '&url=' + ref_link); 280} 281 282 283function _is_mobile(){ 284 if( /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { 285 return true; 286 }else{ 287 return false; 288 } 289};//_is_mobile
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.