1jQuery(document).ready(function($) { 2 3 // Spoiler 4 $('body:not(.su-other-shortcodes-loaded)').on('click keypress', '.su-spoiler-title', function(e) { 5 var $title = $(this), 6 $spoiler = $title.parent(), 7 bar = ($('#wpadminbar').length > 0) ? 28 : 0; 8 // Open/close spoiler 9 $spoiler.toggleClass('su-spoiler-closed'); 10 // Close other spoilers in accordion 11 $spoiler.parent('.su-accordion').children('.su-spoiler').not($spoiler).addClass('su-spoiler-closed'); 12 // Scroll in spoiler in accordion 13 if ($(window).scrollTop() > $title.offset().top) $(window).scrollTop($title.offset().top - $title.height() - bar); 14 e.preventDefault(); 15 }); 16 // Tabs 17 $('body:not(.su-other-shortcodes-loaded)').on('click keypress', '.su-tabs-nav span', function(e) { 18 var $tab = $(this), 19 data = $tab.data(), 20 index = $tab.index(), 21 is_disabled = $tab.hasClass('su-tabs-disabled'), 22 $tabs = $tab.parent('.su-tabs-nav').children('span'), 23 $panes = $tab.parents('.su-tabs').find('.su-tabs-pane'), 24 $gmaps = $panes.eq(index).find('.su-gmap:not(.su-gmap-reloaded)'); 25 // Check tab is not disabled 26 if (is_disabled) return false; 27 // Hide all panes, show selected pane 28 $panes.removeClass('su-tabs-pane-open').eq(index).addClass('su-tabs-pane-open'); 29 // Disable all tabs, enable selected tab 30 $tabs.removeClass('su-tabs-current').eq(index).addClass('su-tabs-current'); 31 // Reload gmaps 32 if ($gmaps.length > 0) $gmaps.each(function() { 33 var $iframe = $(this).find('iframe:first'); 34 $(this).addClass('su-gmap-reloaded'); 35 $iframe.attr('src', $iframe.attr('src')); 36 }); 37 // Set height for vertical tabs 38 tabs_height(); 39 // Open specified url 40 if (data.url !== '') { 41 if (data.target === 'self') window.location = data.url; 42 else if (data.target === 'blank') window.open(data.url); 43 } 44 e.preventDefault(); 45 }); 46 47 // Activate tabs 48 $('.su-tabs').each(function() { 49 var active = parseInt($(this).data('active')) - 1; 50 $(this).children('.su-tabs-nav').children('span').eq(active).trigger('click'); 51 tabs_height(); 52 }); 53 54 // Activate anchor nav for tabs and spoilers 55 anchor_nav(); 56 57 // Lightbox 58 $(document).on('click', '.su-lightbox', function(e) { 59 e.preventDefault(); 60 e.stopPropagation(); 61 if ($(this).parent().attr('id') === 'su-generator-preview') $(this).html(su_other_shortcodes.no_preview); 62 else { 63 var type = $(this).data('mfp-type'); 64 $(this).magnificPopup({ 65 type: type, 66 tClose: su_magnific_popup.close, 67 tLoading: su_magnific_popup.loading, 68 gallery: { 69 tPrev: su_magnific_popup.prev, 70 tNext: su_magnific_popup.next, 71 tCounter: su_magnific_popup.counter 72 }, 73 image: { 74 tError: su_magnific_popup.error 75 }, 76 ajax: { 77 tError: su_magnific_popup.error 78 } 79 }).magnificPopup('open'); 80 } 81 }); 82 // Frame 83 $('.su-frame-align-center, .su-frame-align-none').each(function() { 84 var frame_width = $(this).find('img').width(); 85 $(this).css('width', frame_width + 12); 86 }); 87 // Tooltip 88 $('.su-tooltip').each(function() { 89 var $tt = $(this), 90 $content = $tt.find('.su-tooltip-content'), 91 is_advanced = $content.length > 0, 92 data = $tt.data(), 93 config = { 94 style: { 95 classes: data.classes 96 }, 97 position: { 98 my: data.my, 99 at: data.at, 100 viewport: $(window) 101 }, 102 content: { 103 title: '', 104 text: '' 105 } 106 }; 107 if (data.title !== '') config.content.title = data.title; 108 if (is_advanced) config.content.text = $content; 109 else config.content.text = $tt.attr('title'); 110 if (data.close === 'yes') config.content.button = true; 111 if (data.behavior === 'click') { 112 config.show = 'click'; 113 config.hide = 'click'; 114 $tt.on('click', function(e) { 115 e.preventDefault(); 116 e.stopPropagation(); 117 }); 118 $(window).on('scroll resize', function() { 119 $tt.qtip('reposition'); 120 }); 121 } else if (data.behavior === 'always') { 122 config.show = true; 123 config.hide = false; 124 $(window).on('scroll resize', function() { 125 $tt.qtip('reposition'); 126 }); 127 } else if (data.behavior === 'hover' && is_advanced) { 128 config.hide = { 129 fixed: true, 130 delay: 600 131 }; 132 } 133 $tt.qtip(config); 134 }); 135 136 // Expand 137 $('body:not(.su-other-shortcodes-loaded)').on('click', '.su-expand-link', function() { 138 var $this = $(this), 139 $container = $this.parents('.su-expand'), 140 $content = $container.children('.su-expand-content'); 141 142 if ($container.hasClass('su-expand-collapsed')) { 143 $content.css('max-height', 'none'); 144 } 145 else { 146 $content.css('max-height', $container.data('height') + 'px'); 147 } 148 149 $container.toggleClass('su-expand-collapsed'); 150 }); 151 152 function is_transition_supported() { 153 var thisBody = document.body || document.documentElement, 154 thisStyle = thisBody.style, 155 support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined; 156 157 return support; 158 } 159 160 // Animations is supported 161 if (is_transition_supported()) { 162 // Animate 163 $('.su-animate').each(function() { 164 $(this).one('inview', function(e) { 165 var $this = $(this), 166 data = $this.data(); 167 window.setTimeout(function() { 168 $this.addClass(data.animation); 169 $this.addClass('animated'); 170 $this.css('visibility', 'visible'); 171 }, data.delay * 1000); 172 }); 173 }); 174 } 175 // Animations isn't supported 176 else { 177 $('.su-animate').css('visibility', 'visible'); 178 } 179 180 function tabs_height() {
181 $('.su-tabs-vertical').each(function() { 182 var $tabs = $(this), 183 $nav = $tabs.children('.su-tabs-nav'), 184 $panes = $tabs.find('.su-tabs-pane'), 185 height = 0; 186 $panes.css('min-height', $nav.outerHeight(true)); 187 }); 188 } 189 190 function anchor_nav() { 191 // Check hash 192 if (document.location.hash === '') return; 193 // Go through tabs 194 $('.su-tabs-nav span[data-anchor]').each(function() { 195 if ('#' + $(this).data('anchor') === document.location.hash) { 196 var $tabs = $(this).parents('.su-tabs'), 197 bar = ($('#wpadminbar').length > 0) ? 28 : 0; 198 // Activate tab 199 $(this).trigger('click'); 200 // Scroll-in tabs container 201 window.setTimeout(function() { 202 $(window).scrollTop($tabs.offset().top - bar - 10); 203 }, 100); 204 } 205 }); 206 // Go through spoilers 207 $('.su-spoiler[data-anchor]').each(function() { 208 if ('#' + $(this).data('anchor') === document.location.hash) { 209 var $spoiler = $(this), 210 bar = ($('#wpadminbar').length > 0) ? 28 : 0; 211 // Activate tab 212 if ($spoiler.hasClass('su-spoiler-closed')) $spoiler.find('.su-spoiler-title:first').trigger('click'); 213 // Scroll-in tabs container 214 window.setTimeout(function() { 215 $(window).scrollTop($spoiler.offset().top - bar - 10); 216 }, 100); 217 } 218 }); 219 } 220 221 if ('onhashchange' in window) $(window).on('hashchange', anchor_nav); 222 223 $('body').addClass('su-other-shortcodes-loaded'); 224});
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.