1jQuery(document).ready(function ($) { 2 if ($('#loader-wrapper').length > 0) { 3 // hide preloader when everthing in the document load 4 $('#loader-wrapper').css('display', 'none'); 5 } 6 7 //Open Search form on search icon click 8 if ($('.search-icon-box').length > 0) { 9 $('.search-icon-box').on('click', function (e) { 10 e.preventDefault(); 11 refined_magazine_search(); 12 13 }); 14 } 15 16 function refined_magazine_search(e) { 17 $('.top-bar-search').addClass('open'); 18 $('.top-bar-search form input[type="search"]').focus(); 19 var focusableEls = $('.top-bar-search a[href]:not([disabled]), .top-bar-search button:not([disabled]), .top-bar-search input:not([disabled])'); 20 var firstFocusableEl = focusableEls[0]; 21 var lastFocusableEl = focusableEls[focusableEls.length - 1]; 22 var KEYCODE_TAB = 9; 23 $('.top-bar-search').on('keydown', function (e) { 24 if (e.key === 'Tab' || e.keyCode === KEYCODE_TAB) { 25 if (e.shiftKey) /* shift + tab */ { 26 if (document.activeElement === firstFocusableEl) {
27 lastFocusableEl.focus(); 28 e.preventDefault(); 29 } 30 } else /* tab */ { 31 if (document.activeElement === lastFocusableEl) { 32 firstFocusableEl.focus(); 33 e.preventDefault(); 34 } 35 } 36 } 37 }); 38 } 39 40 // Close popup search form 41 $('.top-bar-search, .top-bar-search .close').on('click', function (event) { 42 if (event.target == this || event.target.className == 'close' || event.keyCode == 27) { 43 $('.top-bar-search').removeClass('open'); 44 $('.search-icon-box').focus(); 45 } 46 }); 47 48 //Post Slider Widget JS 49 if ($('.ct-post-carousel').length > 0) { 50 $(".ct-post-carousel").slick({ 51 items: 1, 52 dots: false, 53 infinite: true, 54 centerMode: false, 55 autoplay: true, 56 lazyLoad: 'ondemand', 57 adaptiveHeight: true 58 }); 59 } 60 61 //Tabs 62 if ($('.ct-tabs').length > 0) { 63 $(".ct-tabs").tabs(); 64 } 65 // Initialize gototop button 66 if ($('#toTop').length > 0) { 67 // Hide the toTop button when the page loads. 68 $("#toTop").css("display", "none"); 69 70 // This function runs every time the user scrolls the page. 71 $(window).scroll(function () { 72 73 // Check weather the user has scrolled down (if "scrollTop()"" is more than 0) 74 if ($(window).scrollTop() > 0) { 75 76 // If it's more than or equal to 0, show the toTop button. 77 $("#toTop").fadeIn("slow"); 78 } else { 79 // If it's less than 0 (at the top), hide the toTop button. 80 $("#toTop").fadeOut("slow"); 81 82 } 83 }); 84 85 // When the user clicks the toTop button, we want the page to scroll to the top. 86 jQuery("#toTop").click(function (event) { 87 88 // Disable the default behaviour when a user clicks an empty anchor link. 89 // (The page jumps to the top instead of // animating) 90 event.preventDefault(); 91 92 // Animate the scrolling motion. 93 jQuery("html, body").animate({ 94 scrollTop: 0 95 }, "slow"); 96 97 }); 98 } 99 100 101 //sticky sidebar 102 var at_body = $("body"); 103 var at_window = $(window); 104 105 if ($('.ct-sticky-sidebar').length > 0) { 106 107 if (at_body.hasClass('ct-sticky-sidebar')) { 108 if (at_body.hasClass('right-sidebar')) { 109 $('#secondary, #primary').theiaStickySidebar(); 110 } else { 111 $('#secondary, #primary').theiaStickySidebar(); 112 } 113 } 114 } 115 116 //Trending News Marquee 117 if ($('.trending-left').length > 0) { 118 $('.trending-left').marquee({ 119 //speed in milliseconds of the marquee 120 duration: 85000, 121 //gap in pixels between the tickers 122 gap: 0, 123 //time in milliseconds before the marquee will start animating 124 delayBeforeStart: 0, 125 //'left' or 'right' 126 direction: 'left', 127 //true or false - should the marquee be duplicated to show an effect of continues flow 128 duplicated: true, 129 130 pauseOnHover: true, 131 startVisible: true 132 }); 133 } 134 135 //Trending News Marquee 136 if ($('.trending-right').length > 0) { 137 $('.trending-right').marquee({ 138 //speed in milliseconds of the marquee 139 duration: 85000, 140 //gap in pixels between the tickers 141 gap: 0, 142 //time in milliseconds before the marquee will start animating 143 delayBeforeStart: 0, 144 //'left' or 'right' 145 direction: 'right', 146 //true or false - should the marquee be duplicated to show an effect of continues flow 147 duplicated: true, 148 149 pauseOnHover: true, 150 startVisible: true 151 }); 152 } 153 154 if (jQuery('.sticky-header').length > 0) { 155 // grab the initial top offset of the navigation 156 var stickyNavTop = $('.sticky-header').offset().top; 157 158 159 // our function that decides weather the navigation bar should have "fixed" css position or not. 160 var stickyNav = function () { 161 var width = $(window).width(); 162 var scrollTop = $(window).scrollTop(); // our current vertical position from the top 163 164 // if we've scrolled more than the navigation, change its position to fixed to stick to top, 165 // otherwise change it back to relative 166 if ((scrollTop > stickyNavTop) && (width > 768)) { 167 $('.sticky-header').addClass('ct-sticky'); 168 $('.sticky-header').removeClass('hide'); 169 } else { 170 $('.sticky-header').removeClass('ct-sticky'); 171 $('.sticky-header').addClass('hide'); 172 } 173 }; 174 175 stickyNav(); 176 // and run it again every time you scroll 177 $(window).scroll(function () { 178 stickyNav(); 179 }); 180 } 181 182 if (jQuery('.ct-show-hide-top').length > 0) { 183 $('.ct-show-hide-top').on('click', function (e) { 184 e.preventDefault(); 185 $('.top-bar .container-inner').toggle('slow'); 186 $(this).toggleClass('ct-rotate'); 187 }); 188 } 189 190 191 $('.main-navigation').on('keydown', function (e) { 192 if ($('.main-navigation').hasClass('toggled')) { 193 var focusableEls = $(' .main-navigation .menu-toggle, .main-navigation a[href]:not([disabled]), .main-navigation li'); 194 var firstFocusableEl = focusableEls[0]; 195 var lastFocusableEl = focusableEls[focusableEls.length - 1]; 196 var KEYCODE_TAB = 9; 197 if (e.key === 'Tab' || e.keyCode === KEYCODE_TAB) { 198 if (e.shiftKey) /* shift + tab */ { 199 if (document.activeElement === firstFocusableEl) {
200 lastFocusableEl.focus(); 201 e.preventDefault(); 202 } 203 } else /* tab */ { 204 if (document.activeElement === lastFocusableEl) { 205 firstFocusableEl.focus(); 206 e.preventDefault(); 207 } 208 } 209 } 210 } 211 }); 212 213 214});
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.