diff --git a/dist/mdsite.js b/dist/mdsite.js index 713ea38..d10caa2 100644 --- a/dist/mdsite.js +++ b/dist/mdsite.js @@ -11,4 +11,4 @@ dangerouslySetInnerHTML=${{__html:this.state.html}} > <${O} /> - `}}B.defaultProps={html:"Wait a moment..."},console.log("viewer"),window.MDS={settings:{title:"MD Site",mdDir:"md/",indexFile:"index.md",menuFile:"menu.md",scripts:[]},updaters:{},updID:1,editMode:!1,current:null,makePath:function(e){const t=window.MDS.settings.mdDir;return t?t+""+e:e},addUpdater:function(e){const t=window.MDS.updID;return window.MDS.updaters[t]=e,window.MDS.updID++,t},removeUpdater:function(e){delete window.MDS.updaters[e]},updateViews:function(e,t){Object.values(window.MDS.updaters).forEach((r=>r(e,t)))},showContent:function(e,t){window.MDS.current={path:e,content:t,saved:!0},window.MDS.updateViews(e,t)},showPath:function(e){const t=window.MDS.makePath(e||window.MDS.settings.indexFile);T(t).then((t=>{window.MDS.showContent(e,t)})).catch((r=>{console.info("No such file",t,r),window.MDS.showContent(e,function(e){return{html:`

No such page: ${e}

