diff --git a/.build/_preinit.js b/.build/_preinit.js deleted file mode 100644 index 5e6ecf25..00000000 --- a/.build/_preinit.js +++ /dev/null @@ -1,5 +0,0 @@ -window.MathJax = { - root: '/js/mathjax', - delayStartupUntil: 'configured' -} -; diff --git a/.build/_tasks.js b/.build/_tasks.js index e22f4a2b..df862224 100644 --- a/.build/_tasks.js +++ b/.build/_tasks.js @@ -65,56 +65,6 @@ module.exports = Promise.mapSeries([ } }) }, - /** - * MathJax - */ - () => { - return fs.accessAsync('./assets/js/mathjax').then(() => { - console.info(colors.white(' └── ') + colors.magenta('MathJax directory already exists. Task aborted.')) - return true - }).catch(err => { - if (err.code === 'ENOENT') { - console.info(colors.white(' └── ') + colors.green('Copy MathJax dependencies to assets...')) - return fs.ensureDirAsync('./assets/js/mathjax').then(() => { - return fs.copyAsync('./node_modules/mathjax', './assets/js/mathjax', { - filter: (src, dest) => { - let srcNormalized = src.replace(/\\/g, '/') - let shouldCopy = false - console.info(colors.white(' ' + srcNormalized)) - _.forEach([ - '/node_modules/mathjax', - '/node_modules/mathjax/jax', - '/node_modules/mathjax/jax/input', - '/node_modules/mathjax/jax/output' - ], chk => { - if (srcNormalized.endsWith(chk)) { - shouldCopy = true - } - }) - _.forEach([ - '/node_modules/mathjax/extensions', - '/node_modules/mathjax/MathJax.js', - '/node_modules/mathjax/jax/element', - '/node_modules/mathjax/jax/input/MathML', - '/node_modules/mathjax/jax/input/TeX', - '/node_modules/mathjax/jax/output/SVG' - ], chk => { - if (srcNormalized.indexOf(chk) > 0) { - shouldCopy = true - } - }) - if (shouldCopy && srcNormalized.indexOf('/fonts/') > 0 && srcNormalized.indexOf('/STIX-Web') <= 1) { - shouldCopy = false - } - return shouldCopy - } - }) - }) - } else { - throw err - } - }) - }, /** * i18n */ @@ -136,21 +86,6 @@ module.exports = Promise.mapSeries([ }) }) }, - /** - * Bundle pre-init scripts - */ - () => { - console.info(colors.white(' └── ') + colors.green('Bundling pre-init scripts...')) - let preInitContent = '' - return fs.readdirAsync('./client/js/pre-init').map(f => { - let fPath = path.join('./client/js/pre-init/', f) - return fs.readFileAsync(fPath, 'utf8').then(fContent => { - preInitContent += fContent + ';\n' - }) - }).then(() => { - return fs.outputFileAsync('./.build/_preinit.js', preInitContent, 'utf8') - }) - }, /** * Delete Fusebox cache */ diff --git a/client/js/app.js b/client/js/app.js index 0972238c..75f43a30 100644 --- a/client/js/app.js +++ b/client/js/app.js @@ -1,6 +1,6 @@ 'use strict' -/* global $ */ +/* global $, siteRoot */ /* eslint-disable no-new */ import Vue from 'vue' @@ -64,6 +64,7 @@ import colorPickerComponent from './components/color-picker.vue' import editorCodeblockComponent from './components/editor-codeblock.vue' import editorFileComponent from './components/editor-file.vue' import editorVideoComponent from './components/editor-video.vue' +import historyComponent from './components/history.vue' import loadingSpinnerComponent from './components/loading-spinner.vue' import modalCreatePageComponent from './components/modal-create-page.vue' import modalCreateUserComponent from './components/modal-create-user.vue' @@ -130,7 +131,7 @@ i18next .use(i18nextXHR) .init({ backend: { - loadPath: '/js/i18n/{{lng}}.json' + loadPath: siteRoot + '/js/i18n/{{lng}}.json' }, lng: siteLang, fallbackLng: siteLang @@ -176,6 +177,7 @@ $(() => { editorCodeblock: editorCodeblockComponent, editorFile: editorFileComponent, editorVideo: editorVideoComponent, + history: historyComponent, loadingSpinner: loadingSpinnerComponent, modalCreatePage: modalCreatePageComponent, modalCreateUser: modalCreateUserComponent, diff --git a/client/js/components/editor.component.js b/client/js/components/editor.component.js index 687ef251..c06bfdc4 100644 --- a/client/js/components/editor.component.js +++ b/client/js/components/editor.component.js @@ -1,6 +1,6 @@ 'use strict' -/* global $ */ +/* global $, siteRoot */ let mde @@ -30,7 +30,7 @@ export default { return resp.json() }).then(resp => { if (resp.ok) { - window.location.assign('/' + self.currentPath) + window.location.assign(siteRoot + '/' + self.currentPath) } else { self.$store.dispatch('alert', { style: 'red', diff --git a/client/js/components/history.vue b/client/js/components/history.vue new file mode 100644 index 00000000..5917c03f --- /dev/null +++ b/client/js/components/history.vue @@ -0,0 +1,41 @@ + + + diff --git a/client/js/components/search.vue b/client/js/components/search.vue index eb3d8810..cb6c45f0 100644 --- a/client/js/components/search.vue +++ b/client/js/components/search.vue @@ -10,7 +10,7 @@ li(v-if='searchres.length === 0') a: em {{ $t('search.nomatch') }} li(v-for='sres in searchres', v-bind:class='{ "is-active": searchmovekey === "res." + sres.entryPath }') - a(v-bind:href='"/" + sres.entryPath') {{ sres.title }} + a(v-bind:href='siteRoot + "/" + sres.entryPath') {{ sres.title }} p.searchresults-label(v-if='searchsuggest.length > 0') {{ $t('search.didyoumean') }} ul.searchresults-list(v-if='searchsuggest.length > 0') li(v-for='sug in searchsuggest', v-bind:class='{ "is-active": searchmovekey === "sug." + sug }') @@ -18,81 +18,81 @@ diff --git a/client/js/components/tree.vue b/client/js/components/tree.vue index 21f0b572..163510f9 100644 --- a/client/js/components/tree.vue +++ b/client/js/components/tree.vue @@ -16,7 +16,7 @@