PageSourceSearch

https://fondazionegoria.it/wp-content/plugins/jnews-video/assets/js/plugin.js?ver=6.0.1

js fondazionegoria.it collected 2026-10-02 13:03:01 UTC 27,768 bytes, 850 lines download raw bytes

1(function ($) {
2
3  'use strict'
4
5  var Video = function (element, module) {
6    this.element = element
7    this.module = module
8  }
9
10  Video.prototype.init = function () {
11    this.canUseWebp()
12    this.injectEvent()
13
14    return this
15  }
16
17  Video.prototype.canUseWebp = function () {
18    this.webp = new Promise(function (resolve) {
19      var webP = new Image()
20      webP.src = 'data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA'
21      webP.onload = webP.onerror = function () {
22        resolve(webP.height === 2)
23      }
24    })
25  }
26
27  Video.prototype.injectEvent = function () {
28    this.metaOption = $(this.module.container).find('.jeg_meta_option')
29    this.videoPreview = $(this.module.container).find('.jeg_post_video_preview')
30    this.moreoption = $(this.module.container).find('.jeg_meta_option .jeg_moreoption')
31    this.postWrapper = $(this.module.container).find('.jeg_post')
32
33    this.metaOptionEvent()
34    this.videoPreviewEvent()
35  }
36
37  Video.prototype.videoPreviewEvent = function () {
38    this.webp.then(function (support) {
39      if (support) {
40        this.videoPreview.each(function (e, element) {
41          var parent = $(element).parents('.jeg_thumb')
42          var mouseenterTimeout = null
43          var mouseleaveTimeout = null
44          var newImg = new Image
45
46          parent.bind('mouseenter', function () {
47            var preview = $(parent).find('.jeg_post_video_preview')
48            var src = $(preview).data('preview')
49
50            newImg.onload = function () {
51              $(parent).addClass('video_previewer')
52              preview.append(newImg)
53
54              mouseenterTimeout = setTimeout(function () {
55                $(parent).removeClass('video_previewer')
56              }, 2800)
57
58              clearTimeout(mouseleaveTimeout)
59            }
60
61            newImg.src = src + '?' + new Date().getMonth() + new Date().getFullYear()
62          }.bind(this)).bind('mouseleave', function () {
63            //need to detect if image still loading
64            newImg.onload = function () {
65              $(parent).removeClass('video_previewer')
66
67              mouseleaveTimeout = setTimeout(function () {
68                $(parent).find('.jeg_post_video_preview img').remove()
69                newImg.src = ''
70              }, 300)
71
72              clearTimeout(mouseenterTimeout)
73            }
74
75            $(parent).removeClass('video_previewer')
76
77            mouseleaveTimeout = setTimeout(function () {
78              $(parent).find('.jeg_post_video_preview img').remove()
79              newImg.src = ''
80            }, 300)
81
82            clearTimeout(mouseenterTimeout)
83
84          }.bind(this))
85        }.bind(this))
86      }
87    }.bind(this))
88
89  }
90
91  Video.prototype.metaOptionEvent = function () {
92    this.moreoption.each(function (e, element) {
93      $(element).superfish({
94        popUpSelector: 'ul,.jeg_add_to_playlist',
95        delay: 250,
96        speed: 'fast',
97        animation: {opacity: 'show'},
98      }).supposition()
99    })
100    $(window).on('click', function () {
101      $(this.metaOption).removeClass('loading').removeClass('active')
102      $(this.metaOption).parents('.jeg_postblock').removeClass('menu-active')
103    }.bind(this))
104
105    this.metaOption.bind('click', function (e) {
106      e.preventDefault()
107      e.stopPropagation()
108
109      var element = e.currentTarget,
110        post_id = $(element).data('id'),
111        option = $(element).find('.jeg_moreoption')
112
113      if ($(element).hasClass('loading')) {
114        return false
115      }
116
117      if ($(element).hasClass('active')) {
118        $(element).removeClass('active')
119        return false
120      }
121
122      $(element).addClass('loading')
123
124      $.ajax({
125        url: jnews_ajax_url,
126        type: 'post',
127        dataType: 'json',
128        data: {
129          post_id: post_id,
130          action: 'get_video_menu',
131        },
132        success: function (result) {
133          if (result.data.response === 0) {
134            JNewsVideoAction.login(result.data)
135          } else {
136            $(this.metaOption).removeClass('loading').removeClass('active')
137            $(this.metaOption).parents('.jeg_postblock').removeClass('menu-active')
138            $(option).html('').append(result.data)
139            $(element).removeClass('loading').addClass('active').show()
140            $(element).parents('.jeg_postblock').addClass('menu-active')
141            $(element).find('[data-action="jeg_add_post"]').on('click', JNewsVideoAction.ajaxAddPost.bind(this))
142            $(element).find('.jeg_moreoption > li:last-child > a').on('click', function (e) {
143              e.preventDefault()
144              e.stopPropagation()
145            })
146            $(element).find('.jeg_add_to_playlist').on('click', '[data-action="jeg_add_post"]', JNewsVideoAction.ajaxAddPost.bind(this))
147            $(element).find('.jeg_popuplink').bind('click', JNewsVideoAction.openPlaylistPopup.bind(this))
148          }
149        }.bind(this),
150      })
151    }.bind(this))
152  }
153
154  var Playlist = function () {
155    // Playlist item
156    $('.jnews-playlist-items').on('click', '[data-action="jeg_remove_post"]', function (e) {
157      e.preventDefault()
158      this.ajaxRemovePost($(e.currentTarget))
159    }.bind(this))
160
161    // Playlist Load More
162    $('.jeg_playlist_load_more').on('click', 'a', function (e) {
163      e.preventDefault()
164      this.ajaxLoadMore($(e.currentTarget))
165    }.bind(this))
166
167    // Popup Form
168    $('[id*=\'jeg_playlist\'] > .jeg_popupform_playlist > form').unbind('submit').on('submit', function (e) {
169      e.preventDefault()
170      this.ajaxPlaylistDashboard($(e.currentTarget))
171    }.bind(this))
172  }
173
174  Playlist.prototype.ajaxLoadMore = function (ele) {
175    var parent = ele.parents().find('[class*="playlist-items"]'),
176      last = parent.find('.jnews-playlist-item').last().data('id'),
177      playlist_id = parent.data('playlist-id'),
178      attr = {
179        last: last,
180        playlist_id: playlist_id,
181        type: 'load_more',
182        action: 'playlist_handler',
183      }
184
185    this.do_ajax(attr, ele)
186  }
187
188  Playlist.prototype.ajaxRemovePost = function (ele) {
189    var parent = ele.parents().find('[class*="playlist-items"]'),
190      post_id = ele.data('post-id'),
191      playlist_id = parent.data('playlist-id'),
192      attr = {
193        post_id: post_id,
194        playlist_id: playlist_id,
195        type: 'remove_post',
196        action: 'playlist_handler',
197      }
198    this.do_ajax(attr, ele)
199  }
200
201  Playlist.prototype.ajaxPlaylistDashboard = function (ele) {
202    var nonce = ele.find('input[name="jnews-playlist-nonce"]'),
203      type = ele.find('input[name="type"]'),
204      attr = {
205        nonce: nonce.val(),
206        type: type.val(),
207        action: 'playlist_handler',
208      }
209
210    if (type.val() === 'create_playlist') {
211      var post_id = ele.find('input[name="post_id"]')
212      attr.post_id = post_id.val()
213    }
214
215    if (type.val() !== 'create_playlist') {
216      var playlist_id = ele.find('input[name="playlist_id"]')
217      attr.playlist_id = playlist_id.val()
218    }
219
220    if (type.val() === 'edit_playlist') {
221      var content = ele.find('textarea[name="content"]'),
222        image = ele.find('input[name="image[]"]')
223      attr.content = content.val()
224      attr.image = image.val()
225    }
226
227    if (type.val() !== 'delete_playlist') {
228      var title = ele.find('input[name="title"]'),
229        visibility = ele.find('select[name="visibility"]')
230      attr.title = title.val()
231      attr.visibility = visibility.find(':selected').val()
232    }
233
234    this.do_ajax(attr, ele)
235  }
236
237  Playlist.prototype.do_ajax = function (attr, ele) {
238    switch (attr.type) {
239      case 'remove_post':
240        var playlistItem = ele.closest('[class*="playlist-item"]').addClass('playlist-item-removing')
241        break
242      case 'create_playlist':
243      case 'edit_playlist':
244      case 'delete_playlist':
245        var msg = $(ele).find('.form-message')
246        msg.html('')
247        ele.find('input[type="submit"]').val(ele.find('input[type="submit"]').data('process'))
248        ele.find('input[type="submit"]').prop('disabled', true)
249        break
250      case 'load_more':
251        var loading = $(ele).addClass('active').data('loading')
252        $(ele).text(loading)
253        break
254      default :
255        break
256    }
257
258    $.ajax({
259      url: jnews_ajax_url,
260      type: 'post',
261      dataType: 'json',
262      data: attr,
263      success: function (data) {
264        switch (attr.type) {
265          case 'remove_post':
266            if (data.response === 1) {
267              $('.playlist-item-removing').remove()
268            } else {
269              $('.playlist-item-removing').html(playlistItem).removeClass('playlist-item-removing')
270            }
271            notificationPopup(data.message)
272            break
273          case 'create_playlist':
274            ele.find('input[type="submit"]').val(ele.find('input[type="submit"]').data('str
274ing'))
275            ele.find('input[type="submit"]').prop('disabled', false)
276            if (data.response === 1) {
277              notificationPopup(data.message)
278              $(ele).trigger('reset')
279              $.magnificPopup.close()
280            } else {
281              msg.html(data.message)
282            }
283
284            break
285          case 'edit_playlist':
286            ele.find('input[type="submit"]').val(ele.find('input[type="submit"]').data('string'))
287            ele.find('input[type="submit"]').prop('disabled', false)
288            if (data.response === 1) {
289              notificationPopup(data.message)
290              $.magnificPopup.close()
291              setTimeout(location.reload(), 500)
292            } else {
293              msg.html(data.message)
294            }
295            break
296          case 'delete_playlist':
297            ele.find('input[type="submit"]').val(ele.find('input[type="submit"]').data('string'))
298            ele.find('input[type="submit"]').prop('disabled', false)
299            if (data.response === 1) {
300              $.magnificPopup.close()
301              notificationPopup(data.message)
302              setTimeout(location.href = data.redirect, 500)
303            } else {
304              msg.html(data.message)
305            }
306            break
307          case 'load_more':
308            if (data.next) {
309              var loading = $(ele).removeClass('active').data('load')
310              $(ele).text(loading)
311            } else {
312              ele.remove()
313            }
314
315            $('.jnews-playlist-items').append(data.html)
316            break
317          default :
318            break
319        }
320      }.bind(this),
321    })
322  }
323
324  var Carousel = function (container) {
325    $(container).find('.jeg_category_list_wrapper').each(function () {
326      var container = $(this)
327      var carousel = container.find('.jeg_category_list').addClass('owl-carousel')
328      var options = {
329        nav: carousel.data('nav'),
330        autoplay: carousel.data('autoplay'),
331        items: carousel.data('items') === undefined ? 3 : carousel.data('items'),
332        delay: carousel.data('delay') === undefined ? 3000 : carousel.data('delay'),
333        rtl: carousel.data('rtl'),
334        margin: carousel.data('margin') === undefined ? 20 : carousel.data('margin')
335      }
336      /* Fullwidth (column 12) */
337      if (container.hasClass('jeg_col_12')) {
338        options.items = carousel.data('items') === undefined ? 5 : carousel.data('items')
339      }
340
341      carousel.on('initialized.owl.carousel', function () {
342        carousel.siblings('.jeg_carousel_placeholder').remove()
343        carousel.parent().addClass('jeg_carousel_wrapper_loaded')
344      })
345
346      carousel.owlCarousel({
347        rtl: jnewsoption.rtl == 1,
348        nav: options.nav,
349        margin: options.margin,
350        navText: false,
351        dots: false,
352        loop: true,
353        mergeFit: false,
354        center: false,
355        items: options.items,
356        autoplay: options.autoplay,
357        autoplayTimeout: options.delay,
358        autoWidth: true,
359        responsive: {
360          0: {items: 1, autoWidth: false},
361          321: {items: 1, margin: options.margin > 15 ? 15 : options.margin, autoWidth: false},
362          568: {items: options.items, margin: options.margin > 15 ? 15 : options.margin, autoWidth: true},
363          1024: {items: options.items, autoWidth: true}
364        }
365      })
366    })
367
368    $(container).find('.jeg_postblock_video_carousel').each(function () {
369      var container = $(this)
370      var carousel = container.find('.jeg_carousel_post').addClass('owl-carousel')
371      var options = {
372        nav: carousel.data('nav'),
373        autoplay: carousel.data('autoplay'),
374        items: carousel.data('items') === undefined ? 3 : carousel.data('items'),
375        delay: carousel.data('delay') === undefined ? 3000 : carousel.data('delay'),
376        rtl: carousel.data('rtl'),
377        margin: carousel.data('margin') === undefined ? 20 : carousel.data('margin'),
378        center: carousel.data('center') === undefined ? true : carousel.data('center'),
379        mergeFit: carousel.data('mergefit') === undefined ? true : carousel.data('mergefit'),
380        stagePadding: carousel.data('stagepadding') === undefined ? 0 : carousel.data('stagepadding'),
381        sliderStyle: carousel.data('sliderstyle') === undefined ? 'slider_1' : carousel.data('sliderstyle')
382      }
383      /* Fullwidth (column 12) */
384      if (container.hasClass('jeg_col_12')) {
385        options.items = carousel.data('items') === undefined ? 5 : carousel.data('items')
386      }
387
388      var set_nav_centered = function () {
389        var slider_nav = container.find('.owl-nav > div')
390
391        if ($(slider_nav).length) {
392          var thumb = container.find('.thumbnail-container')
393          var thumb_height = $(thumb[0]).outerHeight()
394
395          $(slider_nav).each(function () {
396            var nav = $(this)
397            var nav_height = nav.outerHeight()
398            var top = (thumb_height * .5) - (nav_height * .5)
399            nav.css('top', top + 'px')
400          })
401        }
402      }
403
404      carousel.on('initialized.owl.carousel', function () {
405        carousel.siblings('.jeg_carousel_placeholder').remove()
406        carousel.parent().addClass('jeg_carousel_wrapper_loaded')
407      })
408
409      carousel.owlCarousel({
410        rtl: jnewsoption.rtl == 1,
411        nav: options.nav,
412        margin: options.margin,
413        navText: false,
414        dots: false,
415        loop: true,
416        mergeFit: options.mergeFit,
417        center: options.center,
418        items: options.items,
419        stagePadding: options.stagePadding,
420        autoplay: options.autoplay,
421        autoplayTimeout: options.delay,
422        responsive: {
423          0: {items: 1},
424          321: {
425            items: 1,
426            margin: options.margin > 15 ? 15 : options.margin,
427            stagePadding: options.stagePadding > 0 ? 30 : 0
428          },
429          568: {
430            items: 2,
431            margin: options.margin > 15 ? 15 : options.margin,
432            stagePadding: options.stagePadding > 0 ? 50 : 0
433          },
434          1024: {items: options.items, stagePadding: options.stagePadding > 0 ? options.stagePadding : 0}
435        },
436        onInitialized: function () {
437          if (options.sliderStyle == 'slider_4') {
438            set_nav_centered()
439          }
440        },
441      })
442    })
443
444    $(container).find('.jeg_playlist_wrapper').each(function () {
445      var container = $(this)
446      var carousel = container.find('.jeg_playlist').addClass('owl-carousel')
447      var options = {
448        nav: carousel.data('nav'),
449        autoplay: carousel.data('autoplay'),
450        items: carousel.data('items') === undefined ? 3 : carousel.data('items'),
451        delay: carousel.data('delay') === undefined ? 3000 : carousel.data('delay'),
452        rtl: carousel.data('rtl'),
453        margin: carousel.data('margin') === undefined ? 20 : carousel.data('margin')
454      }
455      /* Fullwidth (column 12) */
456      if (container.hasClass('jeg_col_12')) {
457        options.items = carousel.data('items') === undefined ? 5 : carousel.data('items')
458      }
459
460      carousel.on('initialized.owl.carousel', function () {
461        carousel.siblings('.jeg_carousel_placeholder').remove()
462        carousel.parent().addClass('jeg_carousel_wrapper_loaded')
463      })
464
465      carousel.owlCarousel({
466        rtl: jnewsoption.rtl == 1,
467        nav: options.nav,
468        margin: options.margin,
469        navText: false,
470        dots: false,
471        loop: true,
472        items: options.items,
473        autoplay: options.autoplay,
474        autoplayTimeout: options.delay,
475        responsive: {
476          0: {items: 1},
477          321: {items: 1, margin: options.margin > 15 ? 15 : options.margin},
478          568: {items: 2, margin: options.margin > 15 ? 15 : options.margin},
479          1024: {items: options.items}
480        }
481      })
482    })
483  }
484
485  var notificationPopup = function (message) {
486    var notification = $('#notification_action_renderer')
487    var bottom = notification.find('#paper_toast').outerHeight() + 30
488
489    // reset animate
490    notification.stop(true, true)
491    notification.finish()
492    notification.removeAttr('style')
493    notification.find('#paper_toast').removeAttr('style')
494
495    notification.find('#paper_toast').css({opacity: 1})
496    notification.find('#paper_toast span#label').html(message)
497    notification.animate({
498      bottom: bottom,
499    }, 1000, function () {
500      setTimeout(function () {
501        notification.animate({
502          bottom: 0,
503        }, 1000, function () {
504          notification.find('#paper_toast span#label').html(' ')
505        }.bind(this))
506      }.bind(this), 3000)
507    }.bind(this))
508  }
509
510  var metaOptionSingle = function (el, ajax) {
511    var $w = $(window),
512      $el = $(el),
513      _offset = function (dir) {
514        return window[dir == 'y' ? 'pageYOffset' : 'pageXOffset']
515          || document.documentElement && document.documentElement[dir == 'y' ? 'scrollTop' : 'scrollLeft']
516          || document.body[dir == 'y' ? 'scrollTop' : 'scrollLeft']
517      }
518    $w.on('click', function () {
519      $el.removeClass('loading').removeClass('active')
520    })
521    if (ajax) {
522      el.find('.jeg_moreoption').each(function (e, element) {
523        $(element).superfish({
524          popUpSelector: 'ul,.jeg_add_to_playlist',
525          delay: 250,
526          speed: 'fast',
527          animation: {opacity: 'show'},
528        }).supposition()
529      })
530    }
531    el.bind('click', function (e) {
532      e.preventDefault()
533      e.stopPropagation()
534
535      var element = e.currentTarget,
536        $element = $(element)
537
538      if ($element.hasClass('loading')) {
539        return false
540      }
541
542      if ($element.hasClass('active')) {
543        $element.removeClass('active')
544        if (!(ajax)) {
545          var $u = $element.find('.jeg_sharelist')
546          if ($u.length > 0) {
547            $u.removeClass('supposition-active')
548          }
549        }
550        return false
551      }
552
553      $element.addClass('loading')
554
555      if (ajax) {
556        var post_id = $element.data('id'),
557          option = $element.find('.jeg_moreoption')
558
559        $.ajax({
560          url: jnews_ajax_url,
561          type: 'post',
562          dataType: 'json',
563          data: {
564            post_id: post_id,
565            action: 'get_video_menu',
566          },
567          success: function (result) {
568            if (result.data.response === 0) {
569              JNewsVideoAction.login(result.data)
570            } else {
571              $(option).html('').append(result.data)
572              $element.removeClass('loading').addClass('active')
573              $element.parents('.jeg_postblock').addClass('menu-active')
574              $element.find('[data-action="jeg_add_post"]').on('click', JNewsVideoAction.ajaxAddPost)
575              $element.find('.jeg_moreoption > li:last-child > a').on('click', function (e) {
576                e.preventDefault()
577                e.stopPropagation()
578              })
579              $element.find('.jeg_add_to_playlist').on('click', '[data-action="jeg_add_post"]', JNewsVideoAction.ajaxAddPost)
580              $element.find('.jeg_popuplink').bind('click', JNewsVideoAction.openPlaylistPopup)
581            }
582          },
583        })
584      } else {
585        $element.removeClass('loading').addClass('active')
586        $element.each(function (e, element) {
587          var $u = $(element).find('.jeg_sharelist')
588          if ($u.length > 0) {
589            var menuWidth = $u.width(),
590              parentWidth = $u.parents('.jeg_meta_share').width(),
591              totalRight = $w.width() + _offset('x'),
592              menuRight = $u.offset().left + menuWidth
593            if (menuRight > totalRight) {
594              $u.addClass('supposition-active')
595            }
596          }
597        })
598        $element.find('.jeg_popuplink').bind('click', JNewsVideoAction.openPlaylistPopup)
599      }
600    })
601  }
602
603  var JNewsVideoAction = {
604    ajaxAddPost: function (e) {
605      e.preventDefault()
606      e.stopPropagation()
607
608      var ele = $(e.currentTarget),
609        actionType = ele.hasClass('active') ? 'exclude_post' : 'add_post',
610        post_id = ele.parents('.jeg_meta_option').data('id'),
611        playlist_id = ele.data('playlist-id'),
612        attr = {
613          post_id: post_id,
614          playlist_id: playlist_id,
615          type: actionType,
616          action: 'playlist_handler',
617        }
618
619      JNewsVideoAction.do_ajax(attr, ele)
620    }, do_ajax: function (attr, ele) {
621      switch (attr.type) {
622        case 'exclude_post':
623        case 'add_post':
624          ele.addClass('loading')
625          break
626      }
627
628      $.ajax({
629        url: jnews_ajax_url,
630        type: 'post',
631        dataType: 'json',
632        data: attr,
633        success: function (data) {
634          switch (attr.type) {
635            case 'exclude_post':
636              ele.removeClass('active').removeClass('loading')
637              notificationPopup(data.message)
638              break
639            case 'add_post':
640              ele.addClass('active').removeClass('loading')
641              notificationPopup(data.message)
642              break
643            default :
644              break
645          }
646        },
647      })
648    }, openPlaylistPopup: function (e) {
649      e.preventDefault()
650      e.stopPropagation()
651
652      var popup = $($(e.currentTarget).attr('href')),
653        post_id = popup.find('input[name="post_id"]')
654      if ($(post_id).length) {
655        post_id.val($(e.currentTarget).data('post-id'))
656      }
657
658      $.magnificPopup.open({
659        items: {
660          removalDelay: 500,
661          midClick: true,
662          src: $(e.currentTarget).attr('href'),
663          type: 'inline',
664        },
665      })
666    }, login: function (data) {
667      if (data) {
668        $('#jeg_loginform form').find('h3').html(data.message)
669      }
670      window.jnews.loginregister.hook_form()
671      $.magnificPopup.open({
672        items: {
673          removalDelay: 500,
674          midClick: true,
675          src: '#jeg_loginform',
676          type: 'inline',
677        },
678      })
679    }
680  }
681
682  var follow = function (scope) {
683    var el = scope,
684      parent = el.parents('.follow-wrapper'),
685      uid = el.attr('id'),
686      nonce = el.attr('href'),
687      action = '',
688      spinner = parent.find('.jnews-spinner'),
689      meta = el.parents('.jeg_meta_subscribe:not(.no-follow)'),
690      meta_count = meta.find('.jeg_subscribe_count'),
691      new_link = ''
692
693    uid = uid.split('-')
694    action = uid[0]
695    uid = uid[1]
696
697    nonce = nonce.split('?_wpnonce=')
698    nonce = nonce[1].split('&')
699    nonce = nonce[0]
700
701    $.ajax({
702      url: ajaxurl,
703      type: 'post',
704      data: {
705        action: 'bp_' + action,
706        'uid': uid,
707        '_wpnonce': nonce
708      },
709      beforeSend: function () {
710        if (spinner.length) {
711          el.css('display', 'none')
712          spinner.css('display', 'block')
713        }
714      },
715      success: function (response) {
716        if (response.length) {
717          var classStr = el.attr('class')
718          new_link = $(response)
719          // Strip follow/unfollow class.
720          classStr = classStr.replace(action + ' ', '')
721          new_link.addClass(classStr)
722        }
723      }
724    }).always(function () {
725      if (meta_count.length) {
726        $.ajax({
727          url: ajaxurl,
728          type: 'post',
729          data: {
730            action: 'jnews_get_subscribe_count',
731            'uid': uid,
732            '_wpnonce': nonce
733          },
734          success: function (response) {
735            if (response.status) {
736              var new_count = $(response.content)
737              meta_count.replaceWith(new_count)
738            }
739          }
740        }).always(function () {
741          if (spinner.length) {
742            el.replaceWith(new_link)
743            spinner.css('display', 'none')
744          }
745        })
746      } else {
747        if (spinner.length) {
748          el.replaceWith(new_link)
749          el.css('display', '')
750          spinner.css('display', 'none')
751        }
752      }
753    })
754  }
755
756  var BuddyPress = function (container) {
757    this.container = container
758    this.drop = '.jeg_action'
759    this.dropExpanded = '.jeg_action_expanded'
760    this.primaryNav = '.item-list-tabs[aria-label*="primary navigation"]'
761    this.classesDropExpanded = 'jeg_action_expanded'
762
763    this.container.find(this.primaryNav).okayNav({swipe_enabled: false, threshold: 80})
764
765    // Hide drop on focus out.
766    this.container.bind('click touchstart', function (e) {
767      var activeAction = $(e.target).parents(this.dropExpanded)
768      $(this.dropExpanded).not(activeAction).removeClass(this.classesDropExpanded)
769    }.bind(this))
770
771    this.container.find(this.drop).bind('click', function (e) {
772      var expandMenu = $(e.currentTarget)
773      if (expandMenu.is(this.dropExpanded)) {
774        var clickedElement = $(e.target)
775
776        var toggleClicked = clickedElement.hasClass('jeg_action_toggle')
777
778        if (toggleClicked) {
779          expandMenu.removeClass(this.classesDropExpanded)
780          e.preventDefault()
781        }
782      } else {
783        expandMenu.addClass(this.classesDropExpanded)
784        e.preventDefault()
785      }
786    }.bind(this))
787  }
788  BuddyPress.prototype.dropMenuMoveItem = function () {
789    $(this.container).find(this.drop).each(function () {
790      var expandMenu = $(this)
791
792      // Get the element
793      expandMenu.find('.menu-item').each(function (e, ele) {
794        var item
795        if (e < 2) {
796          item = $(ele).detach()
797          if (item.length) {
798            item.removeClass('menu-item').find('a')
799            item.insertBefore(expandMenu)
800          }
801        }
802      })
803      if (!expandMenu.find('.menu-item').length) {
804        expandMenu.remove()
805      }
806
807    })
808  }
809
810  $('.jeg_module_hook').on('jnews_module_init', function (event, obj) {
811    var video = (new Video(this, obj)).init()
812    $(this).data('video', video)
813  }).on('jnews_module_ajax', function () {
814    $(this).data('video').injectEvent()
815  })
816
817  $(document).bind('ready', function () {
818    new Playlist()
819    new Carousel($('body'))
820    var bpjs = new BuddyPress($('#buddypress'))
821    bpjs.dropMenuMoveItem()
822
823    var single_playlist = $('.single-playlist'),
824      single_video = $('.single-format-video'),
825      single_playlist_option = single_playlist.find('.jeg_meta_option'),
826      single_playlist_share = single_playlist.find('.jeg_meta_share'),
827      single_video_option = single_video.find('.jeg_meta_option'),
828      single_video_share = single_video.find('.jeg_meta_share')
829
830    metaOptionSingle(single_playlist_option)
831    metaOptionSingle(single_playlist_share)
832    metaOptionSingle(single_video_option, true)
833    metaOptionSingle(single_video_share)
834
835    $('.jeg_login_required').bind('click', function (e) {
836      e.preventDefault()
837      JNewsVideoAction.login()
838    })
839
840    $('body').on('click', '.jeg_bp_action.follow, .jeg_bp_action.unfollow', function (e) {
841      e.preventDefault()
842      follow($(this))
843      return false
844    })
845  })
846
847  $(document).bind('jnews_vc_trigger jnews_elementor_trigger', function (event, element) {
848    new Carousel($(element))
849  })
850})(jQuery)

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.