1// source --> https://www.notariosyregistradores.com/web/wp-content/plugins/google-language-translator/js/scripts.js?ver=6.0.20 2/*-------------------------------------------------------------------------------* 3 * Script for onClick trigger functionality used by flag images 4 * Script modified from original GTranslate plugin created by Edvard Ananyan at http://edo.webmaster.am 5 * GTranslate Free Version is licensed under GNU/GPL license 6 *-------------------------------------------------------------------------------*/ 7 8function GLTFireEvent(lang_pair, lang_dest) { 9 try { 10 if (document.createEvent) { 11 var event = document.createEvent("HTMLEvents"); 12 event.initEvent(lang_dest, true, true); 13 lang_pair.dispatchEvent(event) 14 } else { 15 var event = document.createEventObject(); 16 lang_pair.fireEvent('on' + lang_dest, event) 17 } 18 } catch (e) {} 19} 20 21function GLTGetCurrentLang() { 22 var keyValue = document.cookie.match('(^|;) ?googtrans=([^;]*)(;|$)'); 23 return keyValue ? keyValue[2].split('/')[2] : null; 24} 25 26function doGoogleLanguageTranslator(lang_pair) { 27 if(window.glt_request_uri) 28 return true; 29 30 if(lang_pair.value) 31 lang_pair = lang_pair.value; 32 33 if(lang_pair == '') 34 return; 35 36 var lang = lang_pair.split('|')[1]; 37 38 if(GLTGetCurrentLang() == null && lang == lang_pair.split('|')[0]) 39 return; 40 41 var teCombo = document.querySelector('select.goog-te-combo'); 42 var teWrapper = document.getElementById('google_language_translator'); 43 44 if(teWrapper == null || teWrapper.innerHTML.length == 0 || teCombo == null || teCombo.innerHTML.length == 0) { 45 setTimeout(function(){doGoogleLanguageTranslator(lang_pair)}, 500); 46 } else { 47 teCombo.value = lang; 48 GLTFireEvent(teCombo,'change');GLTFireEvent(teCombo,'change'); 49 } 50} 51 52jQuery(document).ready(function($) { 53 $('#glt-translate-trigger,#glt-translate-trigger font').toolbar({ 54 content: '#flags', 55 position: 'top', 56 hideOnClick: true, 57 event: 'click', 58 style: 'primary' 59 }); 60 61 $('#glt-translate-trigger').on('toolbarItemClick',function(event) { 62 $(this).removeClass('pressed'); 63 }); 64}); 65 66/** 67 * Toolbar.js 68 * 69 * @fileoverview jQuery plugin that creates tooltip style toolbars. 70 * @link http://paulkinzett.github.com/toolbar/ 71 * @author Paul Kinzett (http://kinzett.co.nz/) 72 * @version 1.1.0 73 * @requires jQuery 1.7+ 74 * 75 * @license jQuery Toolbar Plugin v1.1.0 76 * http://paulkinzett.github.com/toolbar/ 77 * Copyright 2013 - 2015 Paul Kinzett (http://kinzett.co.nz/) 78 * Released under the MIT license. 79 * <https://raw.github.com/paulkinzett/toolbar/master/LICENSE.txt> 80 */ 81 82if ( typeof Object.create !== 'function' ) { 83 Object.create = function( obj ) { 84 function F() {} 85 F.prototype = obj; 86 return new F(); 87 }; 88} 89 90(function( $, window, document, undefined ) { 91 92 var ToolBar = { 93 init: function( options, elem ) { 94 var self = this; 95 self.elem = elem; 96 self.$elem = $( elem ); 97 self.options = $.extend( {}, $.fn.toolbar.options, options ); 98 self.metadata = self.$elem.data(); 99 self.overrideOptions(); 100 self.toolbar = $('<div class="tool-container" />') 101 .addClass('tool-'+self.options.position) 102 .addClass('toolbar-'+self.options.style) 103 .append('<div class="tool-items" />') 104 .append('<div class="arrow" />') 105 .appendTo('body') 106 .css('opacity', 0) 107 .hide(); 108 self.toolbar_arrow = self.toolbar.find('.arrow'); 109 self.initializeToolbar(); 110 }, 111 112 overrideOptions: function() { 113 var self = this; 114 115 $.each( self.options, function( $option ) { 116 if (typeof(self.$elem.data('toolbar-'+$option)) != "undefined") { 117 self.options[$option] = self.$elem.data('toolbar-'+$option); 118 } 119 }); 120 }, 121 122 initializeToolbar: function() { 123 var self = this; 124 self.populateContent(); 125 self.setTrigger(); 126 self.toolbarWidth = self.toolbar.width(); 127 }, 128 129 setTrigger: function() { 130 var self = this; 131 132 if (self.options.event == 'onload') { 133 $(window).load(function(event) { 134 event.preventDefault(); 135 self.show(); 136 }); 137 } 138 139 if (self.options.event == 'click') { 140 self.$elem.on('click', function(event) { 141 event.preventDefault(); 142 if(self.$elem.hasClass('pressed')) { 143 self.hide(); 144 } else { 145 self.show(); 146 } 147 }); 148 149 if (self.options.hideOnClick) { 150 $('html').on("click.toolbar", function ( event ) { 151 if (event.target != self.elem && 152 self.$elem.has(event.target).length === 0 && 153 self.toolbar.has(event.target).length === 0 && 154 self.toolbar.is(":visible")) { 155 self.hide(); 156 } 157 }); 158 } 159 } 160 161 if (self.options.hover) { 162 var moveTime; 163 164 function decideTimeout () { 165 if (self.$elem.hasClass('pressed')) { 166 moveTime = setTimeout(function() { 167 self.hide(); 168 }, 150); 169 } else { 170 clearTimeout(moveTime); 171 }; 172 }; 173 174 self.$elem.on({ 175 mouseenter: function(event) { 176 if (self.$elem.hasClass('pressed')) { 177 clearTimeout(moveTime); 178 } else { 179 self.show(); 180 } 181 } 182 }); 183 184 self.$elem.parent().on({ 185 mouseleave: function(event){ decideTimeout(); } 186 }); 187 188 $('.tool-container').on({ 189 mouseenter: function(event){ clearTimeout(moveTime); }, 190 mouseleave: function(event){ decideTimeout(); } 191 }); 192 } 193 194 $(window).resize(function( event ) { 195 event.stopPropagation(); 196 197 if ( self.toolbar.is(":visible") ) { 198 self.toolbarCss = self.getCoordinates(self.options.position, 20); 199 self.collisionDetection(); 200 self.toolbar.css( self.toolbarCss ); 201 self.toolbar_arrow.css( self.arrowCss ); 202 } 203 }); 204 }, 205 206 populateContent: function() { 207 var self = this; 208 var location = self.toolbar.find('.tool-items'); 209 var content = $(self.options.content).clone( true ).find('a').addClass('tool-item'); 210 211 location.html(content); 212 location.find('.tool-item').on('click', function(event) { 213 if(typeof window.glt_request_uri == 'undefined') 214 event.preventDefault(); 215 self.$elem.trigger('toolbarItemClick', this); 216 }); 217 }, 218 219 calculatePosition: function() { 220 var self = this; 221 self.arrowCss = {}; 222 self.toolbarCss = self.getCoordinates(self.options.position, self.options.adjustment); 223 self.toolbarCss.position = 'fixed'; 224 self.toolbarCss.zIndex = self.options.zIndex; 225 self.collisionDetection(); 226 self.toolbar.css(self.toolbarCss); 227 self.toolbar_arrow.css(self.arrowCss); 228 }, 229 230 getCoordinates: function( position, adjustment ) { 231 var self = this; 232 233 self.coordinates = self.$elem.offset(); 234 235 if (self.options.adjustment && self.options.adjustment[self.options.position]) { 236 adjustment = self.options.adjustment[self.options.position] + adjustment; 237 } 238 239 switch(self.options.position) { 240 case 'top': 241 return { 242 left: self.coordinates.left-(self.toolbar.width()/2)+(self.$elem.outerWidth()/2), 243 top: self.coordinates.top-self.$elem.outerHeight()-adjustment, 244 right: 'auto' 245 }; 246 247 case 'left': 248 return { 249 left: self.coordinates.left-(self.toolbar.width()/2)-(self.$elem.outerWidth()/2)-adjustment, 250 top: self.coordinates.top-(self.toolbar.height()/2)+(self.$elem.outerHeight()/2), 251 right: 'auto' 252 }; 253 254 case 'right': 255 return { 256 left: self.coordinates.left+(self.toolbar.width()/2)+(self.$elem.outerWidth()/2)+adjustment, 257 top: self.coordinates.top-(self.toolbar.height()/2)+(self.$elem.outerHeight()/2), 258 right: 'auto' 259 }; 260 261 case 'bottom': 262 return { 263 left: self.coordinates.left-(self.toolbar.width()/2)+(self.$elem.outerWidth()/2), 264 top: self.coordinates.top+self.$elem.outerHeight()+adjustment, 265 right: 'auto' 266 }; 267 } 268 }, 269 270 collisionDetection: function() { 271 var self = this; 272 var edgeOffset = 20; 273 274 if(self.options.position == 'top' || self.options.position == 'bottom') { 275 self.arrowCss = {left: '50%', right: '50%'}; 276 if( self.toolbarCss.left < edgeOffset ) { 277 self.toolbarCss.left = edgeOffset; 278 self.arrowCss.left = self.$elem.offset().left + self.$elem.width()/2-(edgeOffset); 279 } 280 281 else if(($(window).width() - (self.toolbarCss.left + self.toolbarWidth)) < edgeOffset) { 282 self.toolbarCss.right = edgeOffset; 283 self.toolbarCss.left = 'auto'; 284 self.arrowCss.left = 'auto'; 285 self.arrowCss.right = ($(window).width()-self.$elem.offset().left)-(self.$elem.width()/2)-(edgeOffset)-5; 286 } 287 } 288 }, 289 290 show: function() { 291 var self = this; 292 self.$elem.addClass('pressed'); 293 self.calculatePosition(); 294 self.toolbar.show().css({'opacity': 1}).addClass('animate-'+self.options.animation); 295 self.$elem.trigger('toolbarShown'); 296 }, 297 298 hide: function() { 299 var self = this; 300 var animation = {'opacity': 0}; 301 self.$elem.removeClass('pressed'); 302 switch(self.options.position) { 303 case 'top': 304 animation.top = '+=20'; 305 break; 306 case 'left': 307 animation.left = '+=20'; 308 break; 309 case 'right': 310 animation.left = '-=20'; 311 break; 312 case 'bottom': 313 animation.top = '-=20'; 314 break; 315 } 316 self.toolbar.animate(animation, 200, function() { 317 self.toolbar.hide(); 318 }); 319 self.$elem.trigger('toolbarHidden'); 320 }, 321 322 getToolbarElement: function () { 323 return this.toolbar.find('.tool-items'); 324 } 325 }; 326 327 $.fn.toolbar = function( options ) { 328 if ($.isPlainObject( options )) { 329 return this.each(function() { 330 var toolbarObj = Object.create( ToolBar ); 331 toolbarObj.init( options, this ); 332 $(this).data('toolbarObj', toolbarObj); 333 }); 334 } else if ( typeof options === 'string' && options.indexOf('_') !== 0 ) { 335 var toolbarObj = $(this).data('toolbarObj'); 336 var method = toolbarObj[options]; 337 return method.apply(toolbarObj, $.makeArray(arguments).slice(1)); 338 } 339 }; 340 341 $.fn.toolbar.options = { 342 content: '#myContent', 343 position: 'top', 344 hideOnClick: false, 345 zIndex: 120, 346 hover: false, 347 style: 'default', 348 animation: 'standard', 349 adjustment: 10 350 }; 351}) ( jQuery, window, document ); 352 353jQuery(function($) { 354 $('#flags a, a.single-language, .tool-items a').each(function() { 355 $(this).attr('data-lang', $(this).attr('title')); 356 }); 357 358 $(document.body).on("click", "a.flag", function() { 359 lang_text = $(this).attr('data-lang'); 360 default_lang = window.glt_default_lang || $('#google_language_translator').attr('class').split("-").pop(); 361 lang_prefix = $(this).attr("class").split(" ")[2]; 362 lang_prefix == default_lang ? l() : n(); 363 function l() { 364 doGoogleLanguageTranslator(default_lang + "|" + default_lang); 365 } 366 function n() { 367 doGoogleLanguageTranslator(default_lang + "|" + lang_prefix); 368 } 369 $(".tool-container").hide(); 370 }); 371 372 if(window.glt_request_uri) { 373 $('#google_language_translator select').on('change', function() { 374 doGLTTranslate($(this).val()); 375 }) 376 } 377});
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.