5 lines
13 KiB
JavaScript
5 lines
13 KiB
JavaScript
/*!
|
|
* jekyll-theme-chirpy v7.1.1 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
|
|
*/
|
|
!function(){"use strict";const e=new Map;var t={set(t,n,r){e.has(t)||e.set(t,new Map);const o=e.get(t);o.has(n)||0===o.size?o.set(n,r):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(o.keys())[0]}.`)},get:(t,n)=>e.has(t)&&e.get(t).get(n)||null,remove(t,n){if(!e.has(t))return;const r=e.get(t);r.delete(n),0===r.size&&e.delete(t)}};const n="transitionend",r=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,(e,t)=>`#${CSS.escape(t)}`)),e),o=e=>null==e?`${e}`:Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(),i=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&(e=e[0]),void 0!==e.nodeType),s=e=>i(e)?e.jquery?e[0]:e:"string"==typeof e&&e.length>0?document.querySelector(r(e)):null,a=e=>!e||e.nodeType!==Node.ELEMENT_NODE||(!!e.classList.contains("disabled")||(void 0!==e.disabled?e.disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled"))),l=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,c=[],u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return"function"==typeof e?e.call(...t):n},d=function(e,t){if(!(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]))return void u(e);const r=(e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:n}=window.getComputedStyle(e);const r=Number.parseFloat(t),o=Number.parseFloat(n);return r||o?(t=t.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(n))):0})(t)+5;let o=!1;const i=r=>{let{target:s}=r;s===t&&(o=!0,t.removeEventListener(n,i),u(e))};t.addEventListener(n,i),setTimeout(()=>{o||t.dispatchEvent(new Event(n))},r)},f=/[^.]*(?=\..*)\.|.*/,h=/\..*/,g=/::\d+$/,m={};let p=1;const b={mouseenter:"mouseover",mouseleave:"mouseout"},v=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function _(e,t){return t&&`${t}::${p++}`||e.uidEvent||p++}function y(e){const t=_(e);return e.uidEvent=t,m[t]=m[t]||{},m[t]}function E(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return Object.values(e).find(e=>e.callable===t&&e.delegationSelector===n)}function w(e,t,n){const r="string"==typeof t,o=r?n:t||n;let i=O(e);return v.has(i)||(i=e),[r,o,i]}function A(e,t,n,r,o){if("string"!=typeof t||!e)return;let[i,s,a]=w(t,n,r);if(t in b){const e=e=>function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget))return e.call(this,t)};s=e(s)}const l=y(e),c=l[a]||(l[a]={}),u=E(c,s,i?n:null);if(u)return void(u.oneOff=u.oneOff&&o);const d=_(s,t.replace(f,"")),h=i?function(e,t,n){return function r(o){const i=e.querySelectorAll(t);for(let{target:s}=o;s&&s!==this;s=s.parentNode)for(const a of i)if(a===s)return $(o,{delegateTarget:s}),r.oneOff&&T.off(e,o.type,t,n),n.apply(s,[o])}}(e,n,s):function(e,t){return function n(r){return $(r,{delegateTarget:e}),n.oneOff&&T.off(e,r.type,t),t.apply(e,[r])}}(e,s);h.delegationSelector=i?n:null,h.callable=s,h.oneOff=o,h.uidEvent=d,c[d]=h,e.addEventListener(a,h,i)}function S(e,t,n,r,o){const i=E(t[n],r,o);i&&(e.removeEventListener(n,i,Boolean(o)),delete t[n][i.uidEvent])}function C(e,t,n,r){const o=t[n]||{};for(const[i,s]of Object.entries(o))i.includes(r)&&S(e,t,n,s.callable,s.delegationSelector)}function O(e){return e=e.replace(h,""),b[e]||e}const T={on(e,t,n,r){A(e,t,n,r,!1)},one(e,t,n,r){A(e,t,n,r,!0)},off(e,t,n,r){if("string"!=typeof t||!e)return;const[o,i,s]=w(t,n,r),a=s!==t,l=y(e),c=l[s]||{},u=t.startsWith(".");if(void 0===i){if(u)for(const n of Object.keys(l))C(e,l,n,t.slice(1));for(const[n,r]of Object.entries(c)){const o=n.replace(g,"");a&&!t.includes(o)||S(e,l,s,r.callable,r.delegationSelector)}}else{if(!Object.keys(c).length)return;S(e,l,s,i,o?n:null)}},trigger(e,t,n){if("string"!=typeof t||!e)return null;const r=l();let o=null,i=!0,s=!0,a=!1;t!==O(t)&&r&&(o=r.Event(t,n),r(e).trigger(o),i=!o.isPropagationStopped(),s=!o.isImmediatePropagationStopped(),a=o.isDefaultPrevented());const c=$(new Event(t,{bubbles:i,cancelable:!0}),n);return a&&c.preventDefault(),s&&e.dispatchEvent(c),c.defaultPrevented&&o&&o.preventDefault(),c}};function $(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(const[n,r]of Object.entries(t))try{e[n]=r}catch{Object.defineProperty(e,n,{configurable:!0,get:()=>r})}return e}function N(e){if("true"===e)return!0;if("false"===e)return!1;if(e===Number(e).toString())return Number(e);if(""===e||"null"===e)return null;if("string"!=typeof e)return e;try{return JSON.parse(decodeURIComponent(e))}catch{return e}}function j(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}const L={setDataAttribute(e,t,n){e.setAttribute(`data-bs-${j(t)}`,n)},removeDataAttribute(e,t){e.removeAttribute(`data-bs-${j(t)}`)},getDataAttributes(e){if(!e)return{};const t={},n=Object.keys(e.dataset).filter(e=>e.startsWith("bs")&&!e.startsWith("bsConfig"));for(const r of n){let n=r.replace(/^bs/,"");n=n.charAt(0).toLowerCase()+n.slice(1),t[n]=N(e.dataset[r])}return t},getDataAttribute:(e,t)=>N(e.getAttribute(`data-bs-${j(t)}`))};class D{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(e){return e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e}_mergeConfigObj(e,t){const n=i(t)?L.getDataAttribute(t,"config"):{};return{...this.constructor.Default,..."object"==typeof n?n:{},...i(t)?L.getDataAttributes(t):{},..."object"==typeof e?e:{}}}_typeCheckConfig(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.constructor.DefaultType;for(const[n,r]of Object.entries(t)){const t=e[n],s=i(t)?"element":o(t);if(!new RegExp(r).test(s))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${n}" provided type "${s}" but expected type "${r}".`)}}}class I extends D{constructor(e,n){super(),(e=s(e))&&(this._element=e,this._config=this._getConfig(n),t.set(this._element,this.constructor.DATA_KEY,this))}dispose(){t.remove(this._element,this.constructor.DATA_KEY),T.off(this._element,this.constructor.EVENT_KEY);for(const e of Object.getOwnPropertyNames(this))this[e]=null}_queueCallback(e,t){d(e,t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}_getConfig(e){return e=this._mergeConfigObj(e,this._element),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}static getInstance(e){return t.get(s(e),this.DATA_KEY)}static getOrCreateInstance(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return"5.3.7"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(e){return`${e}${this.EVENT_KEY}`}}const k=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let n=e.getAttribute("href");if(!n||!n.includes("#")&&!n.startsWith("."))return null;n.includes("#")&&!n.startsWith("#")&&(n=`#${n.split("#")[1]}`),t=n&&"#"!==n?n.trim():null}return t?t.split(",").map(e=>r(e)).join(","):null},M={find(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;return[].concat(...Element.prototype.querySelectorAll.call(t,e))},findOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;return Element.prototype.querySelector.call(t,e)},children:(e,t)=>[].concat(...e.children).filter(e=>e.matches(t)),parents(e,t){const n=[];let r=e.parentNode.closest(t);for(;r;)n.push(r),r=r.parentNode.closest(t);return n},prev(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return[n];n=n.previousElementSibling}return[]},next(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return[n];n=n.nextElementSibling}return[]},focusableChildren(e){const t=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(e=>`${e}:not([tabindex^="-"])`).join(",");return this.find(t,e).filter(e=>!a(e)&&(e=>{if(!i(e)||0===e.getClientRects().length)return!1;const t="visible"===getComputedStyle(e).getPropertyValue("visibility"),n=e.closest("details:not([open])");if(!n)return t;if(n!==e){const t=e.closest("summary");if(t&&t.parentNode!==n)return!1;if(null===t)return!1}return t})(e))},getSelectorFromElement(e){const t=k(e);return t&&M.findOne(t)?t:null},getElementFromSelector(e){const t=k(e);return t?M.findOne(t):null},getMultipleElementsFromSelector(e){const t=k(e);return t?M.find(t):[]}},K=".bs.toast",P=`mouseover${K}`,q=`mouseout${K}`,x=`focusin${K}`,W=`focusout${K}`,Y=`hide${K}`,F=`hidden${K}`,R=`show${K}`,V=`shown${K}`,Q="hide",z="show",B="showing",H={animation:"boolean",autohide:"boolean",delay:"number"},U={animation:!0,autohide:!0,delay:5e3};class G extends I{constructor(e,t){super(e,t),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return U}static get DefaultType(){return H}static get NAME(){return"toast"}show(){if(T.trigger(this._element,R).defaultPrevented)return;this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");this._element.classList.remove(Q),this._element.offsetHeight,this._element.classList.add(z,B),this._queueCallback(()=>{this._element.classList.remove(B),T.trigger(this._element,V),this._maybeScheduleHide()},this._element,this._config.animation)}hide(){if(!this.isShown())return;if(T.trigger(this._element,Y).defaultPrevented)return;this._element.classList.add(B),this._queueCallback(()=>{this._element.classList.add(Q),this._element.classList.remove(B,z),T.trigger(this._element,F)},this._element,this._config.animation)}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove(z),super.dispose()}isShown(){return this._element.classList.contains(z)}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout(()=>{this.hide()},this._config.delay)))}_onInteraction(e,t){switch(e.type){case"mouseover":case"mouseout":this._hasMouseInteraction=t;break;case"focusin":case"focusout":this._hasKeyboardInteraction=t}if(t)return void this._clearTimeout();const n=e.relatedTarget;this._element===n||this._element.contains(n)||this._maybeScheduleHide()}_setListeners(){T.on(this._element,P,e=>this._onInteraction(e,!0)),T.on(this._element,q,e=>this._onInteraction(e,!1)),T.on(this._element,x,e=>this._onInteraction(e,!0)),T.on(this._element,W,e=>this._onInteraction(e,!1))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(e){return this.each(function(){const t=G.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e](this)}})}}var J,Z;if(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hide";const n=`click.dismiss${e.EVENT_KEY}`,r=e.NAME;T.on(document,n,`[data-bs-dismiss="${r}"]`,function(n){if(["A","AREA"].includes(this.tagName)&&n.preventDefault(),a(this))return;const o=M.getElementFromSelector(this)||this.closest(`.${r}`);e.getOrCreateInstance(o)[t]()})}(G),J=G,Z=()=>{const e=l();if(e){const t=J.NAME,n=e.fn[t];e.fn[t]=J.jQueryInterface,e.fn[t].Constructor=J,e.fn[t].noConflict=()=>(e.fn[t]=n,J.jQueryInterface)}},"loading"===document.readyState?(c.length||document.addEventListener("DOMContentLoaded",()=>{for(const e of c)e()}),c.push(Z)):Z(),"serviceWorker"in navigator){const e=new URL(document.currentScript.src),t=e.searchParams.get("register"),n=e.searchParams.get("baseurl");if(t){const e=`${n}/sw.min.js`,t=document.getElementById("notification"),r=t.querySelector(".toast-body>button"),o=G.getOrCreateInstance(t);navigator.serviceWorker.register(e).then(e=>{e.waiting&&o.show(),e.addEventListener("updatefound",()=>{e.installing.addEventListener("statechange",()=>{e.waiting&&navigator.serviceWorker.controller&&o.show()})}),r.addEventListener("click",()=>{e.waiting&&e.waiting.postMessage("SKIP_WAITING"),o.hide()})});let i=!1;navigator.serviceWorker.addEventListener("controllerchange",()=>{i||(window.location.reload(),i=!0)})}else navigator.serviceWorker.getRegistrations().then(function(e){for(let t of e)t.unregister()})}}();
|