mkdocs-material/material/assets/javascripts/application.js

8 lines
12 KiB
JavaScript

!function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var o=n(1),r=i(o),a=n(2),s=i(a),c=n(3),l=i(c);document.addEventListener("DOMContentLoaded",function(){Modernizr.addTest("ios",function(){return!!navigator.userAgent.match(/(iPad|iPhone|iPod)/g)}),Modernizr.addTest("standalone",function(){return!!navigator.standalone}),r["default"].attach(document.body);var e=window.matchMedia("(min-width: 1200px)"),t=function(){e.matches?n.listen():n.unlisten()},n=new s["default"](".md-sidebar--primary");t();var i=new s["default"](".md-sidebar--secondary");i.listen();var o=new l["default"](".md-nav--toc .md-nav__item a");o.listen(),window.addEventListener("resize",t);var a=0,c=document.getElementById("md-toggle-search");c.addEventListener("click",function(e){var t=document.body.classList,n=!matchMedia("only screen and (min-width: 960px)").matches;t.contains("md-js__body--locked")?(t.remove("md-js__body--locked"),n&&setTimeout(function(){window.scrollTo(0,a)},100)):(a=window.scrollY,n&&setTimeout(function(){window.scrollTo(0,0)},400),setTimeout(function(){this.checked&&(n&&t.add("md-js__body--locked"),setTimeout(function(){document.getElementById("md-search").focus()},200))}.bind(this),450))})})},function(e,t,n){var i;!function(){"use strict";/**
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
*
* @codingstandard ftlabs-jsv2
* @copyright The Financial Times Limited [All Rights Reserved]
* @license MIT License (see LICENSE.txt)
*/
function o(e,t){function n(e,t){return function(){return e.apply(t,arguments)}}var i;if(t=t||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=t.touchBoundary||10,this.layer=e,this.tapDelay=t.tapDelay||200,this.tapTimeout=t.tapTimeout||700,!o.notNeeded(e)){for(var r=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],s=this,c=0,l=r.length;c<l;c++)s[r[c]]=n(s[r[c]],s);a&&(e.addEventListener("mouseover",this.onMouse,!0),e.addEventListener("mousedown",this.onMouse,!0),e.addEventListener("mouseup",this.onMouse,!0)),e.addEventListener("click",this.onClick,!0),e.addEventListener("touchstart",this.onTouchStart,!1),e.addEventListener("touchmove",this.onTouchMove,!1),e.addEventListener("touchend",this.onTouchEnd,!1),e.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(e.removeEventListener=function(t,n,i){var o=Node.prototype.removeEventListener;"click"===t?o.call(e,t,n.hijacked||n,i):o.call(e,t,n,i)},e.addEventListener=function(t,n,i){var o=Node.prototype.addEventListener;"click"===t?o.call(e,t,n.hijacked||(n.hijacked=function(e){e.propagationStopped||n(e)}),i):o.call(e,t,n,i)}),"function"==typeof e.onclick&&(i=e.onclick,e.addEventListener("click",function(e){i(e)},!1),e.onclick=null)}}var r=navigator.userAgent.indexOf("Windows Phone")>=0,a=navigator.userAgent.indexOf("Android")>0&&!r,s=/iP(ad|hone|od)/.test(navigator.userAgent)&&!r,c=s&&/OS 4_\d(_\d)?/.test(navigator.userAgent),l=s&&/OS [6-7]_\d/.test(navigator.userAgent),u=navigator.userAgent.indexOf("BB10")>0;o.prototype.needsClick=function(e){switch(e.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(e.disabled)return!0;break;case"input":if(s&&"file"===e.type||e.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return/\bneedsclick\b/.test(e.className)},o.prototype.needsFocus=function(e){switch(e.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!a;case"input":switch(e.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!e.disabled&&!e.readOnly;default:return/\bneedsfocus\b/.test(e.className)}},o.prototype.sendClick=function(e,t){var n,i;document.activeElement&&document.activeElement!==e&&document.activeElement.blur(),i=t.changedTouches[0],n=document.createEvent("MouseEvents"),n.initMouseEvent(this.determineEventType(e),!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),n.forwardedTouchEvent=!0,e.dispatchEvent(n)},o.prototype.determineEventType=function(e){return a&&"select"===e.tagName.toLowerCase()?"mousedown":"click"},o.prototype.focus=function(e){var t;s&&e.setSelectionRange&&0!==e.type.indexOf("date")&&"time"!==e.type&&"month"!==e.type?(t=e.value.length,e.setSelectionRange(t,t)):e.focus()},o.prototype.updateScrollParent=function(e){var t,n;if(t=e.fastClickScrollParent,!t||!t.contains(e)){n=e;do{if(n.scrollHeight>n.offsetHeight){t=n,e.fastClickScrollParent=n;break}n=n.parentElement}while(n)}t&&(t.fastClickLastScrollTop=t.scrollTop)},o.prototype.getTargetElementFromEventTarget=function(e){return e.nodeType===Node.TEXT_NODE?e.parentNode:e},o.prototype.onTouchStart=function(e){var t,n,i;if(e.targetTouches.length>1)return!0;if(t=this.getTargetElementFromEventTarget(e.target),n=e.targetTouches[0],s){if(i=window.getSelection(),i.rangeCount&&!i.isCollapsed)return!0;if(!c){if(n.identifier&&n.identifier===this.lastTouchIdentifier)return e.preventDefault(),!1;this.lastTouchIdentifier=n.identifier,this.updateScrollParent(t)}}return this.trackingClick=!0,this.trackingClickStart=e.timeStamp,this.targetElement=t,this.touchStartX=n.pageX,this.touchStartY=n.pageY,e.timeStamp-this.lastClickTime<this.tapDelay&&e.preventDefault(),!0},o.prototype.touchHasMoved=function(e){var t=e.changedTouches[0],n=this.touchBoundary;return Math.abs(t.pageX-this.touchStartX)>n||Math.abs(t.pageY-this.touchStartY)>n},o.prototype.onTouchMove=function(e){return!this.trackingClick||((this.targetElement!==this.getTargetElementFromEventTarget(e.target)||this.touchHasMoved(e))&&(this.trackingClick=!1,this.targetElement=null),!0)},o.prototype.findControl=function(e){return void 0!==e.control?e.control:e.htmlFor?document.getElementById(e.htmlFor):e.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},o.prototype.onTouchEnd=function(e){var t,n,i,o,r,u=this.targetElement;if(!this.trackingClick)return!0;if(e.timeStamp-this.lastClickTime<this.tapDelay)return this.cancelNextClick=!0,!0;if(e.timeStamp-this.trackingClickStart>this.tapTimeout)return!0;if(this.cancelNextClick=!1,this.lastClickTime=e.timeStamp,n=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,l&&(r=e.changedTouches[0],u=document.elementFromPoint(r.pageX-window.pageXOffset,r.pageY-window.pageYOffset)||u,u.fastClickScrollParent=this.targetElement.fastClickScrollParent),i=u.tagName.toLowerCase(),"label"===i){if(t=this.findControl(u)){if(this.focus(u),a)return!1;u=t}}else if(this.needsFocus(u))return e.timeStamp-n>100||s&&window.top!==window&&"input"===i?(this.targetElement=null,!1):(this.focus(u),this.sendClick(u,e),s&&"select"===i||(this.targetElement=null,e.preventDefault()),!1);return!(!s||c||(o=u.fastClickScrollParent,!o||o.fastClickLastScrollTop===o.scrollTop))||(this.needsClick(u)||(e.preventDefault(),this.sendClick(u,e)),!1)},o.prototype.onTouchCancel=function(){this.trackingClick=!1,this.targetElement=null},o.prototype.onMouse=function(e){return!this.targetElement||(!!e.forwardedTouchEvent||(!e.cancelable||(!(!this.needsClick(this.targetElement)||this.cancelNextClick)||(e.stopImmediatePropagation?e.stopImmediatePropagation():e.propagationStopped=!0,e.stopPropagation(),e.preventDefault(),!1))))},o.prototype.onClick=function(e){var t;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===e.target.type&&0===e.detail||(t=this.onMouse(e),t||(this.targetElement=null),t)},o.prototype.destroy=function(){var e=this.layer;a&&(e.removeEventListener("mouseover",this.onMouse,!0),e.removeEventListener("mousedown",this.onMouse,!0),e.removeEventListener("mouseup",this.onMouse,!0)),e.removeEventListener("click",this.onClick,!0),e.removeEventListener("touchstart",this.onTouchStart,!1),e.removeEventListener("touchmove",this.onTouchMove,!1),e.removeEventListener("touchend",this.onTouchEnd,!1),e.removeEventListener("touchcancel",this.onTouchCancel,!1)},o.notNeeded=function(e){var t,n,i,o;if("undefined"==typeof window.ontouchstart)return!0;if(n=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!a)return!0;if(t=document.querySelector("meta[name=viewport]")){if(t.content.indexOf("user-scalable=no")!==-1)return!0;if(n>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(u&&(i=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/),i[1]>=10&&i[2]>=3&&(t=document.querySelector("meta[name=viewport]")))){if(t.content.indexOf("user-scalable=no")!==-1)return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}return"none"===e.style.msTouchAction||"manipulation"===e.style.touchAction||(o=+(/Firefox\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1],!!(o>=27&&(t=document.querySelector("meta[name=viewport]"),t&&(t.content.indexOf("user-scalable=no")!==-1||document.documentElement.scrollWidth<=window.outerWidth)))||("none"===e.style.touchAction||"manipulation"===e.style.touchAction))},o.attach=function(e,t){return new o(e,t)},i=function(){return o}.call(t,n,t,e),!(void 0!==i&&(e.exports=i))}()},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(t){var i=this;n(this,e),this.el_="string"==typeof t?document.querySelector(t):t,this.height_=0,this.locked_=!1,this.handler_=function(e){i.update(e)}}return i(e,[{key:"update",value:function(e){var t=this.el_.parentNode,n=t.getBoundingClientRect(),i=n.top+window.pageYOffset,o=n.bottom+window.pageYOffset,r=window.pageYOffset,a=window.pageYOffset+window.innerHeight,s=i-r,c=window.innerHeight-Math.max(a-o,0)-Math.max(s,t.parentNode.offsetTop);c!=this.height_&&(this.el_.style.height=(this.height_=c)+"px"),s<t.parentNode.offsetTop?this.locked_||(this.el_.classList.add("md-js__sidebar--locked"),this.locked_=!0):this.locked_&&(this.el_.classList.remove("md-js__sidebar--locked"),this.locked_=!1)}},{key:"reset",value:function(){this.el_.classList.remove("md-js__sidebar--locked"),this.el_.style.height_="",this.height_=0,this.locked_=!1}},{key:"listen",value:function(){var e=this;["scroll","resize","orientationchange"].forEach(function(t){window.addEventListener(t,e.handler_,!1)}),this.update()}},{key:"unlisten",value:function(){var e=this;["scroll","resize","orientationchange"].forEach(function(t){window.removeEventListener(t,e.handler_,!1)}),this.reset()}}]),e}();t["default"]=o},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(t){var i=this;n(this,e),this.el_="string"==typeof t?document.querySelectorAll(t):t,this.index_=0,this.offset_=window.pageYOffset,this.handler_=function(e){i.update(e)}}return i(e,[{key:"update",value:function(e){this.index_;if(this.offset_<=window.pageYOffset)for(var t=this.index_;t<this.el_.length;t++){var n=document.querySelector(this.el_[t].hash);if(!(n.offsetTop<=window.pageYOffset))break;t>0&&this.el_[t-1].classList.add("md-nav__link--marked"),this.index_=t}else for(var i=this.index_;i>=0;i--){var o=document.querySelector(this.el_[i].hash);if(!(o.offsetTop>window.pageYOffset)){this.index_=i;break}i>0&&this.el_[i-1].classList.remove("md-nav__link--marked")}this.offset_=window.pageYOffset}},{key:"reset",value:function(){[].forEach.call(this.el_,function(e){e.classList.remove("md-nav__link--marked")})}},{key:"listen",value:function(){var e=this;["scroll","resize","orientationchange"].forEach(function(t){window.addEventListener(t,e.handler_,!1)}),this.update()}},{key:"unlisten",value:function(){var e=this;["scroll","resize","orientationchange"].forEach(function(t){window.removeEventListener(t,e.handler_,!1)}),this.reset()}}]),e}();t["default"]=o}]);