@@ -267,16 +267,20 @@ public function load(){
267267 */
268268 public function addScript (){
269269 $ JSScript = "<script>var GTranslator = {siteLang: \"{$ this ->siteLang }\",googleElement: \"{$ this ->element }\",OPTION_ACTIVE: !1,Current:function(){var b=document.cookie.match( \"(^|;) ?googtrans=([^;]*)(;|$) \");return b?b[2].split( \"/ \")[2]:GTranslator.siteLang},Event:function(b,a){try{if(document.createEventObject){var c=document.createEventObject();b.fireEvent( \"on \"+a,c)}else c=document.createEvent( \"HTMLEvents \"),c.initEvent(a,!0,!0),b.dispatchEvent(c)}catch(d){console.log( \"GTranslator: \"+d)}},runTranslate:function(a,b){if(null!=GTranslator.Current()||lang!=a){for(var c,d=document.getElementsByTagName( \"select \"),e=0;e<d.length;e++)if(/goog-te-combo/.test(d[e].className)){c=d[e];break}null==document.getElementById(GTranslator.googleElement)||0==document.getElementById(GTranslator.googleElement).innerHTML.length||
270- 0==c.length||0==c.innerHTML.length?setTimeout(function(){GTranslator.runTranslate(a,b)},500):(c.value=b,GTranslator.Event(c, \"change \"))}},GoogleInit:function(){new google.translate.TranslateElement({pageLanguage: \"{$ this ->siteLang }\",autoDisplay:!1},GTranslator.googleElement)},GoogleScript:function(){var b=document.createElement( \"script \");b.async=!0;b.type= \"text/javascript \";b.src= \"https://translate.google.com/translate_a/element.js?cb=GTranslator.GoogleInit \";var a=document.getElementsByTagName( \"script \")[0];a.parentNode.insertBefore(b,a)}, " ;
270+ 0==c.length||0==c.innerHTML.length?setTimeout(function(){GTranslator.runTranslate(a,b)},500):(c.value=b,GTranslator.Event(c, \"change \"))}},GoogleInit:function(){new google.translate.TranslateElement({pageLanguage: \"{$ this ->siteLang }\",autoDisplay:!1},GTranslator.googleElement)},GoogleScript:function(){var b=document.createElement( \"script \");b.async=!0;b.type= \"text/javascript \";b.src= \"https://translate.google.com/translate_a/element.js?cb=GTranslator.GoogleInit \";var a=document.getElementsByTagName( \"script \")[0];a.parentNode.insertBefore(b,a)},Translate:function(a,b){ \"undefined \"!=typeof b&&
271+ b.value&&(b=b.value);if(!( \"\"==b||1>b.length)){var c=b.split( \"| \"),d=c[1];GTranslator.runTranslate(c[0],d); " ;
271272 if ($ this ->provider == self ::DEFAULT ){
272- $ JSScript .= "Translate:function(b,a){ \"undefined \"!=typeof a&&
273- a.value&&(a=a.value);if(!( \"\"==a||1>a.length)){var c=a.split( \"| \"),d=c[1];GTranslator.runTranslate(c[0],d);document.getElementById( \"php-g-translator \").innerHTML='<img alt= \"'+d+' \" src= \"{$ this ->iconPath }'+d+' {$ this ->iconType }\"> '+b.getAttribute( \"title \")+'<span class= \"toggle-cert \"></span>'}},toggle:function(){var b=document.getElementById( \"php-gt-languages \"); \"none \"===b.style.display?(b.style.display= \"block \",setTimeout(function(){GTranslator.OPTION_ACTIVE=!0},500)):(b.style.display= \"none \",GTranslator.OPTION_ACTIVE=!1)},toggleClass:function(){document.getElementById( \"php-g-translator \").classList.toggle( \"open \")},
273+ $ JSScript .= "document.getElementById( \"php-g-translator \").innerHTML='<img alt= \"'+d+' \" src= \"{$ this ->iconPath }'+d+' {$ this ->iconType }\"> '+a.getAttribute( \"title \")+'<span class= \"toggle-cert \"></span>'}}, " ;
274+ }else if ($ this ->provider == self ::BOOTSTRAP ){
275+ $ JSScript .= "document.getElementById( \"php-g-translator \").innerHTML='<img alt= \"'+d+' \" src= \"{$ this ->iconPath }'+d+' {$ this ->iconType }\"> '+a.getAttribute( \"title \")}}, " ;
276+ }
277+ if ($ this ->provider == self ::DEFAULT ){
278+ $ JSScript .= "toggle:function(){var b=document.getElementById( \"php-gt-languages \"); \"none \"===b.style.display?(b.style.display= \"block \",setTimeout(function(){GTranslator.OPTION_ACTIVE=!0},500)):(b.style.display= \"none \",GTranslator.OPTION_ACTIVE=!1)},toggleClass:function(){document.getElementById( \"php-g-translator \").classList.toggle( \"open \")},
274279 Init:function(){GTranslator.GoogleScript();var b=document.getElementById( \"php-gt-languages \");document.getElementsByClassName( \"toggle-languages \")[0].onclick=
275280 function(a){a.preventDefault();GTranslator.toggle();GTranslator.toggleClass()};b.addEventListener( \"wheel \",function(a){ \"block \"===window.getComputedStyle(b).display&&b.scrollTo({top:b.scrollTop-(a.wheelDelta||-a.detail)});return!1});document.querySelectorAll( \"body \").forEach(function(a,c){a.addEventListener( \"click \",function(d){ \"block \"===window.getComputedStyle(b).display&>ranslator.OPTION_ACTIVE&&(GTranslator.toggle(),GTranslator.toggleClass())})});null!=GTranslator.Current()&&
276281 document.querySelectorAll( \".drop-li \").forEach(function(a,c){GTranslator.Current()==a.firstChild.getAttribute( \"lang \")&&(document.getElementById( \"php-g-translator \").innerHTML='<img alt= \"'+GTranslator.Current()+' \" src= \"{$ this ->iconPath }' + GTranslator.Current() + ' {$ this ->iconType }\"> '+a.firstChild.textContent+'<span class= \"toggle-cert \"></span>')})}}; " ;
277282 }else if ($ this ->provider == self ::BOOTSTRAP ){
278- $ JSScript .= "Translate:function(a,b){ \"undefined \"!=typeof b&&
279- b.value&&(b=b.value);if(!( \"\"==b||1>b.length)){var c=b.split( \"| \"),d=c[1];GTranslator.runTranslate(c[0],d);document.getElementById( \"php-g-translator \").innerHTML='<img alt= \"'+d+' \" src= \"{$ this ->iconPath }'+d+' {$ this ->iconType }\"> '+a.getAttribute( \"title \")}},Init:function(){GTranslator.GoogleScript();null!=GTranslator.Current()&&document.querySelectorAll( \".drop-li \").forEach(function(a,b){GTranslator.Current()==a.firstChild.getAttribute( \"lang \")&&(document.getElementById( \"php-g-translator \").innerHTML='<img alt= \"'+GTranslator.Current()+' \" src= \"{$ this ->iconPath }' + GTranslator.Current() + ' {$ this ->iconType }\"> '+a.firstChild.textContent)})}}; " ;
283+ $ JSScript .= "Init:function(){GTranslator.GoogleScript();null!=GTranslator.Current()&&document.querySelectorAll( \".drop-li \").forEach(function(a,b){GTranslator.Current()==a.firstChild.getAttribute( \"lang \")&&(document.getElementById( \"php-g-translator \").innerHTML='<img alt= \"'+GTranslator.Current()+' \" src= \"{$ this ->iconPath }' + GTranslator.Current() + ' {$ this ->iconType }\"> '+a.firstChild.textContent)})}}; " ;
280284 }
281285 $ JSScript .= "(function(){GTranslator.Init()})();</script> " ;
282286 return $ JSScript ;
0 commit comments