1(function($) { 2 3 //Settings for lightbox 4 var cbSettings = { 5 rel: 'cboxElement', 6 width: '95%', 7 height: 'auto', 8 maxWidth: '1000', 9 maxHeight: 'auto', 10 title: function() { 11 return $(this).find('img').attr('alt'); 12 }, 13 current: nisargpro_script_vars.current, 14 previous: nisargpro_script_vars.previous, 15 next: nisargpro_script_vars.next, 16 close: nisargpro_script_vars.close, 17 xhrError: nisargpro_script_vars.xhrError, 18 imgError: nisargpro_script_vars.imgError, 19 onCleanup: function(){ 20 $('.gallery a').removeClass('cboxElement'); 21 $('.wp-block-gallery a').removeClass('cboxElement'); 22 } 23 } 24 25 $('.entry-content .gallery-item,.entry-content .blocks-gallery-item').click(function(event) { 26 var target = $( event.target ); 27 var parent_id = $(this).parents('article').attr("id"); 28 29 if( $(this).parent().hasClass('wp-block-gallery') ) { 30 //If gallery created after wp version 5 in Gutenberg 31 var sel = '#'+parent_id+' .wp-block-gallery a'; 32 33 if( target.is('.blocks-gallery-item img') ){ 34 $(sel).colorbox(cbSettings); 35 } 36 } else { 37 if( $(this).parent().hasClass('gallery') ) { 38 //If gallery created before wp version 5 in Classic Editor 39 var sel = '#'+parent_id+' .gallery a'; 40 41 if( target.is('.gallery-item img') ){ 42 $(sel).colorbox(cbSettings); 43 } 44 } 45 } 46 }); 47 48 //Display page's gallery images into lightbox 49 $('.page .gallery-item,.page .blocks-gallery-item').click(function(event) { 50 var target = $( event.target ); 51 var parent_id = $(this).parents('article').attr("id"); 52 53 if( $(this).parent().hasClass('wp-block-gallery') ) { 54 //If gallery created after wp version 5 in Gutenberg 55 var sel = '#'+parent_id+' .wp-block-gallery a'; 56 57 if( target.is('.blocks-gallery-item img') ){ 58 $(sel).colorbox(cbSettings); 59 } 60 } else { 61 if( $(this).parent().hasClass('gallery') ) { 62 //If gallery created before wp version 5 in Classic Editor 63 var sel = '#'+parent_id+' .gallery a'; 64 65 if( target.is('.gallery-item img') ){ 66 $(sel).colorbox(cbSettings); 67 } 68 } 69 } 70 }); 71 72 //Display gallery images of widget_media_gallery in lightbox 73 $('.widget_media_gallery').click( function() { 74 var target = $( event.target ); 75 var el_id = $(this).attr("id"); 76 var sel = '#'+el_id+' .gallery a'; 77 if( target.is('.gallery-item img') ){ 78 $(sel).colorbox(cbSettings); 79 } 80 }); 81 82 //Keep lightbox responsive on screen resize 83 $(window).on('resize', function() { 84 $.colorbox.resize({ 85 width: window.innerWidth > parseInt(cbSettings.maxWidth) ? cbSettings.maxWidth : cbSettings.width 86 }); 87 }); 88 89})(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.