vufindtutorialde/docsify/docsify-pagination.min.js

1 line
5.4 KiB
JavaScript

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e():"function"==typeof define&&define.amd?define(e):e()}(0,function(){"use strict";var n,c=(function(n,e){function t(n,e){return e.querySelector(n)}(e=n.exports=function(n,e){return t(n,e=e||document)}).all=function(n,e){return(e=e||document).querySelectorAll(n)},e.engine=function(n){if(!n.one)throw new Error(".one callback required");if(!n.all)throw new Error(".all callback required");return t=n.one,e.all=n.all,e}}(n={exports:{}},n.exports),n.exports);c.all,c.engine;try{var o=c}catch(n){o=c}var e=Element.prototype,a=e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector,s=function(n,e){if(!n||1!==n.nodeType)return!1;if(a)return a.call(n,e);for(var t=o.all(e,n.parentNode),i=0;i<t.length;++i)if(t[i]==n)return!0;return!1};try{var i=s}catch(n){i=s}var p=function(n,e,t){t=t||document.documentElement;for(;n&&n!==t;){if(i(n,e))return n;n=n.parentNode}return i(n,e)?n:null};!function(n,e){void 0===e&&(e={});var t=e.insertAt;if(n&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=n:o.appendChild(document.createTextNode(n))}}(".docsify-pagination-container{display:flex;flex-wrap:wrap;justify-content:space-between;overflow:hidden;margin:5em 0 1em;border-top:1px solid rgba(0,0,0,.07)}.pagination-item{margin-top:2.5em}.pagination-item a,.pagination-item a:hover{text-decoration:none}.pagination-item a{color:currentColor}.pagination-item a:hover .pagination-item-title{text-decoration:underline}.pagination-item:not(:last-child) a .pagination-item-label,.pagination-item:not(:last-child) a .pagination-item-title{opacity:.3;transition:all .2s}.pagination-item:last-child .pagination-item-label,.pagination-item:not(:last-child) a:hover .pagination-item-label{opacity:.6}.pagination-item:not(:last-child) a:hover .pagination-item-title{opacity:1}.pagination-item-label{font-size:.8em}.pagination-item-label>*{line-height:1;vertical-align:middle}.pagination-item-label svg{height:.8em;width:auto;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1px}.pagination-item--next{margin-left:auto;text-align:right}.pagination-item--next svg{margin-left:.5em}.pagination-item--previous svg{margin-right:.5em}.pagination-item-title{font-size:1.6em}");var t=function(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")},r=function(){function i(n,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}return function(n,e,t){return e&&i(n.prototype,e),t&&i(n,t),n}}(),l=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},u={previousText:"PREVIOUS",nextText:"NEXT",crossChapter:!1},f="docsify-pagination-container";function d(n){return Array.prototype.slice.call(n)}function g(n){return n.href?n:c("a",n)}function m(e,n){return 1===arguments.length?function(n){return m(e,n)}:decodeURIComponent(n.getAttribute("href").split("?")[0])===decodeURIComponent("#"+e)}var h=function(){function e(n){t(this,e),n&&(this.hyperlink=g(n))}return r(e,[{key:"toJSON",value:function(){if(this.hyperlink)return{name:this.hyperlink.innerText,href:this.hyperlink.getAttribute("href")}}}]),e}();var v={container:function(){return'<div class="'+f+'"></div>'},inner:function(n,e){return[n.prev&&'\n <div class="pagination-item pagination-item--previous">\n <a href="'+n.prev.href+'">\n <div class="pagination-item-label">\n <svg class="icon" width="10" height="16" viewBox="0 0 10 16" xmlns="http://www.w3.org/2000/svg">\n <polyline fill="none" vector-effect="non-scaling-stroke" points="8,2 2,8 8,14"/>\n </svg>\n <span>'+e.previousText+'</span>\n </div>\n <div class="pagination-item-title">'+n.prev.name+"</div>\n </a>\n </div>\n ",n.next&&'\n <div class="pagination-item pagination-item--next">\n <a href="'+n.next.href+'">\n <div class="pagination-item-label">\n <span>'+e.nextText+'</span>\n <svg width="10" height="16" viewBox="0 0 10 16" xmlns="http://www.w3.org/2000/svg">\n <polyline fill="none" vector-effect="non-scaling-stroke" points="2,2 8,8 2,14"/>\n </svg>\n </div>\n <div class="pagination-item-title">'+n.next.name+"</div>\n </a>\n </div>\n "].filter(Boolean).join("")}};window.$docsify=window.$docsify||{},window.$docsify.plugins=[function(n,e){var t=l({},u,e.config.pagination||{});function i(){var n=c("."+f);n&&(n.innerHTML=v.inner(function(n,e){try{var t=n.route.path,i=d(c.all(".sidebar li a")).filter(function(n){return!s(n,".section-link")}),o=i.find(m(t)),a=d((p(o,"ul")||{}).children).filter(function(n){return"LI"===n.tagName.toUpperCase()}),r=e?i.findIndex(m(t)):a.findIndex(function(n){var e=g(n);return e&&m(t,e)}),l=e?i:a;return{prev:new h(l[r-1]).toJSON(),next:new h(l[r+1]).toJSON()}}catch(n){return{}}}(e,t.crossChapter),t))}n.afterEach(function(n){return n+v.container()}),n.doneEach(function(){return i()})}].concat(window.$docsify.plugins||[])});