l-hammer/You-need-to-know-css

View on GitHub
libs/docsify-pagination.min.js

Summary

Maintainability
A
0 mins
Test Coverage
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e():"function"==typeof define&&define.amd?define(e):e()}(0,function(){"use strict";var n,o=(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);o.all,o.engine;try{var r=o}catch(n){r=o}var e=Element.prototype,a=e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector,l=function(n,e){if(!n||1!==n.nodeType)return!1;if(a)return a.call(n,e);for(var t=r.all(e,n.parentNode),i=0;i<t.length;++i)if(t[i]==n)return!0;return!1};try{var i=l}catch(n){i=l}var c=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],r=document.createElement("style");r.type="text/css","top"===t&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=n:r.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{text-decoration:none;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{margin-bottom:.35em;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")},s=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}}(),u=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},p={previousText:"PREVIOUS",nextText:"NEXT"},f="docsify-pagination-container";function d(n){return Array.prototype.slice.call(n)}function g(n){return d(n.children).find(function(n){return n.tagName&&"A"===n.tagName.toUpperCase()})}var m=function(){function e(n){t(this,e),n&&(this.hyperlink=g(n))}return s(e,[{key:"toJSON",value:function(){if(this.hyperlink)return{name:this.hyperlink.innerText,href:this.hyperlink.getAttribute("href")}}}]),e}();var h={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=u({},p,e.config.pagination||{});function i(){var n=o("."+f);n&&(n.innerHTML=h.inner(function(n){try{var t=n.route.path,e=d(o.all(".sidebar li a")).filter(function(n){return!l(n,".section-link")}),i=e.find(function(n){return n.getAttribute("href")==="#"+t}),r=d((c(i,"ul")||{}).children).filter(function(n){return"LI"===n.tagName.toUpperCase()}),a=r.findIndex(function(n){var e=g(n);return e&&e.getAttribute("href")==="#"+t});return{prev:new m(r[a-1]).toJSON(),next:new m(r[a+1]).toJSON()}}catch(n){return{}}}(e),t))}n.afterEach(function(n){return n+h.container()}),n.doneEach(function(){return i()})}].concat(window.$docsify.plugins||[])});