|
10 | 10 |
|
11 | 11 | /* Constants and default values */ |
12 | 12 |
|
13 | | - const debug_mode = false; |
14 | 13 | const thumbnail_column = "Thumbnail"; |
15 | 14 | const supported_formats = ["JPG", "JPEG", "PNG", "APNG", "GIF", "SVG", "WEBP", "AVIF", "ICO"]; |
16 | 15 | const supported_version_formats = ["JPG", "JPEG", "PNG", "WEBP"]; |
17 | | - const jszip_version = "3.10.1"; |
18 | | - const ace_builds_version = "1.41.0"; |
19 | 16 | const default_footer_social_snippet = `<a href="PASTE YOUR NEWSLETTER URL HERE" id="subscribe-button" target="_blank"> Subscribe </a> |
20 | 17 |
|
21 | 18 | <!-- Simply enter the URLs of your social media pages in the segments marked in capital letters. You can delete any unused platform sections, which are indicated by the comments: "[Platform]:start" and "[Platform]:end". For SVGs of other social media platforms, visit svgrepo.com . --> |
@@ -4249,72 +4246,35 @@ Options -Indexes |
4249 | 4246 | } |
4250 | 4247 | } |
4251 | 4248 |
|
4252 | | - const importFromCDN = async function(cdn, local) { |
4253 | | - if (!cdn) return await import(local); |
4254 | | - |
4255 | | - try { |
4256 | | - return await import(cdn); |
4257 | | - } catch (error) { |
4258 | | - console.error('Failed to load module from this URL: ', cdn); |
4259 | | - return await import(local); |
4260 | | - } |
4261 | | - } |
4262 | | - |
4263 | 4249 | const loadWebsiteDependencies = async function() { |
4264 | 4250 | const page = thisPage(); |
4265 | 4251 |
|
4266 | | - if (debug_mode === true || extensionEnvironment()) { |
4267 | | - if (["index", "settings"].includes(page)) { |
4268 | | - await import ("../dependencies/jszip/jszip.min.js"); |
4269 | | - } |
4270 | | - |
4271 | | - if (["article-edit", "series-edit", "section-edit", "relation-edit", "author-edit", "settings", "templates"].includes(page)) { |
4272 | | - await import ("../dependencies/ace/ace.js"); |
4273 | | - await import ("../dependencies/ace/ext-language_tools.js"); |
4274 | | - await import ("../dependencies/ace/mode-markdown.js"); |
4275 | | - await import ("../dependencies/ace/mode-twig.js"); |
4276 | | - await import ("../dependencies/ace/mode-html.js"); |
4277 | | - await import ("../dependencies/ace/mode-css.js"); |
4278 | | - await import ("../dependencies/ace/mode-javascript.js"); |
4279 | | - await import ("../dependencies/ace/mode-xml.js"); |
4280 | | - await import ("../dependencies/ace/theme-github_light_default.js"); |
4281 | | - ace.config.set('basePath', '../dependencies/ace'); |
4282 | | - } |
4283 | | - } else { |
4284 | | - if (["index", "settings"].includes(page)) { |
4285 | | - await importFromCDN("https://cdn.jsdelivr.net/npm/jszip@" + jszip_version + "/dist/jszip.min.js", "../dependencies/jszip/jszip.min.js"); |
4286 | | - } |
4287 | | - |
4288 | | - if (["article-edit", "series-edit", "section-edit", "relation-edit", "author-edit", "settings", "templates"].includes(page)) { |
4289 | | - await importFromCDN("https://cdn.jsdelivr.net/npm/ace-builds@" + ace_builds_version + "/src-min/ace.js", "../dependencies/ace/ace.js"); |
4290 | | - await importFromCDN("https://cdn.jsdelivr.net/npm/ace-builds@" + ace_builds_version + "/src-min/ext-language_tools.js", "../dependencies/ace/ext-language_tools.js"); |
4291 | | - await importFromCDN("https://cdn.jsdelivr.net/npm/ace-builds@" + ace_builds_version + "/src-min/mode-markdown.js", "../dependencies/ace/mode-markdown.js"); |
4292 | | - await importFromCDN("https://cdn.jsdelivr.net/npm/ace-builds@" + ace_builds_version + "/src-min/mode-twig.js", "../dependencies/ace/mode-twig.js"); |
4293 | | - await importFromCDN("https://cdn.jsdelivr.net/npm/ace-builds@" + ace_builds_version + "/src-min/mode-html.js", "../dependencies/ace/mode-html.js"); |
4294 | | - await importFromCDN("https://cdn.jsdelivr.net/npm/ace-builds@" + ace_builds_version + "/src-min/mode-css.js", "../dependencies/ace/mode-css.js"); |
4295 | | - await importFromCDN("https://cdn.jsdelivr.net/npm/ace-builds@" + ace_builds_version + "/src-min/mode-javascript.js", "../dependencies/ace/mode-javascript.js"); |
4296 | | - await importFromCDN("https://cdn.jsdelivr.net/npm/ace-builds@" + ace_builds_version + "/src-min/mode-xml.js", "../dependencies/ace/mode-xml.js"); |
4297 | | - await importFromCDN("https://cdn.jsdelivr.net/npm/ace-builds@" + ace_builds_version + "/src-min/theme-github_light_default.js", "../dependencies/ace/theme-github_light_default.js"); |
4298 | | - ace.config.set('basePath', "https://cdn.jsdelivr.net/npm/ace-builds@" + ace_builds_version + "/src-min"); |
4299 | | - } |
| 4252 | + if (["index", "settings"].includes(page)) { |
| 4253 | + await import ("../dependencies/jszip/jszip.min.js"); |
| 4254 | + } |
| 4255 | + |
| 4256 | + if (["article-edit", "series-edit", "section-edit", "relation-edit", "author-edit", "settings", "templates"].includes(page)) { |
| 4257 | + await import ("../dependencies/ace/ace.js"); |
| 4258 | + await import ("../dependencies/ace/ext-language_tools.js"); |
| 4259 | + await import ("../dependencies/ace/mode-markdown.js"); |
| 4260 | + await import ("../dependencies/ace/mode-twig.js"); |
| 4261 | + await import ("../dependencies/ace/mode-html.js"); |
| 4262 | + await import ("../dependencies/ace/mode-css.js"); |
| 4263 | + await import ("../dependencies/ace/mode-javascript.js"); |
| 4264 | + await import ("../dependencies/ace/mode-xml.js"); |
| 4265 | + await import ("../dependencies/ace/theme-github_light_default.js"); |
| 4266 | + ace.config.set('basePath', '../dependencies/ace'); |
4300 | 4267 | } |
4301 | 4268 | } |
4302 | 4269 |
|
4303 | 4270 | const start = async function(lb) { |
4304 | 4271 | if (globalThis.localStorage.getItem("tables-created") !== "true") showLoader(); |
4305 | 4272 | preFormatThead(); |
4306 | 4273 |
|
4307 | | - if (debug_mode === true || extensionEnvironment()) { |
4308 | | - const {default: libreblog} = await import ("../libreblog/libreblog.js"); |
4309 | | - globalThis.lb = libreblog; |
4310 | | - const {default: defaultTheme} = await import ("../themes/default-theme.js"); |
4311 | | - globalThis.default_theme = defaultTheme; |
4312 | | - } else { //TODO: insert the URLs of the scripts |
4313 | | - const {default: libreblog} = await importFromCDN(null, "../libreblog/libreblog.js"); |
4314 | | - globalThis.lb = libreblog; |
4315 | | - const {default: defaultTheme} = await importFromCDN(null, "../themes/default-theme.js"); |
4316 | | - globalThis.default_theme = defaultTheme; |
4317 | | - } |
| 4274 | + const {default: libreblog} = await import ("../libreblog/libreblog.js"); |
| 4275 | + globalThis.lb = libreblog; |
| 4276 | + const {default: defaultTheme} = await import ("../themes/default-theme.js"); |
| 4277 | + globalThis.default_theme = defaultTheme; |
4318 | 4278 |
|
4319 | 4279 | await loadWebsiteDependencies(); |
4320 | 4280 | await globalThis.lb.createMediaWorker(); |
|
0 commit comments