diff --git a/.eslintrc b/.eslintrc index 23d2bb4c..d0b51a9e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -258,6 +258,7 @@ "unicorn/require-post-message-target-origin": "off", "unicorn/string-content": "off", "unicorn/switch-case-braces": ["error", "avoid"], + "unicorn/prefer-query-selector": "off", "getter-return": [ "error", diff --git a/dist/DisambigLinks/DisambigLinks.css b/dist/DisambigLinks/DisambigLinks.css new file mode 100644 index 00000000..8e5257cd --- /dev/null +++ b/dist/DisambigLinks/DisambigLinks.css @@ -0,0 +1,44 @@ +/** + * SPDX-License-Identifier: CC-BY-SA-4.0 + * _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}' + * + * @source + * @author Kaldari, Cyberpower678, Alexander Misel, Artoria2e5, WaitSpring and other Qiuwen Baike Contributors. + */ +/** + * +------------------------------------------------------------+ + * | === WARNING: GLOBAL GADGET FILE === | + * +------------------------------------------------------------+ + * | All changes should be made in the repository, | + * | otherwise they will be lost. | + * +------------------------------------------------------------+ + * | Changes to this page may affect many users. | + * | Please discuss changes by opening an issue before editing. | + * +------------------------------------------------------------+ + */ +/* */ + +/* src/DisambigLinks/DisambigLinks.css */ +a.mw-disambig::after, +a.mw-redirect::after { + font-weight: normal; + line-height: 0; + text-indent: 0.1em; + vertical-align: super; +} +a.mw-disambig::after { + content: "⇄"; + font-size: 0.75em; +} +a.mw-redirect::after { + content: "↳"; + font-size: 0.9em; +} +a.mw-disambig.mw-redirect::after { + content: "⇄↳"; + font-size: 0.75em; +} + +/* */ + +/*# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL0Rpc2FtYmlnTGlua3MvRGlzYW1iaWdMaW5rcy5jc3MiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImEubXctZGlzYW1iaWc6OmFmdGVyLFxuYS5tdy1yZWRpcmVjdDo6YWZ0ZXIge1xuXHRmb250LXdlaWdodDogbm9ybWFsO1xuXHRsaW5lLWhlaWdodDogMDtcblx0dGV4dC1pbmRlbnQ6IDAuMWVtO1xuXHR2ZXJ0aWNhbC1hbGlnbjogc3VwZXI7XG59XG5cbmEubXctZGlzYW1iaWc6OmFmdGVyIHtcblx0Y29udGVudDogJ+KHhCc7XG5cdGZvbnQtc2l6ZTogMC43NWVtO1xufVxuXG5hLm13LXJlZGlyZWN0OjphZnRlciB7XG5cdGNvbnRlbnQ6ICfihrMnO1xuXHRmb250LXNpemU6IDAuOWVtO1xufVxuXG5hLm13LWRpc2FtYmlnLm13LXJlZGlyZWN0OjphZnRlciB7XG5cdGNvbnRlbnQ6ICfih4TihrMnO1xuXHRmb250LXNpemU6IDAuNzVlbTtcbn1cbiJdLAogICJtYXBwaW5ncyI6ICI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLENBQUMsQ0FBQyxXQUFXO0FBQ2IsQ0FBQyxDQUFDLFdBQVc7QUFDWixlQUFhO0FBQ2IsZUFBYTtBQUNiLGVBQWE7QUFDYixrQkFBZ0I7QUFDakI7QUFFQSxDQUFDLENBUkMsV0FRVztBQUNaLFdBQVM7QUFDVCxhQUFXO0FBQ1o7QUFFQSxDQUFDLENBWkMsV0FZVztBQUNaLFdBQVM7QUFDVCxhQUFXO0FBQ1o7QUFFQSxDQUFDLENBbEJDLFdBa0JXLENBakJYLFdBaUJ1QjtBQUN4QixXQUFTO0FBQ1QsYUFBVztBQUNaOyIsCiAgIm5hbWVzIjogW10KfQo= */ diff --git a/dist/HideConversionTab/HideConversionTab.css b/dist/HideConversionTab/HideConversionTab.css new file mode 100644 index 00000000..69544562 --- /dev/null +++ b/dist/HideConversionTab/HideConversionTab.css @@ -0,0 +1,31 @@ +/** + * SPDX-License-Identifier: CC-BY-SA-4.0 + * _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}' + * + * @base + * @source + */ +/** + * +------------------------------------------------------------+ + * | === WARNING: GLOBAL GADGET FILE === | + * +------------------------------------------------------------+ + * | All changes should be made in the repository, | + * | otherwise they will be lost. | + * +------------------------------------------------------------+ + * | Changes to this page may affect many users. | + * | Please discuss changes by opening an issue before editing. | + * +------------------------------------------------------------+ + */ +/* */ + +/* src/HideConversionTab/HideConversionTab.css */ +#ca-varlang-0, +#ca-varlang-1, +#ca-varlang-2, +#mw-mf-language-variant-selection > li:nth-child(-n+3) { + display: none !important; +} + +/* */ + +/*# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL0hpZGVDb252ZXJzaW9uVGFiL0hpZGVDb252ZXJzaW9uVGFiLmNzcyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyog57mB566A6L2s5o2i77ya6buY6K6k6ZqQ6JePemjjgIF6aC1oYW5z5ZKMemgtaGFudOagh+etvu+8jOWFgeiuuOeUqOaIt+WcqOWwj+W3peWFt+S4reiHquihjOWFs+mXreOAgiAqL1xuI2NhLXZhcmxhbmctMCxcbiNjYS12YXJsYW5nLTEsXG4jY2EtdmFybGFuZy0yLFxuI213LW1mLWxhbmd1YWdlLXZhcmlhbnQtc2VsZWN0aW9uID4gbGk6bnRoLWNoaWxkKC1uICsgMykge1xuXHRkaXNwbGF5OiBub25lICFpbXBvcnRhbnQ7XG59XG4iXSwKICAibWFwcGluZ3MiOiAiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFDQSxDQUFDO0FBQ0QsQ0FBQztBQUNELENBQUM7QUFDRCxDQUFDLGlDQUFpQyxFQUFFLEVBQUU7QUFDckMsV0FBUztBQUNWOyIsCiAgIm5hbWVzIjogW10KfQo= */ diff --git a/dist/InPageEdit/InPageEdit.js b/dist/InPageEdit/InPageEdit.js index 01abe7bb..efe60612 100644 --- a/dist/InPageEdit/InPageEdit.js +++ b/dist/InPageEdit/InPageEdit.js @@ -2,7 +2,7 @@ * SPDX-License-Identifier: CC-BY-SA-4.0 * _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}' * - * @source {@link https://git.qiuwen.net.cn/InterfaceAdmin/QiuwenGadgets/src/branch/master/src/InPageEdit} + * @source {@link https://github.com/TopRealm/YsArxiv-Gadgets/tree/master/src/InPageEdit} * @license CC-BY-SA-4.0 {@link https://www.qiuwenbaike.cn/wiki/H:CC-BY-SA-4.0} * @dependency mediawiki.util */ diff --git a/dist/InterwikiTips/InterwikiTips.css b/dist/InterwikiTips/InterwikiTips.css new file mode 100644 index 00000000..1f467688 --- /dev/null +++ b/dist/InterwikiTips/InterwikiTips.css @@ -0,0 +1,57 @@ +/** + * SPDX-License-Identifier: CC-BY-SA-4.0 + * _addText: '{{Gadget Header|license=CC-BY-SA-4.0|import=no}}' + * + * @source + * @author Zorua-Fox and other Youshou Arxiv Contributors. + */ +/** + * +------------------------------------------------------------+ + * | === WARNING: GLOBAL GADGET FILE === | + * +------------------------------------------------------------+ + * | All changes should be made in the repository, | + * | otherwise they will be lost. | + * +------------------------------------------------------------+ + * | Changes to this page may affect many users. | + * | Please discuss changes by opening an issue before editing. | + * +------------------------------------------------------------+ + */ +/* */ + +/* src/InterwikiTips/InterwikiTips.css */ +.mw-parser-output a.extiw[href*=".qiuwenbaike.cn"]::before { + font-weight: normal; + line-height: 0; + text-indent: 0.1em; + vertical-align: super; +} +.mw-parser-output a.extiw[href*=".moegirl.org.cn"]::before { + font-weight: normal; + line-height: 0; + text-indent: 0.1em; + vertical-align: super; +} +.mw-parser-output a.extiw[href*=".qiuwenbaike.cn"]::before { + display: inline-block; + font-size: 1em; + width: 1em; + height: 1em; + margin-right: 0; + content: ""; + background: url(https://youshou.wiki/images/4/41/“求”网站图标(透明背景;2023版).svg) no-repeat 0 0; + background-size: 100%; +} +.mw-parser-output a.extiw[href*=".moegirl.org.cn"]::before { + display: inline-block; + font-size: 1em; + width: 1em; + height: 1em; + margin-right: 0; + content: ""; + background: url(https://youshou.wiki/images/8/88/萌娘百科网站图标.svg) no-repeat 0 0; + background-size: 100%; +} + +/* */ + +/*# sourceMappingURL=data:application/json;base64,ewogICJ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BaUI7QUFDbEI7IiwKICAibmFtZXMiOiBbXQp9Cg== */ diff --git a/dist/NavbarAvatar/NavbarAvatar.js b/dist/NavbarAvatar/NavbarAvatar.js new file mode 100644 index 00000000..0415ff74 --- /dev/null +++ b/dist/NavbarAvatar/NavbarAvatar.js @@ -0,0 +1,44 @@ +/** + * SPDX-License-Identifier: CC-BY-SA-4.0 + * _addText: '{{Gadget Header|license=CC-BY-SA-4.0|import=no}}' + * @author 顶呱呱的阿杰 + */ +/** + * +------------------------------------------------------------+ + * | === WARNING: GLOBAL GADGET FILE === | + * +------------------------------------------------------------+ + * | All changes should be made in the repository, | + * | otherwise they will be lost. | + * +------------------------------------------------------------+ + * | Changes to this page may affect many users. | + * | Please discuss changes by opening an issue before editing. | + * +------------------------------------------------------------+ + */ +/* */ + +(() => { + +"use strict"; + +// dist/NavbarAvatar/NavbarAvatar.js +//! src/NavbarAvatar/NavbarAvatar.ts +$(() => { + let username = mw.user.getName(); + let imgsrc = ""; + if (username) { + username = username.replace(" ", "_"); + imgsrc = "https://youshou.wiki/extensions/Avatar/avatar.php?user=".concat(username); + } else { + imgsrc = "https://youshou.wiki/images/avatars/default/default.gif"; + } + const $body = $("body"); + $body.find("#citizen-userMenu__buttonCheckbox .mw-ui-icon-wikimedia-userAvatar").css({ + "background-image": "url(".concat(imgsrc, ")") + }); +}); + +})(); + +/* */ + +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsic3JjL05hdmJhckF2YXRhci9OYXZiYXJBdmF0YXIudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIiQoKCkgPT4ge1xuXHRsZXQgdXNlcm5hbWUgPSBtdy51c2VyLmdldE5hbWUoKTtcblx0bGV0IGltZ3NyYyA9ICcnO1xuXHRpZiAodXNlcm5hbWUpIHtcblx0XHR1c2VybmFtZSA9IHVzZXJuYW1lLnJlcGxhY2UoJyAnLCAnXycpOyAvL+mBv+WFjeWQjeensOW4puepuuagvO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CAicmVwbGFjZSIsICJjb25jYXQiLCAiJGJvZHkiLCAiZmluZCIsICJjc3MiXQp9Cg== diff --git a/dist/Scroller/Scroller.js b/dist/Scroller/Scroller.js new file mode 100644 index 00000000..7498c963 --- /dev/null +++ b/dist/Scroller/Scroller.js @@ -0,0 +1,119 @@ +/** + * * SPDX-License-Identifier: MIT + * _addText: '{{Gadget Header|license=MIT}}' + * + * @source + */ +/** + * +------------------------------------------------------------+ + * | === WARNING: GLOBAL GADGET FILE === | + * +------------------------------------------------------------+ + * | All changes should be made in the repository, | + * | otherwise they will be lost. | + * +------------------------------------------------------------+ + * | Changes to this page may affect many users. | + * | Please discuss changes by opening an issue before editing. | + * +------------------------------------------------------------+ + */ +/* */ + +(() => { + +"use strict"; + +// dist/Scroller/Scroller.js +//! src/Scroller/Scroller.ts +function _createForOfIteratorHelper(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (!it) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) + o = it; + var i = 0; + var F = function() { + }; + return { s: F, n: function() { + if (i >= o.length) + return { done: true }; + return { done: false, value: o[i++] }; + }, e: function(e) { + throw e; + }, f: F }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var normalCompletion = true, didErr = false, err; + return { s: function() { + it = it.call(o); + }, n: function() { + var step = it.next(); + normalCompletion = step.done; + return step; + }, e: function(e) { + didErr = true; + err = e; + }, f: function() { + try { + if (!normalCompletion && it.return != null) + it.return(); + } finally { + if (didErr) + throw err; + } + } }; +} +function _unsupportedIterableToArray(o, minLen) { + if (!o) + return; + if (typeof o === "string") + return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) + n = o.constructor.name; + if (n === "Map" || n === "Set") + return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) + return _arrayLikeToArray(o, minLen); +} +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) + len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) + arr2[i] = arr[i]; + return arr2; +} +var Scroller = function(element) { + const wheelHandler = function(e) { + if (e.deltaY && !e.deltaX) { + e.preventDefault(); + requestAnimationFrame(() => { + element.scrollBy(e.deltaY, 0); + }); + } + }; + element.addEventListener("wheel", wheelHandler); + element.style.scrollSnapType = "none"; + return function() { + element.removeEventListener("wheel", wheelHandler); + element.style.scrollSnapType = ""; + }; +}; +var scrollerContainers = document.getElementsByClassName("scroller-container"); +var _iterator = _createForOfIteratorHelper(scrollerContainers); +var _step; +try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + const element = _step.value; + Scroller(element); + } +} catch (err) { + _iterator.e(err); +} finally { + _iterator.f(); +} + +})(); + +/* */ + +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsic3JjL1Njcm9sbGVyL1Njcm9sbGVyLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBTY3JvbGxlciA9IGZ1bmN0aW9uIChlbGVtZW50OiBIVE1MRWxlbWVudCkge1xuXHRjb25zdCB3aGVlbEhhbmRsZXIgPSBmdW5jdGlvbiAoZTogV2hlZWxFdmVudCkge1xuXHRcdGlmIChlLmRlbHRhWSAmJiAhZS5kZWx0YVgpIHtcblx0XHRcdGUucHJldmVudERlZmF1bHQoKTtcblx0XHRcdHJlcXVlc3RBbmltYXRpb25GcmFtZSgoKSA9PiB7XG5cdFx0XHRcdGVsZW1lbnQuc2Nyb2xsQnkoZS5kZWx0YVksIDApO1xuXHRcdFx0fSk7XG5cdFx0fVxuXHR9O1xuXHRlbGVtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ3doZWVsJywgd2hlZWxIYW5kbGVyKTtcblx0ZWxlbWVudC5zdHlsZS5zY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QjtFQUNoQztBQUNEO0FBQ0EsSUFBTUUscUJBQXFCQyxTQUFTQyx1QkFBdUIsb0JBQW9CO0FBQUEsSUFBQUMsWUFBQUMsMkJBQ3pESixrQkFBQTtBQUR5RCxJQUN6REs7QUFBQSxJQUFBO0FBQXRCLE9BQUFGLFVBQUFHLEVBQUEsR0FBQSxFQUFBRCxRQUFBRixVQUFBSSxFQUFBLEdBQUFDLFFBQTBDO0FBQUEsVUFBL0JwQixVQUFBaUIsTUFBQUk7QUFDVnRCLGFBQVNDLE9BQU87RUFDakI7QUFBQSxTQUFBc0IsS0FBQTtBQUFBUCxZQUFBYixFQUFBb0IsR0FBQTtBQUFBLFVBQUE7QUFBQVAsWUFBQVEsRUFBQTtBQUFBOyIsCiAgIm5hbWVzIjogWyJTY3JvbGxlciIsICJlbGVtZW50IiwgIndoZWVsSGFuZGxlciIsICJlIiwgImRlbHRhWSIsICJkZWx0YVgiLCAicHJldmVudERlZmF1bHQiLCAicmVxdWVzdEFuaW1hdGlvbkZyYW1lIiwgInNjcm9sbEJ5IiwgImFkZEV2ZW50TGlzdGVuZXIiLCAic3R5bGUiLCAic2Nyb2xsU25hcFR5cGUiLCAicmVtb3ZlRXZlbnRMaXN0ZW5lciIsICJzY3JvbGxlckNvbnRhaW5lcnMiLCAiZG9jdW1lbnQiLCAiZ2V0RWxlbWVudHNCeUNsYXNzTmFtZSIsICJfaXRlcmF0b3IiLCAiX2NyZWF0ZUZvck9mSXRlcmF0b3JIZWxwZXIiLCAiX3N0ZXAiLCAicyIsICJuIiwgImRvbmUiLCAidmFsdWUiLCAiZXJyIiwgImYiXQp9Cg== diff --git a/dist/definition.txt b/dist/definition.txt index e324aa10..80c67bcc 100644 --- a/dist/definition.txt +++ b/dist/definition.txt @@ -5,7 +5,14 @@ == appear == +* DisambigLinks[ResourceLoader|default|requiresES6|right=edit]|DisambigLinks.css +* HideConversionTab[ResourceLoader|default|requiresES6]|HideConversionTab.css +* InterwikiTips[ResourceLoader|default|requiresES6]|InterwikiTips.css * React[ResourceLoader|requiresES6]|React.js +== browser == +* NavbarAvatar[ResourceLoader|default|hidden|requiresES6|right=edit]|NavbarAvatar.js +* Scroller[ResourceLoader|default|hidden|requiresES6]|Scroller.js + == edit == * InPageEdit[ResourceLoader|rights=skipcaptcha|requiresES6]|InPageEdit.js diff --git a/src/DisambigLinks/DisambigLinks.css b/src/DisambigLinks/DisambigLinks.css new file mode 100644 index 00000000..84eb82c9 --- /dev/null +++ b/src/DisambigLinks/DisambigLinks.css @@ -0,0 +1,22 @@ +a.mw-disambig::after, +a.mw-redirect::after { + font-weight: normal; + line-height: 0; + text-indent: 0.1em; + vertical-align: super; +} + +a.mw-disambig::after { + content: '⇄'; + font-size: 0.75em; +} + +a.mw-redirect::after { + content: '↳'; + font-size: 0.9em; +} + +a.mw-disambig.mw-redirect::after { + content: '⇄↳'; + font-size: 0.75em; +} diff --git a/src/DisambigLinks/LICENSE b/src/DisambigLinks/LICENSE new file mode 100644 index 00000000..126efb16 --- /dev/null +++ b/src/DisambigLinks/LICENSE @@ -0,0 +1,7 @@ +/** + * SPDX-License-Identifier: CC-BY-SA-4.0 + * _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}' + * + * @source https://github.com/TopRealm/YsArxiv-Gadgets/tree/master/src/DisambigLinks> + * @author Kaldari, Cyberpower678, Alexander Misel, Artoria2e5, WaitSpring , Qiuwen Baike Contributors and YsArxiv Contributors. + */ diff --git a/src/DisambigLinks/definition.json b/src/DisambigLinks/definition.json new file mode 100644 index 00000000..bce71571 --- /dev/null +++ b/src/DisambigLinks/definition.json @@ -0,0 +1,6 @@ +{ + "enable": true, + "description": "将[[LIB:消歧义|消歧义]]和[[Help:重定向|重定向]]链接高亮显示", + "default": true, + "right": "edit" +} diff --git a/src/HideConversionTab/HideConversionTab.css b/src/HideConversionTab/HideConversionTab.css new file mode 100644 index 00000000..43a270bf --- /dev/null +++ b/src/HideConversionTab/HideConversionTab.css @@ -0,0 +1,7 @@ +/* 繁简转换:默认隐藏zh、zh-hans和zh-hant标签,允许用户在小工具中自行关闭。 */ +#ca-varlang-0, +#ca-varlang-1, +#ca-varlang-2, +#mw-mf-language-variant-selection > li:nth-child(-n + 3) { + display: none !important; +} diff --git a/src/HideConversionTab/LICENSE b/src/HideConversionTab/LICENSE new file mode 100644 index 00000000..512a3a32 --- /dev/null +++ b/src/HideConversionTab/LICENSE @@ -0,0 +1,7 @@ +/** + * SPDX-License-Identifier: CC-BY-SA-4.0 + * _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}' + * + * @base + * @source + */ \ No newline at end of file diff --git a/src/HideConversionTab/definition.json b/src/HideConversionTab/definition.json new file mode 100644 index 00000000..08ce8906 --- /dev/null +++ b/src/HideConversionTab/definition.json @@ -0,0 +1,5 @@ +{ + "enable": true, + "description": "D 隐藏“不转换”、“简体”和“繁体”三个变体转换标签", + "default": true +} diff --git a/src/InterwikiTips/InterwikiTips.css b/src/InterwikiTips/InterwikiTips.css new file mode 100644 index 00000000..2d16d1d9 --- /dev/null +++ b/src/InterwikiTips/InterwikiTips.css @@ -0,0 +1,31 @@ +.mw-parser-output a.extiw:is([href*='.qiuwenbaike.cn'])::before, +.mw-parser-output a.extiw:is([href*='.moegirl.org.cn'])::before { + font-weight: normal; + line-height: 0; + text-indent: 0.1em; + vertical-align: super; +} + +.mw-parser-output a.extiw:is([href*='.qiuwenbaike.cn'])::before { + display: inline-block; + font-size: 1em; + width: 1em; + height: 1em; + margin-right: 0; + content: ''; + background: url('https://youshou.wiki/images/4/41/“求”网站图标(透明背景;2023版).svg') no-repeat 0 0; + background-size: 100%; +} + +.mw-parser-output a.extiw:is([href*='.moegirl.org.cn'])::before { + display: inline-block; + font-size: 1em; + width: 1em; + height: 1em; + margin-right: 0; + content: ''; + background: url('https://youshou.wiki/images/8/88/萌娘百科网站图标.svg') no-repeat 0 0; + background-size: 100%; +} + +/* */ diff --git a/src/InterwikiTips/LICENSE b/src/InterwikiTips/LICENSE new file mode 100644 index 00000000..13b9e0aa --- /dev/null +++ b/src/InterwikiTips/LICENSE @@ -0,0 +1,7 @@ +/** + * SPDX-License-Identifier: CC-BY-SA-4.0 + * _addText: '{{Gadget Header|license=CC-BY-SA-4.0|import=no}}' + * + * @source + * @author Zorua-Fox and other Youshou Arxiv Contributors. + */ \ No newline at end of file diff --git a/src/InterwikiTips/definition.json b/src/InterwikiTips/definition.json new file mode 100644 index 00000000..71c6977a --- /dev/null +++ b/src/InterwikiTips/definition.json @@ -0,0 +1,5 @@ +{ + "enable": true, + "description": "D InterwikiTips 为少部分外链提供图片提示", + "default": true +} diff --git a/src/NavbarAvatar/LICENSE b/src/NavbarAvatar/LICENSE new file mode 100644 index 00000000..e196e708 --- /dev/null +++ b/src/NavbarAvatar/LICENSE @@ -0,0 +1,5 @@ +/** + * SPDX-License-Identifier: CC-BY-SA-4.0 + * _addText: '{{Gadget Header|license=CC-BY-SA-4.0|import=no}}' + * @author 顶呱呱的阿杰 + */ \ No newline at end of file diff --git a/src/NavbarAvatar/NavbarAvatar.css b/src/NavbarAvatar/NavbarAvatar.css new file mode 100644 index 00000000..51d46e6f --- /dev/null +++ b/src/NavbarAvatar/NavbarAvatar.css @@ -0,0 +1,20 @@ +/* 隐藏原有图标 */ +#citizen-userMenu__buttonCheckbox .mw-ui-icon-wikimedia-userAvatar::before { + background-image: none; +} + +/* 右上角头像 */ +#citizen-userMenu__buttonCheckbox .mw-ui-icon-wikimedia-userAvatar { + width: 75%; + height: 75%; + border-radius: 5px; + background-size: cover; +} + +/* 深色模式适配 */ +.client-darkmode #citizen-userMenu__buttonCheckbox > .mw-ui-icon-wikimedia-userAvatar { + -webkit-filter: invert(1) hue-rotate(180deg); + filter: invert(1) hue-rotate(180deg); +} + +/* */ diff --git a/src/NavbarAvatar/NavbarAvatar.ts b/src/NavbarAvatar/NavbarAvatar.ts new file mode 100644 index 00000000..133d13c1 --- /dev/null +++ b/src/NavbarAvatar/NavbarAvatar.ts @@ -0,0 +1,14 @@ +$(() => { + let username = mw.user.getName(); + let imgsrc = ''; + if (username) { + username = username.replace(' ', '_'); //避免名称带空格时无法显示头像 + imgsrc = `https://youshou.wiki/extensions/Avatar/avatar.php?user=${username}`; + } else { + imgsrc = 'https://youshou.wiki/images/avatars/default/default.gif'; + } + const $body: JQuery = $('body'); + $body.find('#citizen-userMenu__buttonCheckbox .mw-ui-icon-wikimedia-userAvatar').css({ + 'background-image': `url(${imgsrc})`, + }); +}); diff --git a/src/NavbarAvatar/definition.json b/src/NavbarAvatar/definition.json new file mode 100644 index 00000000..ad6f32ea --- /dev/null +++ b/src/NavbarAvatar/definition.json @@ -0,0 +1,8 @@ +{ + "enable": true, + "description": " NavbarAvatar 在导航栏显示用户头像。", + "section": "browser", + "default": true, + "hidden": true, + "right": ["edit"] +} diff --git a/src/Scroller/LICENSE b/src/Scroller/LICENSE new file mode 100644 index 00000000..28f152eb --- /dev/null +++ b/src/Scroller/LICENSE @@ -0,0 +1,6 @@ +/** + * * SPDX-License-Identifier: MIT + * _addText: '{{Gadget Header|license=MIT}}' + * + * @source + */ \ No newline at end of file diff --git a/src/Scroller/Scroller.css b/src/Scroller/Scroller.css new file mode 100644 index 00000000..2c2b974c --- /dev/null +++ b/src/Scroller/Scroller.css @@ -0,0 +1,3 @@ +.scroller-item { + scroll-behavior: smooth; +} diff --git a/src/Scroller/Scroller.ts b/src/Scroller/Scroller.ts new file mode 100644 index 00000000..9d007fb3 --- /dev/null +++ b/src/Scroller/Scroller.ts @@ -0,0 +1,20 @@ +const Scroller = function (element: HTMLElement) { + const wheelHandler = function (e: WheelEvent) { + if (e.deltaY && !e.deltaX) { + e.preventDefault(); + requestAnimationFrame(() => { + element.scrollBy(e.deltaY, 0); + }); + } + }; + element.addEventListener('wheel', wheelHandler); + element.style.scrollSnapType = 'none'; + return function () { + element.removeEventListener('wheel', wheelHandler); + element.style.scrollSnapType = ''; + }; +}; +const scrollerContainers = document.getElementsByClassName('scroller-container') as HTMLCollectionOf; +for (const element of scrollerContainers) { + Scroller(element); +} diff --git a/src/Scroller/definition.json b/src/Scroller/definition.json new file mode 100644 index 00000000..c9a15455 --- /dev/null +++ b/src/Scroller/definition.json @@ -0,0 +1,7 @@ +{ + "enable": true, + "description": " Scroller 首页新闻鼠标滚轮滚动工具。", + "section": "browser", + "default": true, + "hidden": true +}