1'use strict'; 2 3/** 4 * RESIZE SENSOR 5 * Copyright Marc J. Schmidt. See the LICENSE file at the top-level 6 * directory of this distribution and at 7 * https://github.com/marcj/css-element-queries/blob/master/LICENSE. 8 */ 9(function (root, factory) { 10 if (typeof define === "function" && define.amd) { 11 define(factory); 12 } else if (typeof exports === "object") { 13 module.exports = factory(); 14 } else { 15 root.ResizeSensor = factory(); 16 } 17}(typeof window !== 'undefined' ? window : this, function () { 18 19 // Make sure it does not throw in a SSR (Server Side Rendering) situation 20 if (typeof window === "undefined") { 21 return null; 22 } 23 // https://github.com/Semantic-Org/Semantic-UI/issues/3855 24 // https://github.com/marcj/css-element-queries/issues/257 25 var globalWindow = typeof window != 'undefined' && window.Math == Math 26 ? window 27 : typeof self != 'undefined' && self.Math == Math 28 ? self 29 : Function('return this')(); 30 // Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor. 31 // In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and 32 // would generate too many unnecessary events. 33 var requestAnimationFrame = globalWindow.requestAnimationFrame || 34 globalWindow.mozRequestAnimationFrame || 35 globalWindow.webkitRequestAnimationFrame || 36 function (fn) { 37 return globalWindow.setTimeout(fn, 20); 38 }; 39 40 /** 41 * Iterate over each of the provided element(s). 42 * 43 * @param {HTMLElement|HTMLElement[]} elements 44 * @param {Function} callback 45 */ 46 function forEachElement(elements, callback){ 47 var elementsType = Object.prototype.toString.call(elements); 48 var isCollectionTyped = ('[object Array]' === elementsType 49 || ('[object NodeList]' === elementsType) 50 || ('[object HTMLCollection]' === elementsType) 51 || ('[object Object]' === elementsType) 52 || ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery 53 || ('undefined' !== typeof Elements && elements instanceof Elements) //mootools 54 ); 55 var i = 0, j = elements.length; 56 if (isCollectionTyped) { 57 for (; i < j; i++) { 58 callback(elements[i]); 59 } 60 } else { 61 callback(elements); 62 } 63 } 64 65 /** 66 * Get element size 67 * @param {HTMLElement} element 68 * @returns {Object} {width, height} 69 */ 70 function getElementSize(element) { 71 if (!element.getBoundingClientRect) { 72 return { 73 width: element.offsetWidth, 74 height: element.offsetHeight 75 } 76 } 77 78 var rect = element.getBoundingClientRect(); 79 return { 80 width: Math.round(rect.width), 81 height: Math.round(rect.height) 82 } 83 } 84 85 /** 86 * Apply CSS styles to element. 87 * 88 * @param {HTMLElement} element 89 * @param {Object} style 90 */ 91 function setStyle(element, style) { 92 Object.keys(style).forEach(function(key) { 93 element.style[key] = style[key]; 94 }); 95 } 96 97 /** 98 * Class for dimension change detection. 99 * 100 * @param {Element|Element[]|Elements|jQuery} element 101 * @param {Function} callback 102 * 103 * @constructor 104 */ 105 var ResizeSensor = function(element, callback) { 106 /** 107 * 108 * @constructor 109 */ 110 function EventQueue() { 111 var q = []; 112 this.add = function(ev) { 113 q.push(ev); 114 }; 115 116 var i, j; 117 this.call = function(sizeInfo) { 118 for (i = 0, j = q.length; i < j; i++) { 119 q[i].call(this, sizeInfo); 120 } 121 }; 122 123 this.remove = function(ev) { 124 var newQueue = []; 125 for(i = 0, j = q.length; i < j; i++) { 126 if(q[i] !== ev) newQueue.push(q[i]); 127 } 128 q = newQueue; 129 }; 130 131 this.length = function() { 132 return q.length; 133 } 134 } 135 136 /** 137 * 138 * @param {HTMLElement} element 139 * @param {Function} resized 140 */ 141 function attachResizeEvent(element, resized) { 142 if (!element) return; 143 if (element.resizedAttached) { 144 element.resizedAttached.add(resized); 145 return; 146 } 147 148 element.resizedAttached = new EventQueue(); 149 element.resizedAttached.add(resized); 150 151 element.resizeSensor = document.createElement('div'); 152 element.resizeSensor.dir = 'ltr'; 153 element.resizeSensor.className = 'resize-sensor'; 154 155 var style = { 156 pointerEvents: 'none', 157 position: 'absolute', 158 left: '0px', 159 top: '0px', 160 right: '0px', 161 bottom: '0px', 162 overflow: 'hidden', 163 zIndex: '-1', 164 visibility: 'hidden', 165 maxWidth: '100%' 166 }; 167 var styleChild = { 168 position: 'absolute', 169 left: '0px', 170 top: '0px', 171 transition: '0s', 172 }; 173 174 setStyle(element.resizeSensor, style); 175 176 var expand = document.createElement('div'); 177 expand.className = 'resize-sensor-expand'; 178 setStyle(expand, style); 179 180 var expandChild = document.createElement('div'); 181 setStyle(expandChild, styleChild); 182 expand.appendChild(expandChild); 183 184 var shrink = document.createElement('div'); 185 shrink.className = 'resize-sensor-shrink'; 186 setStyle(shrink, style); 187 188 var shrinkChild = document.createElement('div'); 189 setStyle(shrinkChild, styleChild); 190 setStyle(shrinkChild, { width: '200%', height: '200%' }); 191 shrink.appendChild(shrinkChild); 192 193 element.resizeSensor.appendChild(expand); 194 element.resizeSensor.appendChild(shrink); 195 element.appendChild(element.resizeSensor); 196 197 var computedStyle = window.getComputedStyle(element); 198 var position = computedStyle ? computedStyle.getPropertyValue('position') : null; 199 if ('absolute' !== position && 'relative' !== position && 'fixed' !== position) { 200 element.style.position = 'relative'; 201 } 202 203 var dirty, rafId; 204 var size = getElementSize(element); 205 var lastWidth = 0; 206 var lastHeight = 0; 207 var initialHiddenCheck = true; 208 var lastAnimationFrame = 0; 209 210 var resetExpandShrink = function () { 211 var width = element.offsetWidth; 212 var height = element.offsetHeight; 213 214 expandChild.style.width = (width + 10) + 'px'; 215 expandChild.style.height = (height + 10) + 'px'; 216 217 expand.scrollLeft = width + 10; 218 expand.scrollTop = height + 10; 219 220 shrink.scrollLeft = width + 10; 221 shrink.scrollTop = height + 10; 222 }; 223 224 var reset = function() { 225 // Check if element is hidden 226 if (initialHiddenCheck) { 227 var invisible = element.offsetWidth === 0 && element.offsetHeight === 0; 228 if (invisible) { 229 // Check in next frame 230 if (!lastAnimationFrame){ 231 lastAnimationFrame = requestAnimationFrame(function(){ 232 lastAnimationFrame = 0; 233 234 reset(); 235 }); 236 } 237 238 return; 239 } else { 240 // Stop checking 241 initialHiddenCheck = false;
242 } 243 } 244 245 resetExpandShrink(); 246 }; 247 element.resizeSensor.resetSensor = reset; 248 249 var onResized = function() { 250 rafId = 0; 251 252 if (!dirty) return; 253 254 lastWidth = size.width; 255 lastHeight = size.height; 256 257 if (element.resizedAttached) { 258 element.resizedAttached.call(size); 259 } 260 }; 261 262 var onScroll = function() { 263 size = getElementSize(element); 264 dirty = size.width !== lastWidth || size.height !== lastHeight; 265 266 if (dirty && !rafId) { 267 rafId = requestAnimationFrame(onResized); 268 } 269 270 reset(); 271 }; 272 273 var addEvent = function(el, name, cb) { 274 if (el.attachEvent) { 275 el.attachEvent('on' + name, cb); 276 } else { 277 el.addEventListener(name, cb); 278 } 279 }; 280 281 addEvent(expand, 'scroll', onScroll); 282 addEvent(shrink, 'scroll', onScroll); 283 284 // Fix for custom Elements 285 requestAnimationFrame(reset); 286 } 287 288 forEachElement(element, function(elem){ 289 attachResizeEvent(elem, callback); 290 }); 291 292 this.detach = function(ev) { 293 ResizeSensor.detach(element, ev); 294 }; 295 296 this.reset = function() { 297 element.resizeSensor.resetSensor(); 298 }; 299 }; 300 301 ResizeSensor.reset = function(element) { 302 forEachElement(element, function(elem){ 303 elem.resizeSensor.resetSensor(); 304 }); 305 }; 306 307 ResizeSensor.detach = function(element, ev) { 308 forEachElement(element, function(elem){ 309 if (!elem) return; 310 if(elem.resizedAttached && typeof ev === "function"){ 311 elem.resizedAttached.remove(ev); 312 if(elem.resizedAttached.length()) return; 313 } 314 if (elem.resizeSensor) { 315 if (elem.contains(elem.resizeSensor)) { 316 elem.removeChild(elem.resizeSensor); 317 } 318 delete elem.resizeSensor; 319 delete elem.resizedAttached; 320 } 321 }); 322 }; 323 324 if (typeof MutationObserver !== "undefined") { 325 var observer = new MutationObserver(function (mutations) { 326 for (var i in mutations) { 327 if (mutations.hasOwnProperty(i)) { 328 var items = mutations[i].addedNodes; 329 for (var j = 0; j < items.length; j++) { 330 if (items[j].resizeSensor) { 331 ResizeSensor.reset(items[j]); 332 } 333 } 334 } 335 } 336 }); 337 338 document.addEventListener("DOMContentLoaded", function (event) { 339 observer.observe(document.body, { 340 childList: true, 341 subtree: true, 342 }); 343 }); 344 } 345 346 return ResizeSensor; 347 348})); 349 350/** 351 * sticky-sidebar - A JavaScript plugin for making smart and high performance. 352 * @version v3.2.0 353 * @link https://github.com/abouolia/sticky-sidebar 354 * @author Ahmed Bouhuolia 355 * @license The MIT License (MIT) 356**/ 357!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.StickySidebar=e()}(this,function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var e=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),i=function(){var i=".stickySidebar",n={topSpacing:0,bottomSpacing:0,containerSelector:!1,innerWrapperSelector:".inner-wrapper-sticky",stickyClass:"is-affixed",resizeSensor:!0,minWidth:!1};return function(){function s(e){var i=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t(this,s),this.options=s.extend(n,o),this.sidebar="string"==typeof e?document.querySelector(e):e,void 0===this.sidebar)throw new Error("There is no specific sidebar element.");this.sidebarInner=!1,this.container=this.sidebar.parentElement,this.affixedType="STATIC",this.direction="down",this.support={transform:!1,transform3d:!1},this._initialized=!1,this._breakpoint=!1,this._resizeListeners=[],this.dimensions={translateY:0,topSpacing:0,bottomSpacing:0,sidebarHeight:0,sidebarWidth:0,containerTop:0,containerHeight:0,viewportHe
vendor: 4,443 bytes, line 357
357ight:0,viewportTop:0,lastViewportTop:0},["handleEvent"].forEach(function(t){i[t]=i[t].bind(i)}),this.initialize()}return e(s,[{key:"initialize",value:function(){var t=this;if(this._setSupportFeatures(),this.options.innerWrapperSelector&&(this.sidebarInner=this.sidebar.querySelector(this.options.innerWrapperSelector),null===this.sidebarInner&&(this.sidebarInner=!1)),!this.sidebarInner){var e=document.createElement("div");for(e.setAttribute("class","inner-wrapper-sticky"),this.sidebar.appendChild(e);this.sidebar.firstChild!=e;)e.appendChild(this.sidebar.firstChild);this.sidebarInner=this.sidebar.querySelector(".inner-wrapper-sticky")}if(this.options.containerSelector){var i=document.querySelectorAll(this.options.containerSelector);if((i=Array.prototype.slice.call(i)).forEach(function(e,i){e.contains(t.sidebar)&&(t.container=e)}),!i.length)throw new Error("The container does not contains on the sidebar.")}"function"!=typeof this.options.topSpacing&&(this.options.topSpacing=parseInt(this.options.topSpacing)||0),"function"!=typeof this.options.bottomSpacing&&(this.options.bottomSpacing=parseInt(this.options.bottomSpacing)||0),this._widthBreakpoint(),this.calcDimensions(),this.stickyPosition(),this.bindEvents(),this._initialized=!0}},{key:"bindEvents",value:function(){window.addEventListener("resize",this,{passive:!0}),window.addEventListener("scroll",this,{passive:!0}),this.sidebar.addEventListener("update"+i,this),this.options.resizeSensor&&"undefined"!=typeof ResizeSensor&&(new ResizeSensor(this.sidebarInner,this.handleEvent),new ResizeSensor(this.container,this.handleEvent))}},{key:"handleEvent",value:function(t){this.updateSticky(t)}},{key:"calcDimensions",value:function(){if(!this._breakpoint){var t=this.dimensions;t.containerTop=s.offsetRelative(this.container).top,t.containerHeight=this.container.clientHeight,t.containerBottom=t.containerTop+t.containerHeight,t.sidebarHeight=this.sidebarInner.offsetHeight,t.sidebarWidth=this.sidebar.offsetWidth,t.viewportHeight=window.innerHeight,this._calcDimensionsWithScroll()}}},{key:"_calcDimensionsWithScroll",value:function(){var t=this.dimensions;t.sidebarLeft=s.offsetRelative(this.sidebar).left,t.viewportTop=document.documentElement.scrollTop||document.body.scrollTop,t.viewportBottom=t.viewportTop+t.viewportHeight,t.viewportLeft=document.documentElement.scrollLeft||document.body.scrollLeft,t.topSpacing=this.options.topSpacing,t.bottomSpacing=this.options.bottomSpacing,"function"==typeof t.topSpacing&&(t.topSpacing=parseInt(t.topSpacing(this.sidebar))||0),"function"==typeof t.bottomSpacing&&(t.bottomSpacing=parseInt(t.bottomSpacing(this.sidebar))||0)}},{key:"isSidebarFitsViewport",value:function(){return this.dimensions.sidebarHeight<this.dimensions.viewportHeight}},{key:"observeScrollDir",value:function(){var t=this.dimensions;if(t.lastViewportTop!==t.viewportTop){var e="down"===this.direction?Math.min:Math.max;t.viewportTop===e(t.viewportTop,t.lastViewportTop)&&(this.direction="down"===this.direction?"up":"down")}}},{key:"getAffixType",value:function(){var t=this.dimensions,e=!1;this._calcDimensionsWithScroll();var i=t.sidebarHeight+t.containerTop,n=t.viewportTop+t.topSpacing,s=t.viewportBottom-t.bottomSpacing;return"up"===this.direction?n<=t.containerTop?(t.translateY=0,e="STATIC"):n<=t.translateY+t.containerTop?(t.translateY=n-t.containerTop,e="VIEWPORT-TOP"):!this.isSidebarFitsViewport()&&t.containerTop<=n&&(e="VIEWPORT-UNBOTTOM"):this.isSidebarFitsViewport()?t.sidebarHeight+n>=t.containerBottom?(t.translateY=t.containerBottom-i,e="CONTAINER-BOTTOM"):n>=t.containerTop&&(t.translateY=n-t.containerTop,e="VIEWPORT-TOP"):t.containerBottom<=s?(t.translateY=t.containerBottom-i,e="CONTAINER-BOTTOM"):i+t.translateY<=s?(t.translateY=s-i,e="VIEWPORT-BOTTOM"):t.containerTop+t.translateY<=n&&(e="VIEWPORT-UNBOTTOM"),t.translateY=Math.max(0,t.translateY),t.translateY=Math.min(t.containerHeight,t.translateY),t.lastViewportTop=t.viewportTop,e}},{key:"_getStyle",value:function(t){if(void 0!==t){var e={inner:{},outer:{}},i=this.dimensions;switch(t){case"VIEWPORT-TOP":e.inner={position:"fixed",top:this.options.topSpacing,left:i.sidebarLeft-i.viewportLeft,width:i.sidebarWidth};break;case"VIEWPORT-BOTTOM":e.inner={position:"fixed",top:"auto",left:i.sidebarLeft,bottom:this.options.bottomSpacing,width:i.sidebarWidth};break;case"CONTAINER-BOTTOM":case"VIEWPORT-UNBOTTOM":var n=this._getTranslate(0,i.translateY+"px");e.inner=n?{transform:n}
vendor: 4,125 bytes, line 357
357:{position:"absolute",top:i.translateY,width:i.sidebarWidth}}switch(t){case"VIEWPORT-TOP":case"VIEWPORT-BOTTOM":case"VIEWPORT-UNBOTTOM":case"CONTAINER-BOTTOM":e.outer={height:i.sidebarHeight,position:"relative"}}return e.outer=s.extend({height:"",position:""},e.outer),e.inner=s.extend({position:"relative",top:"",left:"",bottom:"",width:"",transform:this._getTranslate()},e.inner),e}}},{key:"stickyPosition",value:function(t){if(!this._breakpoint){t=t||!1;var e=this.getAffixType(),n=this._getStyle(e);if((this.affixedType!=e||t)&&e){var o="affix."+e.toLowerCase().replace("viewport-","")+i;s.eventTrigger(this.sidebar,o),"STATIC"===e?s.removeClass(this.sidebar,this.options.stickyClass):s.addClass(this.sidebar,this.options.stickyClass);for(var r in n.outer)this.sidebar.style[r]=n.outer[r];for(var a in n.inner){var c="number"==typeof n.inner[a]?"px":"";this.sidebarInner.style[a]=n.inner[a]+c}var p="affixed."+e.toLowerCase().replace("viewport","")+i;s.eventTrigger(this.sidebar,p)}else this._initialized&&(this.sidebarInner.style.left=n.inner.left);this.affixedType=e}}},{key:"_widthBreakpoint",value:function(){window.innerWidth<=this.options.minWidth?(this._breakpoint=!0,this.affixedType="STATIC",this.sidebar.removeAttribute("style"),s.removeClass(this.sidebar,this.options.stickyClass),this.sidebarInner.removeAttribute("style")):this._breakpoint=!1}},{key:"updateSticky",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._running||(this._running=!0,function(e){requestAnimationFrame(function(){switch(e){case"scroll":t._calcDimensionsWithScroll(),t.observeScrollDir(),t.stickyPosition();break;case"resize":default:t._widthBreakpoint(),t.calcDimensions(),t.stickyPosition(!0)}t._running=!1})}(e.type))}},{key:"_setSupportFeatures",value:function(){var t=this.support;t.transform=s.supportTransform(),t.transform3d=s.supportTransform(!0)}},{key:"_getTranslate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.support.transform3d?"translate3d("+t+", "+e+", "+i+")":!!this.support.translate&&"translate("+t+", "+e+")"}},{key:"destroy",value:function(){window.removeEventListener("resize",this),window.removeEventListener("scroll",this),this.sidebar.classList.remove(this.options.stickyClass),this.sidebar.style.minHeight="",this.sidebar.removeEventListener("update"+i,this);var t={inner:{},outer:{}};t.inner={position:"",top:"",left:"",bottom:"",width:"",transform:""},t.outer={height:"",position:""};for(var e in t.outer)this.sidebar.style[e]=t.outer[e];for(var n in t.inner)this.sidebarInner.style[n]=t.inner[n];this.options.resizeSensor&&"undefined"!=typeof ResizeSensor&&(ResizeSensor.detach(this.sidebarInner,this.handleEvent),ResizeSensor.detach(this.container,this.handleEvent))}}],[{key:"supportTransform",value:function(t){var e=!1,i=t?"perspective":"transform",n=i.charAt(0).toUpperCase()+i.slice(1),s=["Webkit","Moz","O","ms"],o=document.createElement("support").style;return(i+" "+s.join(n+" ")+n).split(" ").forEach(function(t,i){if(void 0!==o[t])return e=t,!1}),e}},{key:"eventTrigger",value:function(t,e,i){try{var n=new CustomEvent(e,{detail:i})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i)}t.dispatchEvent(n)}},{key:"extend",value:function(t,e){var i={};for(var n in t)void 0!==e[n]?i[n]=e[n]:i[n]=t[n];return i}},{key:"offsetRelative",value:function(t){var e={left:0,top:0};do{var i=t.offsetTop,n=t.offsetLeft;isNaN(i)||(e.top+=i),isNaN(n)||(e.left+=n)}while(t=t.offsetParent);return e}},{key:"addClass",value:function(t,e){s.hasClass(t,e)||(t.classList?t.classList.add(e):t.className+=" "+e)}},{key:"removeClass",value:function(t,e){s.hasClass(t,e)&&(t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," "))}},{key:"hasClass",value:function(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}}]),s}()}();return window.StickySidebar=i,i});
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.