PageSourceSearch

https://opeco.com.br/pages/Opeco%20%E2%80%93%20novidades_files/lightbox.js.download

js opeco.com.br collected 2026-10-06 18:05:21 UTC 16,978 bytes, 488 lines download raw bytes

vendor: 4,729 bytes, lines 1-111
1var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
2if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
3{
4  let window = _____WB$wombat$assign$function_____("window");
5  let self = _____WB$wombat$assign$function_____("self");
6  let document = _____WB$wombat$assign$function_____("document");
7  let location = _____WB$wombat$assign$function_____("location");
8  let top = _____WB$wombat$assign$function_____("top");
9  let parent = _____WB$wombat$assign$function_____("parent");
10  let frames = _____WB$wombat$assign$function_____("frames");
11  let opener = _____WB$wombat$assign$function_____("opener");
12
13/*!
14 * Lightbox v2.8.2
15 * by Lokesh Dhakar
16 *
17 * More info:
18 * https://lokeshdhakar.com/projects/lightbox2/
19 *
20 * Copyright 2007, 2015 Lokesh Dhakar
21 * Released under the MIT license
22 * https://github.com/lokesh/lightbox2/blob/master/LICENSE
23 */
24
25// Uses Node, AMD or browser globals to create a module.
26(function (root, factory) {
27    if (typeof define === 'function' && define.amd) {
28        // AMD. Register as an anonymous module.
29        define(['jquery'], factory);
30    } else if (typeof exports === 'object') {
31        // Node. Does not work with strict CommonJS, but
32        // only CommonJS-like environments that support module.exports,
33        // like Node.
34        module.exports = factory(require('jquery'));
35    } else {
36        // Browser globals (root is window)
37        root.lightbox = factory(root.jQuery);
38    }
39}(this, function ($) {
40
41  function Lightbox(options) {
42    this.album = [];
43    this.currentImageIndex = void 0;
44    this.init();
45
46    // options
47    this.options = $.extend({}, this.constructor.defaults);
48    this.option(options);
49  }
50
51  // Descriptions of all options available on the demo site:
52  // https://lokeshdhakar.com/projects/lightbox2/index.html#options
53  Lightbox.defaults = {
54    albumLabel: 'Imagem %1 de %2',
55    alwaysShowNavOnTouchDevices: false,
56    fadeDuration: 500,
57    fitImagesInViewport: true,
58    // maxWidth: 800,
59    // maxHeight: 600,
60    positionFromTop: 50,
61    resizeDuration: 700,
62    showImageNumberLabel: true,
63    wrapAround: false,
64    disableScrolling: false
65  };
66
67  Lightbox.prototype.option = function(options) {
68    $.extend(this.options, options);
69  };
70
71  Lightbox.prototype.imageCountLabel = function(currentImageNum, totalImages) {
72    return this.options.albumLabel.replace(/%1/g, currentImageNum).replace(/%2/g, totalImages);
73  };
74
75  Lightbox.prototype.init = function() {
76    this.enable();
77    this.build();
78  };
79
80  // Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes
81  // that contain 'lightbox'. When these are clicked, start lightbox.
82  Lightbox.prototype.enable = function() {
83    var self = this;
84    $('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]', function(event) {
85      self.start($(event.currentTarget));
86      return false;
87    });
88  };
89
90  // Build html for the lightbox and the overlay.
91  // Attach event handlers to the new DOM elements. click click click
92  Lightbox.prototype.build = function() {
93    var self = this;
94    $('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo($('body'));
95
96    // Cache jQuery objects
97    this.$lightbox       = $('#lightbox');
98    this.$overlay        = $('#lightboxOverlay');
99    this.$outerContainer = this.$lightbox.find('.lb-outerContainer');
100    this.$container      = this.$lightbox.find('.lb-container');
101
102    // Store css values for future lookup
103    this.containerTopPadding = parseInt(this.$container.css('padding-top'), 10);
104    this.containerRightPadding = parseInt(this.$container.css('padding-right'), 10);
105    this.containerBottomPadding = parseInt(this.$container.css('padding-bottom'), 10);
106    this.containerLeftPadding = parseInt(this.$container.css('padding-left'), 10);
107
108    // Attach event handlers to the newly minted DOM elements
109    this.$overlay.hide().on('click', function() {
110      self.end();
111      return false;
112    });
113
114    this.$lightbox.hide().on('click', function(event) {
115      if ($(event.target).attr('id') === 'lightbox') {
116        self.end();
117      }
118      return false;
119    });
120
121    this.$outerContainer.on('click', function(event) {
122      if ($(event.target).attr('id') === 'lightbox') {
123        self.end();
124      }
125      return false;
126    });
127
128    this.$lightbox.find('.lb-prev').on('click', function() {
129      if (self.currentImageIndex === 0) {
130        self.changeImage(self.album.length - 1);
131      } else {
132        self.changeImage(self.currentImageIndex - 1);
133      }
134      return false;
135    });
136
137    this.$lightbox.find('.lb-next').on('click', function() {
138      if (self.currentImageIndex === self.album.length - 1) {
139        self.changeImage(0);
140      } else {
141        self.changeImage(self.currentImageIndex + 1);
142      }
143      return false;
144    });
145
146    this.$lightbox.find('.lb-loader, .lb-close').on('click', function() {
147      self.end();
148      return false;
149    });
150  };
151
152  // Show overlay and lightbox. If the image is part of a set, add siblings to album array.
153  Lightbox.prototype.start = function($link) {
154    var self    = this;
155    var $window = $(window);
156
157    $window.on('resize', $.proxy(this.sizeOverlay, this));
158
159    $('select, object, embed').css({
160      visibility: 'hidden'
161    });
162
163    this.sizeOverlay();
164
165    this.album = [];
166    var imageNumber = 0;
167
168    function addToAlbum($link) {
169      self.album.push({
170        link: $link.attr('href'),
171        title: $link.attr('data-title') || $link.attr('title')
172      });
173    }
174
175    // Support both data-lightbox attribute and rel attribute implementations
176    var dataLightboxValue = $link.attr('data-lightbox');
177    var $links;
178
179    if (dataLightboxValue) {
180      $links = $($link.prop('tagName') + '[data-lightbox="' + dataLightboxValue + '"]');
181      for (var i = 0; i < $links.length; i = ++i) {
182        addToAlbum($($links[i]));
183        if ($links[i] === $link[0]) {
184          imageNumber = i;
185        }
186      }
187    } else {
188      if ($link.attr('rel') === 'lightbox') {
189        // If image is not part of a set
190        addToAlbum($link);
191      } else {
192        // If image is part of a set
193        $links = $($link.prop('tagName') + '[rel="' + $link.attr('rel') + '"]');
194        for (var j = 0; j < $links.length; j = ++j) {
195          addToAlbum($($links[j]));
196          if ($links[j] === $link[0]) {
197            imageNumber = j;
198          }
199        }
200      }
201    }
202
203    // Position Lightbox
204    var top  = $window.scrollTop() + this.options.positionFromTop;
205    var left = $window.scrollLeft();
206    this.$lightbox.css({
207      top: top + 'px',
208      left: left + 'px'
209    }).fadeIn(this.options.fadeDuration);
210
211    // Disable scrolling of the page while open
212    if (this.options.disableScrolling) {
213      $('body').addClass('lb-disable-scrolling');
214    }
215
216    this.changeImage(imageNumber);
217  };
218
219  // Hide most UI elements in preparation for the animated resizing of the lightbox.
220  Lightbox.prototype.changeImage = function(imageNumber) {
221    var self = this;
222
223    this.disableKeyboardNav();
224    var $image = this.$lightbox.find('.lb-image');
225
226    this.$overlay.fadeIn(this.options.fadeDuration);
227
228    $('.lb-loader').fadeIn('slow');
229    this.$lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide();
230
231    this.$outerContainer.addClass('animating');
232
233    // When image to show is preloaded, we send the width and height to sizeContainer()
234    var preloader = new Image();
235    preloader.onload = function() {
236      var $preloader;
237      var imageHeight;
238      var imageWidth;
239      var maxImageHeight;
240      var maxImageWidth;
241      var windowHeight;
242      var windowWidth;
243
244      $image.attr('src', self.album[imageNumber].link);
245
246      $preloader = $(preloader);
247
248      $image.width(preloader.width);
249      $image.height(preloader.height);
250
251      if (self.options.fitImagesInViewport) {
252        // Fit image inside the viewport.
253        // Take into account the border around the image and an additional 10px gutter on each side.
254
255        windowWidth    = $(window).width();
256        windowHeight   = $(window).height();
257        maxImageWidth  = windowWidth - self.containerLeftPadding - self.containerRightPadding - 20;
258        maxImageHeight = windowHeight - self.containerTopPadding - self.containerBottomPadding - 120;
259
260        // Check if image size is larger then maxWidth|maxHeight in settings
261        if (self.options.maxWidth && self.options.maxWidth < maxImageWidth) {
262          maxImageWidth = self.options.maxWidth;
263        }
264        if (self.options.maxHeight && self.options.maxHeight < maxImageWidth) {
265          maxImageHeight = self.options.maxHeight;
266        }
267
268        // Is there a fitting issue?
269        if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) {
270          if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) {
271            imageWidth  = maxImageWidth;
272            imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10);
273            $image.width(imageWidth);
274            $image.height(imageHeight);
275          } else {
276            imageHeight = maxImageHeight;
277            imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10);
278            $image.width(imageWidth);
279            $image.height(imageHeight);
280          }
281        }
282      }
283      self.sizeContainer($image.width(), $image.height());
284    };
285
286    preloader.src          = this.album[imageNumber].link;
287    this.currentImageIndex = imageNumber;
288  };
289
290  // Stretch overlay to fit the viewport
291  Lightbox.prototype.sizeOverlay = function() {
292    this.$overlay
293      .width($(document).width())
294      .height($(document).height());
295  };
296
297  // Animate the size of the lightbox to fit the image we are showing
298  Lightbox.prototype.sizeContainer = function(imageWidth, imageHeight) {
299    var self = this;
300
301    var oldWidth  = this.$outerContainer.outerWidth();
302    var oldHeight = this.$outerContainer.outerHeight();
303    var newWidth  = imageWidth + this.containerLeftPadding + this.containerRightPadding;
304    var newHeight = imageHeight + this.containerTopPadding + this.containerBottomPadding;
305
306    function postResize() {
307      self.$lightbox.find('.lb-dataContainer').width(newWidth);
308      self.$lightbox.find('.lb-prevLink').height(newHeight);
309      self.$lightbox.find('.lb-nextLink').height(newHeight);
310      self.showImage();
311    }
312
313    if (oldWidth !== newWidth || oldHeight !== newHeight) {
314      this.$outerContainer.animate({
315        width: newWidth,
316        height: newHeight
317      }, this.options.resizeDuration, 'swing', function() {
318        postResize();
319      });
320    } else {
321      postResize();
322    }
323  };
324
325  // Display the image and its details and begin preload neighboring images.
326  Lightbox.prototype.showImage = function() {
327    this.$lightbox.find('.lb-loader').stop(true).hide();
328    this.$lightbox.find('.lb-image').fadeIn('slow');
329
330    this.updateNav();
331    this.updateDetails();
332    this.preloadNeighboringImages();
333    this.enableKeyboardNav();
334  };
335
336  // Display previous and next navigation if appropriate.
337  Lightbox.prototype.updateNav = function() {
338    // Check to see if the browser supports touch events. If so, we take the conservative approach
339    // and assume that mouse hover events are not supported and always show prev/next navigation
340    // arrows in image sets.
341    var alwaysShowNav = false;
342    try {
343      document.createEvent('TouchEvent');
344      alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices) ? true : false;
345    } catch (e) {}
346
347    this.$lightbox.find('.lb-nav').show();
348
349    if (this.album.length > 1) {
350      if (this.options.wrapAround) {
351        if (alwaysShowNav) {
352          this.$lightbox.find('.lb-prev, .lb-next').css('opacity', '1');
353        }
354        this.$lightbox.find('.lb-prev, .lb-next').show();
355      } else {
356        if (this.currentImageIndex > 0) {
357          this.$lightbox.find('.lb-prev').show();
358          if (alwaysShowNav) {
359            this.$lightbox.find('.lb-prev').css('opacity', '1');
360          }
361        }
362        if (this.currentImageIndex < this.album.length - 1) {
363          this.$lightbox.find('.lb-next').show();
364          if (alwaysShowNav) {
365            this.$lightbox.find('.lb-next').css('opacity', '1');
366          }
367        }
368      }
369    }
370  };
371
372  // Display caption, image number, and closing button.
373  Lightbox.prototype.updateDetails = function() {
374    var self = this;
375
376    // Enable anchor clicks in the injected caption html.
377    // Thanks Nate Wright for the fix. @https://github.com/NateWr
378    if (typeof this.album[this.currentImageIndex].title !== 'undefined' &&
379      this.album[this.currentImageIndex].title !== '') {
380      this.$lightbox.find('.lb-caption')
381        .html(this.album[this.currentImageIndex].title)
382        .fadeIn('fast')
383        .find('a').on('click', function(event) {
384          if ($(this).attr('target') !== undefined) {
385            window.open($(this).attr('href'), $(this).attr('target'));
386          } else {
387            location.href = $(this).attr('href');
388          }
389        });
390    }
391
392    if (this.album.length > 1 && this.options.showImageNumberLabel) {
393      var labelText = this.imageCountLabel(this.currentImageIndex + 1, this.album.length);
394      this.$lightbox.find('.lb-number').text(labelText).fadeIn('fast');
395    } else {
396      this.$lightbox.find('.lb-number').hide();
397    }
398
399    this.$outerContainer.removeClass('animating');
400
401    this.$lightbox.find('.lb-dataContainer').fadeIn(this.options.resizeDuration, function() {
402      return self.sizeOverlay();
403    });
404  };
405
406  // Preload previous and next images in set.
407  Lightbox.prototype.preloadNeighboringImages = function() {
408    if (this.album.length > this.currentImageIndex + 1) {
409      var preloadNext = new Image();
410      preloadNext.src = this.album[this.currentImageIndex + 1].link;
411    }
412    if (this.currentImageIndex > 0) {
413      var preloadPrev = new Image();
414      preloadPrev.src = this.album[this.currentImageIndex - 1].link;
415    }
416  };
417
418  Lightbox.prototype.enableKeyboardNav = function() {
419    $(document).on('keyup.keyboard', $.proxy(this.keyboardAction, this));
420  };
421
422  Lightbox.prototype.disableKeyboardNav = function() {
423    $(document).off('.keyboard');
424  };
425
426  Lightbox.prototype.keyboardAction = function(event) {
427    var KEYCODE_ESC        = 27;
428    var KEYCODE_LEFTARROW  = 37;
429    var KEYCODE_RIGHTARROW = 39;
430
431    var keycode = event.keyCode;
432    var key     = String.fromCharCode(keycode).toLowerCase();
433    if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
434      this.end();
435    } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {
436      if (this.currentImageIndex !== 0) {
437        this.changeImage(this.currentImageIndex - 1);
438      } else if (this.options.wrapAround && this.album.length > 1) {
439        this.changeImage(this.album.length - 1);
440      }
441    } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {
442      if (this.currentImageIndex !== this.album.length - 1) {
443        this.changeImage(this.currentImageIndex + 1);
444      } else if (this.options.wrapAround && this.album.length > 1) {
445        this.changeImage(0);
446      }
447    }
448  };
449
450  // Closing time. :-(
451  Lightbox.prototype.end = function() {
452    this.disableKeyboardNav();
453    $(window).off('resize', this.sizeOverlay);
454    this.$lightbox.fadeOut(this.options.fadeDuration);
455    this.$overlay.fadeOut(this.options.fadeDuration);
456    $('select, object, embed').css({
457      visibility: 'visible'
458    });
459    if (this.options.disableScrolling) {
460      $('body').removeClass('lb-disable-scrolling');
461    }
462  };
463
464  return new Lightbox();
465}));
466
467
468}
469/*
470     FILE ARCHIVED ON 19:23:50 Nov 18, 2023 AND RETRIEVED FROM THE
471     INTERNET ARCHIVE ON 13:15:17 Sep 22, 2025.
472     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
473
474     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
475     SECTION 108(a)(3)).
476*/
477/*
478playback timings (ms):
479  captures_list: 0.812
480  exclusion.robots: 0.029
481  exclusion.robots.policy: 0.014
482  esindex: 0.016
483  cdx.remote: 792.714
484  LoadShardBlock: 577.11 (3)
485  PetaboxLoader3.datanode: 531.832 (4)
486  PetaboxLoader3.resolve: 353.779 (2)
487  load_resource: 449.255
488*/

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.