diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f4d17672..0291c00c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## 1.4.3 + +### Bug fixes +- Fix toggle button style. +- Support `mailto`, `tel`, etc. href type + + +## 1.4.2 +### Bug fixes +- Fix scroll to top. + ## 1.4.1 ### Bug fixes - Fix generate slug. diff --git a/dev.html b/dev.html index 7edecdefa..dba5d41fc 100644 --- a/dev.html +++ b/dev.html @@ -8,7 +8,5 @@
- - diff --git a/lib/docsify.js b/lib/docsify.js index 87ad60290..e61c0ffad 100644 --- a/lib/docsify.js +++ b/lib/docsify.js @@ -235,19 +235,14 @@ function bindToggle (dom) { dom.addEventListener('click', function () { return body.classList.toggle('close'); }); - if (!/mobile/i.test(navigator.userAgent)) { return } - document.querySelector('aside').addEventListener('click', function (event) { - body.classList.toggle('close'); - }); + if (isMobile()) { + document.querySelector('aside') + .addEventListener('click', function (_) { return body.classList.toggle('close'); }); + } } -var cacheContentDOM; function scroll2Top () { - if (!cacheContentDOM) { - var dom = isMobile() ? 'body' : 'section.content'; - cacheContentDOM = document.querySelector(dom); - } - cacheContentDOM.scrollTop = 0; + document.body.scrollTop = 0; } function sticky () { @@ -2388,7 +2383,7 @@ function cover () { } function toggle () { - return "" + return "" } /** @@ -2450,7 +2445,7 @@ renderer.code = function (code, lang) { return ("
" + hl + "
") }; renderer.link = function (href, title, text) { - if (OPTIONS$1.router && !/^(?:\w+:)?\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/.test(href)) { + if (OPTIONS$1.router && !/:/.test(href)) { href = ("#/" + href).replace(/\/\//g, '/'); } diff --git a/lib/docsify.min.js b/lib/docsify.min.js index 6937f661c..842ecea1c 100644 --- a/lib/docsify.min.js +++ b/lib/docsify.min.js @@ -1,2 +1,2 @@ -var Docsify=function(){"use strict";function e(e,t,n){void 0===t&&(t="GET");var r=new XMLHttpRequest;return r.open(t,e),r.send(),{then:function(e,t){if(void 0===t&&(t=function(){}),n){var a=setInterval(function(e){return n({step:Math.floor(5*Math.random()+1)})},500);r.addEventListener("progress",n),r.addEventListener("loadend",function(e){n(e),clearInterval(a)})}r.addEventListener("error",t),r.addEventListener("load",function(n){var r=n.target;r.status>=400?t(r):e(r.response)})},abort:function(){return 4!==r.readyState&&r.abort()}}}function t(e,t){var n=[],r={};return e.forEach(function(e){var a=e.level||1,i=a-1;a>t||(r[i]?(r[i].children=r[i].children||[],r[i].children.push(e)):n.push(e),r[a]=e)}),n}function n(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}function r(e){return null===e||void 0===e}function a(){var e=window.location;if(E===e.hash&&!r($))return $;var t=e.hash.match(/^#\/([^#]+)/);return t=t&&2===t.length?t[1]:/^#\//.test(e.hash)?"":e.pathname,$=t,E=e.hash,t}function i(){return document.body.clientWidth<=600}function s(e){var t=/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g,n=!1,r="-";if(s.occurrences=s.occurrences||{},"string"!=typeof e)return"";n||(e=e.toLowerCase());var a=e.trim().replace(t,"").replace(/\s/g,r),i=s.occurrences[a];return s.occurrences.hasOwnProperty(a)?i++:i=0,s.occurrences[a]=i,i&&(a=a+"-"+i),a}function o(){function e(){for(var e=0,r=t.length;e10){var o=n[i.getAttribute("data-id")];if(!o||o===a)return;return a&&a.setAttribute("class",""),o.setAttribute("class","active"),void(a=o)}}}if(!i()){for(var t=document.querySelectorAll(".anchor"),n={},r=document.querySelectorAll(".sidebar li"),a=null,s=0,o=r.length;s=t||e.classList.contains("hidden")?document.body.classList.add("sticky"):document.body.classList.remove("sticky")}()}function g(e,t){return t={exports:{}},e(t,t.exports),t.exports}function h(e){return e?(/\/\//.test(e)||(e="https://github.com/"+e),e=e.replace(/^git\+/,""),'\n \n \n '):""}function f(e){return"
\n "+e+'\n \n
\n
\n
\n
'}function m(){var e=", 100%, 85%",t="linear-gradient(to left bottom, hsl("+(Math.floor(255*Math.random())+e)+") 0%, hsl("+(Math.floor(255*Math.random())+e)+") 100%)";return'
\n
\n
\n
'}function b(){return''}function y(e,t){return void 0===t&&(t=""),e&&e.length?(e.forEach(function(e){t+='
  • '+e.title+"
  • ",e.children&&(t+='
    • '+y(e.children)+"
    ")}),t):""}function v(e,t){var n=document.querySelector("nav")||document.createElement("nav");M.repo||n.classList.add("no-badge"),e[t?"outerHTML":"innerHTML"]=h(M.repo)+(M.coverpage?m():"")+f(M.sidebarToggle?b():""),document.body.insertBefore(n,document.body.children[0]),c("button.sidebar-toggle"),M.coverpage?!i()&&window.addEventListener("scroll",d):document.body.classList.add("sticky")}function k(e){if(P("article",e?j(e):"not found"),M.sidebar||M.loadSidebar||w(),e&&"undefined"!=typeof Vue&&"undefined"!=typeof Vuep){var t=new Vue({el:"main"});t.$nextTick(function(e){return o()})}M.auto2top&&p()}function x(e){N.navbar&&N.navbar===e||(N.navbar=e,e&&P("nav",j(e)),u("nav"))}function w(e){var n;n=e?j(e):M.sidebar?y(M.sidebar,"