Welcome to mirror list, hosted at ThFree Co, Russian Federation.

main.js « js « static - github.com/capnfabs/paperesque.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 62a4333e3faeb11bdea4bfa4faad39d9f9f0375e (plain)
1
(function () {function E(e){var r=document.createElement("a");return r.className="header-link",r.title="Link to this section",r.href="#"+e,r.innerHTML="<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 8 8\"><path d=\"M5.88.03c-.18.01-.36.03-.53.09-.27.1-.53.25-.75.47a.5.5 0 1 0 .69.69c.11-.11.24-.17.38-.22.35-.12.78-.07 1.06.22.39.39.39 1.04 0 1.44l-1.5 1.5c-.44.44-.8.48-1.06.47-.26-.01-.41-.13-.41-.13a.5.5 0 1 0-.5.88s.34.22.84.25c.5.03 1.2-.16 1.81-.78l1.5-1.5c.78-.78.78-2.04 0-2.81-.28-.28-.61-.45-.97-.53-.18-.04-.38-.04-.56-.03zm-2 2.31c-.5-.02-1.19.15-1.78.75l-1.5 1.5c-.78.78-.78 2.04 0 2.81.56.56 1.36.72 2.06.47.27-.1.53-.25.75-.47a.5.5 0 1 0-.69-.69c-.11.11-.24.17-.38.22-.35.12-.78.07-1.06-.22-.39-.39-.39-1.04 0-1.44l1.5-1.5c.4-.4.75-.45 1.03-.44.28.01.47.09.47.09a.5.5 0 1 0 .44-.88s-.34-.2-.84-.22z\" /></svg>",r}function F(){var e=document.querySelectorAll("section#main article");if(1==e.length){var r=e[0].querySelectorAll("h2, h3, h4");Array.prototype.forEach.call(r,function(e,r){var a=E(e.id);e.appendChild(a)})}}function G(){e(F)}function e(e){"complete"===document.readyState||"interactive"===document.readyState?setTimeout(e,1):document.addEventListener("DOMContentLoaded",e)}function H(e){"complete"===document.readyState?setTimeout(e,1):window.addEventListener("load",e)}function I(e){H(function(){window.addEventListener("resize",e),setTimeout(e,1)})}var b=[];var J=function(){return b.some(function(e){return e.activeTargets.length>0})};var K=function(){return b.some(function(e){return e.skippedTargets.length>0})};var l="ResizeObserver loop completed with undelivered notifications.",L=function(){var e;"function"==typeof ErrorEvent?e=new ErrorEvent("error",{message:l}):((e=document.createEvent("Event")).initEvent("error",!1,!1),e.message=l),window.dispatchEvent(e)};var M,d;!function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(d||(M=d={},M));var w=function(){function t(t,h,i,e){return this.x=t,this.y=h,this.width=i,this.height=e,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Object.freeze(this)}return t.fromRect=function(h){return new t(h.x,h.y,h.width,h.height)},t}();var q=function(e){return e instanceof SVGElement&&"getBBox"in e},y=function(e){if(q(e)){var t=e.getBBox(),$=t.width,i=t.height;return!$&&!i}var s=e,r=s.offsetWidth,n=s.offsetHeight;return!(r||n||e.getClientRects().length)},N=function(e){switch(e.tagName){case"INPUT":if("image"!==e.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0;}return!1};var c="undefined"!=typeof window?window:{};var k=new Map,A=/auto|scroll/,Q=/^tb|vertical/,T=/msie|trident/i.test(c.navigator&&c.navigator.userAgent),f=function(e){return parseFloat(e||"0")},j=function(e,$,r){return void 0===e&&(e=0),void 0===$&&($=0),void 0===r&&(r=!1),Object.freeze({inlineSize:(r?$:e)||0,blockSize:(r?e:$)||0})},C=Object.freeze({devicePixelContentBoxSize:j(),borderBoxSize:j(),contentBoxSize:j(),contentRect:new w(0,0,0,0)}),m=function(e){if(k.has(e))return k.get(e);if(y(e))return k.set(e,C),C;var $=getComputedStyle(e),r=q(e)&&e.ownerSVGElement&&e.getBBox(),t=!T&&"border-box"===$.boxSizing,i=Q.test($.writingMode||""),o=!r&&A.test($.overflowY||""),P=!r&&A.test($.overflowX||""),a=r?0:f($.paddingTop),n=r?0:f($.paddingRight),s=r?0:f($.paddingBottom),c=r?0:f($.paddingLeft),l=r?0:f($.borderTopWidth),Y=r?0:f($.borderRightWidth),p=r?0:f($.borderBottomWidth),v=c+n,x=a+s,d=(r?0:f($.borderLeftWidth))+Y,z=l+p,u=P?e.offsetHeight-z-e.clientHeight:0,B=o?e.offsetWidth-d-e.clientWidth:0,h=t?v+d:0,g=t?x+z:0,m=r?r.width:f($.width)-h-B,R=r?r.height:f($.height)-g-u,S=m+v+B+d,b=R+x+u+z,O=Object.freeze({devicePixelContentBoxSize:j(Math.round(m*devicePixelRatio),Math.round(R*devicePixelRatio),i),borderBoxSize:j(S,b,i),contentBoxSize:j(m,R,i),contentRect:new w(c,a,m,R)});return k.set(e,O),O},n=function(e,$){var r=m(e),t=r.borderBoxSize,i=r.contentBoxSize,o=r.devicePixelContentBoxSize;switch($){case d.DEVICE_PIXEL_CONTENT_BOX:return o;case d.BORDER_BOX:return t;default:return i;}};var O=function(){return function(e){var t=m(e);this.target=e,this.contentRect=t.contentRect,this.borderBoxSize=[t.borderBoxSize],this.contentBoxSize=[t.contentBoxSize],this.devicePixelContentBoxSize=[t.devicePixelContentBoxSize]}}();var o=function(e){if(y(e))return 1/0;for(var r=0,t=e.parentNode;t;)r+=1,t=t.parentNode;return r};var P=function(){var e=1/0,r=[];b.forEach(function(t){if(0!==t.activeTargets.length){var a=[];t.activeTargets.forEach(function(r){var t=new O(r.target),s=o(r.target);a.push(t),r.lastReportedSize=n(r.target,r.observedBox),s<e&&(e=s)}),r.push(function(){t.callback.call(t.observer,a,t.observer)}),t.activeTargets.splice(0,t.activeTargets.length)}});for(var t=0,a=r;t<a.length;t++){(0,a[t])()}return e};var p=function(e){k.clear(),b.forEach(function(t){t.activeTargets.splice(0,t.activeTargets.length),t.skippedTargets.splice(0,t.skippedTargets.length),t.observationTargets.forEach(function(r){r.isActive()&&(o(r.target)>e?t.activeTargets.push(r):t.skippedTargets.push(r))})})};var R=function(){var r=0;for(p(r);J();)r=P(),p(r);return K()&&L(),r>0};var s,t=[],S=function(){return t.splice(0).forEach(function(a){return a()})},U=function(a){if(!s){var r=document.createTextNode("");new MutationObserver(function(){return S()}).observe(r,{characterData:!0}),s=function(){r.textContent=""}}t.push(a),s()};var V=function(e){U(function(){requestAnimationFrame(e)})};var r=0,W=function(){return!!r},X=12,Y={attributes:!0,characterData:!0,childList:!0,subtree:!0},u=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Z=!1,$=function(){function e(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return e.prototype.run=function(e){var r=this;Z||(Z=!0,V(function(){var t=!1;try{t=R()}finally{if(Z=!1,!W())return;t?r.run(60):e?r.run(e-1):r.start()}}))},e.prototype.schedule=function(){this.stop(),this.run(X)},e.prototype.observe=function(){var e=this,r=function(){return e.observer&&e.observer.observe(document.body,Y)};document.body?r():c.addEventListener("DOMContentLoaded",r)},e.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),u.forEach(function(r){return c.addEventListener(r,e.listener,!0)}))},e.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),u.forEach(function(r){return c.removeEventListener(r,e.listener,!0)}),this.stopped=!0)},e}(),h=new $,i=function(e){!r&&e>0&&h.start(),!(r+=e)&&h.stop()};var _=function(e){return!q(e)&&!N(e)&&"inline"===getComputedStyle(e).display},aa=function(){function e(e,i){this.target=e,this.observedBox=i||d.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var e=n(this.target,this.observedBox);return _(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},e}();var ba=function(){return function(e,t){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=t}}();var a=new Map,v=function(e,r){for(var $=0;$<e.length;$+=1)if(e[$].target===r)return $;return-1},g=function(){function e(){}return e.connect=function(e,r){var $=new ba(e,r);b.push($),a.set(e,$)},e.observe=function(e,r,$){if(a.has(e)){var s=a.get(e);v(s.observationTargets,r)<0&&(s.observationTargets.push(new aa(r,$&&$.box)),i(1),h.schedule())}},e.unobserve=function(e,r){if(a.has(e)){var $=a.get(e),s=v($.observationTargets,r);s>=0&&($.observationTargets.splice(s,1),i(-1))}},e.disconnect=function(e){if(a.has(e)){var r=a.get(e);b.splice(b.indexOf(r),1),a.delete(e),i(-r.observationTargets.length)}},e}();var ca=function(){function e(e){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof e)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");g.connect(this,e)}return e.prototype.observe=function(e,r){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(e instanceof Element==!1)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");g.observe(this,e,r)},e.prototype.unobserve=function(e){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(e instanceof Element==!1)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");g.unobserve(this,e)},e.prototype.disconnect=function(){g.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();var x="section#main",z="section.footnotes[role=doc-endnotes]",da=1260;function ea(e,t){var o=e.offsetParent.getBoundingClientRect().top;return t.getBoundingClientRect().top-o}function fa(e){var t=0;Array.prototype.forEach.call(e,function(e,o){var r=document.querySelector("a.footnote-ref[href='#"+e.id+"']"),$=ea(e,r.closest("p,li")||r);$<t&&($=t),t=$+e.offsetHeight+parseInt(window.getComputedStyle(e).marginBottom)+parseInt(window.getComputedStyle(e).marginTop),e.style.top=$+"px",e.style.position="absolute"})}function ga(e){Array.prototype.forEach.call(e,function(e,t){e.style.top=null,e.style.position=null})}function B(e){var t=document.querySelector(z),o=t.querySelectorAll("li[role=doc-endnote]");e?(t.classList.add("floating-footnotes"),fa(o),ha()):(ia(),ga(o),t.classList.remove("floating-footnotes"))}function ha(){var e=document.querySelector(x);D.observe(e)}function ia(){D.disconnect()}var ja=function(){var e=!1;return function(){var t=window.innerWidth>=da;t!==e&&(B(t),e=t)}}(),D=new ca(function(e,t){B(!0)});function ka(){e(function(){var e=document.querySelector(z),t=document.querySelector(x),o=t&&!t.classList.contains("no-floating-footnotes");e&&o&&I(ja)})}ka(),G();})();