1/* 2 Editorial by HTML5 UP 3 html5up.net | @ajlkn 4 Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) 5*/ 6 7(function($) { 8 9 skel.breakpoints({ 10 xlarge: '(max-width: 1680px)', 11 large: '(max-width: 1280px)', 12 medium: '(max-width: 980px)', 13 small: '(max-width: 736px)', 14 xsmall: '(max-width: 480px)', 15 'xlarge-to-max': '(min-width: 1681px)', 16 'small-to-xlarge': '(min-width: 481px) and (max-width: 1680px)' 17 }); 18 19 $(function() { 20 21 var $window = $(window), 22 $head = $('head'), 23 $body = $('body'); 24 25 // Disable animations/transitions ... 26 27 // ... until the page has loaded. 28 $body.addClass('is-loading'); 29 30 $window.on('load', function() { 31 setTimeout(function() { 32 $body.removeClass('is-loading'); 33 }, 100); 34 }); 35 36 // ... when resizing. 37 var resizeTimeout; 38 39 $window.on('resize', function() { 40 41 // Mark as resizing. 42 $body.addClass('is-resizing'); 43 44 // Unmark after delay. 45 clearTimeout(resizeTimeout); 46 47 resizeTimeout = setTimeout(function() { 48 $body.removeClass('is-resizing'); 49 }, 100); 50 51 }); 52 53 // Fix: Placeholder polyfill. 54 $('form').placeholder(); 55 56 // Prioritize "important" elements on medium. 57 skel.on('+medium -medium', function() { 58 $.prioritize( 59 '.important\\28 medium\\29', 60 skel.breakpoint('medium').active 61 ); 62 }); 63 64 // Fixes. 65 66 // Object fit images. 67 if (!skel.canUse('object-fit') 68 || skel.vars.browser == 'safari') 69 $('.image.object').each(function() { 70 71 var $this = $(this), 72 $img = $this.children('img'); 73 74 // Hide original image. 75 $img.css('opacity', '0'); 76 77 // Set background. 78 $this 79 .css('background-image', 'url("' + $img.attr('src') + '")') 80 .css('background-size', $img.css('object-fit') ? $img.css('object-fit') : 'cover') 81 .css('background-position', $img.css('object-position') ? $img.css('object-position') : 'center'); 82 83 }); 84 85 // Sidebar. 86 var $sidebar = $('#sidebar'), 87 $sidebar_inner = $sidebar.children('.inner'); 88 89 // Inactive by default on <= large. 90 skel 91 .on('+large', function() { 92 $sidebar.addClass('inactive'); 93 }) 94 .on('-large !large', function() { 95 $sidebar.removeClass('inactive'); 96 }); 97 98 // Hack: Workaround for Chrome/Android scrollbar position bug. 99 if (skel.vars.os == 'android' 100 && skel.vars.browser == 'chrome') 101 $('<style>#sidebar .inner::-webkit-scrollbar { display: none; }</style>') 102 .appendTo($head); 103 104 // Toggle. 105 if (skel.vars.IEVersion > 9) { 106 107 $('<a href="#sidebar" class="toggle">Toggle</a>') 108 .appendTo($sidebar) 109 .on('click', function(event) { 110 111 // Prevent default. 112 event.preventDefault(); 113 event.stopPropagation(); 114 115 // Toggle. 116 $sidebar.toggleClass('inactive'); 117 118 }); 119 120 } 121 122 // Events. 123 124 // Link clicks. 125 $sidebar.on('click', 'a', function(event) { 126 127 // >large? Bail. 128 if (!skel.breakpoint('large').active) 129 return; 130 131 // Vars. 132 var $a = $(this), 133 href = $a.attr('href'), 134 target = $a.attr('target'); 135 136 // Prevent default. 137 event.preventDefault(); 138 event.stopPropagation(); 139 140 // Check URL. 141 if (!href || href == '#' || href == '') 142 return; 143 144 // Hide sidebar. 145 $sidebar.addClass('inactive'); 146 147 // Redirect to href. 148 setTimeout(function() { 149 150 if (target == '_blank') 151 window.open(href); 152 else 153 window.location.href = href; 154 155 }, 500); 156 157 }); 158 159 // Prevent certain events inside the panel from bubbling. 160 $sidebar.on('click touchend touchstart touchmove', function(event) { 161 162 // >large? Bail. 163 if (!skel.breakpoint('large').active) 164 return; 165 166 // Prevent propagation. 167 event.stopPropagation(); 168 169 }); 170 171 // Hide panel on body click/tap. 172 $body.on('click touchend', function(event) { 173 174 // >large? Bail. 175 if (!skel.breakpoint('large').active) 176 return; 177 178 // Deactivate. 179 $sidebar.addClass('inactive'); 180 181 });
182 183 // Scroll lock. 184 // Note: If you do anything to change the height of the sidebar's content, be sure to 185 // trigger 'resize.sidebar-lock' on $window so stuff doesn't get out of sync. 186 187 $window.on('load.sidebar-lock', function() { 188 189 var sh, wh, st; 190 191 // Reset scroll position to 0 if it's 1. 192 if ($window.scrollTop() == 1) 193 $window.scrollTop(0); 194 195 $window 196 .on('scroll.sidebar-lock', function() { 197 198 var x, y; 199 200 // IE<10? Bail. 201 if (skel.vars.IEVersion < 10) 202 return; 203 204 // <=large? Bail. 205 if (skel.breakpoint('large').active) { 206 207 $sidebar_inner 208 .data('locked', 0) 209 .css('position', '') 210 .css('top', ''); 211 212 return; 213 214 } 215 216 // Calculate positions. 217 x = Math.max(sh - wh, 0); 218 y = Math.max(0, $window.scrollTop() - x); 219 220 // Lock/unlock. 221 if ($sidebar_inner.data('locked') == 1) { 222 223 if (y <= 0) 224 $sidebar_inner 225 .data('locked', 0) 226 .css('position', '') 227 .css('top', ''); 228 else 229 $sidebar_inner 230 .css('top', -1 * x); 231 232 } 233 else { 234 235 if (y > 0) 236 $sidebar_inner 237 .data('locked', 1) 238 .css('position', 'fixed') 239 .css('top', -1 * x); 240 241 } 242 243 }) 244 .on('resize.sidebar-lock', function() { 245 246 // Calculate heights. 247 wh = $window.height(); 248 sh = $sidebar_inner.outerHeight() + 30; 249 250 // Trigger scroll. 251 $window.trigger('scroll.sidebar-lock'); 252 253 }) 254 .trigger('resize.sidebar-lock'); 255 256 }); 257 258 // Menu. 259 var $menu = $('#menu'), 260 $menu_openers = $menu.children('ul').find('.opener'); 261 262 // Openers. 263 $menu_openers.each(function() { 264 265 var $this = $(this); 266 267 $this.on('click', function(event) { 268 269 // Prevent default. 270 event.preventDefault(); 271 272 // Toggle. 273 $menu_openers.not($this).removeClass('active'); 274 $this.toggleClass('active'); 275 276 // Trigger resize (sidebar lock). 277 $window.triggerHandler('resize.sidebar-lock'); 278 279 }); 280 281 }); 282 283 }); 284 285})(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.