diff --git a/dist/js/viki.js b/dist/js/viki.js index c6c77a2..5336152 100644 --- a/dist/js/viki.js +++ b/dist/js/viki.js @@ -704,6 +704,6 @@ Module.A=function(b){function c(){for(var b=0;3>b;b++)e.push(0)}var d=b.length+1 function tb(b){function c(){var c=0;ob=E;Module._main&&(gb(ib),c=Module.A(b),Module.noExitRuntime||gb(jb));if(Module.postRun)for("function"==typeof Module.postRun&&(Module.postRun=[Module.postRun]);0>2],d=L[e+4>>2],f=new Uint8Array(J.subarray(c,c+d))}finally{0!=(e|0)&&(b=e|0,c=L[b>>2],0!=(c|0)&&(Z(c),L[b>>2]=0),Z(e))}return f};ha("Zopfli.RawDeflate",wd);ha("Zopfli.RawDeflate.prototype.compress",wd.prototype.B);}).call(this); ; -/*! viki 2019-01-13 */ +/*! viki 2019-01-16 */ -!function o(a,l,s){function c(t,e){if(!l[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(u)return u(t,!0);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}var r=l[t]={exports:{}};a[t][0].call(r.exports,function(e){return c(a[t][1][e]||e)},r,r.exports,o,a,l,s)}return l[t].exports}for(var u="function"==typeof require&&require,e=0;e'),n="row flex-xl-nowrap";e.naviFile||(n+=" justify-content-md-center");var i=$('
'));t.append(i);var r=null,o=null,a=null;e.toc?a=e.naviFile?(r="col-12 col-md-3 col-lg-2 viki-sidebar",o="col-12 col-md-9 col-lg-8 py-md-3 pl-md-5 viki-content","d-none d-lg-block col-lg-2 viki-toc"):(o="col-12 col-md-8 col-lg-8 col-xl-8 py-md-3 pl-md-5 viki-content","d-none d-md-block col-md-4 col-lg-3 col-xl-2 viki-toc"):o=e.naviFile?(r="col-12 col-md-3 col-xl-2 viki-sidebar","col-12 col-md-9 col-xl-8 py-md-3 pl-md-5 viki-content"):"col-12 col-md-9 py-md-3 pl-md-5 viki-content";var l=null,s=null,c=null;r&&(l=$('
'))),o&&(s=$('
'))),a&&(c=$('
'))),l&&i.append(l),s&&i.append(s),c&&i.append(c),$("body").append(t)}},{key:"isMarkdown",value:function(e){return e.endsWith(".md")}},{key:"renderFileInternal",value:function(n){var i=this;$.get(n,function(e){var t=i.viki.info;t.setTarget(n),t.data=e,(new f.default).updateHashSilently("#!"+n),i.renderContentAndToc()})}},{key:"renderContentAndToc",value:function(){var e=this.viki.info,t=new c.default;if(e.contentContainerId&&this.isMarkdown(e.target)){var n=$("#"+e.contentContainerId);new l.default(n).render(this.viki.config.markdown,e.data),t.rewriteLinks(n,e.target,e.baseUrl)}if(e.tocContainerId){var i=$("#"+e.tocContainerId);new s.default(i).render($("#"+e.contentContainerId)),t.rewriteLinks(i,e.target,e.baseUrl)}if($(window).scrollTop(0),e.anchor){var r=$("#"+e.contentContainerId+" #"+e.anchor);0'),t=$('
');if(this.viki.config.footer){var n=$('"));t.append(n)}var i=$('"));t.append(i),e.append(t),$("body").append(e),this.viki.scheduleNext()}}}])&&l(n.prototype,i),r&&l(n,r),t}();n.default=d},{"./logger.js":8,"./worker.js":20}],6:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n\n ×\n \n '),e.append(this.imageViewDiv),this.initImageViewBox(),this.closeImageViewBox()}},{key:"initImageViewBox",value:function(){var i=this,d=function(e,t,n){"absolute"!=e.style.position&&(e.style.position="absolute",e.style.zIndex=parseInt(i.imageViewDiv.find("#image-view-close")[0].style.zIndex)-1),e.style.left=t+"px",e.style.top=n+"px"};this.imageViewDiv.click(function(e){e=e||window.event;var t=i.imageViewDiv.find("#image-view")[0];e.target.id!=t.id&&i.closeImageViewBox(),e.preventDefault()}),this.imageViewDiv[0].onwheel=function(e){if(!!!(e=e||window.event).ctrlKey){var t=e.target;if(t&&"image-view"==t.id){var n=t.getBoundingClientRect(),i=e.clientX-n.left,r=e.clientY-n.top,o=t.getAttribute("oriWidth"),a=t.getAttribute("oriWidth");o||(o=n.width,a=n.height,t.setAttribute("oriWidth",o),t.setAttribute("oriHeight",a));var l=Math.floor(o/4),s=e.wheelDelta||-e.detail,c=Math.max(-1,Math.min(1,s)),u=n.width+(c<0?-l:l);if(u<200)e.preventDefault();else{var f=u/n.width;t.style.width=u+"px",d(t,e.clientX-i*f,e.clientY-r*f),e.preventDefault()}}}};var e=this.imageViewDiv.find("#image-view")[0];e.onmousedown=function(e){var t=(e=e||window.event).target;i.viewBoxImageMouseDown=!0,i.viewBoxImageOffsetToMouse=[t.offsetLeft-e.clientX,t.offsetTop-e.clientY],e.preventDefault()},e.onmouseup=function(e){e=e||window.event,i.viewBoxImageMouseDown=!1,e.preventDefault()},e.onmousemove=function(e){var t=(e=e||window.event).target;i.viewBoxImageMouseDown&&d(t,e.clientX+i.viewBoxImageOffsetToMouse[0],e.clientY+i.viewBoxImageOffsetToMouse[1]),e.preventDefault()},this.imageViewDiv.find("#image-view-close")[0].onclick=function(){i.closeImageViewBox()}}},{key:"setupIMGToView",value:function(e){var t=this;e&&"img"==e.nodeName.toLowerCase()&&(e.classList.add("viki-view-image"),e.ondblclick=function(e){t.viewImage(e.target.src)})}},{key:"closeImageViewBox",value:function(){this.imageViewDiv&&this.imageViewDiv.hide()}},{key:"viewImage",value:function(e){var t=1').concat(e[t].content,"")},this.mdit.use(window.markdownitFootnote),this.mdit.use(window["markdown-it-imsize.js"]),this.mdit.use(texmath,{delimiters:["dollars","raw"]}),this.mdit.use(window.markdownitContainer,"alert",{validate:function(e){return e.trim().match(/^alert-\S+$/)},render:function(e,t){var n=e[t].info.trim().match(/^(alert-\S+)$/);return 1!==e[t].nesting?"\n":''),a=$(''),l=this.viki.naviItems,s=0;s'),n=0;n'+e.title+""},n=function(e){var t=-1;for(var n in e)-1==t?t=e[n].level:t>e[n].level&&(t=e[n].level);return-1==t&&(t=1),t}(e),i=function(e,t){var n=t-1,i=[];for(var r in e){for(var o=e[r];o.level>n+1;){var a={level:n+=1,anchor:"",title:"[EMPTY]"};i.push(a)}i.push(o),n=o.level}return i}(e,n),r="
  • ",o=["
  • "],a=n;for(var l in i){var s=i[l];if(s.level==a)r+="",r+="
  • ",r+=t(s);else if(s.level>a)r+="
      ",o.push("
    "),r+="
  • ",r+=t(s),o.push("
  • "),a=s.level;else{for(;s.level"==c&&a--}r+="",r+="
  • ",r+=t(s)}}for(;0
  • ",""))+""}},{key:"rewriteAnchorInToc",value:function(e){var o=this;e.find("a").click(function(e){e.preventDefault();var t=e.target.getAttribute("href"),n=t.lastIndexOf("#");if(-1!=n){var i=t.substring(n);if(i){var r=$(i);0":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,function(e){return t[e]})}},{key:"updateHashSilently",value:function(e){window.viki_silent_hash=!0,window.location.hash=e}},{key:"pathEqual",value:function(e,t){return this.cleanPath(e.toLowerCase())===this.cleanPath(t.toLowerCase())}},{key:"isSubPath",value:function(e,t){if(""===e)return!0;if(!e)return!1;var n=this.cleanPath(e.toLowerCase());return this.cleanPath(t.toLowerCase()).startsWith(n)}},{key:"baseName",value:function(e){var t=e.lastIndexOf(".");return-1==t?e:e.substring(0,t)}}])&&r(t.prototype,n),i&&r(t,i),e}();n.default=i},{}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=i(e("./logger.js")),o=i(e("./vikiinfo.js")),a=e("./configworker.js"),l=i(e("./pageworker.js")),s=e("./naviworker.js"),c=i(e("./fetchtargetworker.js")),u=i(e("./contentworker.js")),f=i(e("./footerworker.js"));function i(e){return e&&e.__esModule?e:{default:e}}function d(e,t){for(var n=0;n=this.workers.length-1?(r.default.log("all workers finished"),this.curWorkerIdx=-1):(++this.curWorkerIdx,r.default.log("schedule worker",this.curWorkerIdx),this.workers[this.curWorkerIdx].run())}},{key:"initTargetFromHash",value:function(){var e="index.md",t=window.location.hash||"";if(""===t)return this.info.setTarget(e),!0;var n,i,r="";if("#"===t||"#!"===t?r="#!"+e:t.startsWith("#!")&&t.endsWith("/")&&(r=t+e),r)return window.location.hash=r,window.location.reload(!1),!1;t.startsWith("#!")?e=t.substring(2):t.startsWith("#")&&(e=t.substring(1)),n=e,(i=document.createElement("a")).href=n,window.location.hostname!==i.hostname&&(e="index.md");var o=(e=decodeURIComponent(e)).indexOf("#");return-1!=o?this.info.setTarget(e.substring(0,o),e.substring(o+1)):this.info.setTarget(e),!0}}])&&d(t.prototype,n),i&&d(t,i),e}();n.default=v},{"./configworker.js":1,"./contentworker.js":2,"./fetchtargetworker.js":4,"./footerworker.js":5,"./logger.js":8,"./naviworker.js":13,"./pageworker.js":14,"./vikiinfo.js":19}],19:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i,r=(i=e("./utils.js"))&&i.__esModule?i:{default:i};function o(e,t){for(var n=0;n'),n="row flex-xl-nowrap";e.naviFile||(n+=" justify-content-md-center");var i=$('
    '));t.append(i);var r=null,o=null,a=null;e.toc?a=e.naviFile?(r="col-12 col-md-3 col-lg-2 viki-sidebar",o="col-12 col-md-9 col-lg-8 py-md-3 pl-md-5 viki-content","d-none d-lg-block col-lg-2 viki-toc"):(o="col-12 col-md-8 col-lg-8 col-xl-8 py-md-3 pl-md-5 viki-content","d-none d-md-block col-md-4 col-lg-3 col-xl-2 viki-toc"):o=e.naviFile?(r="col-12 col-md-3 col-xl-2 viki-sidebar","col-12 col-md-9 col-xl-8 py-md-3 pl-md-5 viki-content"):"col-12 col-md-9 py-md-3 pl-md-5 viki-content";var l=null,s=null,c=null;r&&(l=$('
    '))),o&&(s=$('
    '))),a&&(c=$('
    '))),l&&i.append(l),s&&i.append(s),c&&i.append(c),$("body").append(t)}},{key:"isMarkdown",value:function(e){return e.endsWith(".md")}},{key:"renderFileInternal",value:function(n){var i=this;$.get(n,function(e){var t=i.viki.info;t.setTarget(n),t.data=e,(new f.default).updateHashSilently("#!"+n),i.renderContentAndToc()})}},{key:"renderContentAndToc",value:function(){var e=this.viki.info,t=new c.default;if(e.contentContainerId&&this.isMarkdown(e.target)){var n=$("#"+e.contentContainerId);new l.default(n).render(this.viki.config.markdown,e.data),t.rewriteLinks(n,e.target,e.baseUrl)}if(e.tocContainerId){var i=$("#"+e.tocContainerId);new s.default(i).render($("#"+e.contentContainerId)),t.rewriteLinks(i,e.target,e.baseUrl)}if($(window).scrollTop(0),e.anchor){var r=$("#"+e.contentContainerId+" #"+e.anchor);0'),t=$('
    ');if(this.viki.config.footer){var n=$('"));t.append(n)}var i=$('"));t.append(i),e.append(t),$("body").append(e),this.viki.scheduleNext()}}}])&&l(n.prototype,i),r&&l(n,r),t}();n.default=d},{"./logger.js":8,"./worker.js":20}],6:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n\n ×\n \n '),e.append(this.imageViewDiv),this.initImageViewBox(),this.closeImageViewBox()}},{key:"initImageViewBox",value:function(){var i=this,d=function(e,t,n){"absolute"!=e.style.position&&(e.style.position="absolute",e.style.zIndex=parseInt(i.imageViewDiv.find("#image-view-close")[0].style.zIndex)-1),e.style.left=t+"px",e.style.top=n+"px"};this.imageViewDiv.click(function(e){e=e||window.event;var t=i.imageViewDiv.find("#image-view")[0];e.target.id!=t.id&&i.closeImageViewBox(),e.preventDefault()}),this.imageViewDiv[0].onwheel=function(e){if(!!!(e=e||window.event).ctrlKey){var t=e.target;if(t&&"image-view"==t.id){var n=t.getBoundingClientRect(),i=e.clientX-n.left,r=e.clientY-n.top,o=t.getAttribute("oriWidth"),a=t.getAttribute("oriWidth");o||(o=n.width,a=n.height,t.setAttribute("oriWidth",o),t.setAttribute("oriHeight",a));var l=Math.floor(o/4),s=e.wheelDelta||-e.detail,c=Math.max(-1,Math.min(1,s)),u=n.width+(c<0?-l:l);if(u<200)e.preventDefault();else{var f=u/n.width;t.style.width=u+"px",d(t,e.clientX-i*f,e.clientY-r*f),e.preventDefault()}}}};var e=this.imageViewDiv.find("#image-view")[0];e.onmousedown=function(e){var t=(e=e||window.event).target;i.viewBoxImageMouseDown=!0,i.viewBoxImageOffsetToMouse=[t.offsetLeft-e.clientX,t.offsetTop-e.clientY],e.preventDefault()},e.onmouseup=function(e){e=e||window.event,i.viewBoxImageMouseDown=!1,e.preventDefault()},e.onmousemove=function(e){var t=(e=e||window.event).target;i.viewBoxImageMouseDown&&d(t,e.clientX+i.viewBoxImageOffsetToMouse[0],e.clientY+i.viewBoxImageOffsetToMouse[1]),e.preventDefault()},this.imageViewDiv.find("#image-view-close")[0].onclick=function(){i.closeImageViewBox()}}},{key:"setupIMGToView",value:function(e){var t=this;e&&"img"==e.nodeName.toLowerCase()&&(e.classList.add("viki-view-image"),e.ondblclick=function(e){t.viewImage(e.target.src)})}},{key:"closeImageViewBox",value:function(){this.imageViewDiv&&this.imageViewDiv.hide()}},{key:"viewImage",value:function(e){var t=1').concat(e[t].content,"")},this.mdit.use(window.markdownitFootnote),this.mdit.use(window["markdown-it-imsize.js"]),this.mdit.use(texmath,{delimiters:["dollars","raw"]}),this.mdit.use(window.markdownitContainer,"alert",{validate:function(e){return e.trim().match(/^alert-\S+$/)},render:function(e,t){var n=e[t].info.trim().match(/^(alert-\S+)$/);return 1!==e[t].nesting?"\n":''),a=$(''),l=this.viki.naviItems,s=0;s'),n=0;n'+e.title+""},n=function(e){var t=-1;for(var n in e)-1==t?t=e[n].level:t>e[n].level&&(t=e[n].level);return-1==t&&(t=1),t}(e),i=function(e,t){var n=t-1,i=[];for(var r in e){for(var o=e[r];o.level>n+1;){var a={level:n+=1,anchor:"",title:"[EMPTY]"};i.push(a)}i.push(o),n=o.level}return i}(e,n),r="
  • ",o=["
  • "],a=n;for(var l in i){var s=i[l];if(s.level==a)r+="",r+="
  • ",r+=t(s);else if(s.level>a)r+="
      ",o.push("
    "),r+="
  • ",r+=t(s),o.push("
  • "),a=s.level;else{for(;s.level"==c&&a--}r+="",r+="
  • ",r+=t(s)}}for(;0
  • ",""))+""}},{key:"rewriteAnchorInToc",value:function(e){var o=this;e.find("a").click(function(e){e.preventDefault();var t=e.target.getAttribute("href"),n=t.lastIndexOf("#");if(-1!=n){var i=t.substring(n);if(i){var r=$(i);0":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,function(e){return t[e]})}},{key:"updateHashSilently",value:function(e){window.viki_silent_hash=!0,window.location.hash=e}},{key:"pathEqual",value:function(e,t){return this.cleanPath(e.toLowerCase())===this.cleanPath(t.toLowerCase())}},{key:"isSubPath",value:function(e,t){if(""===e)return!0;if(!e)return!1;var n=this.cleanPath(e.toLowerCase());return this.cleanPath(t.toLowerCase()).startsWith(n)}},{key:"baseName",value:function(e){var t=e.lastIndexOf(".");return-1==t?e:e.substring(0,t)}}])&&r(t.prototype,n),i&&r(t,i),e}();n.default=i},{}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=i(e("./logger.js")),o=i(e("./vikiinfo.js")),a=e("./configworker.js"),l=i(e("./pageworker.js")),s=e("./naviworker.js"),c=i(e("./fetchtargetworker.js")),u=i(e("./contentworker.js")),f=i(e("./footerworker.js"));function i(e){return e&&e.__esModule?e:{default:e}}function d(e,t){for(var n=0;n=this.workers.length-1?(r.default.log("all workers finished"),this.curWorkerIdx=-1):(++this.curWorkerIdx,r.default.log("schedule worker",this.curWorkerIdx),this.workers[this.curWorkerIdx].run())}},{key:"initTargetFromHash",value:function(){var e="index.md",t=window.location.hash||"";if(""===t)return this.info.setTarget(e),!0;var n,i,r="";if("#"===t||"#!"===t?r="#!"+e:t.startsWith("#!")&&t.endsWith("/")&&(r=t+e),r)return window.location.hash=r,window.location.reload(!1),!1;t.startsWith("#!")?e=t.substring(2):t.startsWith("#")&&(e=t.substring(1)),n=e,(i=document.createElement("a")).href=n,window.location.hostname!==i.hostname&&(e="index.md");var o=(e=decodeURIComponent(e)).indexOf("#");return-1!=o?this.info.setTarget(e.substring(0,o),e.substring(o+1)):this.info.setTarget(e),!0}}])&&d(t.prototype,n),i&&d(t,i),e}();n.default=v},{"./configworker.js":1,"./contentworker.js":2,"./fetchtargetworker.js":4,"./footerworker.js":5,"./logger.js":8,"./naviworker.js":13,"./pageworker.js":14,"./vikiinfo.js":19}],19:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i,r=(i=e("./utils.js"))&&i.__esModule?i:{default:i};function o(e,t){for(var n=0;n