Oops...`,markdown:""}}(e))}))},go:function(e){e.match(/^( http|ftp )(s)?\:/i)||!e.match(/\.(md|markdown)$/i)||e.match(/\#/)?window.location=e:(window.MDS.showPath(e),history.pushState(e,null,"#!"+e))},action:{edit:()=>{window.MDS.editMode=!0;const e=document.createElement("script");e.src="mdeditor.js",document.body.appendChild(e)},setMenu:e=>{const t=document.getElementById("menu");T(window.MDS.makePath(window.MDS.menuFile)).then((e=>{t.innerHTML=e.html})).catch((e=>console.log("no sidebar",e)))}}},window.addEventListener("DOMContentLoaded",(function(){console.log("Starting...");const r=window.MDS,n=Object.assign(r.settings,window.settings);r.settings=n;const o=document.getElementById("menu"),a=document.getElementById("content");o&&T(r.makePath("sidebar.md")).then((e=>{o.innerHTML=e.html})).catch((e=>console.log("no sidebar",e))),a?(function(r,n,o){var a,s,l;t.__&&t.__(r,n),s=(a="function"==typeof o)?null:o&&o.__k||n.__k,l=[],D(n,r=(!a&&o||n).__k=p(_,null,[r]),s||i,i,void 0!==n.ownerSVGElement,!a&&o?[o]:s?null:n.firstChild?e.call(n.childNodes):null,l,!a&&o?o:s?s.__e:n.firstChild,a),E(l,r)}(p(B,{base:r.settings.mdDir}),a),window.location.hash?(history.replaceState(window.location.hash.substring(2),null),r.showPath(window.location.hash.substring(2))):r.showPath(r.settings.indexFile)):console.error("Content node not found"),window.MDS.settings.scripts.forEach((e=>{const t=document.createElement("script");t.setAttribute("src",e),document.head.appendChild(t)}))})),window.addEventListener("click",(function(e){const t=e.target,r=t.getAttribute("href")||t.parentNode.getAttribute&&t.parentNode.getAttribute("href");r&&!r.startsWith("data:")&&(window.MDS.go(r),console.log("link clicked",r),e.preventDefault(),e.stopPropagation())})),window.addEventListener("popstate",(e=>{e&&window.MDS.showPath(e.state)})),window.addEventListener("hashchange",(()=>{window.MDS.go(window.location.hash.substring(2))})),window.addEventListener("error",(e=>console.log("Error in window",e)))})()})(); \ No newline at end of file + `}}B.defaultProps={html:"Wait a moment..."},console.log("viewer"),window.MDS={settings:{title:"MD Site",mdDir:"md/",indexFile:"index.md",menuFile:"menu.md",scripts:[],editorScript:"mdeditor.js"},updaters:{},updID:1,editMode:!1,current:null,makePath:function(e){const t=window.MDS.settings.mdDir;return t?t+""+e:e},addUpdater:function(e){const t=window.MDS.updID;return window.MDS.updaters[t]=e,window.MDS.updID++,t},removeUpdater:function(e){delete window.MDS.updaters[e]},updateViews:function(e,t){Object.values(window.MDS.updaters).forEach((r=>r(e,t)))},showContent:function(e,t){window.MDS.current={path:e,content:t,saved:!0},window.MDS.updateViews(e,t)},showPath:function(e){const t=window.MDS.makePath(e||window.MDS.settings.indexFile);T(t).then((t=>{window.MDS.showContent(e,t)})).catch((r=>{console.info("No such file",t,r),window.MDS.showContent(e,function(e){return{html:`

No such page: ${e}

Oops...`,markdown:""}}(e))}))},go:function(e){e.match(/^( http|ftp )(s)?\:/i)||!e.match(/\.(md|markdown)$/i)||e.match(/\#/)?window.location=e:(window.MDS.showPath(e),history.pushState(e,null,"#!"+e))},action:{edit:()=>{window.MDS.editMode=!0;const e=document.createElement("script");e.src=window.MDS.settings.editorScript,document.body.appendChild(e)},setMenu:e=>{const t=document.getElementById("menu");T(window.MDS.makePath(window.MDS.menuFile)).then((e=>{t.innerHTML=e.html})).catch((e=>console.log("no sidebar",e)))}}},window.addEventListener("DOMContentLoaded",(function(){console.log("Starting...");const r=window.MDS,n=Object.assign(r.settings,window.settings);r.settings=n;const o=document.getElementById("menu"),a=document.getElementById("content");o&&T(r.makePath("sidebar.md")).then((e=>{o.innerHTML=e.html})).catch((e=>console.log("no sidebar",e))),a?(function(r,n,o){var a,s,l;t.__&&t.__(r,n),s=(a="function"==typeof o)?null:o&&o.__k||n.__k,l=[],D(n,r=(!a&&o||n).__k=p(_,null,[r]),s||i,i,void 0!==n.ownerSVGElement,!a&&o?[o]:s?null:n.firstChild?e.call(n.childNodes):null,l,!a&&o?o:s?s.__e:n.firstChild,a),E(l,r)}(p(B,{base:r.settings.mdDir}),a),window.location.hash?(history.replaceState(window.location.hash.substring(2),null),r.showPath(window.location.hash.substring(2))):r.showPath(r.settings.indexFile)):console.error("Content node not found"),window.MDS.settings.scripts.forEach((e=>{const t=document.createElement("script");t.setAttribute("src",e),document.head.appendChild(t)}))})),window.addEventListener("click",(function(e){const t=e.target,r=t.getAttribute("href")||t.parentNode.getAttribute&&t.parentNode.getAttribute("href");r&&!r.startsWith("data:")&&(window.MDS.go(r),console.log("link clicked",r),e.preventDefault(),e.stopPropagation())})),window.addEventListener("popstate",(e=>{e&&window.MDS.showPath(e.state)})),window.addEventListener("hashchange",(()=>{window.MDS.go(window.location.hash.substring(2))})),window.addEventListener("error",(e=>console.log("Error in window",e)))})()})(); \ No newline at end of file diff --git a/docs/sidebar.ru.md b/docs/sidebar.ru.md index e69de29..3931658 100644 --- a/docs/sidebar.ru.md +++ b/docs/sidebar.ru.md @@ -0,0 +1,3 @@ +* [ Начало ](index.ru.md) +* [ Начало работы ](getting_started.ru.md) +* [ Кастомизация ](customization.ru.md) diff --git a/package.json b/package.json index 16691ac..61c406c 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,7 @@ "css-watch": "npx sass --watch src/style/style.scss:test/view.css", "css-build": "npx sass src/style/style.scss:dist/view.css --no-source-map", "build": "npx webpack --mode production", - "watch": "npx webpack --mode development", - "postbuild": "shx rm dist/loader.js dist/*.map" + "watch": "npx webpack --mode development" }, "author": "", "license": "ISC",