diff --git a/MyApp/wwwroot/lib/js/default.js b/MyApp/wwwroot/lib/js/default.js new file mode 100644 index 0000000..9f31aab --- /dev/null +++ b/MyApp/wwwroot/lib/js/default.js @@ -0,0 +1,32 @@ +window.hljs?.highlightAll() + +if (!localStorage.getItem('data:tags.txt')) +{ + fetch('/data/tags.txt') + .then(r => r.text()) + .then(txt => localStorage.setItem('data:tags.txt', txt)); +} + +function metadataDate(metadataJson) { + try { + if (metadataJson) { + return new Date(parseInt(metadataJson.match(/Date\((\d+)\)/)[1])) + } + } catch{} + return new Date() - (24 * 60 * 60 * 1000) +} + +const metadataJson = localStorage.getItem('/metadata/app.json') +const oneHourAgo = new Date() - 60 * 60 * 1000 +const clearMetadata = !metadataJson + || location.search.includes('clear=metadata') + || metadataDate(metadataJson) < oneHourAgo + +if (clearMetadata) { + fetch('/metadata/app.json') + .then(r => r.text()) + .then(json => { + console.log('updating /metadata/app.json...') + localStorage.setItem('/metadata/app.json', json) + }) +} diff --git a/MyApp/wwwroot/mjs/app.mjs b/MyApp/wwwroot/mjs/app.mjs index efda390..183d324 100644 --- a/MyApp/wwwroot/mjs/app.mjs +++ b/MyApp/wwwroot/mjs/app.mjs @@ -15,7 +15,7 @@ const CustomElements = [ 'lite-youtube' ] -const alreadyMounted = el => el.__vue_app__ +export const alreadyMounted = el => el.__vue_app__ const mockArgs = { attrs:{}, slots:{}, emit:() => {}, expose: () => {} } function hasTemplate(el,component) { diff --git a/MyApp/wwwroot/pages/Questions/Answer.mjs b/MyApp/wwwroot/pages/Questions/Answer.mjs index 11daf4e..ec3ab6e 100644 --- a/MyApp/wwwroot/pages/Questions/Answer.mjs +++ b/MyApp/wwwroot/pages/Questions/Answer.mjs @@ -6,8 +6,7 @@ import { AnswerQuestion, PreviewMarkdown } from "dtos.mjs" export default { template:`