1(function($) { 2 3$(document).ready(function() { 4 5 $("#sexy_tooltip").mousedown(function(e){ 6 return false; 7 }); 8 9 $(document).mousedown(function(e){ 10 var w = parseInt(e.which); 11 if(w == 3) { 12 return false; 13 } 14 if(!isMyDiv(e) && isVissible()) { 15 hide_speaker(); 16 clearSelection(); 17 } 18 else { 19 if(isVissible() && isMyDiv(e)) { 20 if(!sound_container_clicked) { 21 if(!check_pro_version()) { 22 alert('To hide a backlink please purchase a GSpeech PRO version'); 23 return false; 24 } 25 var isIE = document.all?true:false; 26 make_audio(); 27 if(isIE) 28 blink_speaker(); 29 else 30 rotate_speaker(); 31 //user clicks on my speaker 32 sound_container_clicked = true; 33 } 34 else { 35 clearSelection(); 36 hide_speaker(); 37 } 38 39 e.preventDefault(); 40 } 41 else 42 clearSelection(); 43 } 44 }); 45 46 $("body").keydown(function(e) { 47 if(e.keyCode == 13) { 48 if(isVissible()) { 49 if(!sound_container_clicked) { 50 if(!check_pro_version()) { 51 alert('To hide a backlink please purchase a GSpeech PRO version'); 52 return false; 53 } 54 var isIE = document.all?true:false; 55 make_audio(); 56 if(isIE) 57 blink_speaker(); 58 else 59 rotate_speaker(); 60 //user clicks on my speaker 61 sound_container_clicked = true; 62 } 63 else { 64 clearSelection(); 65 hide_speaker(); 66 } 67 } 68 } 69 }); 70 71 function clearSelection() { 72 if (window.getSelection) { 73 if (window.getSelection().empty) { // Chrome 74 window.getSelection().empty(); 75 } else if (window.getSelection().removeAllRanges) { // Firefox 76 window.getSelection().removeAllRanges(); 77 } 78 } else if (document.selection) { // IE 79 document.selection.empty(); 80 } 81 }; 82 83 function hide_speaker() { 84 clearAllPlayers(); 85 $('#sound_container').fadeTo(10,1); 86 $('#sound_container').fadeOut(300); 87 for(f in blink_timer) { 88 clearTimeout(blink_timer[f]); 89 } 90 for(ff in rotate_timer) { 91 clearInterval(rotate_timer[ff]); 92 } 93 sound_container_clicked = false; 94 blinking_enable = true; 95 sound_container_visible = true; 96 97 hide_tooltip_basic($('#sexy_tooltip')); 98 }; 99 100 function stop_speaker() { 101 clearAllPlayers(); 102 $("#sound_container").rotate({animateTo:360}); 103 $('#sound_container').fadeTo(10,1); 104 for(f in blink_timer) { 105 clearTimeout(blink_timer[f]); 106 } 107 for(f in rotate_timer) { 108 clearInterval(rotate_timer[f]); 109 } 110 sound_container_clicked = false; 111 blinking_enable = true; 112 sound_container_visible = true; 113 }; 114 115 document.onmouseup = function(e){ 116 if(!basic_plg_enable) 117 return; 118 selected_txt = GetSelectedText (); 119 if(!isMyDiv(e) && !sound_container_clicked) { 120 var patt1=/^(\s)*$/gi; 121 var txt_empty = patt1.test(selected_txt); 122 if(txt_empty) 123 selected_txt = ''; 124 if(selected_txt != '' && selected_txt != undefined && selected_txt.length > 1 && !txt_empty) { 125 var coords = get_coord (e); 126 var x = coords[0]; 127 var y = coords[1]; 128 move_sound_container(x,y,selected_txt); 129 } 130 } 131 }; 132 133 function check_pro_version() { 134 return true; 135 var bl = $("#sexy_tooltip").css("display"); 136 var bl1 = $("#sexy_tooltip .tooltip_inner").css("display"); 137 if(bl == 'block' && bl1 == 'block') 138 return true; 139 return false; 140 }; 141 142 $("#sexy_tooltip").mouseup(function(e){ 143 return false; 144 }); 145 146 function rotate_speaker() { 147 var angle = 0; 148 rotate_timer_element = setInterval(function(){ 149 angle+=3; 150 $("#sound_container").rotate(angle); 151 },15); 152 rotate_timer.push(rotate_timer_element); 153 154 }; 155 156 function blink_speaker() { 157 if(sound_container_visible) { 158 $('#sound_container').fadeTo(200,0.2); 159 sound_container_visible = false; 160 } 161 else { 162 $('#sound_container').fadeTo(200,1); 163 sound_container_visible = true; 164 } 165 blink_timer.push(setTimeout(blink_speaker,800)); 166 }; 167 168 function change_speaker_animation() { 169 if(!($("#sound_container").is(":visible"))) 170 return; 171 if(blinking_enable) { 172 for(f in rotate_timer) { 173 clearInterval(rotate_timer[f]); 174 } 175 $("#sound_container").rotate({animateTo:0}); 176 blink_speaker(); 177 } 178 blinking_enable = false; 179 }; 180 181 function isVissible() 182 { 183 var dis = $('#sound_container').css('display'); 184 if(dis == 'block') 185 return true; 186 else 187 return false; 188 }; 189 190 function isMyDiv(e) { 191 if(typeof event=="undefined") 192 var x = e.target||e.srcElement; 193 else 194 var x = event.target||event.srcElement; 195 var id_clicked = x.id; 196 if(id_clicked == 'sound_container') 197 return true; 198 else 199 return false; 200 }; 201 202 function navigate_tooltip_basic($tooltip,sound_x,sound_y) { 203 204 var center_offset_x = parseFloat($('#sound_container ').width() / 2); 205 var tooltip_width = parseFloat($tooltip.find('.tooltip_inner').width()); 206 var tooltip_height = parseFloat($tooltip.show().find('.tooltip_inner').height()); 207 var container_height = parseFloat($tooltip.next('#sound_container ').height()); 208 $tooltip.hide(); 209 210 if($tooltip.find('.the-tooltip').hasClass('left')) { 211 var final_offset = -32 * 1 + center_offset_x * 1 + sound_x * 1; 212 $tooltip.css({'left': final_offset, opacity: 0, 'display': 'block'});
213 } 214 215 if($tooltip.find('.the-tooltip').hasClass('top')) { 216 var top_0 = sound_y - 200 * 1; 217 var top_1 = sound_y ; 218 $tooltip.css({'top': top_0, display: 'block'}); 219 var new_opacity = 0.95; 220 $tooltip.stop().animate( { 221 top: top_1, 222 opacity: new_opacity 223 },300,'easeOutBack',function () { 224 $tooltip.css({'display': 'block'}); 225 }); 226 } 227 else if($tooltip.find('.the-tooltip').hasClass('bottom')) { 228 if($tooltip.find('.tooltip_inner').hasClass('powered_by')) 229 var new_opacity = 0.95; 230 else 231 var new_opacity = 0.95; 232 233 var top_0 = sound_y + 200 * 1; 234 var top_1 = sound_y + container_height * 1 + 16 * 1 ; 235 $tooltip.css({'top': top_0,display: 'block'}); 236 $tooltip.stop().animate( { 237 top: top_1, 238 opacity: new_opacity 239 },300,'easeOutBack',function () { 240 $tooltip.css({'display': 'block'}); 241 }); 242 } 243 }; 244 245 function hide_tooltip_basic($tooltip) { 246 if($tooltip.find('.the-tooltip').hasClass('top')) { 247 $tooltip.stop(true,true).delay(200).animate( { 248 top: '-=200px', 249 opacity: 0 250 },300,'easeInBack',function() { 251 $(this).hide(); 252 }); 253 } 254 else if($tooltip.find('.the-tooltip').hasClass('bottom')) { 255 $tooltip.stop(true,true).delay(130).animate( { 256 top: '+=200px', 257 opacity: 0 258 },300,'easeInBack',function() { 259 $(this).hide(); 260 }); 261 } 262 } 263 264 $("#sound_container").hover(function() { 265 var sound_x = parseFloat($(this).css('left')); 266 var sound_y = parseFloat($(this).css('top')); 267 navigate_tooltip_basic($('#sexy_tooltip_title'),sound_x,sound_y); 268 },function() { 269 var sound_x = parseFloat($(this).css('left')); 270 var sound_y = parseFloat($(this).css('top')); 271 hide_tooltip_basic($('#sexy_tooltip_title'),sound_x,sound_y); 272 }); 273 274 function move_sound_container(x,y,txt) { 275 var sound_x = x * 1 + 5; 276 var sound_y = y * 1 - 5; 277 $('#sound_container').css({ 278 left: sound_x, 279 top: sound_y 280 }); 281 $("#sound_container").rotate(0); 282 $('#sound_container').fadeIn(400); 283 $('#sound_text').html(txt); 284 285 navigate_tooltip_basic($('#sexy_tooltip'),sound_x,sound_y); 286 }; 287 288 //main function which creates audio 289 function make_audio() { 290 selected_txt = $('#sound_text').html(); 291 var 292 words_array = new Array(), 293 sent_array = new Array(), 294 sent_index = 0; 295 296 words_array = selected_txt.split(/[^\S]+/); 297 298 for(var i = 0; i < words_array.length; i++) { 299 if(sent_array[sent_index] == undefined) { 300 sent_array[sent_index] = ''; 301 } 302 303 var total_l = sent_array[sent_index].length + words_array[i].length; 304 if(sent_array[sent_index].length < speech_text_length && total_l < speech_text_length) { 305 sent_array[sent_index] += words_array[i] + ' '; 306 } 307 else { 308 ++sent_index; 309 sent_array[sent_index] = words_array[i] + ' '; 310 } 311 }; 312 313 var players_count = sent_array.length; 314 315 var htm_cont = ''; 316 for(var i = 0; i < players_count; i++) { 317 htm_cont += '<audio id="player' + i + '" src="' + streamerphp_folder + 'speech.mpeg" type="' + translation_audio_type + '" controls="controls"></audio>'; 318 } 319 $("#sound_audio").html(htm_cont); 320 321 for(var i = 0; i < players_count; i++) { 322 create_htm(i,players_count); 323 }; 324 325 // new version addings 326 327 function gs_get_token(encoded_text) { 328 var query = encoded_text; 329 var cM = function(a) { 330 return function() { 331 return a 332 } 333 }; 334 var of = "="; 335 var dM = function(a, b) { 336 for (var c = 0; c < b.length - 2; c += 3) { 337 var d = b.charAt(c + 2), 338 d = d >= t ? d.charCodeAt(0) - 87 : Number(d), 339 d = b.charAt(c + 1) == Tb ? a >>> d : a << d; 340 a = b.charAt(c) == Tb ? a + d & 4294967295 : a ^ d 341 } 342 return a 343 }; 344 345 var eM = null; 346 var cb = 0; 347 var k = ""; 348 var Vb = "+-a^+6"; 349 var Ub = "+-3^+b+-f"; 350 var t = "a"; 351 var Tb = "+"; 352 var dd = "."; 353 var hoursBetween = Math.floor(Date.now() / 3600000); 354 window.TKK = hoursBetween.toString(); 355 356 fM = function(a) { 357 var b; 358 if (null === eM) { 359 var c = cM(String.fromCharCode(84)); // char 84 is T 360 b = cM(String.fromCharCode(75)); // char 75 is K 361 c = [c(), c()]; 362 c[1] = b(); 363 // So basically we're getting window.TKK
364 eM = Number(window[c.join(b())]) || 0 365 } 366 b = eM; 367 368 // This piece of code is used to convert d into the utf-8 encoding of a 369 var d = cM(String.fromCharCode(116)), 370 c = cM(String.fromCharCode(107)), 371 d = [d(), d()]; 372 d[1] = c(); 373 for (var c = cb + d.join(k) + 374 of, d = [], e = 0, f = 0; f < a.length; f++) { 375 var g = a.charCodeAt(f); 376 377 128 > g ? d[e++] = g : (2048 > g ? d[e++] = g >> 6 | 192 : (55296 == (g & 64512) && f + 1 < a.length && 56320 == (a.charCodeAt(f + 1) & 64512) ? (g = 65536 + ((g & 1023) << 10) + (a.charCodeAt(++f) & 1023), d[e++] = g >> 18 | 240, d[e++] = g >> 12 & 63 | 128) : d[e++] = g >> 12 | 224, d[e++] = g >> 6 & 63 | 128), d[e++] = g & 63 | 128) 378 } 379 380 381 a = b || 0; 382 for (e = 0; e < d.length; e++) a += d[e], a = dM(a, Vb); 383 a = dM(a, Ub); 384 0 > a && (a = (a & 2147483647) + 2147483648); 385 a %= 1E6; 386 return a.toString() + dd + (a ^ b) 387 }; 388 389 var token = fM(query); 390 391 return token; 392 } 393 394 function gs_replace_ch(str) { 395 var str = str.replace("'", ""); 396 str = str.replace('"', ''); 397 str = str.replace('', ''); 398 str = str.replace('/', ''); 399 str = str.replace(' ', ''); 400 // str = str.replace('&', ''); 401 402 return str; 403 } 404 405 function create_htm(i,players_count) { 406 $('#player' + i).mediaelementplayer({ 407 success: function (mediaElement, domObject) { 408 //detect media end 409 players[i] = mediaElement; 410 411 412 // sets src 413 var encoded_text = gs_replace_ch(sent_array[i]); 414 var token = gs_get_token(encoded_text); 415 encoded_text = encodeURIComponent(encoded_text); 416 var embed_url = streamerphp_folder + 'streamer.php?q=' + encoded_text + '&l=' + lang_identifier + '&tr_tool=' +translation_tool + '&token=' + token; 417 mediaElement.setSrc(embed_url); 418 419 //play next audio, when current ends 420 mediaElement.addEventListener('pause', function(e) { 421 try { 422 players[i + 1].play() 423 } catch(e){} 424 }, false); 425 426 players[0].addEventListener('progress', function(e) { 427 change_speaker_animation(); 428 }, false); 429 430 if(i == players_count - 1) { 431 players[players_count - 1].addEventListener('pause', function(e) { 432 stop_speaker(); 433 }, false); 434 } 435 436 mediaElement.load(); 437 438 if(i == 0) { 439 mediaElement.play(); 440 } 441 } 442 }); 443 } 444 445 }; 446 447 function GetSelectedText() { 448 var selText = "", selTextParts = []; 449 450 function getNodeText(node) { 451 if (node.nodeType == 3) { 452 selTextParts.push(node.data); 453 } else if (node.hasChildNodes() 454 && !(node.nodeType == 1 && /^(script|style)$/i.test(node.tagName))) { 455 for (var child = node.firstChild; !!child; child = child.nextSibling) { 456 getNodeText(child); 457 } 458 } 459 }; 460 461 if (window.getSelection) { 462 var sel = window.getSelection(), rangeCount = sel.rangeCount; 463 if (rangeCount) { 464 for (var i = 0; i < rangeCount; ++i) { 465 getNodeText(sel.getRangeAt(i).cloneContents()); 466 } 467 selText = selTextParts.join(""); 468 } 469 } 470 else if (document.selection && document.selection.type == "Text") { 471 selText = document.selection.createRange().text; 472 } 473 return selText; 474 }; 475 476 function get_coord (e) { 477 var isIE = document.all?true:false; 478 var pos_x, pos_y; 479 if (!isIE) { 480 pos_x = e.pageX; 481 pos_y = e.pageY; 482 } 483 if (isIE) { 484 var left = document.documentElement.scrollLeft ? 485 document.documentElement.scrollLeft : 486 document.body.scrollLeft; 487 pos_x = event.clientX + left; 488 489 var top = document.documentElement.scrollTop ? 490 document.documentElement.scrollTop : 491 document.body.scrollTop; 492 pos_y = event.clientY + top; 493 } 494 return [pos_x,pos_y]; 495 }; 496 497 function clearAllPlayers() { 498 for(var c in players) { 499 players[c] = ''; 500 } 501 $('#sound_audio').html(''); 502 }; 503 504 505 506}); 507})(jQuery);
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.