PageSourceSearch

http://www.anguilla-vacation.com/wp-content/plugins/google-language-translator/js/scripts_ver-5.0.48.js

js anguilla-vacation.com collected 2026-10-02 13:15:24 UTC 14,214 bytes, 388 lines download raw bytes

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

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.