1jQuery(function($) { 2 var nextgen_fancybox_init = function() { 3 var selector = nextgen_lightbox_filter_selector($, $(".ngg-fancybox")); 4 5 window.addEventListener( 6 "click", 7 e => { 8 let $target = $(e.target); 9 var $anchor = $target.is('a') ? $target : $target.parents('a').first(); 10 11 if (!$anchor.is(selector) && !$target.is(selector)) { 12 return; 13 } 14 15 // Skip Dribbble direct links - they should navigate to external URL, not open lightbox. 16 if ($anchor.attr('data-dribbble-direct') === 'true') { 17 return; 18 } 19 20 var imageId = $anchor.attr('data-image-id'); 21 var isTikTokImage = false; 22 var tiktokData = null; 23 24 if (imageId && window.ngg_tiktok_images && window.ngg_tiktok_images[imageId]) { 25 isTikTokImage = true; 26 tiktokData = window.ngg_tiktok_images[imageId]; 27 } else if ($anchor.attr('data-tiktok-play-url') || $anchor.attr('data-tiktok-share-url')) { 28 isTikTokImage = true; 29 tiktokData = { 30 playUrl: $anchor.attr('data-tiktok-play-url') || '', 31 shareUrl: $anchor.attr('data-tiktok-share-url') || '', 32 embedUrl: $anchor.attr('data-tiktok-embed-url') || '' 33 }; 34 } 35 36 if (isTikTokImage && tiktokData) { 37 var $galleryContainer = $anchor.closest('[data-gallery-id]'); 38 var galleryId = null; 39 40 if ($galleryContainer.length) { 41 galleryId = $galleryContainer.attr('data-gallery-id') || $galleryContainer.data('gallery-id'); 42 } else { 43 $galleryContainer = $anchor.closest('.ngg-galleryoverview, .ngg-imagebrowser, .ngg-slideshow'); 44 if ($galleryContainer.length) { 45 galleryId = $galleryContainer.attr('data-gallery-id') || 46 $galleryContainer.data('gallery-id') || 47 $galleryContainer.attr('data-nextgen-gallery-id') || 48 $galleryContainer.data('nextgen-gallery-id'); 49 } 50 } 51 52 if (galleryId) { 53 galleryId = String(galleryId); 54 } 55 56 var tiktokSettings = {}; 57 if (window.NggTikTokVideo && typeof window.NggTikTokVideo.getTikTokSettings === 'function') { 58 tiktokSettings = window.NggTikTokVideo.getTikTokSettings(galleryId); 59 } else { 60 if (window.ngg_tiktok_gallery_settings) { 61 if (galleryId && window.ngg_tiktok_gallery_settings['gallery_' + galleryId]) { 62 tiktokSettings = window.ngg_tiktok_gallery_settings['gallery_' + galleryId]; 63 } else if (window.ngg_tiktok_gallery_settings.global) { 64 tiktokSettings = window.ngg_tiktok_gallery_settings.global; 65 } 66 } 67 } 68 69 var linkSetting = String(tiktokSettings.link || '0'); 70 71 if (linkSetting === '1' || linkSetting === '2') { 72 return; 73 } 74 } 75 76 e.preventDefault(); 77 $(selector).fancybox({ 78 titlePosition: 'inside', 79 // Needed for twenty eleven 80 onComplete: function(selectedArray, selectedIndex, selectedOpts) { 81 $("#fancybox-wrap").css("z-index", 10000); 82 83 var element = selectedArray[selectedIndex]; 84 var $element = $(element); 85 var playUrl = $element.data("tiktok-play-url"); 86 var shareUrl = $element.data("tiktok-share-url"); 87 var videoUrl = $element.attr("data-video-url"); 88 89 // Handle TikTok 90 if (playUrl || shareUrl) { 91 $("#fancybox-wrap").addClass("ngg-tiktok-mode"); 92 NextGEN_TikTok.handle_content({ 93 playUrl: playUrl, 94 shareUrl: shareUrl, 95 container: $("#fancybox-content"), 96 onBeforeAppend: function () { 97 $("#fancybox-img").hide(); 98 }, 99 }); 100 } 101 // Handle video links 102 else if (videoUrl && window.NextGEN_Video && window.NextGEN_Video.detect_platform(videoUrl)) { 103 $("#fancybox-wrap").addClass("ngg-video-mode"); 104 105 // Remove existing video containers 106 $("#fancybox-content .ngg-video-container, #fancybox-content .ngg-video-error").remove(); 107 108 // Get gallery ID for settings 109 var galleryId = null; 110 var $galleryContainer = $element.closest('[data-gallery-id]'); 111 if ($galleryContainer.length) { 112 galleryId = $galleryContainer.attr('data-gallery-id') || $galleryContainer.data('gallery-id'); 113 } 114 115 // Get video settings 116 var videoSettings = {}; 117 if (window.ngg_video_gallery_settings) { 118 if (galleryId && window.ngg_video_gallery_settings['gallery_' + galleryId]) { 119 videoSettings = window.ngg_video_gallery_settings['gallery_' + galleryId]; 120 } 121 } 122 123 window.NextGEN_Video.handle_content({ 124 videoUrl: videoUrl, 125 container: $("#fancybox-content")[0], 126 settings: videoSettings, 127 containerClass: "ngg-video-container", 128 videoClass: "ngg-video-player", 129 errorClass: "ngg-video-error", 130 onBeforeAppend: function () { 131 $("#fancybox-img").hide(); 132 }, 133 }); 134 } 135 }, 136 onCleanup: function () { 137 $("#fancybox-wrap").removeClass("ngg-tiktok-mode ngg
137-video-mode"); 138 $("#fancybox-content .ngg-tiktok-container, #fancybox-content .ngg-tiktok-error").remove(); 139 $("#fancybox-content .ngg-video-container, #fancybox-content .ngg-video-error").remove(); 140 }, 141 }); 142 $target.trigger('click.fb'); 143 144 e.stopPropagation(); 145 }, 146 true 147 ) 148 }; 149 $(window).on('refreshed', nextgen_fancybox_init); 150 nextgen_fancybox_init(); 151});
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.