PageSourceSearch

https://nbliberal.ca/wp-content/plugins/happyfiles-pro/assets/libs…/js/lg-thumbnail.min.js?ver=1779577903

js nbliberal.ca collected 2026-10-02 08:09:50 UTC 17,292 bytes, 395 lines download raw bytes

1/**!
2 * lg-thumbnail.js | 1.2.0 | May 20th 2020
3 * http://sachinchoolur.github.io/lg-thumbnail.js
4 * Copyright (c) 2016 Sachin N;
5 * @license GPLv3
6 */
7!(function (t) {
8  if ('object' == typeof exports && 'undefined' != typeof module) module.exports = t()
9  else if ('function' == typeof define && define.amd) define([], t)
10  else {
11    var e
12    ;(e =
13      'undefined' != typeof window
14        ? window
15        : 'undefined' != typeof global
16        ? global
17        : 'undefined' != typeof self
18        ? self
19        : this),
20      (e.LgThumbnail = t())
21  }
22})(function () {
23  var t, e, i
24  return (function () {
25    function t(e, i, o) {
26      function u(s, l) {
27        if (!i[s]) {
28          if (!e[s]) {
29            var h = 'function' == typeof require && require
30            if (!l && h) return h(s, !0)
31            if (r) return r(s, !0)
32            var n = new Error("Cannot find module '" + s + "'")
33            throw ((n.code = 'MODULE_NOT_FOUND'), n)
34          }
35          var a = (i[s] = { exports: {} })
36          e[s][0].call(
37            a.exports,
38            function (t) {
39              return u(e[s][1][t] || t)
40            },
41            a,
42            a.exports,
43            t,
44            e,
45            i,
46            o
47          )
48        }
49        return i[s].exports
50      }
51      for (var r = 'function' == typeof require && require, s = 0; s < o.length; s++) u(o[s])
52      return u
53    }
54    return t
55  })()(
56    {
57      1: [
58        function (e, i, o) {
59          !(function (e, i) {
60            if ('function' == typeof t && t.amd) t([], i)
61            else if (void 0 !== o) i()
62            else {
63              var u = { exports: {} }
64              i(), (e.lgThumbnail = u.exports)
65            }
66          })(this, function () {
67            'use strict'
68            var t =
69                Object.assign ||
70                function (t) {
71                  for (var e = 1; e < arguments.length; e++) {
72                    var i = arguments[e]
73                    for (var o in i) Object.prototype.hasOwnProperty.call(i, o) && (t[o] = i[o])
74                  }
75                  return t
76                },
77              e = {
78                thumbnail: !0,
79                animateThumb: !0,
80                currentPagerPosition: 'middle',
81                thumbWidth: 100,
82                thumbContHeight: 100,
83                thumbMargin: 5,
84                exThumbImage: !1,
85                showThumbByDefault: !0,
86                toggleThumb: !0,
87                pullCaptionUp: !0,
88                enableThumbDrag: !0,
89                enableThumbSwipe: !0,
90                swipeThreshold: 50,
91                loadYoutubeThumbnail: !0,
92                youtubeThumbSize: 1,
93                loadVimeoThumbnail: !0,
94                vimeoThumbSize: 'thumbnail_small',
95                loadDailymotionThumbnail: !0
96              },
97              i = function i(o) {
98                return (
99                  (this.el = o),
100                  (this.core = window.lgData[this.el.getAttribute('lg-uid')]),
101                  (this.core.s = t({}, e, this.core.s)),
102                  (this.thumbOuter = null),
103                  (this.thumbOuterWidth = 0),
104                  (this.thumbTotalWidth = this.core.items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin)),
105                  (this.thumbIndex = this.core.index),
106                  (this.left = 0),
107                  this.init(),
108                  this
109                )
110              }
111            ;(i.prototype.init = function () {
112              var t = this
113              this.core.s.thumbnail &&
114                this.core.items.length > 1 &&
115                (this.core.s.showThumbByDefault &&
116                  setTimeout(function () {
117                    utils.addClass(t.core.outer, 'lg-thumb-open')
118                  }, 700),
119                this.core.s.pullCaptionUp && utils.addClass(this.core.outer, 'lg-pull-caption-up'),
120                this.build(),
121                this.core.s.animateThumb
122                  ? (this.core.s.enableThumbDrag && !this.core.isTouch && this.core.doCss() && this.enableThumbDrag(),
123                    this.core.s.enableThumbSwipe && this.core.isTouch && this.core.doCss() && this.enableThumbSwipe(),
124                    (this.thumbClickable = !1))
125                  : (this.thumbClickable = !0),
126                this.toggle(),
127                this.thumbkeyPress())
128            }),
129              (i.prototype.build = function () {
130                function t(t, u, r) {
131                  var s = e.core.isVideo(t, r) || {},
132                    l,
133                    h = ''
134                  s.youtube || s.vimeo || s.dailymotion
135                    ? s.youtube
136                      ? (l = e.core.s.loadYoutubeThumbnail
137                          ? '//img.youtube.com/vi/' + s.youtube[1] + '/' + e.core.s.youtubeThumbSize + '.jpg'
138                          : u)
139                      : s.vimeo
140                      ? e.core.s.loadVimeoThumbnail
141                        ? ((l = '//i.vimeocdn.com/video/error_' + o + '.jpg'), (h = s.vimeo[1]))
142                        : (l = u)
143                      : s.dailymotion &&
144                        (l = e.core.s.loadDailymotionThumbnail
145                          ? '//www.dailymotion.com/thumbnail/video/' + s.dailymotion[1]
146                          : u)
147                    : (l = u),
148                    (i +=
149                      '<div data-vimeo-id="' +
150                      h +
151                      '" class="lg-thumb-item" style="width:' +
152                      e.core.s.thumbWidth +
153                      'px; margin-right: ' +
154                      e.core.s.thumbMargin +
155                      'px"><img src="' +
156                      l +
157                      '" /></div>'),
158                    (h = '')
159                }
160                var e = this,
161                  i = '',
162                  o = '',
163                  u,
164                  r = '<div class="lg-thumb-outer"><div class="lg-thumb group"></div></div>'
165                switch (this.core.s.vimeoThumbSize) {
166                  case 'thumbnail_large':
167                    o = '640'
168                    break
169                  case 'thumbnail_medium':
170                    o = '200x150'
171                    break
172                  case 'thumbnail_small':
173                    o = '100x75'
174                }
175                if (
176                  (utils.addClass(e.core.outer, 'lg-has-thumb'),
177                  e.core.outer.querySelector('.lg').insertAdjacentHTML('beforeend', r),
178                  (e.thumbOuter = e.core.outer.querySelector('.lg-thumb-outer')),
179                  (e.thumbOuterWidth = e.thumbOuter.offsetWidth),
180                  e.core.s.animateThumb &&
181                    ((e.core.outer.querySelector('.lg-thumb').style.width = e.thumbTotalWidth + 'px'),
182                    (e.core.outer.querySelector('.lg-thumb').style.position = 'relative')),
183                  this.core.s.animateThumb && (e.thumbOuter.style.height = e.core.s.thumbContHeight + 'px'),
184                  e.core.s.dynamic)
185                )
186                  for (var s = 0; s < e.core.s.dynamicEl.length; s++)
187                    t(e.core.s.dynamicEl[s].src, e.core.s.dynamicEl[s].thumb, s)
188                else
189                  for (var l = 0; l < e.core.items.length; l++)
190                    e.core.s.exThumbImage
191                      ? t(
192                          e.core.items[l].getAttribute('href') || e.core.items[l].getAttribute('data-src'),
193                          e.core.items[l].getAttribute(e.core.s.exThumbImage),
194                          l
195                        )
196                      : t(
197                          e.core.items[l].getAttribute('href') || e.core.items[l].getAttribute('data-src'),
198                          e.core.items[l].querySelector('img').getAttribute('src'),
199                          l
200                        )
201                ;(e.core.outer.querySelector('.lg-thumb').innerHTML = i),
202                  (u = e.core.outer.querySelectorAll('.lg-thumb-item'))
203                for (var h = 0; h < u.length; h++)
204                  !(function (t) {
205                    var i = u[t],
206                      o = i.getAttribute('data-vimeo-id')
207                    if (o) {
208                      window['lgJsonP' + e.el.getAttribute('lg-uid') + h] = function (t) {
209                        i.querySelector('img').setAttribute('src', t[0][e.core.s.vimeoThumbSize])
210                      }
211                      var r = document.createElement('script')
212                      ;(r.className = 'lg-script'),
213                        (r.src =
214                          '//www.vimeo.com/api/v2/video/' +
215                          o +
216                          '.json?callback=lgJsonP' +
217                          e.el.getAttribute('lg-uid') +
218                          h),
219                        document.body.appendChild(r)
220                    }
221                  })(h)
222                utils.addClass(u[e.core.index], 'active'),
223                  utils.on(e.core.el, 'onBeforeSlide.lgtm', function () {
224                    for (var t = 0; t < u.length; t++) utils.removeClass(u[t], 'active')
225                    utils.addClass(u[e.core.index], 'active')
226                  })
227                for (var n = 0; n < u.length; n++)
228                  !(function (t) {
229                    utils.on(u[t], 'click.lg touchend.lg', function () {
230                      setTimeout(function () {
231                        ;((e.thumbClickable && !e.core.lgBusy) || !e.core.doCss()) &&
232                          ((e.core.index = t), e.core.slide(e.core.index, !1, !0))
233                      }, 50)
234                    })
235                  })(n)
236                utils.on(e.core.el, 'onBeforeSlide.lgtm', function () {
237                  e.animateThumb(e.core.index)
238                }),
239                  utils.on(window, 'resize.lgthumb orientationchange.lgthumb', function () {
240                    setTimeout(function () {
241                      e.animateThumb(e.core.index), (e.thumbOuterWidth = e.thumbOuter.offsetWidth)
242                    }, 200)
243                  })
244              }),
245              (i.prototype.setTranslate = function (t) {
246                utils.setVendor(
247                  this.core.outer.querySelector('.lg-thumb'),
248                  'Transform',
249                  'translate3d(-' + t + 'px, 0px, 0px)'
250                )
251              }),
252              (i.prototype.animateThumb = function (t) {
253                var e = this.core.outer.querySelector('.lg-thumb')
254                if (this.core.s.animateThumb) {
255                  var i
256                  switch (this.core.s.currentPagerPosition) {
257                    case 'left':
258                      i = 0
259                      break
260                    case 'middle':
261                      i = this.thumbOuterWidth / 2 - this.core.s.thumbWidth / 2
262                      break
263                    case 'right':
264                      i = this.thumbOuterWidth - this.core.s.thumbWidth
265                  }
266                  ;(this.left = (this.core.s.thumbWidth + this.core.s.thumbMargin) * t - 1 - i),
267                    this.left > this.thumbTotalWidth - this.thumbOuterWidth &&
268                      (this.left = this.thumbTotalWidth - this.thumbOuterWidth),
269                    this.left < 0 && (this.left = 0),
270                    this.core.lGalleryOn
271                      ? (utils.hasClass(e, 'on') ||
272                          utils.setVendor(
273                            this.core.outer.querySelector('.lg-thumb'),
274                            'TransitionDuration',
275                            this.core.s.speed + 'ms'
276                          ),
277                        this.core.doCss() || (e.style.left = -this.left + 'px'))
278                      : this.core.doCss() || (e.style.left = -this.left + 'px'),
279                    this.setTranslate(this.left)
280                }
281              }),
282              (i.prototype.enableThumbDrag = function () {
283                var t = this,
284                  e = 0,
285                  i = 0,
286                  o = !1,
287                  u = !1,
288                  r = 0
289                utils.addClass(t.thumbOuter, 'lg-grab'),
290                  utils.on(t.core.outer.querySelector('.lg-thumb'), 'mousedown.lgthumb', function (i) {
291                    t.thumbTotalWidth > t.thumbOuterWidth &&
292                      (i.preventDefault(),
293                      (e = i.pageX),
294                      (o = !0),
295                      (t.core.outer.scrollLeft += 1),
296                      (t.core.outer.scrollLeft -= 1),
297                      (t.thumbClickable = !1),
298                      utils.removeClass(t.thumbOuter, 'lg-grab'),
299                      utils.addClass(t.thumbOuter, 'lg-grabbing'))
300                  }),
301                  utils.on(window, 'mousemove.lgthumb', function (s) {
302                    o &&
303                      ((r = t.left),
304                      (u = !0),
305                      (i = s.pageX),
306                      utils.addClass(t.thumbOuter, 'lg-dragging'),
307                      (r -= i - e),
308                      r > t.thumbTotalWidth - t.thumbOuterWidth && (r = t.thumbTotalWidth - t.thumbOuterWidth),
309                      r < 0 && (r = 0),
310                      t.setTranslate(r))
311                  }),
312                  utils.on(window, 'mouseup.lgthumb', function () {
313                    u
314                      ? ((u = !1),
315                        utils.removeClass(t.thumbOuter, 'lg-dragging'),
316                        (t.left = r),
317                        Math.abs(i - e) < t.core.s.swipeThreshold && (t.thumbClickable = !0))
318                      : (t.thumbClickable = !0),
319                      o &&
320                        ((o = !1),
321                        utils.removeClass(t.thumbOuter, 'lg-grabbing'),
322                        utils.addClass(t.thumbOuter, 'lg-grab'))
323                  })
324              }),
325              (i.prototype.enableThumbSwipe = function () {
326                var t = this,
327                  e = 0,
328                  i = 0,
329                  o = !1,
330                  u = 0
331                utils.on(t.core.outer.querySelector('.lg-thumb'), 'touchstart.lg', function (i) {
332                  t.thumbTotalWidth > t.thumbOuterWidth &&
333                    (i.preventDefault(), (e = i.targetTouches[0].pageX), (t.thumbClickable = !1))
334                }),
335                  utils.on(t.core.outer.querySelector('.lg-thumb'), 'touchmove.lg', function (r) {
336                    t.thumbTotalWidth > t.thumbOuterWidth &&
337                      (r.preventDefault(),
338                      (i = r.targetTouches[0].pageX),
339                      (o = !0),
340                      utils.addClass(t.thumbOuter, 'lg-dragging'),
341                      (u = t.left),
342                      (u -= i - e),
343                      u > t.thumbTotalWidth - t.thumbOuterWidth && (u = t.thumbTotalWidth - t.thumbOuterWidth),
344                      u < 0 && (u = 0),
345                      t.setTranslate(u))
346                  }),
347                  utils.on(t.core.outer.querySelector('.lg-thumb'), 'touchend.lg', function () {
348                    t.thumbTotalWidth > t.thumbOuterWidth && o
349                      ? ((o = !1),
350                        utils.removeClass(t.thumbOuter, 'lg-dragging'),
351                        Math.abs(i - e) < t.core.s.swipeThreshold && (t.thumbClickable = !0),
352                        (t.left = u))
353                      : (t.thumbClickable = !0)
354                  })
355              }),
356              (i.prototype.toggle = function () {
357                var t = this
358                t.core.s.toggleThumb &&
359                  (utils.addClass(t.core.outer, 'lg-can-toggle'),
360                  t.thumbOuter.insertAdjacentHTML(
361                    'beforeend',
362                    '<button aria-label="Toggle thumbnails" class="lg-toggle-thumb lg-icon"></button>'
363                  ),
364                  utils.on(t.core.outer.querySelector('.lg-toggle-thumb'), 'click.lg', function () {
365                    utils.hasClass(t.core.outer, 'lg-thumb-open')
366                      ? utils.removeClass(t.core.outer, 'lg-thumb-open')
367                      : utils.addClass(t.core.outer, 'lg-thumb-open')
368                  }))
369              }),
370              (i.prototype.thumbkeyPress = function () {
371                var t = this
372                utils.on(window, 'keydown.lgthumb', function (e) {
373                  38 === e.keyCode
374                    ? (e.preventDefault(), utils.addClass(t.core.outer, 'lg-thumb-open'))
375                    : 40 === e.keyCode && (e.preventDefault(), utils.removeClass(t.core.outer, 'lg-thumb-open'))
376                })
377              }),
378              (i.prototype.destroy = function (t) {
379                if (this.core.s.thumbnail && this.core.items.length > 1) {
380                  utils.off(window, '.lgthumb'),
381                    t || this.thumbOuter.parentNode.removeChild(this.thumbOuter),
382                    utils.removeClass(this.core.outer, 'lg-has-thumb')
383                  for (var e = document.getElementsByClassName('lg-script'); e[0]; ) e[0].parentNode.removeChild(e[0])
384                }
385              }),
386              (window.lgModules.thumbnail = i)
387          })
388        },
389        {}
390      ]
391    },
392    {},
393    [1]
394  )(1)
395})

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.