1(function($) { 2 3$(document).ready(function() { 4 5 $("#gs_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($('#gs_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 var bl = $("#gs_tooltip").css("display"); 135 var bl1 = $("#gs_tooltip .tooltip_inner").css("display"); 136 if(bl == 'block' && bl1 == 'block') 137 return true; 138 return false; 139 }; 140 141 $("#gs_tooltip").mouseup(function(e){ 142 return false; 143 }); 144 145 function rotate_speaker() { 146 var angle = 0; 147 rotate_timer_element = setInterval(function(){ 148 angle+=3; 149 $("#sound_container").rotate(angle); 150 },15); 151 rotate_timer.push(rotate_timer_element); 152 153 }; 154 155 function blink_speaker() { 156 if(sound_container_visible) { 157 $('#sound_container').fadeTo(200,0.2); 158 sound_container_visible = false; 159 } 160 else { 161 $('#sound_container').fadeTo(200,1); 162 sound_container_visible = true; 163 } 164 blink_timer.push(setTimeout(blink_speaker,800)); 165 }; 166 167 function change_speaker_animation() { 168 if(!($("#sound_container").is(":visible"))) 169 return; 170 if(blinking_enable) { 171 for(f in rotate_timer) { 172 clearInterval(rotate_timer[f]); 173 } 174 $("#sound_container").rotate({animateTo:0}); 175 blink_speaker(); 176 } 177 blinking_enable = false; 178 }; 179 180 function isVissible() 181 { 182 var dis = $('#sound_container').css('display');
183 if(dis == 'block') 184 return true; 185 else 186 return false; 187 }; 188 189 function isMyDiv(e) { 190 if(typeof event=="undefined") 191 var x = e.target||e.srcElement; 192 else 193 var x = event.target||event.srcElement; 194 var id_clicked = x.id; 195 if(id_clicked == 'sound_container') 196 return true; 197 else 198 return false; 199 }; 200 201 function navigate_tooltip_basic($tooltip,sound_x,sound_y) { 202 203 var center_offset_x = parseFloat($('#sound_container ').width() / 2); 204 var tooltip_width = parseFloat($tooltip.find('.tooltip_inner').width()); 205 var tooltip_height = parseFloat($tooltip.show().find('.tooltip_inner').height()); 206 var container_height = parseFloat($tooltip.next('#sound_container ').height()); 207 $tooltip.hide(); 208 209 if($tooltip.find('.the-tooltip').hasClass('left')) { 210 var final_offset = -32 * 1 + center_offset_x * 1 + sound_x * 1; 211 $tooltip.css({'left': final_offset, opacity: 0, 'display': 'block'}); 212 } 213 214 if($tooltip.find('.the-tooltip').hasClass('top')) { 215 var top_0 = sound_y - 200 * 1; 216 var top_1 = sound_y ; 217 $tooltip.css({'top': top_0, display: 'block'}); 218 var new_opacity = 0.95; 219 $tooltip.stop().animate( { 220 top: top_1, 221 opacity: new_opacity 222 },300,'easeOutBack',function () { 223 $tooltip.css({'display': 'block'}); 224 }); 225 } 226 else if($tooltip.find('.the-tooltip').hasClass('bottom')) { 227 if($tooltip.find('.tooltip_inner').hasClass('powered_by')) 228 var new_opacity = 0.95; 229 else 230 var new_opacity = 0.95; 231 232 var top_0 = sound_y + 200 * 1; 233 var top_1 = sound_y + container_height * 1 + 16 * 1 ; 234 $tooltip.css({'top': top_0,display: 'block'}); 235 $tooltip.stop().animate( { 236 top: top_1, 237 opacity: new_opacity 238 },300,'easeOutBack',function () { 239 $tooltip.css({'display': 'block'}); 240 }); 241 } 242 }; 243 244 function hide_tooltip_basic($tooltip) { 245 if($tooltip.find('.the-tooltip').hasClass('top')) { 246 $tooltip.stop(true,true).delay(200).animate( { 247 top: '-=200px', 248 opacity: 0 249 },300,'easeInBack',function() { 250 $(this).hide(); 251 }); 252 } 253 else if($tooltip.find('.the-tooltip').hasClass('bottom')) { 254 $tooltip.stop(true,true).delay(130).animate( { 255 top: '+=200px', 256 opacity: 0 257 },300,'easeInBack',function() { 258 $(this).hide(); 259 }); 260 } 261 } 262 263 $("#sound_container").hover(function() { 264 var sound_x = parseFloat($(this).css('left')); 265 var sound_y = parseFloat($(this).css('top')); 266 navigate_tooltip_basic($('#gs_tooltip_title'),sound_x,sound_y); 267 },function() { 268 var sound_x = parseFloat($(this).css('left')); 269 var sound_y = parseFloat($(this).css('top')); 270 hide_tooltip_basic($('#gs_tooltip_title'),sound_x,sound_y); 271 }); 272 273 function move_sound_container(x,y,txt) { 274 275 if($('.wrapper').hasClass('is-aside-open')){ 276 var sound_x = x * 1 + 5 - 250; 277 var sound_y = y * 1 - 5; 278 }else{ 279 var sound_x = x * 1 + 5; 280 var sound_y = y * 1 - 5; 281 } 282 $('#sound_container').css({ 283 left: sound_x, 284 top: sound_y 285 }); 286 $("#sound_container").rotate(0); 287 $('#sound_container').fadeIn(400); 288 $('#sound_text').html(txt); 289 290 navigate_tooltip_basic($('#gs_tooltip'),sound_x,sound_y); 291 }; 292 293 //main function which creates audio 294 function make_audio() { 295 selected_txt = $('#sound_text').html(); 296 var 297 words_array = new Array(), 298 sent_array = new Array(), 299 sent_index = 0; 300 301 words_array = selected_txt.split(/[^\S]+/); 302 303 for(var i = 0; i < words_array.length; i++) { 304 if(sent_array[sent_index] == undefined) { 305 sent_array[sent_index] = ''; 306 } 307 308 var total_l = sent_array[sent_index].length + words_array[i].length; 309 if(sent_array[sent_index].length < speech_text_length && total_l < speech_text_length) { 310 sent_array[sent_index] += words_array[i] + ' '; 311 } 312 else { 313 ++sent_index; 314 sent_array[sent_index] = words_array[i] + ' '; 315 } 316 }; 317 318 var players_count = sent_array.length; 319 320 var htm_cont = ''; 321 for(var i = 0; i < players_count; i++) { 322 htm_cont += '<audio id="player' + i + '" src="' + streamerphp_folder + 'speech.mpeg" type="' + translation_audio_type + '" controls="controls"></audio>'; 323 } 324 $("#sound_audio").html(htm_cont); 325 326 for(var i = 0; i < players_count; i++) { 327 create_htm(i,players_count); 328 }; 329 330 // new version addings 331 332 function gs_get_token(encoded_text) { 333 var query = encoded_text; 334 var cM = function(a) { 335 return function() { 336 return a 337 } 338 }; 339 var of = "="; 340 var dM = function(a, b) { 341 for (var c = 0; c < b.length - 2; c += 3) { 342 var d = b.charAt(c + 2), 343 d = d >= t ? d.charCodeAt(0) - 87 : Number(d), 344 d = b.charAt(c + 1) == Tb ? a >>> d : a << d; 345 a = b.charAt(c) == Tb ? a + d & 4294967295 : a ^ d 346 } 347 return a 348 }; 349 350 var eM = null; 351 var cb = 0; 352 var k = ""; 353 var Vb = "+-a^+6"; 354 var Ub = "+-3^+b+-f"; 355 var t = "a"; 356 var Tb = "+"; 357 var dd = "."; 358 var hoursBetween = Math.floor(Date.now() / 3600000); 359 window.TKK = hoursBetween.toString(); 360 361 fM = function(a) { 362 var b; 363 if (null === eM) { 364 var c = cM(String.fromCharCode(84)); // char 84 is T 365 b = cM(String.fromCharCode(75)); // char 75 is K 366 c = [c(), c()]; 367 c[1] = b(); 368 // So basically we're getting window.TKK
369 eM = Number(window[c.join(b())]) || 0 370 } 371 b = eM; 372 373 // This piece of code is used to convert d into the utf-8 encoding of a 374 var d = cM(String.fromCharCode(116)), 375 c = cM(String.fromCharCode(107)), 376 d = [d(), d()]; 377 d[1] = c(); 378 for (var c = cb + d.join(k) + 379 of, d = [], e = 0, f = 0; f < a.length; f++) { 380 var g = a.charCodeAt(f); 381 382 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) 383 } 384 385 386 a = b || 0; 387 for (e = 0; e < d.length; e++) a += d[e], a = dM(a, Vb); 388 a = dM(a, Ub); 389 0 > a && (a = (a & 2147483647) + 2147483648); 390 a %= 1E6; 391 return a.toString() + dd + (a ^ b) 392 }; 393 394 var token = fM(query); 395 396 return token; 397 } 398 399 function gs_replace_ch(str) { 400 var str = str.replace("'", ""); 401 str = str.replace('"', ''); 402 str = str.replace('', ''); 403 str = str.replace('/', ''); 404 str = str.replace(' ', ''); 405 // str = str.replace('&', ''); 406 407 return str; 408 } 409 410 function create_htm(i,players_count) { 411 $('#player' + i).mediaelementplayer({ 412 success: function (mediaElement, domObject) { 413 //detect media end 414 players[i] = mediaElement; 415 416 417 // sets src 418 var encoded_text = gs_replace_ch(sent_array[i]); 419 var token = gs_get_token(encoded_text); 420 encoded_text = encodeURIComponent(encoded_text); 421 var embed_url = streamerphp_folder + 'streamer.php?q=' + encoded_text + '&l=' + lang_identifier + '&tr_tool=' +translation_tool + '&token=' + token; 422 mediaElement.setSrc(embed_url); 423 424 //play next audio, when current ends 425 mediaElement.addEventListener('pause', function(e) { 426 try { 427 players[i + 1].play() 428 } catch(e){} 429 }, false); 430 431 players[0].addEventListener('progress', function(e) { 432 change_speaker_animation(); 433 }, false); 434 435 if(i == players_count - 1) { 436 players[players_count - 1].addEventListener('pause', function(e) { 437 stop_speaker(); 438 }, false); 439 } 440 441 mediaElement.load(); 442 443 if(i == 0) { 444 mediaElement.play(); 445 } 446 } 447 }); 448 } 449 450 }; 451 452 function GetSelectedText() { 453 var selText = "", selTextParts = []; 454 455 function getNodeText(node) { 456 if (node.nodeType == 3) { 457 selTextParts.push(node.data); 458 } else if (node.hasChildNodes() 459 && !(node.nodeType == 1 && /^(script|style)$/i.test(node.tagName))) { 460 for (var child = node.firstChild; !!child; child = child.nextSibling) { 461 getNodeText(child); 462 } 463 } 464 }; 465 466 if (window.getSelection) { 467 var sel = window.getSelection(), rangeCount = sel.rangeCount; 468 if (rangeCount) { 469 for (var i = 0; i < rangeCount; ++i) { 470 getNodeText(sel.getRangeAt(i).cloneContents()); 471 } 472 selText = selTextParts.join(""); 473 } 474 } 475 else if (document.selection && document.selection.type == "Text") { 476 selText = document.selection.createRange().text; 477 } 478 return selText; 479 }; 480 481 function get_coord (e) { 482 var isIE = document.all?true:false; 483 var pos_x, pos_y; 484 if (!isIE) { 485 pos_x = e.pageX; 486 pos_y = e.pageY; 487 } 488 if (isIE) { 489 var left = document.documentElement.scrollLeft ? 490 document.documentElement.scrollLeft : 491 document.body.scrollLeft; 492 pos_x = event.clientX + left; 493 494 var top = document.documentElement.scrollTop ? 495 document.documentElement.scrollTop : 496 document.body.scrollTop; 497 pos_y = event.clientY + top; 498 } 499 return [pos_x,pos_y]; 500 }; 501 502 function clearAllPlayers() { 503 for(var c in players) { 504 players[c] = ''; 505 } 506 $('#sound_audio').html(''); 507 }; 508 509 510 511}); 512})(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.