mirror of
https://github.com/zhigang1992/docsify.git
synced 2026-04-23 04:49:20 +08:00
[build] 4.8.0
This commit is contained in:
2
lib/plugins/disqus.min.js
vendored
2
lib/plugins/disqus.min.js
vendored
@@ -1 +1 @@
|
||||
!function(){var i=location.href.replace("/-/","/#/");i!==location.href&&(location.href=i);$docsify.plugins=[].concat(function(i,t){var e=Docsify.dom,o=t.config.disqus;if(!o)throw Error("$docsify.disqus is required");i.init(function(i){var t=e.create("script");t.async=!0,t.src="https://"+o+".disqus.com/embed.js",t.setAttribute("data-timestamp",Number(new Date)),e.appendTo(e.body,t)}),i.mounted(function(i){var o=e.create("div");o.id="disqus_thread";var n=e.getNode("#main");o.style="width: "+n.clientWidth+"px; margin: 0 auto 20px;",e.appendTo(e.find(".content"),o),window.disqus_config=function(){this.page.url=location.origin+"/-"+t.route.path,this.page.identifier=t.route.path,this.page.title=document.title}}),i.doneEach(function(i){void 0!==window.DISQUS&&window.DISQUS.reset({reload:!0,config:function(){this.page.url=location.origin+"/-"+t.route.path,this.page.identifier=t.route.path,this.page.title=document.title}})})},$docsify.plugins)}();
|
||||
!function(){var i=location.href.replace("/-/","/#/");i!==location.href&&(location.href=i),$docsify.plugins=[].concat(function(i,o){var n=Docsify.dom,e=o.config.disqus;if(!e)throw Error("$docsify.disqus is required");i.init(function(i){var t=n.create("script");t.async=!0,t.src="https://"+e+".disqus.com/embed.js",t.setAttribute("data-timestamp",Number(new Date)),n.appendTo(n.body,t)}),i.mounted(function(i){var t=n.create("div");t.id="disqus_thread";var e=n.getNode("#main");t.style="width: "+e.clientWidth+"px; margin: 0 auto 20px;",n.appendTo(n.find(".content"),t),window.disqus_config=function(){this.page.url=location.origin+"/-"+o.route.path,this.page.identifier=o.route.path,this.page.title=document.title}}),i.doneEach(function(i){void 0!==window.DISQUS&&window.DISQUS.reset({reload:!0,config:function(){this.page.url=location.origin+"/-"+o.route.path,this.page.identifier=o.route.path,this.page.title=document.title}})})},$docsify.plugins)}();
|
||||
|
||||
2
lib/plugins/emoji.min.js
vendored
2
lib/plugins/emoji.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ function handleExternalScript() {
|
||||
var newScript = document.createElement('script');
|
||||
|
||||
Array.prototype.slice.call(script.attributes).forEach(function (attribute) {
|
||||
newScript.setAttribute(attribute.name, attribute.value);
|
||||
newScript[attribute.name] = attribute.value;
|
||||
});
|
||||
|
||||
script.parentNode.insertBefore(newScript, script);
|
||||
|
||||
2
lib/plugins/external-script.min.js
vendored
2
lib/plugins/external-script.min.js
vendored
@@ -1 +1 @@
|
||||
!function(){function o(){for(var o=Docsify.dom.getNode("#main"),e=Docsify.dom.findAll(o,"script"),n=e.length;n--;){var i=e[n];if(i&&i.src){var t=document.createElement("script");Array.prototype.slice.call(i.attributes).forEach(function(o){t.setAttribute(o.name, o.value),i.parentNode.insertBefore(t,i),i.parentNode.removeChild(i)}}}window.$docsify.plugins=[].concat(function(e){e.doneEach(o)},window.$docsify.plugins)}();
|
||||
!function(){function e(){for(var o=Docsify.dom.getNode("#main"),e=Docsify.dom.findAll(o,"script"),n=e.length;n--;){var i=e[n];if(i&&i.src){var t=document.createElement("script");Array.prototype.slice.call(i.attributes).forEach(function(o){t[o.name]=o.value}),i.parentNode.insertBefore(t,i),i.parentNode.removeChild(i)}}}window.$docsify.plugins=[].concat(function(o){o.doneEach(e)},window.$docsify.plugins)}();
|
||||
|
||||
2
lib/plugins/front-matter.min.js
vendored
2
lib/plugins/front-matter.min.js
vendored
@@ -1 +1 @@
|
||||
!function(){var e=[],n=[],t=0,r={regLevel:new RegExp("^([\\s\\-]+)"),invalidLine:new RegExp("^\\-\\-\\-|^\\.\\.\\.|^\\s*#.*|^\\s*$"),dashesString:new RegExp('^\\s*\\"([^\\"]*)\\"\\s*$'),quotesString:new RegExp("^\\s*\\'([^\\']*)\\'\\s*$"),float:new RegExp("^[+-]?[0-9]+\\.[0-9]+(e[+-]?[0-9]+(\\.[0-9]+)?)?$"),integer:new RegExp("^[+-]?[0-9]+$"),array:new RegExp("\\[\\s*(.*)\\s*\\]"),map:new RegExp("\\{\\s*(.*)\\s*\\}"),key_value:new RegExp("([a-z0-9_-][ a-z0-9_-]*):( .+)","i"),single_key_value:new RegExp("^([a-z0-9_-][ a-z0-9_-]*):( .+?)$","i"),key:new RegExp("([a-z0-9_-][ a-z0-9_-]+):( .+)?","i"),item:new RegExp("^-\\s+"),trim:new RegExp("^\\s+|\\s+$"),comment:new RegExp("([^\\'\\\"#]+([\\'\\\"][^\\'\\\"]*[\\'\\\"])*)*(#.*)?")};function i(e){return{parent:null,length:0,level:e,lines:[],children:[],addChild:function(e){this.children.push(e),e.parent=this,++this.length}}}function l(e){var n=null;if("true"==(e=e.replace(r.trim,"")))return!0;if("false"==e)return!1;if(".NaN"==e)return Number.NaN;if("null"==e)return null;if(".inf"==e)return Number.POSITIVE_INFINITY;if("-.inf"==e)return Number.NEGATIVE_INFINITY;if(n=e.match(r.dashesString))return n[1];if(n=e.match(r.quotesString))return n[1];if(n=e.match(r.float))return parseFloat(n[0]);if(n=e.match(r.integer))return parseInt(n[0]);if(isNaN(n=Date.parse(e))){if(n=e.match(r.single_key_value)){return(u={})[n[1]]=l(n[2]),u}if(n=e.match(r.array)){for(var t=0,i=" ",u=[],a="",s=!1,f=0,h=n[1].length;f<h;++f){if("'"==(i=n[1][f])||'"'==i){if(!1===s){s=i,a+=i;continue}if("'"==i&&"'"==s||'"'==i&&'"'==s){s=!1,a+=i;continue}}else if(!1!==s||"["!=i&&"{"!=i)if(!1!==s||"]"!=i&&"}"!=i){if(!1===s&&0==t&&","==i){u.push(l(a)),a="";continue}}else--t;else++t;a+=i}return a.length>0&&u.push(l(a)),u}if(n=e.match(r.map)){for(t=0,i=" ",u=[],a="",s=!1,f=0,h=n[1].length;f<h;++f){if("'"==(i=n[1][f])||'"'==i){if(!1===s){s=i,a+=i;continue}if("'"==i&&"'"==s||'"'==i&&'"'==s){s=!1,a+=i;continue}}else if(!1!==s||"["!=i&&"{"!=i)if(!1!==s||"]"!=i&&"}"!=i){if(!1===s&&0==t&&","==i){u.push(a),a="";continue}}else--t;else++t;a+=i}a.length>0&&u.push(a);var o={};for(f=0,h=u.length;f<h;++f)(n=u[f].match(r.key_value))&&(o[n[1]]=l(n[2]));return o}return e}return new Date(n)}function u(e){for(var n=e.lines,t=e.children,r=[n.join(" ")],i=0,l=t.length;i<l;++i)r.push(u(t[i]));return r.join("\n")}function a(e){for(var n=e.lines,t=e.children,r=n.join("\n"),i=0,l=t.length;i<l;++i)r+=a(t[i]);return r}function s(t){return function t(i){for(var s=null,f={},h=null,o=null,c=null,p=-1,g=[],v=!0,d=0,m=i.length;d<m;++d)if(-1==p||p==i[d].level){g.push(d),p=i[d].level,h=i[d].lines,o=i[d].children,c=null;for(var w=0,E=h.length;w<E;++w){var x=h[w];if(s=x.match(r.key)){var b=s[1];if("-"==b[0]&&(b=b.replace(r.item,""),v&&(v=!1,void 0===f.length&&(f=[])),null!=c&&f.push(c),c={},v=!0),void 0!==s[2]){var y=s[2].replace(r.trim,"");if("&"==y[0]){var R=t(o);null!=c?c[b]=R:f[b]=R,n[y.substr(1)]=R}else if("|"==y[0])null!=c?c[b]=a(o.shift()):f[b]=a(o.shift());else if("*"==y[0]){var N=y.substr(1),_={};if(void 0===n[N])e.push("Reference '"+N+"' not found!");else{for(var $ in n[N])_[$]=n[N][$];null!=c?c[b]=_:f[b]=_}}else">"==y[0]?null!=c?c[b]=u(o.shift()):f[b]=u(o.shift()):null!=c?c[b]=l(y):f[b]=l(y)}else null!=c?c[b]=t(o):f[b]=t(o)}else{if(x.match(/^-\s*$/)){v&&(v=!1,void 0===f.length&&(f=[])),null!=c&&f.push(c),c={},v=!0;continue}if(s=x.match(/^-\s*(.*)/)){null!=c?c.push(l(s[1])):(v&&(v=!1,void 0===f.length&&(f=[])),f.push(l(s[1])));continue}}}null!=c&&(v&&(v=!1,void 0===f.length&&(f=[])),f.push(c))}for(d=g.length-1;d>=0;--d)i.splice.call(i,g[d],1);return f}(t.children)}function f(l){e=[],n=[],t=(new Date).getTime();var u=s(function(n){var t,l=r.regLevel,u=r.invalidLine,a=n.split("\n"),s=0,f=0,h=[],o=new i(-1),c=new i(0);o.addChild(c);var p=[],g="";h.push(c),p.push(s);for(var v=0,d=a.length;v<d;++v)if(!(g=a[v]).match(u)){if((s=(t=l.exec(g))?t[1].length:0)>f){var m=c;c=new i(s),m.addChild(c),h.push(c),p.push(s)}else if(s<f){for(var w=!1,E=p.length-1;E>=0;--E)if(p[E]==s){c=new i(s),h.push(c),p.push(s),null!=h[E].parent&&h[E].parent.addChild(c),w=!0;break}if(!w)return void e.push("Error: Invalid indentation at line "+v+": "+g)}c.lines.push(g.replace(r.trim,"")),f=s}return o}(function(e){var n,t=e.split("\n"),i=r.comment;for(var l in t)(n=t[l].match(i))&&void 0!==n[3]&&(t[l]=n[0].substr(0,n[0].length-n[3].length));return t.join("\n")}(l)));return t=(new Date).getTime()-t,u}var h=new RegExp("^(\\ufeff?(= yaml =|---)$([\\s\\S]*?)(?:\\2|\\.\\.\\.)$(?:\\n)?)","m");function o(e){var n=(e=e||"").split(/(\r?\n)/);return n[0]&&/= yaml =|---/.test(n[0])?function(e){var n=h.exec(e);if(!n)return{attributes:{},body:e};var t=n[n.length-1].replace(/^\s+|\s+$/g,""),r=f(t)||{},i=e.replace(n[0],"");return{attributes:r,body:i,frontmatter:t}}(e):{attributes:{},body:e}}$docsify.plugins=[].concat(function(e,n){e.beforeEach(function(e){var t=o(e),r=t.attributes,i=t.body;return n.frontmatter=r,i})},$docsify.plugins)}();
|
||||
!function(){var b=[],y=[],t=0,R={regLevel:new RegExp("^([\\s\\-]+)"),invalidLine:new RegExp("^\\-\\-\\-|^\\.\\.\\.|^\\s*#.*|^\\s*$"),dashesString:new RegExp('^\\s*\\"([^\\"]*)\\"\\s*$'),quotesString:new RegExp("^\\s*\\'([^\\']*)\\'\\s*$"),float:new RegExp("^[+-]?[0-9]+\\.[0-9]+(e[+-]?[0-9]+(\\.[0-9]+)?)?$"),integer:new RegExp("^[+-]?[0-9]+$"),array:new RegExp("\\[\\s*(.*)\\s*\\]"),map:new RegExp("\\{\\s*(.*)\\s*\\}"),key_value:new RegExp("([a-z0-9_-][ a-z0-9_-]*):( .+)","i"),single_key_value:new RegExp("^([a-z0-9_-][ a-z0-9_-]*):( .+?)$","i"),key:new RegExp("([a-z0-9_-][ a-z0-9_-]+):( .+)?","i"),item:new RegExp("^-\\s+"),trim:new RegExp("^\\s+|\\s+$"),comment:new RegExp("([^\\'\\\"#]+([\\'\\\"][^\\'\\\"]*[\\'\\\"])*)*(#.*)?")};function m(e){return{parent:null,length:0,level:e,lines:[],children:[],addChild:function(e){this.children.push(e),++(e.parent=this).length}}}function N(e){var n=null;if("true"==(e=e.replace(R.trim,"")))return!0;if("false"==e)return!1;if(".NaN"==e)return Number.NaN;if("null"==e)return null;if(".inf"==e)return Number.POSITIVE_INFINITY;if("-.inf"==e)return Number.NEGATIVE_INFINITY;if(n=e.match(R.dashesString))return n[1];if(n=e.match(R.quotesString))return n[1];if(n=e.match(R.float))return parseFloat(n[0]);if(n=e.match(R.integer))return parseInt(n[0]);if(isNaN(n=Date.parse(e))){if(n=e.match(R.single_key_value))return(i={})[n[1]]=N(n[2]),i;if(n=e.match(R.array)){for(var t=0,r=" ",i=[],l="",u=!1,a=0,s=n[1].length;a<s;++a){if("'"==(r=n[1][a])||'"'==r){if(!1===u){l+=u=r;continue}if("'"==r&&"'"==u||'"'==r&&'"'==u){u=!1,l+=r;continue}}else if(!1!==u||"["!=r&&"{"!=r)if(!1!==u||"]"!=r&&"}"!=r){if(!1===u&&0==t&&","==r){i.push(N(l)),l="";continue}}else--t;else++t;l+=r}return 0<l.length&&i.push(N(l)),i}if(n=e.match(R.map)){for(t=0,r=" ",i=[],l="",u=!1,a=0,s=n[1].length;a<s;++a){if("'"==(r=n[1][a])||'"'==r){if(!1===u){l+=u=r;continue}if("'"==r&&"'"==u||'"'==r&&'"'==u){u=!1,l+=r;continue}}else if(!1!==u||"["!=r&&"{"!=r)if(!1!==u||"]"!=r&&"}"!=r){if(!1===u&&0==t&&","==r){i.push(l),l="";continue}}else--t;else++t;l+=r}0<l.length&&i.push(l);var f={};for(a=0,s=i.length;a<s;++a)(n=i[a].match(R.key_value))&&(f[n[1]]=N(n[2]));return f}return e}return new Date(n)}function _(e){for(var n=e.lines,t=e.children,r=[n.join(" ")],i=0,l=t.length;i<l;++i)r.push(_(t[i]));return r.join("\n")}function $(e){for(var n=e.lines,t=e.children,r=n.join("\n"),i=0,l=t.length;i<l;++i)r+=$(t[i]);return r}function r(e){return function e(n){for(var t=null,r={},i=null,l=null,u=null,a=-1,s=[],f=!0,h=0,o=n.length;h<o;++h)if(-1==a||a==n[h].level){s.push(h),a=n[h].level,i=n[h].lines,l=n[h].children,u=null;for(var c=0,p=i.length;c<p;++c){var g=i[c];if(t=g.match(R.key)){var v=t[1];if("-"==v[0]&&(v=v.replace(R.item,""),f&&(f=!1,void 0===r.length&&(r=[])),null!=u&&r.push(u),u={},f=!0),void 0!==t[2]){var d=t[2].replace(R.trim,"");if("&"==d[0]){var m=e(l);null!=u?u[v]=m:r[v]=m,y[d.substr(1)]=m}else if("|"==d[0])null!=u?u[v]=$(l.shift()):r[v]=$(l.shift());else if("*"==d[0]){var w=d.substr(1),E={};if(void 0===y[w])b.push("Reference '"+w+"' not found!");else{for(var x in y[w])E[x]=y[w][x];null!=u?u[v]=E:r[v]=E}}else">"==d[0]?null!=u?u[v]=_(l.shift()):r[v]=_(l.shift()):null!=u?u[v]=N(d):r[v]=N(d)}else null!=u?u[v]=e(l):r[v]=e(l)}else{if(g.match(/^-\s*$/)){f&&(f=!1,void 0===r.length&&(r=[])),null!=u&&r.push(u),u={},f=!0;continue}if(t=g.match(/^-\s*(.*)/)){null!=u?u.push(N(t[1])):(f&&(f=!1,void 0===r.length&&(r=[])),r.push(N(t[1])));continue}}}null!=u&&(f&&(f=!1,void 0===r.length&&(r=[])),r.push(u))}for(h=s.length-1;0<=h;--h)n.splice.call(n,s[h],1);return r}(e.children)}function l(e){b=[],y=[],t=(new Date).getTime();var n=r(function(e){var n,t=R.regLevel,r=R.invalidLine,i=e.split("\n"),l=0,u=0,a=[],s=new m(-1),f=new m(0);s.addChild(f);var h=[],o="";a.push(f),h.push(l);for(var c=0,p=i.length;c<p;++c)if(!(o=i[c]).match(r)){if(u<(l=(n=t.exec(o))?n[1].length:0)){var g=f;f=new m(l),g.addChild(f),a.push(f),h.push(l)}else if(l<u){for(var v=!1,d=h.length-1;0<=d;--d)if(h[d]==l){f=new m(l),a.push(f),h.push(l),null!=a[d].parent&&a[d].parent.addChild(f),v=!0;break}if(!v)return void b.push("Error: Invalid indentation at line "+c+": "+o)}f.lines.push(o.replace(R.trim,"")),u=l}return s}(function(e){var n,t=e.split("\n"),r=R.comment;for(var i in t)(n=t[i].match(r))&&void 0!==n[3]&&(t[i]=n[0].substr(0,n[0].length-n[3].length));return t.join("\n")}(e)));return t=(new Date).getTime()-t,n}var u=new RegExp("^(\\ufeff?(= yaml =|---)$([\\s\\S]*?)(?:\\2|\\.\\.\\.)$(?:\\n)?)","m");function a(e){var n=(e=e||"").split(/(\r?\n)/);return n[0]&&/= yaml =|---/.test(n[0])?function(e){var n=u.exec(e);if(!n)return{attributes:{},body:e};var t=n[n.length-1].replace(/^\s+|\s+$/g,""),r=l(t)||{},i=e.replace(n[0],"");return{attributes:r,body:i,frontmatter:t}}(e):{attributes:{},body:e}}$docsify.plugins=[].concat(function(e,i){e.beforeEach(function(e){var n=a(e),t=n.attributes,r=n.body;return i.frontmatter=t,r})},$docsify.plugins)}();
|
||||
|
||||
2
lib/plugins/ga.min.js
vendored
2
lib/plugins/ga.min.js
vendored
@@ -1 +1 @@
|
||||
!function(){function n(n){!function(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",n,"auto")}function o(){window.ga||n($docsify.ga),window.ga("set","page",location.hash),window.ga("send","pageview")}$docsify.plugins=[].concat(function(n){$docsify.ga?n.beforeEach(o):console.error("[Docsify] ga is required.")},$docsify.plugins)}();
|
||||
!function(){function n(n){var o;(o=document.createElement("script")).async=!0,o.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(o),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",n,"auto")}function o(){window.ga||n($docsify.ga),window.ga("set","page",location.hash),window.ga("send","pageview")}$docsify.plugins=[].concat(function(n){$docsify.ga?n.beforeEach(o):console.error("[Docsify] ga is required.")},$docsify.plugins)}();
|
||||
|
||||
2
lib/plugins/gitalk.min.js
vendored
2
lib/plugins/gitalk.min.js
vendored
@@ -1 +1 @@
|
||||
!function(){$docsify.plugins=[].concat(function(n){var t=Docsify.dom;n.mounted(function(n){var i=t.create("div");i.id="gitalk-container";var e=t.getNode("#main");i.style="width: "+e.clientWidth+"px; margin: 0 auto 20px;",t.appendTo(t.find(".content"),i);var o=t.create("script");o.textContent="gitalk.render('gitalk-container')",t.appendTo(t.body,o)})},$docsify.plugins)}();
|
||||
$docsify.plugins=[].concat(function(t){var a=Docsify.dom;t.mounted(function(t){var n=a.create("div");n.id="gitalk-container";var i=a.getNode("#main");n.style="width: "+i.clientWidth+"px; margin: 0 auto 20px;",a.appendTo(a.find(".content"),n);var e=a.create("script");e.textContent="gitalk.render('gitalk-container')",a.appendTo(a.body,e)})},$docsify.plugins);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(function () {
|
||||
var INDEXS = {};
|
||||
var helper;
|
||||
|
||||
function escapeHtml(string) {
|
||||
var entityMap = {
|
||||
@@ -18,7 +17,7 @@ function escapeHtml(string) {
|
||||
function getAllPaths(router) {
|
||||
var paths = [];
|
||||
|
||||
helper.dom.findAll('a:not([data-nosearch])').forEach(function (node) {
|
||||
document.querySelectorAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(function (node) {
|
||||
var href = node.href;
|
||||
var originHref = node.getAttribute('href');
|
||||
var path = router.parse(href).path;
|
||||
@@ -154,8 +153,6 @@ function search(query) {
|
||||
}
|
||||
|
||||
function init$1(config, vm) {
|
||||
helper = Docsify;
|
||||
|
||||
var isAuto = config.paths === 'auto';
|
||||
var isExpired = localStorage.getItem('docsify.search.expires') < Date.now();
|
||||
|
||||
@@ -176,7 +173,7 @@ function init$1(config, vm) {
|
||||
return count++
|
||||
}
|
||||
|
||||
helper
|
||||
Docsify
|
||||
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
|
||||
.then(function (result) {
|
||||
INDEXS[path] = genIndex(path, result, vm.router, config.depth);
|
||||
@@ -186,14 +183,15 @@ function init$1(config, vm) {
|
||||
}
|
||||
|
||||
var NO_DATA_TEXT = '';
|
||||
var options;
|
||||
|
||||
function style() {
|
||||
var code = "\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .input-wrap {\n display: flex;\n align-items: center;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 0 7px;\n line-height: 36px;\n font-size: 14px;\n}\n\n.search input::-webkit-search-decoration,\n.search input::-webkit-search-cancel-button,\n.search input {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n.search .clear-button {\n width: 36px;\n text-align: right;\n display: none;\n}\n\n.search .clear-button.show {\n display: block;\n}\n\n.search .clear-button svg {\n transform: scale(.5);\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}";
|
||||
var code = "\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .input-wrap {\n display: flex;\n align-items: center;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 0 7px;\n line-height: 36px;\n font-size: 14px;\n}\n\n.search input::-webkit-search-decoration,\n.search input::-webkit-search-cancel-button,\n.search input {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n.search .clear-button {\n width: 36px;\n text-align: right;\n display: none;\n}\n\n.search .clear-button.show {\n display: block;\n}\n\n.search .clear-button svg {\n transform: scale(.5);\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}\n\n.app-name.hide, .sidebar-nav.hide {\n display: none;\n}";
|
||||
|
||||
Docsify.dom.style(code);
|
||||
}
|
||||
|
||||
function tpl(opts, defaultValue) {
|
||||
function tpl(defaultValue) {
|
||||
if ( defaultValue === void 0 ) defaultValue = '';
|
||||
|
||||
var html =
|
||||
@@ -209,11 +207,18 @@ function doSearch(value) {
|
||||
var $search = Docsify.dom.find('div.search');
|
||||
var $panel = Docsify.dom.find($search, '.results-panel');
|
||||
var $clearBtn = Docsify.dom.find($search, '.clear-button');
|
||||
var $sidebarNav = Docsify.dom.find('.sidebar-nav');
|
||||
var $appName = Docsify.dom.find('.app-name');
|
||||
|
||||
if (!value) {
|
||||
$panel.classList.remove('show');
|
||||
$clearBtn.classList.remove('show');
|
||||
$panel.innerHTML = '';
|
||||
|
||||
if (options.hideOtherSidebarContent) {
|
||||
$sidebarNav.classList.remove('hide');
|
||||
$appName.classList.remove('hide');
|
||||
}
|
||||
return
|
||||
}
|
||||
var matchs = search(value);
|
||||
@@ -226,6 +231,10 @@ function doSearch(value) {
|
||||
$panel.classList.add('show');
|
||||
$clearBtn.classList.add('show');
|
||||
$panel.innerHTML = html || ("<p class=\"empty\">" + NO_DATA_TEXT + "</p>");
|
||||
if (options.hideOtherSidebarContent) {
|
||||
$sidebarNav.classList.add('hide');
|
||||
$appName.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
function bindEvents() {
|
||||
@@ -276,16 +285,22 @@ function updateNoData(text, path) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateOptions(opts) {
|
||||
options = opts;
|
||||
}
|
||||
|
||||
function init(opts, vm) {
|
||||
var keywords = vm.router.parse().query.s;
|
||||
|
||||
updateOptions(opts);
|
||||
style();
|
||||
tpl(opts, keywords);
|
||||
tpl(keywords);
|
||||
bindEvents();
|
||||
keywords && setTimeout(function (_) { return doSearch(keywords); }, 500);
|
||||
}
|
||||
|
||||
function update(opts, vm) {
|
||||
updateOptions(opts);
|
||||
updatePlaceholder(opts.placeholder, vm.route.path);
|
||||
updateNoData(opts.noData, vm.route.path);
|
||||
}
|
||||
@@ -295,7 +310,8 @@ var CONFIG = {
|
||||
noData: 'No Results!',
|
||||
paths: 'auto',
|
||||
depth: 2,
|
||||
maxAge: 86400000 // 1 day
|
||||
maxAge: 86400000, // 1 day
|
||||
hideOtherSidebarContent: false
|
||||
};
|
||||
|
||||
var install = function (hook, vm) {
|
||||
@@ -310,6 +326,7 @@ var install = function (hook, vm) {
|
||||
CONFIG.placeholder = opts.placeholder || CONFIG.placeholder;
|
||||
CONFIG.noData = opts.noData || CONFIG.noData;
|
||||
CONFIG.depth = opts.depth || CONFIG.depth;
|
||||
CONFIG.hideOtherSidebarContent = opts.hideOtherSidebarContent || CONFIG.hideOtherSidebarContent;
|
||||
}
|
||||
|
||||
var isAuto = CONFIG.paths === 'auto';
|
||||
|
||||
2
lib/plugins/search.min.js
vendored
2
lib/plugins/search.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
lib/plugins/zoom-image.min.js
vendored
2
lib/plugins/zoom-image.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user