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