From b826921d469c15481c6c3cff22c578af1814ebf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E7=BB=99?= <2271007263A@gmail.com> Date: Sat, 17 Feb 2024 17:54:08 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E5=B0=8F=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AdvancedSiteNotices/.options | 1 + .../AdvancedSiteNotices.css | 66 + .../AdvancedSiteNotices.js | 253 + src/AjaxLogin/.options | 1 + src/AjaxLogin/AjaxLogin.js | 517 ++ src/Autolink/.options | 1 + src/Autolink/Autolink.js | 183 + src/Carousel/.options | 1 + src/Carousel/Carousel-cfg.js | 57 + src/Carousel/Carousel.css | 106 + src/Carousel/Carousel.js | 1134 +++ src/CodeLinks/.options | 1 + src/CodeLinks/CodeLinks.js | 243 + src/Collapsible/.options | 1 + src/Collapsible/Collapsible.css | 38 + src/Collapsible/Collapsible.js | 244 + src/CollapsibleSidebar/.options | 1 + src/CollapsibleSidebar/CollapsibleSidebar.js | 181 + src/ConfirmLogout/.options | 1 + src/ConfirmLogout/ConfirmLogout.js | 59 + src/CookieWarning/.options | 1 + src/CookieWarning/CookieWarning.css | 50 + src/CookieWarning/CookieWarning.js | 67 + src/Definitions/.options | 1 + src/Definitions/Definitions.css | 37 + src/Definitions/Definitions.js | 251 + src/Ding/.options | 1 + src/Ding/Ding.css | 101 + src/Ding/Ding.js | 74 + src/DisamAssist/.options | 1 + src/DisamAssist/DisamAssist.css | 104 + src/DisamAssist/DisamAssist.js | 1047 +++ src/DisambigLinks/.options | 1 + src/DisambigLinks/DisambigLinks.css | 43 + src/EasyArchive/.options | 1 + src/EasyArchive/EasyArchive.js | 700 ++ src/Edit-count/.options | 1 + src/Edit-count/Edit-count.js | 162 + src/Edit0/.options | 1 + src/Edit0/Edit0.css | 75 + src/Edit0/Edit0.js | 59 + src/EditConflict/.options | 1 + src/EditConflict/EditConflict.js | 319 + src/EditFormJS/.options | 1 + src/EditFormJS/Editform.js | 258 + src/Edittools-delh/.options | 1 + src/Edittools-delh/Edittools-delh.js | 195 + src/Edittools-refToolbar/.options | 1 + src/Edittools-refToolbar/RefToolbar.js | 54 + src/Edittools-vector/.options | 1 + src/Edittools-vector/Edittools-vector.js | 218 + src/Edittools-vplus/.options | 1 + src/Edittools-vplus/Edittools-vplus.js | 363 + src/FloatTOC/.options | 1 + src/FloatTOC/FloatTOC.css | 145 + src/FloatTOC/FloatTOC.js | 246 + src/Fullwidth-search-fix/.options | 1 + .../Fullwidth-search-fix.js | 42 + src/Geo/.options | 1 + src/Geo/Geo.js | 121 + src/GeoLocation/.options | 1 + src/GeoLocation/GeoLocation.css | 100 + src/GeoLocation/GeoLocation.js | 540 ++ src/GeoLocationReader/.options | 1 + src/GeoLocationReader/GeoLocationReader.css | 110 + src/GeoLocationReader/GeoLocationReader.js | 1258 +++ src/Gongbi-TOC3/.options | 1 + src/Gongbi-TOC3/Gongbi-TOC3.css | 7 + src/HanSect/.options | 1 + src/HanSect/HanSect.css | 56 + src/HideConversionTab/.options | 1 + src/HideConversionTab/HideConversionTab.css | 28 + src/HotCat/.options | 1 + src/HotCat/HotCat.js | 3377 +++++++ src/HotCat/Hotcatcheck.js | 245 + src/InPageEdit/.options | 1 + src/InPageEdit/InPageEdit-load.js | 28 + src/InfoboxCSS/.options | 1 + src/InfoboxCSS/Infobox.css | 195 + src/InterwikiTips/.options | 1 + src/InterwikiTips/InterwikiTips.css | 50 + src/ListUsersLastActive/.options | 1 + .../ListUsersLastActive.js | 145 + src/LoginToEdit/.options | 1 + src/LoginToEdit/LoginToEdit.js | 123 + src/MarkRights/.options | 1 + src/MarkRights/MarkRights.css | 163 + src/MarkRights/MarkRights.js | 213 + src/Markblocked/.options | 1 + src/Markblocked/Markblocked.js | 224 + src/MboxCss/.options | 1 + src/MboxCss/Mbox.css | 319 + src/Morebits/.options | 1 + src/NavFrame/.options | 1 + src/NavFrame/NavFrame.css | 75 + src/NavFrame/NavFrame.js | 99 + src/NavbarAvatar/.options | 1 + src/NavbarAvatar/NavbarAvatar.css | 37 + src/NavbarAvatar/NavbarAvatar.js | 31 + src/NavboxCSS/.options | 1 + src/NavboxCSS/Navbox.css | 362 + src/Navigation_popups/.options | 1 + src/Navigation_popups/Popups.css | 183 + src/Navigation_popups/Popups.js | 923 ++ src/NoteTA-Vector/.options | 1 + src/NoteTA-Vector/NoteTA-Vector.css | 18 + src/NoteTA-Vector/NoteTA-Vector.js | 34 + src/NoteTA/.options | 1 + src/NoteTA/NoteTA.css | 9 + src/NoteTA/NoteTA.js | 192 + src/NotifyConversion/.options | 1 + src/NotifyConversion/NotifyConversion.css | 26 + src/NotifyConversion/NotifyConversion.js | 94 + src/OneSideMenu/.options | 1 + src/OneSideMenu/OneSideMenu.css | 30 + src/OnlineAdmins/.options | 1 + src/OnlineAdmins/OnlineAdmins.js | 174 + src/PagePatroller/.options | 1 + src/PagePatroller/PagePatroller.js | 100 + src/PreserveVariant/.options | 1 + src/PreserveVariant/PreserveVariant.js | 45 + src/ProveIt/.options | 1 + src/ProveIt/ProveIt-load.js | 31 + src/ProveIt/ProveIt.js | 1691 ++++ src/PurgePageCache/.options | 1 + src/PurgePageCache/PurgePageCache.js | 94 + src/QuickPatrol/.options | 1 + src/QuickPatrol/QuickPatrol.js | 125 + src/RRD/.options | 1 + src/RRD/RRD.js | 259 + src/RollbackSummary/.options | 1 + src/RollbackSummary/RollbackSummary.js | 48 + src/ScrollUpButton/.options | 1 + src/ScrollUpButton/ScrollUpButton.js | 102 + src/Scroller/.options | 1 + src/Scroller/Scroller.css | 78 + src/Scroller/Scroller.js | 78 + src/SearchShortcuts/.options | 1 + src/SearchShortcuts/SearchShortcuts.js | 46 + src/Select2/.options | 1 + src/ShortURL/.options | 1 + src/ShortURL/ShortURL.js | 175 + src/ShowAvatar/.options | 1 + src/ShowAvatar/ShowAvatar.css | 54 + src/ShowAvatar/ShowAvatar.js | 48 + src/SideTOC/.options | 1 + src/SideTOC/SideTOC.js | 38 + src/SiteCommonJS/.options | 1 + src/SiteCommonJS/SiteCommon.js | 322 + src/ToolsRedirect-bio-latin-names/.options | 1 + .../ToolsRedirect-bio-latin-names.js | 33 + .../.options | 1 + .../ToolsRedirect-courtesy-and-art-names.js | 108 + src/ToolsRedirect-opt-bolds/.options | 1 + .../ToolsRedirect-opt-bolds.js | 14 + src/ToolsRedirect/.options | 1 + src/ToolsRedirect/ToolsRedirect.css | 45 + src/ToolsRedirect/ToolsRedirect.js | 674 ++ src/TranslateVariants/.options | 1 + src/TranslateVariants/TranslateVariants.js | 238 + src/Twinkle/.options | 1 + src/UTCLiveClock/.options | 1 + src/UTCLiveClock/UTCLiveClock.js | 145 + src/UserJS/.options | 1 + src/UserJS/User.js | 214 + src/UserLinkAvatar/.options | 1 + src/UserLinkAvatar/UserLinkAvatar.css | 55 + src/UserLinkAvatar/UserLinkAvatar.js | 82 + src/UserLinkAvatarMagnifier/.options | 1 + .../UserLinkAvatarMagnifier.css | 3 + src/UserRightsManager/.options | 1 + src/UserRightsManager/UserRightsManager.js | 374 + src/WhoIsActive/.options | 1 + src/WhoIsActive/WhoIsActive.css | 99 + src/WhoIsActive/WhoIsActive.js | 171 + src/Wikicache/.options | 1 + src/Wikicache/Wikicache-load.js | 306 + src/Wikiplus/.options | 1 + src/Wikiplus/Wikiplus-highlight.js | 1028 +++ src/Wikiplus/Wikiplus-load.js | 51 + src/Wikiplus/Wikiplus.js | 7790 +++++++++++++++++ src/Wordcount/.options | 1 + src/Wordcount/Wordcount.js | 54 + src/i18n/.options | 1 + src/i18n/i18n.js | 203 + src/jQueryLazyload/.options | 1 + src/jQueryLazyload/jQueryLazyload.js | 204 + 187 files changed, 32586 insertions(+) create mode 100644 src/AdvancedSiteNotices/.options create mode 100644 src/AdvancedSiteNotices/AdvancedSiteNotices.css create mode 100644 src/AdvancedSiteNotices/AdvancedSiteNotices.js create mode 100644 src/AjaxLogin/.options create mode 100644 src/AjaxLogin/AjaxLogin.js create mode 100644 src/Autolink/.options create mode 100644 src/Autolink/Autolink.js create mode 100644 src/Carousel/.options create mode 100644 src/Carousel/Carousel-cfg.js create mode 100644 src/Carousel/Carousel.css create mode 100644 src/Carousel/Carousel.js create mode 100644 src/CodeLinks/.options create mode 100644 src/CodeLinks/CodeLinks.js create mode 100644 src/Collapsible/.options create mode 100644 src/Collapsible/Collapsible.css create mode 100644 src/Collapsible/Collapsible.js create mode 100644 src/CollapsibleSidebar/.options create mode 100644 src/CollapsibleSidebar/CollapsibleSidebar.js create mode 100644 src/ConfirmLogout/.options create mode 100644 src/ConfirmLogout/ConfirmLogout.js create mode 100644 src/CookieWarning/.options create mode 100644 src/CookieWarning/CookieWarning.css create mode 100644 src/CookieWarning/CookieWarning.js create mode 100644 src/Definitions/.options create mode 100644 src/Definitions/Definitions.css create mode 100644 src/Definitions/Definitions.js create mode 100644 src/Ding/.options create mode 100644 src/Ding/Ding.css create mode 100644 src/Ding/Ding.js create mode 100644 src/DisamAssist/.options create mode 100644 src/DisamAssist/DisamAssist.css create mode 100644 src/DisamAssist/DisamAssist.js create mode 100644 src/DisambigLinks/.options create mode 100644 src/DisambigLinks/DisambigLinks.css create mode 100644 src/EasyArchive/.options create mode 100644 src/EasyArchive/EasyArchive.js create mode 100644 src/Edit-count/.options create mode 100644 src/Edit-count/Edit-count.js create mode 100644 src/Edit0/.options create mode 100644 src/Edit0/Edit0.css create mode 100644 src/Edit0/Edit0.js create mode 100644 src/EditConflict/.options create mode 100644 src/EditConflict/EditConflict.js create mode 100644 src/EditFormJS/.options create mode 100644 src/EditFormJS/Editform.js create mode 100644 src/Edittools-delh/.options create mode 100644 src/Edittools-delh/Edittools-delh.js create mode 100644 src/Edittools-refToolbar/.options create mode 100644 src/Edittools-refToolbar/RefToolbar.js create mode 100644 src/Edittools-vector/.options create mode 100644 src/Edittools-vector/Edittools-vector.js create mode 100644 src/Edittools-vplus/.options create mode 100644 src/Edittools-vplus/Edittools-vplus.js create mode 100644 src/FloatTOC/.options create mode 100644 src/FloatTOC/FloatTOC.css create mode 100644 src/FloatTOC/FloatTOC.js create mode 100644 src/Fullwidth-search-fix/.options create mode 100644 src/Fullwidth-search-fix/Fullwidth-search-fix.js create mode 100644 src/Geo/.options create mode 100644 src/Geo/Geo.js create mode 100644 src/GeoLocation/.options create mode 100644 src/GeoLocation/GeoLocation.css create mode 100644 src/GeoLocation/GeoLocation.js create mode 100644 src/GeoLocationReader/.options create mode 100644 src/GeoLocationReader/GeoLocationReader.css create mode 100644 src/GeoLocationReader/GeoLocationReader.js create mode 100644 src/Gongbi-TOC3/.options create mode 100644 src/Gongbi-TOC3/Gongbi-TOC3.css create mode 100644 src/HanSect/.options create mode 100644 src/HanSect/HanSect.css create mode 100644 src/HideConversionTab/.options create mode 100644 src/HideConversionTab/HideConversionTab.css create mode 100644 src/HotCat/.options create mode 100644 src/HotCat/HotCat.js create mode 100644 src/HotCat/Hotcatcheck.js create mode 100644 src/InPageEdit/.options create mode 100644 src/InPageEdit/InPageEdit-load.js create mode 100644 src/InfoboxCSS/.options create mode 100644 src/InfoboxCSS/Infobox.css create mode 100644 src/InterwikiTips/.options create mode 100644 src/InterwikiTips/InterwikiTips.css create mode 100644 src/ListUsersLastActive/.options create mode 100644 src/ListUsersLastActive/ListUsersLastActive.js create mode 100644 src/LoginToEdit/.options create mode 100644 src/LoginToEdit/LoginToEdit.js create mode 100644 src/MarkRights/.options create mode 100644 src/MarkRights/MarkRights.css create mode 100644 src/MarkRights/MarkRights.js create mode 100644 src/Markblocked/.options create mode 100644 src/Markblocked/Markblocked.js create mode 100644 src/MboxCss/.options create mode 100644 src/MboxCss/Mbox.css create mode 100644 src/Morebits/.options create mode 100644 src/NavFrame/.options create mode 100644 src/NavFrame/NavFrame.css create mode 100644 src/NavFrame/NavFrame.js create mode 100644 src/NavbarAvatar/.options create mode 100644 src/NavbarAvatar/NavbarAvatar.css create mode 100644 src/NavbarAvatar/NavbarAvatar.js create mode 100644 src/NavboxCSS/.options create mode 100644 src/NavboxCSS/Navbox.css create mode 100644 src/Navigation_popups/.options create mode 100644 src/Navigation_popups/Popups.css create mode 100644 src/Navigation_popups/Popups.js create mode 100644 src/NoteTA-Vector/.options create mode 100644 src/NoteTA-Vector/NoteTA-Vector.css create mode 100644 src/NoteTA-Vector/NoteTA-Vector.js create mode 100644 src/NoteTA/.options create mode 100644 src/NoteTA/NoteTA.css create mode 100644 src/NoteTA/NoteTA.js create mode 100644 src/NotifyConversion/.options create mode 100644 src/NotifyConversion/NotifyConversion.css create mode 100644 src/NotifyConversion/NotifyConversion.js create mode 100644 src/OneSideMenu/.options create mode 100644 src/OneSideMenu/OneSideMenu.css create mode 100644 src/OnlineAdmins/.options create mode 100644 src/OnlineAdmins/OnlineAdmins.js create mode 100644 src/PagePatroller/.options create mode 100644 src/PagePatroller/PagePatroller.js create mode 100644 src/PreserveVariant/.options create mode 100644 src/PreserveVariant/PreserveVariant.js create mode 100644 src/ProveIt/.options create mode 100644 src/ProveIt/ProveIt-load.js create mode 100644 src/ProveIt/ProveIt.js create mode 100644 src/PurgePageCache/.options create mode 100644 src/PurgePageCache/PurgePageCache.js create mode 100644 src/QuickPatrol/.options create mode 100644 src/QuickPatrol/QuickPatrol.js create mode 100644 src/RRD/.options create mode 100644 src/RRD/RRD.js create mode 100644 src/RollbackSummary/.options create mode 100644 src/RollbackSummary/RollbackSummary.js create mode 100644 src/ScrollUpButton/.options create mode 100644 src/ScrollUpButton/ScrollUpButton.js create mode 100644 src/Scroller/.options create mode 100644 src/Scroller/Scroller.css create mode 100644 src/Scroller/Scroller.js create mode 100644 src/SearchShortcuts/.options create mode 100644 src/SearchShortcuts/SearchShortcuts.js create mode 100644 src/Select2/.options create mode 100644 src/ShortURL/.options create mode 100644 src/ShortURL/ShortURL.js create mode 100644 src/ShowAvatar/.options create mode 100644 src/ShowAvatar/ShowAvatar.css create mode 100644 src/ShowAvatar/ShowAvatar.js create mode 100644 src/SideTOC/.options create mode 100644 src/SideTOC/SideTOC.js create mode 100644 src/SiteCommonJS/.options create mode 100644 src/SiteCommonJS/SiteCommon.js create mode 100644 src/ToolsRedirect-bio-latin-names/.options create mode 100644 src/ToolsRedirect-bio-latin-names/ToolsRedirect-bio-latin-names.js create mode 100644 src/ToolsRedirect-courtesy-and-art-names/.options create mode 100644 src/ToolsRedirect-courtesy-and-art-names/ToolsRedirect-courtesy-and-art-names.js create mode 100644 src/ToolsRedirect-opt-bolds/.options create mode 100644 src/ToolsRedirect-opt-bolds/ToolsRedirect-opt-bolds.js create mode 100644 src/ToolsRedirect/.options create mode 100644 src/ToolsRedirect/ToolsRedirect.css create mode 100644 src/ToolsRedirect/ToolsRedirect.js create mode 100644 src/TranslateVariants/.options create mode 100644 src/TranslateVariants/TranslateVariants.js create mode 100644 src/Twinkle/.options create mode 100644 src/UTCLiveClock/.options create mode 100644 src/UTCLiveClock/UTCLiveClock.js create mode 100644 src/UserJS/.options create mode 100644 src/UserJS/User.js create mode 100644 src/UserLinkAvatar/.options create mode 100644 src/UserLinkAvatar/UserLinkAvatar.css create mode 100644 src/UserLinkAvatar/UserLinkAvatar.js create mode 100644 src/UserLinkAvatarMagnifier/.options create mode 100644 src/UserLinkAvatarMagnifier/UserLinkAvatarMagnifier.css create mode 100644 src/UserRightsManager/.options create mode 100644 src/UserRightsManager/UserRightsManager.js create mode 100644 src/WhoIsActive/.options create mode 100644 src/WhoIsActive/WhoIsActive.css create mode 100644 src/WhoIsActive/WhoIsActive.js create mode 100644 src/Wikicache/.options create mode 100644 src/Wikicache/Wikicache-load.js create mode 100644 src/Wikiplus/.options create mode 100644 src/Wikiplus/Wikiplus-highlight.js create mode 100644 src/Wikiplus/Wikiplus-load.js create mode 100644 src/Wikiplus/Wikiplus.js create mode 100644 src/Wordcount/.options create mode 100644 src/Wordcount/Wordcount.js create mode 100644 src/i18n/.options create mode 100644 src/i18n/i18n.js create mode 100644 src/jQueryLazyload/.options create mode 100644 src/jQueryLazyload/jQueryLazyload.js diff --git a/src/AdvancedSiteNotices/.options b/src/AdvancedSiteNotices/.options new file mode 100644 index 00000000..cdfc97ed --- /dev/null +++ b/src/AdvancedSiteNotices/.options @@ -0,0 +1 @@ +AdvancedSiteNotices[ResourceLoader|default|dependencies=ext.gadget.i18n,mediawiki.api,mediawiki.storage,mediawiki.util]|AdvancedSiteNotices.css|AdvancedSiteNotices.js \ No newline at end of file diff --git a/src/AdvancedSiteNotices/AdvancedSiteNotices.css b/src/AdvancedSiteNotices/AdvancedSiteNotices.css new file mode 100644 index 00000000..4439d777 --- /dev/null +++ b/src/AdvancedSiteNotices/AdvancedSiteNotices.css @@ -0,0 +1,66 @@ +/** + * SPDX-License-Identifier: CC-BY-SA-4.0 + * _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}' + * + * @base + * @source + * @dependency ext.gadget.i18n, mediawiki.api, mediawiki.storage, mediawiki.util + */ +/** + * +--------------------------------------------------------+ + * | === 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 at talk page before editing. | + * +--------------------------------------------------------+ + */ +/* */ +#asn-area { + display: flex; + height: 4em; + align-items: center; + padding: 0 0.5em; + border: 1px solid #ccc; + background: #fafbfc; + overflow-y: hidden; + text-align: center; +} + +#asn-name { + order: 1; + padding: 0 0.5em; + border-radius: 0.25em; + background: #36c; + color: #fff; + white-space: nowrap; +} + +#asn-dismissable-notice { + width: 100%; + order: 2; + margin: 1em 0.5em; +} + +#advancedSiteNotices { + word-break: break-word; +} + +#asn-dismiss { + min-width: 2em; + order: 3; + font-size: 150%; +} + +#asn-dismiss a { + color: #000; +} + +#asn-dismiss a:hover { + color: #36c; + text-decoration: none; +} + +/* */ \ No newline at end of file diff --git a/src/AdvancedSiteNotices/AdvancedSiteNotices.js b/src/AdvancedSiteNotices/AdvancedSiteNotices.js new file mode 100644 index 00000000..e9e8d93c --- /dev/null +++ b/src/AdvancedSiteNotices/AdvancedSiteNotices.js @@ -0,0 +1,253 @@ +/** + * 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 at talk page before editing. | + * +--------------------------------------------------------+ + */ +/* */ +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +$( /*#__PURE__*/function () { + var _advancedSiteNotices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { + var $siteNotice, i18nMessages, messages, message, STORAGE_KEY, asnVersion, asnVersionLast, $asnList, asnTimer, asnStyles, $asnArea, $asnDismiss, $asnDismissableNotices, $asnName, $currentNotice, testCriteria, matchCriteria, loadNotices, _response$parse, api, response, $notices; + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + $siteNotice = $('#siteNotice'); + if (!(['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1 || !$siteNotice.length)) { + _context.next = 3; + break; + } + return _context.abrupt("return"); + case 3: + i18nMessages = function i18nMessages() { + var _i18n = i18n, + localize = _i18n.localize; + return { + announcement: localize({ + ja: '通知', + zh: '公告' + }), + dismiss: localize({ + en: 'turn off this notice', + ja: 'ASNをオフにする', + 'zh-hans': '关闭公告', + 'zh-hant': '關閉公告' + }), + dismissNotice: localize({ + en: 'You have chosen to turn off Advanced Site Notices for the next 30 days.
If the site-wide announcement is not updated within the next 30 days, it will no longer be displayed; however, if the site-wide announcement is updated, it will be displayed again.', + ja: '今後30日間、ASNをオフにすることを選択しました。
サイト全体の通知が今後30日以内に更新されない場合、表示されなくなります。ただし、サイト全体の通知が更新される場合は、再び表示されます。', + 'zh-hans': '您已选择在接下来30日内关闭“高级站点通告”。
若接下来30日内全站公告未有更新,则不再显示;但是,若全站公告内容更新,则将重新显示。', + 'zh-hant': '您已選擇在接下來30日內關閉「高級站點通告」。
若接下來30日內全站公告未有更新,則不再顯示;但是,若全站公告內容更新,則將重新顯示。' + }) + }; + }; + messages = i18nMessages(); + message = function message(key) { + return messages[key] || key; + }; + STORAGE_KEY = 'dismissASN'; + asnVersion = '0'; + asnVersionLast = mw.storage.get(STORAGE_KEY); + asnStyles = []; + $asnArea = $('
').attr('id', 'asn-area'); + $asnDismiss = $('
').attr('id', 'asn-dismiss').append($('').attr({ + href: '#', + role: 'button', + title: message('dismiss'), + 'aria-label': message('dismiss') + }).text('×')); + $asnDismissableNotices = $('
').addClass('noprint').attr('id', 'asn-dismissable-notice'); + $asnName = $('
').attr('id', 'asn-name').text(message('announcement')); + $currentNotice = $('
').attr('id', 'advancedSiteNotices').addClass('center'); + $asnArea.append($asnName, $asnDismissableNotices.append($currentNotice), $asnDismiss); + $asnDismiss.on('click', function (event) { + event.preventDefault(); + clearTimeout(asnTimer); + $asnArea.remove(); + mw.storage.set(STORAGE_KEY, asnVersion, 2592e3); // 30 days + mw.notify($('').html(message('dismissNotice'))); + }); + testCriteria = function testCriteria(criteria) { + // @ts-ignore + var in_group = function in_group(group) { + var _wgUserGroups$include; + var wgUserGroups = mw.config.get('wgUserGroups'); + return (_wgUserGroups$include = wgUserGroups === null || wgUserGroups === void 0 ? void 0 : wgUserGroups.indexOf(group) !== -1) !== null && _wgUserGroups$include !== void 0 ? _wgUserGroups$include : false; + }; + // @ts-ignore + var only_for = function only_for(userLanguage) { + return userLanguage === mw.config.get('wgUserLanguage'); + }; + // FIXME: This shouldn't be using eval on data entered in wikitext. + // If that data is malformed it will throw an exception e.g. criteria = "(false))" + try { + // eslint-disable-next-line security/detect-eval-with-expression, no-eval + return eval(criteria); + } catch (_unused) { + return false; + } + }; + matchCriteria = function matchCriteria($asnItem) { + var cache = $asnItem.data('asn-cache'); + if (cache !== undefined) { + return cache; + } + var criteria = $asnItem.attr('data-asn-criteria'); + if (criteria === undefined) { + criteria = $asnItem.attr('class') ? 'false' : 'true'; + if ($asnItem.hasClass('only_sysop')) { + criteria += '||in_group("sysop")'; + } + if ($asnItem.hasClass('only_logged')) { + criteria += '||in_group("user")'; + } + if ($asnItem.hasClass('only_anon')) { + criteria += '||!in_group("user")'; + } + if ($asnItem.hasClass('only_zh_cn')) { + criteria += '||only_for("zh-cn")'; + } + if ($asnItem.hasClass('only_zh_sg')) { + criteria += '||only_for("zh-sg")'; + } + if ($asnItem.hasClass('only_zh_my')) { + criteria += '||only_for("zh-my")'; + } + if ($asnItem.hasClass('only_zh_hk')) { + criteria += '||only_for("zh-hk")'; + } + if ($asnItem.hasClass('only_zh_mo')) { + criteria += '||only_for("zh-mo")'; + } + if ($asnItem.hasClass('only_zh_tw')) { + criteria += '||only_for("zh-tw")'; + } + } else { + criteria = decodeURIComponent(criteria.replace(/\+/g, '%20')); + criteria = criteria.trim() || 'true'; + } + var result = testCriteria(criteria); + $asnItem.data('asn-cache', result); + return result; + }; + loadNotices = function loadNotices(index) { + if (asnVersion === asnVersionLast || !$asnArea.length) { + return; + } + var asnListLength = $asnList.length; + var nextAsnIndex = (index + 1) % asnListLength; + var $asnItem = $(); + var i = 0; + while (i++ < asnListLength) { + $asnItem = $asnList.eq(index); + if ($asnItem.length) { + if (!matchCriteria($asnItem)) { + loadNotices(nextAsnIndex); + return; + } + index = index++ % asnListLength; + } + } + if (typeof $asnItem.data('asn-html') === 'string') { + $asnItem.data('asn-html-raw', decodeURIComponent($asnItem.data('asn-html').replace(/\+/g, '%20'))); + $asnItem.data('asn-html', ''); + } + if (typeof $asnItem.data('asn-style') === 'string') { + var style = mw.util.addCSS(decodeURIComponent($asnItem.data('asn-style').replace(/\+/g, '%20'))); + $asnItem.data('asn-style', ''); + $asnItem.data('asn-style-id', asnStyles.length); + style.disabled = true; + asnStyles.push(style); + } + var asnItemHtml = $asnItem.data('asn-html-raw') || $asnItem.html(); + var styleId = $asnItem.data('asn-style-id'); + var currentNoticeHtml = $currentNotice.html(); + if (currentNoticeHtml && currentNoticeHtml !== asnItemHtml) { + $currentNotice.stop().fadeOut(function () { + for (var _i = 0, _asnStyles = asnStyles; _i < _asnStyles.length; _i++) { + var _style = _asnStyles[_i]; + _style.disabled = true; + } + var asnStyle = asnStyles[styleId]; + if (asnStyle) { + asnStyle.disabled = false; + } + $currentNotice.html(asnItemHtml); + // animation try /catched to avoid TypeError: (Animation.tweeners[prop]||[]).concat is not a function error being seen in production + try { + $currentNotice.fadeIn(); + } catch (_unused2) {} + }); + } else if (!currentNoticeHtml) { + $asnArea.appendTo($siteNotice); + var asnStyle = asnStyles[styleId]; + if (asnStyle) { + asnStyle.disabled = false; + } + $currentNotice.html(asnItemHtml).fadeIn(); + } + asnTimer = setTimeout(function () { + loadNotices(nextAsnIndex); + }, 7e3); + }; + _context.prev = 20; + api = new mw.Api({ + ajax: { + headers: { + 'Api-User-Agent': "Qiuwen/1.1 (AdvancedSiteNotices/1.1; ".concat(mw.config.get('wgWikiID'), ")") + } + } + }); + _context.next = 24; + return api.get({ + action: 'parse', + formatversion: '2', + prop: 'text', + page: 'Template:AdvancedSiteNotices/ajax', + uselang: mw.config.get('wgUserLanguage'), + variant: mw.config.get('wgUserLanguage') + }); + case 24: + response = _context.sent; + if ((_response$parse = response['parse']) !== null && _response$parse !== void 0 && _response$parse.text) { + _context.next = 27; + break; + } + return _context.abrupt("return"); + case 27: + $notices = $('
').html(response['parse'].text).find('ul.sitents'); + asnVersion = $notices.data('asn-version').toString(); + $asnList = $('li', $notices); + loadNotices(Math.floor(Math.random() * $asnList.length)); + _context.next = 35; + break; + case 33: + _context.prev = 33; + _context.t0 = _context["catch"](20); + case 35: + case "end": + return _context.stop(); + } + }, _callee, null, [[20, 33]]); + })); + function advancedSiteNotices() { + return _advancedSiteNotices.apply(this, arguments); + } + return advancedSiteNotices; +}()); +/* */ \ No newline at end of file diff --git a/src/AjaxLogin/.options b/src/AjaxLogin/.options new file mode 100644 index 00000000..1a9d4a37 --- /dev/null +++ b/src/AjaxLogin/.options @@ -0,0 +1 @@ +AjaxLogin[ResourceLoader|default|hidden|dependencies=ext.gadget.Ding,ext.gadget.i18n,mediawiki.api,oojs-ui-core,oojs-ui-windows,oojs-ui.styles.icons-interactions,oojs-ui.styles.icons-user]|AjaxLogin.js \ No newline at end of file diff --git a/src/AjaxLogin/AjaxLogin.js b/src/AjaxLogin/AjaxLogin.js new file mode 100644 index 00000000..5c9ccf34 --- /dev/null +++ b/src/AjaxLogin/AjaxLogin.js @@ -0,0 +1,517 @@ +/** + * SPDX-License-Identifier: GPL-3.0 + * _addText: '{{Gadget Header|license=GPL-3.0}}' + * + * @source + * @author 安忆 + * @dependency ext.gadget.Ding, ext.gadget.i18n, mediawiki.api, oojs-ui-core, oojs-ui-windows, oojs-ui.styles.icons-interactions, oojs-ui.styles.icons-user + */ +/** + * +--------------------------------------------------------+ + * | === 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 at talk page before editing. | + * +--------------------------------------------------------+ + */ +/* */ +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return { value: void 0, done: !0 }; } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable || "" === iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } throw new TypeError(_typeof(iterable) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +(function ajaxLogin() { + var ding = function ding(value) { + var autoHide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'default'; + autoHide ? DingExposedInterface(value, type) : DingExposedInterface(value, type, 'long'); + }; + var windowManager; + var ajaxLoginMain = function ajaxLoginMain() { + var i18nMessages = function i18nMessages() { + var _i18n = i18n, + localize = _i18n.localize; + return { + '6-digit number': localize({ + ja: '6桁の数字', + 'zh-hans': '6位数字', + 'zh-hant': '6位數字' + }), + Cancel: localize({ + ja: 'キャンセル', + zh: '取消' + }), + 'Enter password': localize({ + ja: 'パスワード', + 'zh-hans': '请输入密码', + 'zh-hant': '請輸入密碼' + }), + 'Enter 2FA verification code': localize({ + en: '2FA verification code', + ja: '2FA認証コード', + 'zh-hans': '请输入2FA验证码', + 'zh-hant': '請輸入2FA驗證碼' + }), + 'Forgot password?': localize({ + ja: 'パスワードをお忘れですか?', + 'zh-hans': '忘记密码?', + 'zh-hant': '忘記密碼?' + }), + 'Getting login token': localize({ + ja: 'ログイントークンを取得しています', + 'zh-hans': '正在获取登录令牌', + 'zh-hant': '正在獲取登入權杖' + }), + 'help for I agree with the relevant terms': localize({ + en: 'When you login, it means that you have carefully read, fully understood and agreed to comply with the Terms of Service, Personal Information Protection Policy and General Principles.', + ja: 'ログインをすると、あなたは本サイトの『利用規約』『個人情報保護条例』『档案馆章程』を十分に理解し、同意したことになります。', + 'zh-hans': '登录时,即代表您已仔细阅读、充分了解并同意遵守本网站的《用户协议》《个人信息保护条例》《档案馆章程》。', + 'zh-hant': '登錄時,即代表您已仔細閱讀、充分了解並同意遵守本網站的《用戶協議》《個人信息保護条例》《档案馆章程》。' + }), + 'I agree with the relevant terms': localize({ + ja: '関連する規約を読み、同意', + 'zh-hans': '我已阅读并同意相关条款', + 'zh-hant': '我已閲讀並同意相關條款' + }), + 'If selected, the login status will be kept for 6 months. If not selected, it will be kept for 1 month.': localize({ + ja: 'チェックを入れるとログイン状態が6ヶ月間保持され、入れない場合は1ヶ月間保持されます。', + 'zh-hans': '勾选则保持登录状态6个月,不勾选则保持1个月。', + 'zh-hant': '勾選则保持登入狀態6個月,不勾選則保持1個月。' + }), + 'Keep me logged in': localize({ + ja: 'ログイン状態を保持', + 'zh-hans': '记住我的登录状态', + 'zh-hant': '記住我的登入狀態' + }), + 'Logging in': localize({ + ja: 'ログインしています', + 'zh-hans': '正在登录', + 'zh-hant': '正在登入' + }), + Login: localize({ + ja: 'ログイン', + 'zh-hans': '登录', + 'zh-hant': '登入' + }), + 'Login cancelled': localize({ + ja: 'ログインキャンセル', + 'zh-hans': '登录取消', + 'zh-hant': '登入取消' + }), + 'Login succeed': localize({ + ja: 'ログインに成功しました', + 'zh-hans': '登录成功', + 'zh-hant': '登入成功' + }), + 'Login token getted': localize({ + ja: 'ログイントークンの取得に成功しました', + 'zh-hans': '获取登录令牌成功', + 'zh-hant': '獲取登入權杖成功' + }), + 'Network error': localize({ + ja: 'ネットワークエラー', + 'zh-hans': '网络异常', + 'zh-hant': '網路異常' + }), + 'New password': localize({ + ja: '新しいパスワード', + 'zh-hans': '新密码', + 'zh-hant': '新密碼' + }), + 'New password is required': localize({ + ja: '新しいパスワードを設定してください', + 'zh-hans': '需要设置新密码', + 'zh-hant': '需要設置新密碼' + }), + Password: localize({ + ja: 'パスワード', + 'zh-hans': '密码', + 'zh-hant': '密碼' + }), + 'Please read the relevant terms. If you agree, check the checkbox to confirm': localize({ + ja: '関連する規約をお読みいただき、同意される場合は、チェックボックスにチェックを入れて確認してください', + 'zh-hans': '请阅读相关条款。若同意,勾选复选框以确认', + 'zh-hant': '請閲讀相關條款。若同意,勾選複選框以確認' + }), + 'Reset password': localize({ + ja: 'パスワードをリセット', + 'zh-hans': '重置密码', + 'zh-hant': '重新設定密碼' + }), + 'The 2FA verification code cannot be empty': localize({ + ja: '2FA認証コードが入力されていません', + 'zh-hans': '2FA验证码不能为空', + 'zh-hant': '2FA驗證碼不能爲空' + }), + 'The password cannot be empty': localize({ + ja: 'パスワードが入力されていません', + 'zh-hans': '密码不能为空', + 'zh-hant': '密碼不能爲空' + }), + 'The username or password cannot be empty': localize({ + ja: '利用者名またはパスワードが入力されていません', + 'zh-cn': '用户名或密码不能为空', + 'zh-hk': '用戶名稱或密碼不能爲空', + 'zh-tw': '使用者名稱或密碼不能爲空' + }), + 'The user login is too frequent, please try again in five minutes': localize({ + ja: '利用者が頻繁すぎるため、5分後に再試行してください', + 'zh-cn': '用户登录过于频繁,请五分钟后再试', + 'zh-hk': '用戶登入過於頻繁,請五分鐘後再試', + 'zh-tw': '使用者登入过于频繁,请五分钟后再试' + }), + 'Unknown API error': localize({ + ja: '未定義のAPIエラー', + 'zh-hans': '未定义的API错误', + 'zh-hant': '未定義的API錯誤' + }), + Username: localize({ + ja: '利用者名', + 'zh-cn': '用户名', + 'zh-hk': '用戶名稱', + 'zh-tw': '使用者名稱' + }), + 'Invalid 2FA verification code': localize({ + ja: '2FA認証コードが間違っています', + 'zh-hans': '2FA验证码错误', + 'zh-hant': '2FA驗證碼錯誤' + }), + 'Invalid useruame or password': localize({ + ja: '利用者名またはパスワードが間違っています', + 'zh-cn': '用户名或密码错误', + 'zh-hk': '用戶名稱或密碼錯誤', + 'zh-tw': '使用者名稱或密碼錯誤' + }) + }; + }; + var messages = i18nMessages(); + var message = function message(key) { + return messages[key] || key; + }; + var messageDialog = new OO.ui.MessageDialog(); + var nameInput = new OO.ui.TextInputWidget({ + icon: 'userAvatar', + placeholder: message('Username'), + validate: 'non-empty' + }); + var pwdInput = new OO.ui.TextInputWidget({ + icon: 'key', + placeholder: message('Password'), + type: 'password', + validate: 'non-empty' + }); + var agreeTosCheckbox = new OO.ui.CheckboxInputWidget(); + var agreeTosLayout = new OO.ui.FieldLayout(agreeTosCheckbox, { + align: 'inline', + label: message('I agree with the relevant terms') + }); + var keepLoginCheckbox = new OO.ui.CheckboxInputWidget(); + var keepLoginLayout = new OO.ui.FieldLayout(keepLoginCheckbox, { + align: 'inline', + help: message('If selected, the login status will be kept for 6 months. If not selected, it will be kept for 1 month.'), + label: message('Keep me logged in') + }); + var $label = $('