mirror of
https://gitee.com/tawords/tawords-docs
synced 2025-01-10 11:28:13 +08:00
CSS JS文件本地化提高加载速度
This commit is contained in:
parent
6776edbd16
commit
6793ff7a27
@ -6,7 +6,10 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="description" content="背Ta单词 官方文档">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
|
||||
|
||||
<!-- 主题样式 -->
|
||||
<link rel="stylesheet" href="static/docsify/lib/themes/vue.css">
|
||||
|
||||
<link rel="shortcut icon" href="favicon.ico" />
|
||||
|
||||
</head>
|
||||
@ -152,7 +155,7 @@
|
||||
}
|
||||
</script>
|
||||
<!-- Docsify v4 -->
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
|
||||
<script src="static/docsify/docsify@4.js"></script>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<script>
|
||||
@ -171,23 +174,31 @@
|
||||
|
||||
<!-- plugins -->
|
||||
<!-- 搜索 -->
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
|
||||
<!-- <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script> -->
|
||||
<script src="static/docsify/lib/plugins/search.min.js"></script>
|
||||
|
||||
<!-- 复制到剪贴板 -->
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"></script>
|
||||
<!-- <script src="//cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"></script> -->
|
||||
<script src="static/docsify/lib/plugins/docsify-copy-code.min.js"></script>
|
||||
|
||||
<!-- 字数统计 -->
|
||||
<script src="//unpkg.com/docsify-count/dist/countable.js"></script>
|
||||
<!-- <script src="//unpkg.com/docsify-count/dist/countable.js"></script> -->
|
||||
<!-- <script src="static/docsify/lib/plugins/docsify-count@1.1.0/countable.js"></script> -->
|
||||
<script src="static/docsify/lib/plugins/docsify-count@1.1.0/countable.min.js"></script>
|
||||
|
||||
<!-- footer plugin -- latest version -->
|
||||
<script src="//cdn.jsdelivr.net/npm/@alertbox/docsify-footer/dist/docsify-footer.min.js"></script>
|
||||
<!-- <script src="//cdn.jsdelivr.net/npm/@alertbox/docsify-footer/dist/docsify-footer.min.js"></script> -->
|
||||
<script src="static/docsify/lib/plugins/docsify-footer.min.js"></script>
|
||||
|
||||
<!-- 上一章 下一章 -->
|
||||
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
|
||||
<!-- <script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script> -->
|
||||
<script src="static/docsify/lib/plugins/docsify-pagination@2.6.1/docsify-pagination.min.js"></script>
|
||||
|
||||
<!-- drawio -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/docsify-drawio/viewer.min.js"></script>
|
||||
<script src='https://cdn.jsdelivr.net/npm/docsify-drawio/drawio.js'></script>
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/docsify-drawio/viewer.min.js"></script> -->
|
||||
<script src="static/docsify/lib/plugins/docsify-drawio/viewer.min.js"></script>
|
||||
<!-- <script src='https://cdn.jsdelivr.net/npm/docsify-drawio/drawio.js'></script> -->
|
||||
<script src='static/docsify/lib/plugins/docsify-drawio/drawio.js'></script>
|
||||
|
||||
|
||||
<!-- docsify-tabs (latest v1.x.x) -->
|
||||
@ -228,7 +239,8 @@
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify-dark-mode@latest/dist/index.min.js"></script> -->
|
||||
|
||||
<!-- 阅读进度条插件 -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/docsify-progress@latest/dist/progress.min.js"></script>
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/docsify-progress@latest/dist/progress.min.js"></script> -->
|
||||
<script src="static/docsify/lib/plugins/docsify-progress@1.0.3/progress.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
1
docs/static/docsify/docsify@4.js
vendored
Normal file
1
docs/static/docsify/docsify@4.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9
docs/static/docsify/lib/plugins/docsify-copy-code.min.js
vendored
Normal file
9
docs/static/docsify/lib/plugins/docsify-copy-code.min.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* docsify-copy-code
|
||||
* v2.1.1
|
||||
* https://github.com/jperasmus/docsify-copy-code
|
||||
* (c) 2017-2020 JP Erasmus <jperasmus11@gmail.com>
|
||||
* MIT license
|
||||
*/
|
||||
!function(){"use strict";function s(o){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o})(o)}!function(o,e){void 0===e&&(e={});var t=e.insertAt;if(o&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.type="text/css","top"===t&&n.firstChild?n.insertBefore(c,n.firstChild):n.appendChild(c),c.styleSheet?c.styleSheet.cssText=o:c.appendChild(document.createTextNode(o))}}(".docsify-copy-code-button,.docsify-copy-code-button span{cursor:pointer;transition:all .25s ease}.docsify-copy-code-button{position:absolute;z-index:1;top:0;right:0;overflow:visible;padding:.65em .8em;border:0;border-radius:0;outline:0;font-size:1em;background:grey;background:var(--theme-color,grey);color:#fff;opacity:0}.docsify-copy-code-button span{border-radius:3px;background:inherit;pointer-events:none}.docsify-copy-code-button .error,.docsify-copy-code-button .success{position:absolute;z-index:-100;top:50%;right:0;padding:.5em .65em;font-size:.825em;opacity:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.docsify-copy-code-button.error .error,.docsify-copy-code-button.success .success{right:100%;opacity:1;-webkit-transform:translate(-115%,-50%);transform:translate(-115%,-50%)}.docsify-copy-code-button:focus,pre:hover .docsify-copy-code-button{opacity:1}"),document.querySelector('link[href*="docsify-copy-code"]')&&console.warn("[Deprecation] Link to external docsify-copy-code stylesheet is no longer necessary."),window.DocsifyCopyCodePlugin={init:function(){return function(o,e){o.ready(function(){console.warn("[Deprecation] Manually initializing docsify-copy-code using window.DocsifyCopyCodePlugin.init() is no longer necessary.")})}}},window.$docsify=window.$docsify||{},window.$docsify.plugins=[function(o,r){o.doneEach(function(){var o=Array.apply(null,document.querySelectorAll("pre[data-lang]")),c={buttonText:"Copy to clipboard",errorText:"Error",successText:"Copied"};r.config.copyCode&&Object.keys(c).forEach(function(t){var n=r.config.copyCode[t];"string"==typeof n?c[t]=n:"object"===s(n)&&Object.keys(n).some(function(o){var e=-1<location.href.indexOf(o);return c[t]=e?n[o]:c[t],e})});var e=['<button class="docsify-copy-code-button">','<span class="label">'.concat(c.buttonText,"</span>"),'<span class="error">'.concat(c.errorText,"</span>"),'<span class="success">'.concat(c.successText,"</span>"),"</button>"].join("");o.forEach(function(o){o.insertAdjacentHTML("beforeend",e)})}),o.mounted(function(){document.querySelector(".content").addEventListener("click",function(o){if(o.target.classList.contains("docsify-copy-code-button")){var e="BUTTON"===o.target.tagName?o.target:o.target.parentNode,t=document.createRange(),n=e.parentNode.querySelector("code"),c=window.getSelection();t.selectNode(n),c.removeAllRanges(),c.addRange(t);try{document.execCommand("copy")&&(e.classList.add("success"),setTimeout(function(){e.classList.remove("success")},1e3))}catch(o){console.error("docsify-copy-code: ".concat(o)),e.classList.add("error"),setTimeout(function(){e.classList.remove("error")},1e3)}"function"==typeof(c=window.getSelection()).removeRange?c.removeRange(t):"function"==typeof c.removeAllRanges&&c.removeAllRanges()}})})}].concat(window.$docsify.plugins||[])}();
|
||||
//# sourceMappingURL=docsify-copy-code.min.js.map
|
60
docs/static/docsify/lib/plugins/docsify-count@1.1.0/countable.js
vendored
Normal file
60
docs/static/docsify/lib/plugins/docsify-count@1.1.0/countable.js
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
//default values
|
||||
var defaultOptions = {
|
||||
countable: true,
|
||||
position: "top",
|
||||
margin: "10px",
|
||||
float: "right",
|
||||
fontsize: "0.9em",
|
||||
color: "rgb(90,90,90)",
|
||||
language: "english",
|
||||
isExpected: true,
|
||||
}
|
||||
|
||||
// Docsify plugin functions
|
||||
function plugin(hook, vm) {
|
||||
if (!defaultOptions.countable) {
|
||||
return
|
||||
}
|
||||
let wordsCount
|
||||
hook.beforeEach(function (content) {
|
||||
// Match regex every time you start parsing .md
|
||||
wordsCount = content.match(/([\u4e00-\u9fa5]+?|[a-zA-Z0-9]+)/g).length
|
||||
return content
|
||||
})
|
||||
hook.afterEach(function (html, next) {
|
||||
let str = wordsCount + " words"
|
||||
let readTime = Math.ceil(wordsCount / 400) + " min"
|
||||
//Determine whether to use the Chinese style according to the attribute "language"
|
||||
if (defaultOptions.language === "chinese") {
|
||||
str = wordsCount + " 字"
|
||||
readTime = Math.ceil(wordsCount / 400) + " 分钟"
|
||||
}
|
||||
|
||||
//add html string
|
||||
next(
|
||||
`
|
||||
${defaultOptions.position === "bottom" ? html : ""}
|
||||
<div style="margin-${defaultOptions.position ? "bottom" : "top"}: ${
|
||||
defaultOptions.margin
|
||||
};">
|
||||
<span style="
|
||||
float: ${defaultOptions.float === "right" ? "right" : "left"};
|
||||
font-size: ${defaultOptions.fontsize};
|
||||
color:${defaultOptions.color};">
|
||||
${str}
|
||||
${defaultOptions.isExpected ? ` | ${readTime}` : ""}
|
||||
</span>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
${defaultOptions.position !== "bottom" ? html : ""}
|
||||
`
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
// Docsify plugin options
|
||||
window.$docsify["count"] = Object.assign(
|
||||
defaultOptions,
|
||||
window.$docsify["count"]
|
||||
)
|
||||
window.$docsify.plugins = [].concat(plugin, window.$docsify.plugins)
|
1
docs/static/docsify/lib/plugins/docsify-count@1.1.0/countable.min.js
vendored
Normal file
1
docs/static/docsify/lib/plugins/docsify-count@1.1.0/countable.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var defaultOptions={countable:!0,position:"top",margin:"10px",float:"right",fontsize:"0.9em",color:"rgb(90,90,90)",language:"english",isExpected:!0};function plugin(t,n){if(!defaultOptions.countable)return;let o;t.beforeEach(function(t){return o=t.match(/([\u4e00-\u9fa5]+?|[a-zA-Z0-9]+)/g).length,t}),t.afterEach(function(t,n){let i=o+" words",e=Math.ceil(o/400)+" min";"chinese"===defaultOptions.language&&(i=o+" 字",e=Math.ceil(o/400)+" 分钟"),n(`\n ${"bottom"===defaultOptions.position?t:""}\n <div style="margin-${defaultOptions.position?"bottom":"top"}: ${defaultOptions.margin};">\n <span style="\n float: ${"right"===defaultOptions.float?"right":"left"};\n font-size: ${defaultOptions.fontsize};\n color:${defaultOptions.color};">\n ${i}\n ${defaultOptions.isExpected?` | ${e}`:""}\n </span>\n <div style="clear: both"></div>\n </div>\n ${"bottom"!==defaultOptions.position?t:""}\n `)})}window.$docsify.count=Object.assign(defaultOptions,window.$docsify.count),window.$docsify.plugins=[].concat(plugin,window.$docsify.plugins);
|
51
docs/static/docsify/lib/plugins/docsify-drawio/drawio.js
vendored
Normal file
51
docs/static/docsify/lib/plugins/docsify-drawio/drawio.js
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
(function () {
|
||||
// 下面是解析的部分
|
||||
const chatMap = {
|
||||
"&": "&",
|
||||
"'": "'",
|
||||
"`": "`",
|
||||
'"': """,
|
||||
"<": "<",
|
||||
">": ">",
|
||||
};
|
||||
const escapeHTML = (string) => {
|
||||
if (typeof string !== "string") return string;
|
||||
return string.replace(/[&'`"<>]/g, function (match) {
|
||||
return chatMap[match];
|
||||
});
|
||||
};
|
||||
window.drawioConverter = function (xml, idx = new Date().getTime()) {
|
||||
let mxGraphData = {
|
||||
editable: false,
|
||||
highlight: "#0000ff",
|
||||
nav: false,
|
||||
toolbar: null,
|
||||
edit: null,
|
||||
resize: true,
|
||||
lightbox: "open",
|
||||
// "check-visible-state": false,
|
||||
// "auto-fit": false,
|
||||
// move: false,
|
||||
xml,
|
||||
};
|
||||
|
||||
const json = JSON.stringify(mxGraphData);
|
||||
|
||||
return `<div class="drawio-viewer-index-${idx}">
|
||||
<div class="mxgraph" style="max-width: 100%; border: 1px solid transparent" data-mxgraph="${escapeHTML(json)}"></div>
|
||||
</div>
|
||||
`;
|
||||
};
|
||||
|
||||
// 下面是插件加载部分
|
||||
|
||||
const install = function (hook) {
|
||||
hook.doneEach((hook) => {
|
||||
try {
|
||||
window.GraphViewer.processElements();
|
||||
} catch {}
|
||||
});
|
||||
};
|
||||
|
||||
window.$docsify.plugins = [].concat(install, $docsify.plugins);
|
||||
})();
|
3963
docs/static/docsify/lib/plugins/docsify-drawio/viewer.min.js
vendored
Normal file
3963
docs/static/docsify/lib/plugins/docsify-drawio/viewer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
docs/static/docsify/lib/plugins/docsify-footer.min.js
vendored
Normal file
4
docs/static/docsify/lib/plugins/docsify-footer.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"WDEB":[function(require,module,exports) {
|
||||
!function(e,o,t){o.plugins=[].concat(function(o,t){var n=t.config,c=n.loadFooter,r=n.ext,i=n.requestHeaders;if(c){var f=!0===c?"_footer"+r:c;o.mounted(function(o){var n=t.router.getFile(f),c=e.dom.getNode("article");e.get(n,!1,i).then(function(o){var n=t.compiler.compile(o),r=e.dom.create("footer",n);e.dom.appendTo(c,r),t._lifecycle.afterEach(function(e){return e+n})})})}},o.plugins)}(Docsify,$docsify);
|
||||
},{}]},{},["WDEB"], null)
|
||||
//# sourceMappingURL=/docsify-footer.min.js.map
|
1
docs/static/docsify/lib/plugins/docsify-pagination@2.6.1/docsify-pagination.min.js
vendored
Normal file
1
docs/static/docsify/lib/plugins/docsify-pagination@2.6.1/docsify-pagination.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
70
docs/static/docsify/lib/plugins/docsify-progress@1.0.3/progress.js
vendored
Normal file
70
docs/static/docsify/lib/plugins/docsify-progress@1.0.3/progress.js
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
function plugin(hook, vm) {
|
||||
let marginTop
|
||||
hook.mounted(function () {
|
||||
const content = document.getElementsByClassName("content")[0]
|
||||
marginTop = parseFloat(
|
||||
window.getComputedStyle(content).paddingTop.replace("px", "")
|
||||
)
|
||||
|
||||
let insertDOM = `
|
||||
<div style="position: fixed; width: 100%; z-index: 999; height: ${
|
||||
window.$docsify["progress"].height
|
||||
};
|
||||
${
|
||||
window.$docsify["progress"].position === "top"
|
||||
? "top: 0;"
|
||||
: "bottom: 0;"
|
||||
}">
|
||||
<div id="progress-display" style="background-color: ${
|
||||
window.$docsify["progress"].color
|
||||
}; width: 0; border-radius: 2px; height: ${
|
||||
window.$docsify["progress"].height
|
||||
}; transition: width 0.3s;"></div>
|
||||
</div>
|
||||
`
|
||||
const mainDOM = document.getElementsByTagName("body")[0]
|
||||
mainDOM.innerHTML = mainDOM.innerHTML + insertDOM
|
||||
|
||||
function switcher() {
|
||||
const body = document.getElementsByTagName("body")[0]
|
||||
if (!body.classList.contains("close")) {
|
||||
body.classList.add("close")
|
||||
} else {
|
||||
body.classList.remove("close")
|
||||
}
|
||||
}
|
||||
|
||||
const btn = document.querySelector("div.sidebar-toggle-button")
|
||||
btn.addEventListener("click", function (e) {
|
||||
e.stopPropagation()
|
||||
switcher()
|
||||
})
|
||||
})
|
||||
hook.ready(function () {
|
||||
window.addEventListener("scroll", function (e) {
|
||||
let totalHeight =
|
||||
marginTop +
|
||||
parseFloat(
|
||||
window
|
||||
.getComputedStyle(document.getElementById("main"))
|
||||
.height.replace("px", "")
|
||||
)
|
||||
let scrollTop =
|
||||
document.body.scrollTop + document.documentElement.scrollTop
|
||||
let remain = totalHeight - document.body.offsetHeight
|
||||
document.getElementById("progress-display").style.width =
|
||||
Math.ceil((scrollTop / remain) * 100) + "%"
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Docsify plugin options
|
||||
window.$docsify["progress"] = Object.assign(
|
||||
{
|
||||
position: "top",
|
||||
color: "var(--theme-color,#42b983)",
|
||||
height: "3px",
|
||||
},
|
||||
window.$docsify["progress"]
|
||||
)
|
||||
window.$docsify.plugins = [].concat(plugin, window.$docsify.plugins)
|
1
docs/static/docsify/lib/plugins/search.min.js
vendored
Normal file
1
docs/static/docsify/lib/plugins/search.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
docs/static/docsify/lib/themes/vue.css
vendored
Normal file
1
docs/static/docsify/lib/themes/vue.css
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user