bump: 3.4.4

This commit is contained in:
qingwei.li 2017-03-17 17:12:41 +08:00
parent 2d6a51b057
commit 1edcd63cdb
3 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,10 @@
# 3.4.4 / 2017-03-17
* fix(search): fix input style
* fix search plugin match bug
# 3.4.3 / 2017-03-16 # 3.4.3 / 2017-03-16
==================
* Add ability to ignore headers when generating toc ([#127](https://github.com/QingWei-Li/docsify/issues/127) [@christopherwk210](https://github.com/christopherwk210)) * Add ability to ignore headers when generating toc ([#127](https://github.com/QingWei-Li/docsify/issues/127) [@christopherwk210](https://github.com/christopherwk210))
* fix external-script not inserting script at right place [@Leopoldthecoder](https://github.com/Leopoldthecoder) * fix external-script not inserting script at right place [@Leopoldthecoder](https://github.com/Leopoldthecoder)

View File

@ -79,7 +79,7 @@ function search (keywords) {
data = data.concat(Object.keys(INDEXS[key]).map(function (page) { return INDEXS[key][page]; })); data = data.concat(Object.keys(INDEXS[key]).map(function (page) { return INDEXS[key][page]; }));
}); });
keywords = keywords.trim().split(/[\s\-\\\/]+/); keywords = [].concat(keywords, keywords.trim().split(/[\s\-\\\/]+/));
var loop = function ( i ) { var loop = function ( i ) {
var post = data[i]; var post = data[i];
@ -173,7 +173,7 @@ var dom;
var NO_DATA_TEXT = ''; var NO_DATA_TEXT = '';
function style () { 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 .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: 7px;\n line-height: 22px;\n font-size: 14px;\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 .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: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\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 style = dom.create('style', code); var style = dom.create('style', code);
dom.appendTo(dom.head, style); dom.appendTo(dom.head, style);
} }

View File

@ -1 +1 @@
this.D=this.D||{},function(){"use strict";function e(e){var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(){var e=[];return d.dom.findAll("a:not([data-nosearch])").map(function(n){var t=n.href,o=n.getAttribute("href"),a=d.route.parse(t).path;a&&e.indexOf(a)===-1&&!d.route.isAbsolutePath(o)&&e.push(a)}),e}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function o(e,n){void 0===n&&(n="");var t,o=window.marked.lexer(n),a=window.Docsify.slugify,i=Docsify.route.toURL,r={};return o.forEach(function(n){if("heading"===n.type&&n.depth<=2)t=i(e,{id:a(n.text)}),r[t]={slug:t,title:n.text,body:""};else{if(!t)return;r[t]?r[t].body?r[t].body+="\n"+(n.text||""):r[t].body=n.text:r[t]={slug:t,title:"",body:""}}}),a.clear(),r}function a(n){var t=[],o=[];Object.keys(g).forEach(function(e){o=o.concat(Object.keys(g[e]).map(function(n){return g[e][n]}))}),n=n.trim().split(/[\s\-\\\\/]+/);for(var a=function(a){var i=o[a],r=!1,s="",c=i.title&&i.title.trim(),l=i.body&&i.body.trim(),u=i.slug||"";if(c&&l&&(n.forEach(function(n,t){var o=new RegExp(n,"gi"),a=-1,i=-1;if(a=c&&c.search(o),i=l&&l.search(o),a<0&&i<0)r=!1;else{r=!0,i<0&&(i=0);var u=0,f=0;u=i<11?0:i-10,f=0===u?70:i+n.length+60,f>l.length&&(f=l.length);var p="..."+e(l).substring(u,f).replace(o,'<em class="search-keyword">'+n+"</em>")+"...";s+=p}}),r)){var f={title:e(c),content:s,url:u};t.push(f)}},i=0;i<o.length;i++)a(i);return t}function i(e,a){d=Docsify;var i="auto"===e.paths,r=localStorage.getItem("docsify.search.expires")<Date.now();if(g=JSON.parse(localStorage.getItem("docsify.search.index")),r)g={};else if(!i)return;var s=i?n():e.paths,c=s.length,l=0;s.forEach(function(n){return g[n]?l++:void d.get(a.$getFile(n)).then(function(a){g[n]=o(n,a),c===++l&&t(e.maxAge)})})}function r(){var e="\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 .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: 7px;\n line-height: 22px;\n font-size: 14px;\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=h.create("style",e);h.appendTo(h.head,n)}function s(e){var n='<input type="search" /><div class="results-panel"></div></div>',t=h.create("div",n),o=h.find("aside");h.toggleClass(t,"search"),h.before(o,t)}function c(){var e,n=h.find("div.search"),t=h.find(n,"input"),o=h.find(n,".results-panel"),i=function(e){if(!e)return o.classList.remove("show"),void(o.innerHTML="");var n=a(e),t="";n.forEach(function(e){t+='<div class="matching-post">\n <h2><a href="'+e.url+'">'+e.title+"</a></h2>\n <p>"+e.content+"</p>\n</div>"}),o.classList.add("show"),o.innerHTML=t||'<p class="empty">'+y+"</p>"};h.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),h.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return i(n.target.value.trim())},100)})}function l(e,n){var t=h.getNode('.search input[type="search"]');if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).find(function(e){return n.indexOf(e)>-1});t.placeholder=e[o]}}function u(e,n){if("string"==typeof e)y=e;else{var t=Object.keys(e).find(function(e){return n.indexOf(e)>-1});y=e[t]}}function f(e){h=Docsify.dom,r(),s(e),c()}function p(e,n){l(e.placeholder,n.route.path),u(e.noData,n.route.path)}var d,h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",maxAge:864e5},v=function(e,n){var t=Docsify.util,o=n.config.search||m;Array.isArray(o)?m.paths=o:"object"==typeof o&&(m.paths=Array.isArray(o.paths)?o.paths:"auto",m.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:m.maxAge,m.placeholder=o.placeholder||m.placeholder,m.noData=o.noData||m.noData);var a="auto"===m.paths;e.mounted(function(e){f(m),!a&&i(m,n)}),e.doneEach(function(e){p(m,n),a&&i(m,n)})};window.$docsify.plugins=[].concat(v,window.$docsify.plugins)}(); this.D=this.D||{},function(){"use strict";function n(n){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return String(n).replace(/[&<>"'\/]/g,function(n){return e[n]})}function e(){var n=[];return d.dom.findAll("a:not([data-nosearch])").map(function(e){var t=e.href,a=e.getAttribute("href"),o=d.route.parse(t).path;o&&n.indexOf(o)===-1&&!d.route.isAbsolutePath(a)&&n.push(o)}),n}function t(n){localStorage.setItem("docsify.search.expires",Date.now()+n),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function a(n,e){void 0===e&&(e="");var t,a=window.marked.lexer(e),o=window.Docsify.slugify,r=Docsify.route.toURL,i={};return a.forEach(function(e){if("heading"===e.type&&e.depth<=2)t=r(n,{id:o(e.text)}),i[t]={slug:t,title:e.text,body:""};else{if(!t)return;i[t]?i[t].body?i[t].body+="\n"+(e.text||""):i[t].body=e.text:i[t]={slug:t,title:"",body:""}}}),o.clear(),i}function o(e){var t=[],a=[];Object.keys(g).forEach(function(n){a=a.concat(Object.keys(g[n]).map(function(e){return g[n][e]}))}),e=[].concat(e,e.trim().split(/[\s\-\\\\/]+/));for(var o=function(o){var r=a[o],i=!1,s="",c=r.title&&r.title.trim(),l=r.body&&r.body.trim(),p=r.slug||"";if(c&&l&&(e.forEach(function(e,t){var a=new RegExp(e,"gi"),o=-1,r=-1;if(o=c&&c.search(a),r=l&&l.search(a),o<0&&r<0)i=!1;else{i=!0,r<0&&(r=0);var p=0,u=0;p=r<11?0:r-10,u=0===p?70:r+e.length+60,u>l.length&&(u=l.length);var f="..."+n(l).substring(p,u).replace(a,'<em class="search-keyword">'+e+"</em>")+"...";s+=f}}),i)){var u={title:n(c),content:s,url:p};t.push(u)}},r=0;r<a.length;r++)o(r);return t}function r(n,o){d=Docsify;var r="auto"===n.paths,i=localStorage.getItem("docsify.search.expires")<Date.now();if(g=JSON.parse(localStorage.getItem("docsify.search.index")),i)g={};else if(!r)return;var s=r?e():n.paths,c=s.length,l=0;s.forEach(function(e){return g[e]?l++:void d.get(o.$getFile(e)).then(function(o){g[e]=a(e,o),c===++l&&t(n.maxAge)})})}function i(){var n="\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 .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: 7px;\n line-height: 22px;\n font-size: 14px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\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}",e=h.create("style",n);h.appendTo(h.head,e)}function s(n){var e='<input type="search" /><div class="results-panel"></div></div>',t=h.create("div",e),a=h.find("aside");h.toggleClass(t,"search"),h.before(a,t)}function c(){var n,e=h.find("div.search"),t=h.find(e,"input"),a=h.find(e,".results-panel"),r=function(n){if(!n)return a.classList.remove("show"),void(a.innerHTML="");var e=o(n),t="";e.forEach(function(n){t+='<div class="matching-post">\n <h2><a href="'+n.url+'">'+n.title+"</a></h2>\n <p>"+n.content+"</p>\n</div>"}),a.classList.add("show"),a.innerHTML=t||'<p class="empty">'+y+"</p>"};h.on(e,"click",function(n){return"A"!==n.target.tagName&&n.stopPropagation()}),h.on(t,"input",function(e){clearTimeout(n),n=setTimeout(function(n){return r(e.target.value.trim())},100)})}function l(n,e){var t=h.getNode('.search input[type="search"]');if("string"==typeof n)t.placeholder=n;else{var a=Object.keys(n).find(function(n){return e.indexOf(n)>-1});t.placeholder=n[a]}}function p(n,e){if("string"==typeof n)y=n;else{var t=Object.keys(n).find(function(n){return e.indexOf(n)>-1});y=n[t]}}function u(n){h=Docsify.dom,i(),s(n),c()}function f(n,e){l(n.placeholder,e.route.path),p(n.noData,e.route.path)}var d,h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",maxAge:864e5},v=function(n,e){var t=Docsify.util,a=e.config.search||m;Array.isArray(a)?m.paths=a:"object"==typeof a&&(m.paths=Array.isArray(a.paths)?a.paths:"auto",m.maxAge=t.isPrimitive(a.maxAge)?a.maxAge:m.maxAge,m.placeholder=a.placeholder||m.placeholder,m.noData=a.noData||m.noData);var o="auto"===m.paths;n.mounted(function(n){u(m),!o&&r(m,e)}),n.doneEach(function(n){f(m,e),o&&r(m,e)})};window.$docsify.plugins=[].concat(v,window.$docsify.plugins)}();