From ba203efd0047c107b0ec59ef9e58e15109376cc5 Mon Sep 17 00:00:00 2001 From: Bhsd <55071315+bhsd-harry@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:19:25 +0800 Subject: [PATCH] fix(gadget-prism): no unicode flag (#465) --- .../MediaWiki:Gadget-prism-language-wiki.js | 1 + src/gadgets/prism-language-wiki/definition.yaml | 4 ++-- src/gadgets/prism/MediaWiki:Gadget-prism.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gadgets/prism-language-wiki/MediaWiki:Gadget-prism-language-wiki.js b/src/gadgets/prism-language-wiki/MediaWiki:Gadget-prism-language-wiki.js index 094630fe..f044083f 100644 --- a/src/gadgets/prism-language-wiki/MediaWiki:Gadget-prism-language-wiki.js +++ b/src/gadgets/prism-language-wiki/MediaWiki:Gadget-prism-language-wiki.js @@ -5,6 +5,7 @@ const wiki = {}; Prism.languages.wiki = wiki; + await libCachedCode.injectCachedCode("/MediaWiki:Gadget-wikiparser-node.js?action=raw&ctype=text/javascript", "script"); Parser.config = await (await fetch("/MediaWiki:Gadget-prism-language-wiki.json?action=raw&ctype=application/json")).json(); const keyword = "keyword", url = "url", diff --git a/src/gadgets/prism-language-wiki/definition.yaml b/src/gadgets/prism-language-wiki/definition.yaml index aed3fa99..8914da7e 100644 --- a/src/gadgets/prism-language-wiki/definition.yaml +++ b/src/gadgets/prism-language-wiki/definition.yaml @@ -22,7 +22,8 @@ rights: peers: [] -dependencies: [] +dependencies: + - ext.gadget.libCachedCode _sites: - zh @@ -31,6 +32,5 @@ _sites: _section: system _files: - - MediaWiki:Gadget-wikiparser-node.js - MediaWiki:Gadget-prism-language-wiki.js - MediaWiki:Gadget-prism-language-wiki.json diff --git a/src/gadgets/prism/MediaWiki:Gadget-prism.js b/src/gadgets/prism/MediaWiki:Gadget-prism.js index eed8a6e3..1f0e6949 100755 --- a/src/gadgets/prism/MediaWiki:Gadget-prism.js +++ b/src/gadgets/prism/MediaWiki:Gadget-prism.js @@ -70,7 +70,7 @@ $(() => { }; // 仅用于判断是否合法语言,无需去重 const acceptsLangNames = Object.values(acceptsLangs); - let hash = /^#L\d+$/u.test(location.hash); + let hash = /^#L\d+$/.test(location.hash); Prism.hooks.add("complete", ({ element }) => { if (element) { const { dataset: { start = 1 } } = element.parentElement;