1////////////////////////////// jquery growl ////////////////////////////// 2 3// Generated by CoffeeScript 1.9.3 4 5/* 6jQuery Growl 7Copyright 2015 Kevin Sylvestre 81.3.1 9 */ 10 11(function() { 12 "use strict"; 13 var $, Animation, Growl, 14 bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; 15 16 $ = jQuery; 17 18 Animation = (function() { 19 function Animation() {} 20 21 Animation.transitions = { 22 "webkitTransition": "webkitTransitionEnd", 23 "mozTransition": "mozTransitionEnd", 24 "oTransition": "oTransitionEnd", 25 "transition": "transitionend" 26 }; 27 28 Animation.transition = function($el) { 29 var el, ref, result, type; 30 el = $el[0]; 31 ref = this.transitions; 32 for (type in ref) { 33 result = ref[type]; 34 if (el.style[type] != null) { 35 return result; 36 } 37 } 38 }; 39 40 return Animation; 41 42 })(); 43 44 Growl = (function() { 45 Growl.settings = { 46 namespace: 'growl', 47 duration: 3200, 48 close: "×", 49 location: "default", 50 style: "default", 51 size: "medium" 52 }; 53 54 Growl.growl = function(settings) { 55 if (settings == null) { 56 settings = {}; 57 } 58 this.initialize(); 59 return new Growl(settings); 60 }; 61 62 Growl.initialize = function() { 63 return $("body:not(:has(#growls))").append('<div id="growls" />'); 64 }; 65 66 function Growl(settings) { 67 if (settings == null) { 68 settings = {}; 69 } 70 this.container = bind(this.container, this); 71 this.content = bind(this.content, this); 72 this.html = bind(this.html, this); 73 this.$growl = bind(this.$growl, this); 74 this.$growls = bind(this.$growls, this); 75 this.animate = bind(this.animate, this); 76 this.remove = bind(this.remove, this); 77 this.dismiss = bind(this.dismiss, this); 78 this.present = bind(this.present, this); 79 this.cycle = bind(this.cycle, this); 80 this.close = bind(this.close, this); 81 this.click = bind(this.click, this); 82 this.unbind = bind(this.unbind, this); 83 this.bind = bind(this.bind, this); 84 this.render = bind(this.render, this); 85 this.settings = $.extend({}, Growl.settings, settings); 86 this.$growls().attr('class', this.settings.location); 87 this.render(); 88 } 89 90 Growl.prototype.render = function() { 91 var $growl; 92 $growl = this.$growl(); 93 this.$growls().append($growl); 94 if (this.settings.fixed) { 95 this.present(); 96 } else { 97 this.cycle(); 98 } 99 }; 100 101 Growl.prototype.bind = function($growl) { 102 if ($growl == null) { 103 $growl = this.$growl(); 104 } 105 $growl.on("click", this.click); 106 return $growl.on("contextmenu", this.close).find("." + this.settings.namespace + "-close").on("click", this.close); 107 }; 108 109 Growl.prototype.unbind = function($growl) { 110 if ($growl == null) { 111 $growl = this.$growl(); 112 } 113 $growl.off("click", this.click); 114 return $growl.off("contextmenu", this.close).find("." + this.settings.namespace + "-close").off("click", this.close); 115 }; 116 117 Growl.prototype.click = function(event) { 118 if (this.settings.url != null) { 119 event.preventDefault(); 120 event.stopPropagation(); 121 return window.open(this.settings.url); 122 } 123 }; 124 125 Growl.prototype.close = function(event) { 126 var $growl; 127 event.preventDefault(); 128 event.stopPropagation(); 129 $growl = this.$growl(); 130 return $growl.stop().queue(this.dismiss).queue(this.remove); 131 }; 132 133 Growl.prototype.cycle = function() { 134 var $growl; 135 $growl = this.$growl(); 136 return $growl.queue(this.present).delay(this.settings.duration).queue(this.dismiss).queue(this.remove); 137 }; 138 139 Growl.prototype.present = function(callback) { 140 var $growl; 141 $growl = this.$growl(); 142 this.bind($growl); 143 return this.animate($growl, this.settings.namespace + "-incoming", 'out', callback); 144 }; 145 146 Growl.prototype.dismiss = function(callback) { 147 var $growl; 148 $growl = this.$growl(); 149 this.unbind($growl); 150 return this.animate($growl, this.settings.namespace + "-outgoing", 'in', callback); 151 }; 152 153 Growl.prototype.remove = function(callback) { 154 this.$growl().remove(); 155 return callback(); 156 }; 157 158 Growl.prototype.animate = function($element, name, direction, callback) { 159 var transition; 160 if (direction == null) { 161 direction = 'in'; 162 } 163 transition = Animation.transition($element);
164 $element[direction === 'in' ? 'removeClass' : 'addClass'](name); 165 $element.offset().position; 166 $element[direction === 'in' ? 'addClass' : 'removeClass'](name); 167 if (callback == null) { 168 return; 169 } 170 if (transition != null) { 171 $element.one(transition, callback); 172 } else { 173 callback(); 174 } 175 }; 176 177 Growl.prototype.$growls = function() { 178 return this.$_growls != null ? this.$_growls : this.$_growls = $('#growls'); 179 }; 180 181 Growl.prototype.$growl = function() { 182 return this.$_growl != null ? this.$_growl : this.$_growl = $(this.html()); 183 }; 184 185 Growl.prototype.html = function() { 186 return this.container(this.content()); 187 }; 188 189 Growl.prototype.content = function() { 190 return "<div class='" + this.settings.namespace + "-close'>" + this.settings.close + "</div>\n<div class='" + this.settings.namespace + "-title'>" + this.settings.title + "</div>\n<div class='" + this.settings.namespace + "-message'>" + this.settings.message + "</div>"; 191 }; 192 193 Growl.prototype.container = function(content) { 194 return "<div class='" + this.settings.namespace + " " + this.settings.namespace + "-" + this.settings.style + " " + this.settings.namespace + "-" + this.settings.size + "'>\n " + content + "\n</div>"; 195 }; 196 197 return Growl; 198 199 })(); 200 201 this.Growl = Growl; 202 203 $.growl = function(options) { 204 if (options == null) { 205 options = {}; 206 } 207 return Growl.growl(options); 208 }; 209 210 $.growl.error = function(options) { 211 var settings; 212 if (options == null) { 213 options = {}; 214 } 215 settings = { 216 title: "Error!", 217 style: "error" 218 }; 219 return $.growl($.extend(settings, options)); 220 }; 221 222 $.growl.notice = function(options) { 223 var settings; 224 if (options == null) { 225 options = {}; 226 } 227 settings = { 228 title: "Notice!", 229 style: "notice" 230 }; 231 return $.growl($.extend(settings, options)); 232 }; 233 234 $.growl.warning = function(options) { 235 var settings; 236 if (options == null) { 237 options = {}; 238 } 239 settings = { 240 title: "Warning!", 241 style: "warning" 242 }; 243 return $.growl($.extend(settings, options)); 244 }; 245 246}).call(this); 247 248 249 250 251////////////////////////////// tooltips ////////////////////////////// 252var btns = document.querySelectorAll('.copy'); 253 254// for (var i = 0; i < btns.length; i++) { 255// btns[i].addEventListener('mouseleave', function(e) { 256// e.currentTarget.setAttribute('class', 'copy'); 257// e.currentTarget.removeAttribute('aria-label'); 258// }); 259// } 260 261function showTooltip(elem, msg) { 262 elem.setAttribute('class', elem.className+' tooltipped tooltipped-s'); 263 elem.setAttribute('aria-label', msg); 264} 265 266// Simplistic detection, do not use it in production 267function fallbackMessage(action) { 268 var actionMsg = ''; 269 var actionKey = (action === 'cut' ? 'X' : 'C'); 270 271 if(/iPhone|iPad/i.test(navigator.userAgent)) { 272 actionMsg = 'No support :('; 273 } 274 else if (/Mac/i.test(navigator.userAgent)) { 275 actionMsg = 'Press â-' + actionKey + ' to ' + action; 276 } 277 else { 278 actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action; 279 } 280 281 return actionMsg; 282} 283 284 285 286////////////////////////////// lazysizes ////////////////////////////// 287/*! lazysizes - v5.2.0-beta1 */ 288!function(a,b){var c=b(a,a.document);a.lazySizes=c,"object"==typeof module&&module.exports&&(module.exports=c)}("undefined"!=typeof window?window:{},function(a,b){"use strict";var c,d;if(function(){var b,c={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};d=a.lazySizesConfig||a.lazysizesConfig||{};for(b in c)b in d||(d[b]=c[b])}(),!b||!b.getElementsByClassName)return{init:function(){},cfg:d,noSupport:!0};var e=b.documentElement,f=a.Date,g=a.HTMLPictureElement,h="addEventListener",i="getAttribute",j=a[h],k=a.setTimeout,l=a.requestAnimationFrame||k,m=a.requestIdleCallback,n=/^picture$/i,o=["load","error","lazyincluded","_lazyloaded"],p={},q=Array.prototype.forEach,r=function(a,b){return p[b]||(p[b]=new RegExp("(\\s|^)"+b+"(\\s|$)")),p[b].test(a[i]("class")||"")&&p[b]},s=function(a,b){r(a,b)||a.setAttribute("class",(a[i]("class")||"").trim()+" "+b)},t=function(a,b){var c;(c=r(a,b))&&a.setAttribute("class",(a[i]("class")||"").replace(c," "))},u=function(a,b,c){var d=c?h:"removeEventListener";c&&u(a,b),o.forEach(function(c){a[d](c,b)}
288)},v=function(a,d,e,f,g){var h=b.createEvent("Event");return e||(e={}),e.instance=c,h.initEvent(d,!f,!g),h.detail=e,a.dispatchEvent(h),h},w=function(b,c){var e;!g&&(e=a.picturefill||d.pf)?(c&&c.src&&!b[i]("srcset")&&b.setAttribute("srcset",c.src),e({reevaluate:!0,elements:[b]})):c&&c.src&&(b.src=c.src)},x=function(a,b){return(getComputedStyle(a,null)||{})[b]},y=function(a,b,c){for(c=c||a.offsetWidth;c<d.minSize&&b&&!a._lazysizesWidth;)c=b.offsetWidth,b=b.parentNode;return c},z=function(){var a,c,d=[],e=[],f=d,g=function(){var b=f;for(f=d.length?e:d,a=!0,c=!1;b.length;)b.shift()();a=!1},h=function(d,e){a&&!e?d.apply(this,arguments):(f.push(d),c||(c=!0,(b.hidden?k:l)(g)))};return h._lsFlush=g,h}(),A=function(a,b){return b?function(){z(a)}:function(){var b=this,c=arguments;z(function(){a.apply(b,c)})}},B=function(a){var b,c=0,e=d.throttleDelay,g=d.ricTimeout,h=function(){b=!1,c=f.now(),a()},i=m&&g>49?function(){m(h,{timeout:g}),g!==d.ricTimeout&&(g=d.ricTimeout)}:A(function(){k(h)},!0);return function(a){var d;(a=!0===a)&&(g=33),b||(b=!0,d=e-(f.now()-c),d<0&&(d=0),a||d<9?i():k(i,d))}},C=function(a){var b,c,d=99,e=function(){b=null,a()},g=function(){var a=f.now()-c;a<d?k(g,d-a):(m||e)(e)};return function(){c=f.now(),b||(b=k(g,d))}},D=function(){var g,m,o,p,y,D,F,G,H,I,J,K,L=/^img$/i,M=/^iframe$/i,N="onscroll"in a&&!/(gle|ing)bot/.test(navigator.userAgent),O=0,P=0,Q=0,R=-1,S=function(a){Q--,(!a||Q<0||!a.target)&&(Q=0)},T=function(a){return null==K&&(K="hidden"==x(b.body,"visibility")),K||!("hidden"==x(a.parentNode,"visibility")&&"hidden"==x(a,"visibility"))},U=function(a,c){var d,f=a,g=T(a);for(G-=c,J+=c,H-=c,I+=c;g&&(f=f.offsetParent)&&f!=b.body&&f!=e;)(g=(x(f,"opacity")||1)>0)&&"visible"!=x(f,"overflow")&&(d=f.getBoundingClientRect(),g=I>d.left&&H<d.right&&J>d.top-1&&G<d.bottom+1);return g},V=function(){var a,f,h,j,k,l,n,o,q,r,s,t,u=c.elements;if((p=d.loadMode)&&Q<8&&(a=u.length)){for(f=0,R++;f<a;f++)if(u[f]&&!u[f]._lazyRace)if(!N||c.prematureUnveil&&c.prematureUnveil(u[f]))ba(u[f]);else if((o=u[f][i]("data-expand"))&&(l=1*o)||(l=P),r||(r=!d.expand||d.expand<1?e.clientHeight>500&&e.clientWidth>500?500:370:d.expand,c._defEx=r,s=r*d.expFactor,t=d.hFac,K=null,P<s&&Q<1&&R>2&&p>2&&!b.hidden?(P=s,R=0):P=p>1&&R>1&&Q<6?r:O),q!==l&&(D=innerWidth+l*t,F=innerHeight+l,n=-1*l,q=l),h=u[f].getBoundingClientRect(),(J=h.bottom)>=n&&(G=h.top)<=F&&(I=h.right)>=n*t&&(H=h.left)<=D&&(J||I||H||G)&&(d.loadHidden||T(u[f]))&&(m&&Q<3&&!o&&(p<3||R<4)||U(u[f],l))){if(ba(u[f]),k=!0,Q>9)break}else!k&&m&&!j&&Q<4&&R<4&&p>2&&(g[0]||d.preloadAfterLoad)&&(g[0]||!o&&(J||I||H||G||"auto"!=u[f][i](d.sizesAttr)))&&(j=g[0]||u[f]);j&&!k&&ba(j)}},W=B(V),X=function(a){var b=a.target;if(b._lazyCache)return void delete b._lazyCache;S(a),s(b,d.loadedClass),t(b,d.loadingClass),u(b,Z),v(b,"lazyloaded")},Y=A(X),Z=function(a){Y({target:a.target})},$=function(a,b){try{a.contentWindow.location.replace(b)}catch(c){a.src=b}},_=function(a){var b,c=a[i](d.srcsetAttr);(b=d.customMedia[a[i]("data-media")||a[i]("media")])&&a.setAttribute("media",b),c&&a.setAttribute("srcset",c)},aa=A(function(a,b,c,e,f){var g,h,j,l,m,p;(m=v(a,"lazybeforeunveil",b)).defaultPrevented||(e&&(c?s(a,d.autosizesClass):a.setAttribute("sizes",e)),h=a[i](d.srcsetAttr),g=a[i](d.srcAttr),f&&(j=a.parentNode,l=j&&n.test(j.nodeName||"")),p=b.firesLoad||"src"in a&&(h||g||l),m={target:a},s(a,d.loadingClass),p&&(clearTimeout(o),o=k(S,2500),u(a,Z,!0)),l&&q.call(j.getElementsByTagName("source"),_),h?a.setAttribute("srcset",h):g&&!l&&(M.test(a.nodeName)?$(a,g):a.src=g),f&&(h||l)&&w(a,{src:g})),a._lazyRace&&delete a._lazyRace,t(a,d.lazyClass),z(function(){var b=a.complete&&a.naturalWidth>1;p&&!b||(b&&s(a,"ls-is-cached"),X(m),a._lazyCache=!0,k(function(){"_lazyCache"in a&&delete a._lazyCache},9)),"lazy"==a.loading&&Q--},!0)}),ba=function(a){if(!a._lazyRace){var b,c=L.test(a.nodeName),e=c&&(a[i](d.sizesAttr)||a[i]("sizes")),f="auto"==e;(!f&&m||!c||!a[i]("src")&&!a.srcset||a.complete||r(a,d.errorClass)||!r(a,d.lazyClass))&&(b=v(a,"lazyunveilread").detail,f&&E.updateElem(a,!0,a.offsetWidth),a._lazyRace=!0,Q++,aa(a,b,f,e,c))}},ca=C(function(){d.loadMode=3,W()}
288),da=function(){3==d.loadMode&&(d.loadMode=2),ca()},ea=function(){if(!m){if(f.now()-y<999)return void k(ea,999);m=!0,d.loadMode=3,W(),j("scroll",da,!0)}};return{_:function(){y=f.now(),c.elements=b.getElementsByClassName(d.lazyClass),g=b.getElementsByClassName(d.lazyClass+" "+d.preloadClass),j("scroll",W,!0),j("resize",W,!0),j("pageshow",function(a){if(a.persisted){var c=b.querySelectorAll("."+d.loadingClass);c.length&&c.forEach&&l(function(){c.forEach(function(a){a.complete&&ba(a)})})}}),a.MutationObserver?new MutationObserver(W).observe(e,{childList:!0,subtree:!0,attributes:!0}):(e[h]("DOMNodeInserted",W,!0),e[h]("DOMAttrModified",W,!0),setInterval(W,999)),j("hashchange",W,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(a){b[h](a,W,!0)}),/d$|^c/.test(b.readyState)?ea():(j("load",ea),b[h]("DOMContentLoaded",W),k(ea,2e4)),c.elements.length?(V(),z._lsFlush()):W()},checkElems:W,unveil:ba,_aLSL:da}}(),E=function(){var a,c=A(function(a,b,c,d){var e,f,g;if(a._lazysizesWidth=d,d+="px",a.setAttribute("sizes",d),n.test(b.nodeName||""))for(e=b.getElementsByTagName("source"),f=0,g=e.length;f<g;f++)e[f].setAttribute("sizes",d);c.detail.dataAttr||w(a,c.detail)}),e=function(a,b,d){var e,f=a.parentNode;f&&(d=y(a,f,d),e=v(a,"lazybeforesizes",{width:d,dataAttr:!!b}),e.defaultPrevented||(d=e.detail.width)&&d!==a._lazysizesWidth&&c(a,f,e,d))},f=function(){var b,c=a.length;if(c)for(b=0;b<c;b++)e(a[b])},g=C(f);return{_:function(){a=b.getElementsByClassName(d.autosizesClass),j("resize",g)},checkElems:g,updateElem:e}}(),F=function(){!F.i&&b.getElementsByClassName&&(F.i=!0,E._(),D._())};return k(function(){d.init&&F()}),c={cfg:d,autoSizer:E,loader:D,init:F,uP:w,aC:s,rC:t,hC:r,fire:v,gW:y,rAF:z}}); 289 290 291 292 293 294 295////////////////////////////// clipboard ////////////////////////////// 296 297/*! 298 * clipboard.js v1.5.16 299 * https://zenorocha.github.io/clipboard.js 300 * 301 * Licensed MIT © Zeno Rocha 302 */ 303(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Clipboard = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 304var DOCUMENT_NODE_TYPE = 9; 305 306/** 307 * A polyfill for Element.matches() 308 */ 309if (Element && !Element.prototype.matches) { 310 var proto = Element.prototype; 311 312 proto.matches = proto.matchesSelector || 313 proto.mozMatchesSelector || 314 proto.msMatchesSelector || 315 proto.oMatchesSelector || 316 proto.webkitMatchesSelector; 317} 318 319/** 320 * Finds the closest parent that matches a selector. 321 * 322 * @param {Element} element 323 * @param {String} selector 324 * @return {Function} 325 */ 326function closest (element, selector) { 327 while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { 328 if (element.matches(selector)) return element; 329 element = element.parentNode; 330 } 331} 332 333module.exports = closest; 334 335},{}],2:[function(require,module,exports){ 336var closest = require('./closest'); 337 338/** 339 * Delegates event to a selector. 340 * 341 * @param {Element} element 342 * @param {String} selector 343 * @param {String} type 344 * @param {Function} callback 345 * @param {Boolean} useCapture 346 * @return {Object} 347 */ 348function delegate(element, selector, type, callback, useCapture) { 349 var listenerFn = listener.apply(this, arguments); 350 351 element.addEventListener(type, listenerFn, useCapture); 352 353 return { 354 destroy: function() { 355 element.removeEventListener(type, listenerFn, useCapture); 356 } 357 } 358} 359 360/** 361 * Finds closest match and invokes callback. 362 * 363 * @param {Element} element 364 * @param {String} selector 365 * @param {String} type 366 * @param {Function} callback 367 * @return {Function} 368 */ 369function listener(element, selector, type, callback) { 370 return function(e) { 371 e.delegateTarget = closest(e.target, selector); 372 373 if (e.delegateTarget) { 374 callback.call(element, e); 375 } 376 } 377} 378 379module.exports = delegate; 380 381},{"./closest":1}],3:[function(require,module,exports){ 382/** 383 * Check if argument is a HTML element. 384 * 385 * @param {Object} value 386 * @return {Boolean} 387 */ 388exports.node = function(value) { 389 return value !== undefined 390 && value instanceof HTMLElement 391 && value.nodeType === 1; 392}; 393 394/** 395 * Check if argument is a list of HTML elements. 396 * 397 * @param {Object} value 398 * @return {Boolean} 399 */ 400exports.nodeList = function(value) { 401 var type = Object.prototype.toString.call(value); 402 403 return value !== undefined 404 && (type === '[object NodeList]' || type === '[object HTMLCollection]') 405 && ('length' in value) 406 && (value.length === 0 || exports.node(value[0])); 407}; 408 409/** 410 * Check if argument is a string. 411 * 412 * @param {Object} value 413 * @return {Boolean} 414 */ 415exports.string = function(value) { 416 return typeof value === 'string' 417 || value instanceof String; 418}; 419 420/** 421 * Check if argument is a function. 422 * 423 * @param {Object} value 424 * @return {Boolean} 425 */ 426exports.fn = function(value) { 427 var type = Object.prototype.toString.call(value); 428 429 return type === '[object Function]'; 430}; 431 432},{}],4:[function(require,module,exports){ 433var is = require('./is'); 434var delegate = require('delegate'); 435 436/** 437 * Validates all params and calls the right 438 * listener function based on its target type. 439 * 440 * @param {String|HTMLElement|HTMLCollection|NodeList} target 441 * @param {String} type 442 * @param {Function} callback 443 * @return {Object} 444 */ 445function listen(target, type, callback) { 446 if (!target && !type && !callback) { 447 throw new Error('Missing required arguments'); 448 } 449 450 if (!is.string(type)) { 451 throw new TypeError('Second argument must be a String'); 452 } 453 454 if (!is.fn(callback)) { 455 throw new TypeError('Third argument must be a Function'); 456 } 457 458 if (is.node(target)) { 459 return listenNode(target, type, callback); 460 } 461 else if (is.nodeList(target)) { 462 return listenNodeList(target, type, callback); 463 } 464 else if (is.string(target)) { 465 return listenSelector(target, type, callback); 466 } 467 else { 468 throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); 469 } 470} 471 472/** 473 * Adds an event listener to a HTML element 474 * and returns a remove listener function. 475 * 476 * @param {HTMLElement} node 477 * @param {String} type 478 * @param {Function} callback 479 * @return {Object} 480 */ 481function listenNode(node, type, callback) { 482 node.addEventListener(type, callback); 483 484 return { 485 destroy: function() { 486 node.removeEventListener(type, callback); 487 } 488 } 489} 490 491/** 492 * Add an event listener to a list of HTML elements 493 * and returns a remove listener function. 494 * 495 * @param {NodeList|HTMLCollection} nodeList 496 * @param {String} type 497 * @param {Function} callback 498 * @return {Object} 499 */ 500function listenNodeList(nodeList, type, callback) { 501 Array.prototype.forEach.call(nodeList, function(node) { 502 node.addEventListener(type, callback); 503 }); 504 505 return { 506 destroy: function() { 507 Array.prototype.forEach.call(nodeList, function(node) { 508 node.removeEventListener(type, callback); 509 }); 510 } 511 } 512} 513 514/** 515 * Add an event listener to a selector 516 * and returns a remove listener function. 517 * 518 * @param {String} selector 519 * @param {String} type 520 * @param {Function} callback 521 * @return {Object} 522 */ 523function listenSelector(selector, type, callback) { 524 return delegate(document.body, selector, type, callback); 525} 526 527module.exports = listen; 528 529},{"./is":3,"delegate":2}],5:[function(require,module,exports){ 530function select(element) { 531 var selectedText; 532 533 if (element.nodeName === 'SELECT') { 534 element.focus(); 535 536 selectedText = element.value; 537 } 538 else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { 539 element.focus(); 540 element.setSelectionRange(0, element.value.length); 541 542 selectedText = element.value; 543 } 544 else { 545 if (element.hasAttribute('contenteditable')) { 546 element.focus(); 547 } 548 549 var selection = window.getSelection(); 550 var range = document.createRange(); 551 552 range.selectNodeContents(element); 553 selection.removeAllRanges(); 554 selection.addRange(range); 555 556 selectedText = selection.toString(); 557 } 558 559 return selectedText; 560} 561 562module.exports = select; 563 564},{}],6:[function(require,module,exports){ 565function E () { 566 // Keep this empty so it's easier to inherit from 567 // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) 568} 569 570E.prototype = { 571 on: function (name, callback, ctx) { 572 var e = this.e || (this.e = {}); 573 574 (e[name] || (e[name] = [])).push({ 575 fn: callback, 576 ctx: ctx 577 }); 578 579 return this; 580 }, 581 582 once: function (name, callback, ctx) { 583 var self = this; 584 function listener () { 585 self.off(name, listener); 586 callback.apply(ctx, arguments); 587 }; 588 589 listener._ = callback 590 return this.on(name, listener, ctx); 591 }, 592 593 emit: function (name) { 594 var data = [].slice.call(arguments, 1); 595 var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); 596 var i = 0; 597 var len = evtArr.length; 598 599 for (i; i < len; i++) { 600 evtArr[i].fn.apply(evtArr[i].ctx, data); 601 } 602 603 return this; 604 }, 605 606 off: function (name, callback) { 607 var e = this.e || (this.e = {}); 608 var evts = e[name]; 609 var liveEvents = []; 610 611 if (evts && callback) { 612 for (var i = 0, len = evts.length; i < len; i++) { 613 if (evts[i].fn !== callback && evts[i].fn._ !== callback) 614 liveEvents.push(evts[i]); 615 } 616 } 617 618 // Remove event from queue to prevent memory leak 619 // Suggested by https://github.com/lazd 620 // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 621 622 (liveEvents.length) 623 ? e[name] = liveEvents 624 : delete e[name]; 625 626 return this; 627 } 628}; 629 630module.exports = E; 631 632},{}],7:[function(require,module,exports){ 633(function (global, factory) { 634 if (typeof define === "function" && define.amd) { 635 define(['module', 'select'], factory); 636 } else if (typeof exports !== "undefined") { 637 factory(module, require('select')); 638 } else { 639 var mod = { 640 exports: {} 641 }; 642 factory(mod, global.select); 643 global.clipboardAction = mod.exports; 644 } 645})(this, function (module, _select) { 646 'use strict'; 647 648 var _select2 = _interopRequireDefault(_select); 649 650 function _interopRequireDefault(obj) { 651 return obj && obj.__esModule ? obj : { 652 default: obj 653 }; 654 } 655 656 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { 657 return typeof obj; 658 } : function (obj) { 659 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 660 }; 661 662 function _classCallCheck(instance, Constructor) { 663 if (!(instance instanceof Constructor)) { 664 throw new TypeError("Cannot call a class as a function"); 665 } 666 } 667 668 var _createClass = function () { 669 function defineProperties(target, props) { 670 for (var i = 0; i < props.length; i++) { 671 var descriptor = props[i]; 672 descriptor.enumerable = descriptor.enumerable || false; 673 descriptor.configurable = true; 674 if ("value" in descriptor) descriptor.writable = true; 675 Object.defineProperty(target, descriptor.key, descriptor); 676 } 677 } 678 679 return function (Constructor, protoProps, staticProps) { 680 if (protoProps) defineProperties(Constructor.prototype, protoProps); 681 if (staticProps) defineProperties(Constructor, staticProps); 682 return Constructor; 683 }; 684 }(); 685 686 var ClipboardAction = function () { 687 /** 688 * @param {Object} options 689 */ 690 function ClipboardAction(options) { 691 _classCallCheck(this, ClipboardAction); 692 693 this.resolveOptions(options); 694 this.initSelection(); 695 } 696 697 /** 698 * Defines base properties passed from constructor. 699 * @param {Object} options 700 */ 701 702 703 _createClass(ClipboardAction, [{ 704 key: 'resolveOptions', 705 value: function resolveOptions() { 706 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 707 708 this.action = options.action; 709 this.emitter = options.emitter; 710 this.target = options.target; 711 this.text = options.text; 712 this.trigger = options.trigger; 713 714 this.selectedText = ''; 715 } 716 }, { 717 key: 'initSelection', 718 value: function initSelection() { 719 if (this.text) { 720 this.selectFake(); 721 } else if (this.target) { 722 this.selectTarget(); 723 } 724 } 725 }, { 726 key: 'selectFake', 727 value: function selectFake() { 728 var _this = this; 729 730 var isRTL = document.documentElement.getAttribute('dir') == 'rtl'; 731 732 this.removeFake(); 733 734 this.fakeHandlerCallback = function () { 735 return _this.removeFake(); 736 }; 737 this.fakeHandler = document.body.addEventListener('click', this.fakeHandlerCallback) || true; 738 739 this.fakeElem = document.createElement('textarea'); 740 // Prevent zooming on iOS 741 this.fakeElem.style.fontSize = '12pt'; 742 // Reset box model 743 this.fakeElem.style.border = '0'; 744 this.fakeElem.style.padding = '0'; 745 this.fakeElem.style.margin = '0'; 746 // Move element out of screen horizontally 747 this.fakeElem.style.position = 'absolute'; 748 this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px'; 749 // Move element to the same position vertically 750 var yPosition = window.pageYOffset || document.documentElement.scrollTop; 751 this.fakeElem.addEventListener('focus', window.scrollTo(0, yPosition)); 752 this.fakeElem.style.top = yPosition + 'px'; 753 754 this.fakeElem.setAttribute('readonly', ''); 755 this.fakeElem.value = this.text; 756 757 document.body.appendChild(this.fakeElem); 758 759 this.selectedText = (0, _select2.default)(this.fakeElem); 760 this.copyText(); 761 } 762 }, { 763 key: 'removeFake', 764 value: function removeFake() { 765 if (this.fakeHandler) { 766 document.body.removeEventListener('click', this.fakeHandlerCallback); 767 this.fakeHandler = null; 768 this.fakeHandlerCallback = null; 769 } 770 771 if (this.fakeElem) { 772 document.body.removeChild(this.fakeElem); 773 this.fakeElem = null; 774 } 775 } 776 }, { 777 key: 'selectTarget', 778 value: function selectTarget() { 779 this.selectedText = (0, _select2.default)(this.target); 780 this.copyText(); 781 } 782 }, { 783 key: 'copyText', 784 value: function copyText() { 785 var succeeded = void 0; 786 787 try { 788 succeeded = document.execCommand(this.action); 789 } catch (err) { 790 succeeded = false;
vendor: 2,793 bytes, lines 791-866
791 } 792 793 this.handleResult(succeeded); 794 } 795 }, { 796 key: 'handleResult', 797 value: function handleResult(succeeded) { 798 this.emitter.emit(succeeded ? 'success' : 'error', { 799 action: this.action, 800 text: this.selectedText, 801 trigger: this.trigger, 802 clearSelection: this.clearSelection.bind(this) 803 }); 804 } 805 }, { 806 key: 'clearSelection', 807 value: function clearSelection() { 808 if (this.target) { 809 this.target.blur(); 810 } 811 812 window.getSelection().removeAllRanges(); 813 } 814 }, { 815 key: 'destroy', 816 value: function destroy() { 817 this.removeFake(); 818 } 819 }, { 820 key: 'action', 821 set: function set() { 822 var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy'; 823 824 this._action = action; 825 826 if (this._action !== 'copy' && this._action !== 'cut') { 827 throw new Error('Invalid "action" value, use either "copy" or "cut"'); 828 } 829 }, 830 get: function get() { 831 return this._action; 832 } 833 }, { 834 key: 'target', 835 set: function set(target) { 836 if (target !== undefined) { 837 if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) { 838 if (this.action === 'copy' && target.hasAttribute('disabled')) { 839 throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); 840 } 841 842 if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { 843 throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); 844 } 845 846 this._target = target; 847 } else { 848 throw new Error('Invalid "target" value, use a valid Element'); 849 } 850 } 851 }, 852 get: function get() { 853 return this._target; 854 } 855 }]); 856 857 return ClipboardAction; 858 }(); 859 860 module.exports = ClipboardAction; 861}); 862 863},{"select":5}],8:[function(require,module,exports){ 864(function (global, factory) { 865 if (typeof define === "function" && define.amd) { 866 define(['module', './clipboard-action', 'tiny-emitter', 'good-l
866istener'], factory); 867 } else if (typeof exports !== "undefined") { 868 factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener')); 869 } else { 870 var mod = { 871 exports: {} 872 }; 873 factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener); 874 global.clipboard = mod.exports; 875 } 876})(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) { 877 'use strict'; 878 879 var _clipboardAction2 = _interopRequireDefault(_clipboardAction); 880 881 var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter); 882 883 var _goodListener2 = _interopRequireDefault(_goodListener); 884 885 function _interopRequireDefault(obj) { 886 return obj && obj.__esModule ? obj : { 887 default: obj 888 }; 889 } 890 891 function _classCallCheck(instance, Constructor) { 892 if (!(instance instanceof Constructor)) { 893 throw new TypeError("Cannot call a class as a function"); 894 } 895 } 896 897 var _createClass = function () { 898 function defineProperties(target, props) { 899 for (var i = 0; i < props.length; i++) { 900 var descriptor = props[i]; 901 descriptor.enumerable = descriptor.enumerable || false; 902 descriptor.configurable = true; 903 if ("value" in descriptor) descriptor.writable = true; 904 Object.defineProperty(target, descriptor.key, descriptor); 905 } 906 } 907 908 return function (Constructor, protoProps, staticProps) { 909 if (protoProps) defineProperties(Constructor.prototype, protoProps); 910 if (staticProps) defineProperties(Constructor, staticProps); 911 return Constructor; 912 }; 913 }(); 914 915 function _possibleConstructorReturn(self, call) { 916 if (!self) { 917 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 918 } 919 920 return call && (typeof call === "object" || typeof call === "function") ? call : self; 921 } 922 923 function _inherits(subClass, superClass) { 924 if (typeof superClass !== "function" && superClass !== null) { 925 throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); 926 } 927 928 subClass.prototype = Object.create(superClass && superClass.prototype, { 929 constructor: { 930 value: subClass, 931 enumerable: false, 932 writable: true, 933 configurable: true 934 } 935 }); 936 if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; 937 } 938 939 var Clipboard = function (_Emitter) { 940 _inherits(Clipboard, _Emitter); 941 942 /** 943 * @param {String|HTMLElement|HTMLCollection|NodeList} trigger 944 * @param {Object} options 945 */ 946 function Clipboard(trigger, options) { 947 _classCallCheck(this, Clipboard); 948 949 var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this)); 950 951 _this.resolveOptions(options); 952 _this.listenClick(trigger); 953 return _this; 954 } 955 956 /** 957 * Defines if attributes would be resolved using internal setter functions 958 * or custom functions that were passed in the constructor. 959 * @param {Object} options 960 */ 961 962 963 _createClass(Clipboard, [{ 964 key: 'resolveOptions', 965 value: function resolveOptions() { 966 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 967 968 this.action = typeof options.action === 'function' ? options.action : this.defaultAction; 969 this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; 970 this.text = typeof options.text === 'function' ? options.text : this.defaultText; 971 } 972 }, { 973 key: 'listenClick', 974 value: function listenClick(trigger) { 975 var _this2 = this; 976 977 this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) { 978 return _this2.onClick(e); 979 }); 980 } 981 }, { 982 key: 'onClick', 983 value: function onClick(e) { 984 var trigger = e.delegateTarget || e.currentTarget; 985 986 if (this.clipboardAction) { 987 this.clipboardAction = null; 988 } 989 990 this.clipboardAction = new _clipboardAction2.default({ 991 action: this.action(trigger), 992 target: this.target(trigger), 993 text: this.text(trigger), 994 trigger: trigger, 995 emitter: this 996 }); 997 } 998 }, { 999 key: 'defaultAction', 1000 value: function defaultAction(trigger) { 1001 return getAttributeValue('action', trigger); 1002 } 1003 }, { 1004 key: 'defaultTarget', 1005 value: function defaultTarget(trigger) { 1006 var selector = getAttributeValue('target', trigger); 1007 1008 if (selector) { 1009 return document.querySelector(selector); 1010 } 1011 } 1012 }, { 1013 key: 'defaultText', 1014 value: function defaultText(trigger) { 1015 return getAttributeValue('text', trigger); 1016 } 1017 }, { 1018 key: 'destroy', 1019 value: function destroy() { 1020 this.listener.destroy(); 1021 1022 if (this.clipboardAction) { 1023 this.clipboardAction.destroy(); 1024 this.clipboardAction = null; 1025 } 1026 } 1027 }]); 1028 1029 return Clipboard; 1030 }(_tinyEmitter2.default); 1031 1032 /** 1033 * Helper function to retrieve attribute value. 1034 * @param {String} suffix 1035 * @param {Element} element 1036 */ 1037 function getAttributeValue(suffix, element) { 1038 var attribute = 'data-clipboard-' + suffix; 1039 1040 if (!element.hasAttribute(attribute)) { 1041 return; 1042 } 1043 1044 return element.getAttribute(attribute); 1045 } 1046 1047 module.exports = Clipboard; 1048}); 1049 1050}
1050,{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8) 1051}); 1052 1053 1054 1055/*! 1056 * The Final Countdown for jQuery v2.2.0 (http://hilios.github.io/jQuery.countdown/) 1057 * Copyright (c) 2016 Edson Hilios 1058 * 1059 * Permission is hereby granted, free of charge, to any person obtaining a copy of 1060 * this software and associated documentation files (the "Software"), to deal in 1061 * the Software without restriction, including without limitation the rights to 1062 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 1063 * the Software, and to permit persons to whom the Software is furnished to do so, 1064 * subject to the following conditions: 1065 * 1066 * The above copyright notice and this permission notice shall be included in all 1067 * copies or substantial portions of the Software. 1068 * 1069 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1070 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 1071 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 1072 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 1073 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 1074 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 1075 */ 1076!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){"use strict";function b(a){if(a instanceof Date)return a;
vendor: 4,712 bytes, lines 1076-1103
1076if(String(a).match(g))return String(a).match(/^[0-9]*$/)&&(a=Number(a)),String(a).match(/\-/)&&(a=String(a).replace(/\-/g,"/")),new Date(a);throw new Error("Couldn't cast `"+a+"` to a date object.")}function c(a){var b=a.toString().replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");return new RegExp(b)}function d(a){return function(b){var d=b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);if(d)for(var f=0,g=d.length;f<g;++f){var h=d[f].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),j=c(h[0]),k=h[1]||"",l=h[3]||"",m=null;h=h[2],i.hasOwnProperty(h)&&(m=i[h],m=Number(a[m])),null!==m&&("!"===k&&(m=e(l,m)),""===k&&m<10&&(m="0"+m.toString()),b=b.replace(j,m.toString()))}return b=b.replace(/%%/,"%")}}function e(a,b){var c="s",d="";return a&&(a=a.replace(/(:|;|\s)/gi,"").split(/\,/),1===a.length?c=a[0]:(d=a[0],c=a[1])),Math.abs(b)>1?c:d}var f=[],g=[],h={precision:100,elapse:!1,defer:!1};g.push(/^[0-9]*$/.source),g.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g=new RegExp(g.join("|"));var i={Y:"years",m:"months",n:"daysToMonth",d:"daysToWeek",w:"weeks",W:"weeksToMonth",H:"hours",M:"minutes",S:"seconds",D:"totalDays",I:"totalHours",N:"totalMinutes",T:"totalSeconds"},j=function(b,c,d){this.el=b,this.$el=a(b),this.interval=null,this.offset={},this.options=a.extend({},h),this.instanceNumber=f.length,f.push(this),this.$el.data("countdown-instance",this.instanceNumber),d&&("function"==typeof d?(this.$el.on("update.countdown",d),this.$el.on("stoped.countdown",d),this.$el.on("finish.countdown",d)):this.options=a.extend({},h,d)),this.setFinalDate(c),this.options.defer===!1&&this.start()};a.extend(j.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var a=this;this.update(),this.interval=setInterval(function(){a.update.call(a)},this.options.precision)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent("stoped")},toggle:function(){this.interval?this.stop():this.start()},pause:function(){this.stop()},resume:function(){this.start()},remove:function(){this.stop.call(this),f[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(a){this.finalDate=b(a)},update:function(){if(0===this.$el.closest("html").length)return void this.remove();var b,c=void 0!==a._data(this.el,"events"),d=new Date;b=this.finalDate.getTime()-d.getTime(),b=Math.ceil(b/1e3),b=!this.options.elapse&&b<0?0:Math.abs(b),this.totalSecsLeft!==b&&c&&(this.totalSecsLeft=b,this.elapsed=d>=this.finalDate,this.offset={seconds:this.totalSecsLeft%60,minutes:Math.floor(this.totalSecsLeft/60)%60,hours:Math.floor(this.totalSecsLeft/60/60)%24,days:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToWeek:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToMonth:Math.floor(this.totalSecsLeft/60/60/24%30.4368),weeks:Math.floor(this.totalSecsLeft/60/60/24/7),weeksToMonth:Math.floor(this.totalSecsLeft/60/60/24/7)%4,months:Math.floor(this.totalSecsLeft/60/60/24/30.4368),years:Math.abs(this.finalDate.getFullYear()-d.getFullYear()),totalDays:Math.floor(this.totalSecsLeft/60/60/24),totalHours:Math.floor(this.totalSecsLeft/60/60),totalMinutes:Math.floor(this.totalSecsLeft/60),totalSeconds:this.totalSecsLeft},this.options.elapse||0!==this.totalSecsLeft?this.dispatchEvent("update"):(this.stop(),this.dispatchEvent("finish")))},dispatchEvent:function(b){var c=a.Event(b+".countdown");c.finalDate=this.finalDate,c.elapsed=this.elapsed,c.offset=a.extend({},this.offset),c.strftime=d(this.offset),this.$el.trigger(c)}}),a.fn.countdown=function(){var b=Array.prototype.slice.call(arguments,0);return this.each(function(){var c=a(this).data("countdown-instance");if(void 0!==c){var d=f[c],e=b[0];j.prototype.hasOwnProperty(e)?d[e].apply(d,b.slice(1)):null===String(e).match(/^[$A-Z_][0-9A-Z_$]*$/i)?(d.setFinalDate.call(d,e),d.start()):a.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi,e))}else new j(this,b[0],b[1])})}}); 1077 1078 1079 1080 1081 1082/*! loadCSS. [c]2017 Filament Group, Inc. MIT License */ 1083/* This file is meant as a standalone workflow for 1084- testing support for link[rel=preload] 1085- enabling async CSS loading in browsers that do not support rel=preload 1086- applying rel preload css once loaded, whether supported or not. 1087*/ 1088(function( w ){ 1089 "use strict"; 1090 // rel=preload support test 1091 if( !w.loadCSS ){ 1092 w.loadCSS = function(){}; 1093 } 1094 // define on the loadCSS obj 1095 var rp = loadCSS.relpreload = {}; 1096 // rel=preload feature support test 1097 // runs once and returns a function for compat purposes 1098 rp.support = (function(){ 1099 var ret; 1100 try { 1101 ret = w.document.createElement( "link" ).relList.supports( "preload" ); 1102 } catch (e) { 1103 ret = false;
vendor: 2,732 bytes, lines 1104-1192
1104 } 1105 return function(){ 1106 return ret; 1107 }; 1108 })(); 1109 1110 // if preload isn't supported, get an asynchronous load by using a non-matching media attribute 1111 // then change that media back to its intended value on load 1112 rp.bindMediaToggle = function( link ){ 1113 // remember existing media attr for ultimate state, or default to 'all' 1114 var finalMedia = link.media || "all"; 1115 1116 function enableStylesheet(){ 1117 // unbind listeners 1118 if( link.addEventListener ){ 1119 link.removeEventListener( "load", enableStylesheet ); 1120 } else if( link.attachEvent ){ 1121 link.detachEvent( "onload", enableStylesheet ); 1122 } 1123 link.setAttribute( "onload", null ); 1124 link.media = finalMedia; 1125 } 1126 1127 // bind load handlers to enable media 1128 if( link.addEventListener ){ 1129 link.addEventListener( "load", enableStylesheet ); 1130 } else if( link.attachEvent ){ 1131 link.attachEvent( "onload", enableStylesheet ); 1132 } 1133 1134 // Set rel and non-applicable media type to start an async request 1135 // note: timeout allows this to happen async to let rendering continue in IE 1136 setTimeout(function(){ 1137 link.rel = "stylesheet"; 1138 link.media = "only x"; 1139 }); 1140 // also enable media after 3 seconds, 1141 // which will catch very old browsers (android 2.x, old firefox) that don't support onload on link 1142 setTimeout( enableStylesheet, 3000 ); 1143 }; 1144 1145 // loop through link elements in DOM 1146 rp.poly = function(){ 1147 // double check this to prevent external calls from running 1148 if( rp.support() ){ 1149 return; 1150 } 1151 var links = w.document.getElementsByTagName( "link" ); 1152 for( var i = 0; i < links.length; i++ ){ 1153 var link = links[ i ]; 1154 // qualify links to those with rel=preload and as=style attrs 1155 if( link.rel === "preload" && link.getAttribute( "as" ) === "style" && !link.getAttribute( "data-loadcss" ) ){ 1156 // prevent rerunning on link 1157 link.setAttribute( "data-loadcss", true ); 1158 // bind listeners to toggle media back 1159 rp.bindMediaToggle( link ); 1160 } 1161 } 1162 }; 1163 1164 // if unsupported, run the polyfill 1165 if( !rp.support() ){ 1166 // run once at least 1167 rp.poly(); 1168 1169 // rerun poly on an interval until onload 1170 var run = w.setInterval( rp.poly, 500 ); 1171 if( w.addEventListener ){ 1172 w.addEventListener( "load", function(){ 1173 rp.poly(); 1174 w.clearInterval( run ); 1175 } ); 1176 } else if( w.attachEvent ){ 1177 w.attachEvent( "onload", function(){ 1178 rp.poly(); 1179 w.clearInterval( run ); 1180 } ); 1181 } 1182 } 1183 1184 1185 // commonjs 1186 if( typeof exports !== "undefined" ){ 1187 exports.loadCSS = loadCSS; 1188 } 1189 else { 1190 w.loadCSS = loadCSS; 1191 } 1192}( typeof global !== "undefined" ? global : this ) );
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.