你现在正在访问的是萌娘百科用于保存和管理图片、音频等媒体文件的子项目萌娘共享,想要回到萌娘百科,请使用浏览器上的返回按钮、或点击这里
“MediaWiki:Gadget-prism-language-javascript-extras.js”的版本间的差异
AnnAngela-dbot(讨论 | 贡献) (代码变动:2d5d0ae - feat(Gadget/prism): 新的代码高亮工具 (#443) by U:AnnAngela, co-authored-by: GH:github-actions[bot],U:Bhsd) (1个标签:由机器人或全自动脚本执行的操作) |
AnnAngela-dbot(讨论 | 贡献) (代码变动:2d5d0ae3 - feat(Gadget/prism): 新的代码高亮工具 (#443) by U:AnnAngela, co-authored-by: GH:github-actions[bot],U:Bhsd) (1个标签:由机器人或全自动脚本执行的操作) |
||
第4行: | 第4行: | ||
* ------------------------------------------------------------------------- | * ------------------------------------------------------------------------- | ||
*/ | */ | ||
− | var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/prism-language-javascript/MediaWiki:Gadget-prism-language-javascript-extras.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]、[[U:Bhsd]]|longId=2d5d0ae30421796cfa323a02a78713c0ed261417|shortId= | + | var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/prism-language-javascript/MediaWiki:Gadget-prism-language-javascript-extras.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]、[[U:Bhsd]]|longId=2d5d0ae30421796cfa323a02a78713c0ed261417|shortId=2d5d0ae3|summary=feat(Gadget/prism): 新的代码高亮工具 (#443)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com>↩Co-authored-by: Bhsd <55071315+bhsd-harry📧users.noreply.github.com></nowiki>}}'; |
/* <pre> */ | /* <pre> */ |
2024年4月16日 (二) 09:08的最新版本
/** * ------------------------------------------------------------------------- * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!! * ------------------------------------------------------------------------- */ var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/prism-language-javascript/MediaWiki:Gadget-prism-language-javascript-extras.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]、[[U:Bhsd]]|longId=2d5d0ae30421796cfa323a02a78713c0ed261417|shortId=2d5d0ae3|summary=feat(Gadget/prism): 新的代码高亮工具 (#443)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com>↩Co-authored-by: Bhsd <55071315+bhsd-harry📧users.noreply.github.com></nowiki>}}'; /* <pre> */ "use strict"; (function (Prism) { Prism.languages.insertBefore('javascript', 'function-variable', { 'method-variable': { pattern: RegExp('(\\.\\s*)' + Prism.languages.javascript['function-variable'].pattern.source), lookbehind: true, alias: ['function-variable', 'method', 'function', 'property-access'] } }); Prism.languages.insertBefore('javascript', 'function', { 'method': { pattern: RegExp('(\\.\\s*)' + Prism.languages.javascript['function'].source), lookbehind: true, alias: ['function', 'property-access'] } }); Prism.languages.insertBefore('javascript', 'constant', { 'known-class-name': [ { pattern: /\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/, alias: 'class-name' }, { pattern: /\b(?:[A-Z]\w*)Error\b/, alias: 'class-name' } ] }); function withId(source, flags) { return RegExp(source.replace(/<ID>/g, function () { return /(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source; }), flags); } Prism.languages.insertBefore('javascript', 'keyword', { 'imports': { pattern: withId(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source), lookbehind: true, inside: Prism.languages.javascript }, 'exports': { pattern: withId(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source), lookbehind: true, inside: Prism.languages.javascript } }); Prism.languages.javascript['keyword'].unshift({ pattern: /\b(?:as|default|export|from|import)\b/, alias: 'module' }, { pattern: /\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/, alias: 'control-flow' }, { pattern: /\bnull\b/, alias: ['null', 'nil'] }, { pattern: /\bundefined\b/, alias: 'nil' }); Prism.languages.insertBefore('javascript', 'operator', { 'spread': { pattern: /\.{3}/, alias: 'operator' }, 'arrow': { pattern: /=>/, alias: 'operator' } }); Prism.languages.insertBefore('javascript', 'punctuation', { 'property-access': { pattern: withId(/(\.\s*)#?<ID>/.source), lookbehind: true }, 'maybe-class-name': { pattern: /(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/, lookbehind: true }, 'dom': { pattern: /\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/, alias: 'variable' }, 'console': { pattern: /\bconsole(?=\s*\.)/, alias: 'class-name' } }); var maybeClassNameTokens = ['function', 'function-variable', 'method', 'method-variable', 'property-access']; for (var i = 0; i < maybeClassNameTokens.length; i++) { var token = maybeClassNameTokens[i]; var value = Prism.languages.javascript[token]; if (Prism.util.type(value) === 'RegExp') { value = Prism.languages.javascript[token] = { pattern: value }; } var inside = value.inside || {}; value.inside = inside; inside['maybe-class-name'] = /^[A-Z][\s\S]*/; } }(Prism)); /* </pre> */