PageSourceSearch

https://www.dashbus.com/wp-content/plugins/ultimate-lightbox/assets/js/ewd-ulb.js?ver=1.1.12

js dashbus.com collected 2026-10-02 04:54:33 UTC 6,890 bytes, 160 lines download raw bytes

1jQuery(document).ready(function() {
2	var add_lightbox_string = ewd_ulb_php_add_data.add_lightbox.replace(/"/g, '"');
3	var add_lightbox_array = jQuery.parseJSON(add_lightbox_string);
4
5	var lightbox_added = false;
6
7	var title_src = ewd_ulb_php_add_data.overlay_text_source == 'caption' ? 'title' : 'alt';
8	var description_src = ewd_ulb_php_add_data.overlay_text_source == 'caption' ? 'caption' : 'alt';
9
10	if (jQuery.inArray("all_images", add_lightbox_array) !== -1) {
11		jQuery("img").each(function() {
12			if (jQuery(this).height() >= ewd_ulb_php_add_data.min_height && jQuery(this).width() >= ewd_ulb_php_add_data.min_width) {
13				if (description_src == 'caption') {var description = jQuery(this).parent().parent().find('figcaption').html();}
14				else {var description = jQuery(this).attr(description_src);}
15
16				jQuery(this).parent().addClass('ewd-ulb-lightbox');
17				jQuery(this).parent().data('ulbsource', jQuery(this).attr('src').replace(/-150x150/g, ''));
18				jQuery(this).parent().data('ulbtitle', jQuery(this).attr(title_src));
19				jQuery(this).parent().data('ulbdescription', description);
20			}
21		});
22	}
23
24	if (jQuery.inArray("all_youtube", add_lightbox_array) !== -1) {
25		jQuery("iframe").each(function() {
26			if (jQuery(this).height() >= ewd_ulb_php_add_data.min_height && jQuery(this).width() >= ewd_ulb_php_add_data.min_width) {
27				var youtube = jQuery(this).attr('src').match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i);
28				if (youtube) {
29					jQuery(this).parent().addClass('ewd-ulb-lightbox');
30					jQuery(this).parent().addClass('ewd-ulb-iframe-parent');
31					jQuery(this).parent().append('<div class="ewd-ulb-overlay"></div>');
32					jQuery(this).parent().data('ulbsource', jQuery(this).attr('src').split("?")[0]);
33					jQuery(this).parent().data('ulbheight', jQuery(this).attr('height'));
34					jQuery(this).parent().data('ulbwidth', jQuery(this).attr('width'));
35				}
36			}
37		});
38	}
39
40	if (jQuery.inArray("image_class", add_lightbox_array) !== -1) {
41		var class_array = ewd_ulb_php_add_data.image_class_list.split(','); console.log( class_array );
42		jQuery(class_array).each(function(index, el) {
43			jQuery("."+el).each(function() { 
44				if (jQuery(this).height() >= ewd_ulb_php_add_data.min_height && jQuery(this).width() >= ewd_ulb_php_add_data.min_width) { console.log( 'applied' );
45
46					if (description_src == 'caption') {var description = jQuery(this).closest('figure').find('figcaption').html();}
47					else {var description = jQuery(this).attr(description_src);}
48
49					jQuery(this).parent().addClass('ewd-ulb-lightbox');
50					jQuery(this).parent().data('ulbsource', jQuery(this).attr('src'));
51					jQuery(this).parent().data('ulbtitle', jQuery(this).attr(title_src));
52					jQuery(this).parent().data('ulbdescription', description);
53				}
54			});
55		});
56	}
57
58	if (jQuery.inArray("image_selector", add_lightbox_array) !== -1) {
59		var selector_array = ewd_ulb_php_add_data.image_selector_list.split(',');
60		jQuery(selector_array).each(function(index, el) {
61			jQuery(el).each(function() { 
62				if (jQuery(this).height() >= ewd_ulb_php_add_data.min_height && jQuery(this).width() >= ewd_ulb_php_add_data.min_width) {
63					 
64					if (description_src == 'caption') {var description = jQuery(this).closest('figure').find('figcaption').html();}
65					else {var description = jQuery(this).attr(description_src);}
66					
67					jQuery(this).parent().addClass('ewd-ulb-lightbox');
68					jQuery(this).parent().data('ulbsource', jQuery(this).attr('src'));
69					jQuery(this).parent().data('ulbtitle', jQuery(this).attr(title_src));
70					jQuery(this).parent().data('ulbdescription', description);
71				}
72			});
73		});
74	}
75
76	if (jQuery.inArray("woocommerce_product_page", add_lightbox_array) !== -1) {
77		jQuery('.product .images figure').find('img.wp-post-image').each(function() {
78			if (jQuery(this).data('src')) {var src = jQuery(this).data('src');}
79			else {var src = jQuery(this).attr('src');}
80
81			if (description_src == 'caption') {var description = jQuery(this).parent().parent().find('figcaption').html();}
82			else {var description = img.attr(description_src);}
83
84			jQuery(this).parent().addClass('ewd-ulb-lightbox');
85			jQuery(this).parent().data('ulbsource', src);
86			jQuery(this).parent().data('ulbtitle', jQuery(this).attr(title_src));
87			jQuery(this).parent().data('ulbdescription', description);
88
89			jQuery(this).parent().parent().on('click', function() {
90				lightbox.toggle();
91			});
92
93		});
94		/*jQuery('.flex-control-nav').on('click', function() {
95			lightbox.setGenericCurrentSlide(this);
96		});
97		jQuery('.woocommerce-product-gallery__trigger').off();
98		jQuery('.woocommerce-product-gallery__trigger').on('click', function() {console.log("Called click");
99			lightbox.toggle();
100		});*/
101	}
102
103	if (jQuery.inArray("galleries", add_lightbox_array) !== -1 && jQuery.inArray("all_images", add_lightbox_array) === -1) {
104		jQuery(".gallery").each(function() { 
105			var gallery_id = jQuery(this).attr("id");
106			jQuery(this).find('a').each(function() {
107				if (jQuery(this).find("img").length) {
108					var img = jQuery(this).find('img').first();
109					if (img.height() >= ewd_ulb_php_add_data.min_height && img.width() >= ewd_ulb_php_add_data.min_width) {	
110						if (description_src == 'caption') {var description = jQuery(this).parent().parent().find('figcaption').html();}
111						else {var description = img.attr(description_src);}
112
113						jQuery(this).addClass('ewd-ulb-lightbox');
114						jQuery(this).data('ulbsource', img.attr('src').replace(/-150x150/g, ''));
115						jQuery(this).data('ulbtitle', img.attr(title_src));
116						jQuery(this).data('ulbdescription', description);
117						jQuery(this).data('ulbGallery', gallery_id);
118					}
119				}
120			})
121		});
122
123		jQuery( '.wp-block-gallery' ).each( function() { 
124
125			var gallery_id = ulb_generate_random_string();
126			jQuery( this ).find( 'img' ).each( function() {
127
128				var img = jQuery( this );
129
130				if ( img.height() >= ewd_ulb_php_add_data.min_height && img.width() >= ewd_ulb_php_add_data.min_width ) {	
131					
132					if ( description_src == 'caption' ) { var description = jQuery(this).parent().find('figcaption').html(); }
133					else { var description = img.attr(description_src); }
134
135					jQuery(this).addClass( 'ewd-ulb-lightbox' );
136					jQuery(this).data( 'ulbsource', jQuery( this ).attr('src').replace(/-150x150/g, '') );
137					jQuery(this).data( 'ulbtitle', jQuery( this ).attr( title_src ) );
138					jQuery(this).data( 'ulbdescription', description );
139					jQuery(this).data( 'ulbGallery', gallery_id );
140				}
141
142			});
143		});
144	} 
145
146});
147
148function ulb_generate_random_string( length ) {
149
150   var result           = '';
151   var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
152   var charactersLength = characters.length;
153
154   for ( var i = 0; i < length; i++ ) {
155      
156      result += characters.charAt(Math.floor(Math.random() * charactersLength));
157   }
158
159   return result;
160}

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.