imported>=海豚= |
imported>=海豚= |
第1行: |
第1行: |
| // <pre>
| | <div id="404search" class="plainlinks" style="text-align: center; font-size: medium;"> |
| "use strict"; | | [[File:1af0ec1c84d5deb91d6d4e6bce273ff69e8b2847.webp|600px]] |
| $(() => (async () => {
| | |
| if (mw.config.get("wgCanonicalSpecialPageName") !== "Recentchanges") {
| | <span style="font-size: x-large;"> 肥肠抱歉,您访问的页面被猫吃掉了4o4</span> |
| return;
| | |
| }
| | 不要着急,喝杯热茶暖暖身子吧!您还可以[[Special:Search/{{PAGENAME}}|搜索本页标题]]或[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} 搜索相关日志]。 |
| await mw.loader.using("mw.Api");
| | |
| const uuidv4 = () => {
| | 但您目前没有权限创建本页面,{{#switch:{{NAMESPACENUMBER}}|0|1|2|3|5|6|7|9|10|11|13|14|15|275|711|828|829|2301='''[https://www.hmoegirl.com/index.php?title=Special:%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95&returnto={{urlencode:{{FULLPAGENAMEE}}}}&returntoquery=variant%3D{{urlencode:{{FULLPAGENAMEE}}}} 登录]''' 后您就可以获得编辑权限啦~ |
| let result = "";
| | |
| while (result === "" || $(`#${result}, [name="${result}"]`).length > 0) {
| | 没有账户?点这里 '''[https://www.hmoegirl.com/index.php?title=Special:%E5%88%9B%E5%BB%BA%E8%B4%A6%E6%88%B7&returnto={{urlencode:{{FULLPAGENAMEE}}}}&returntoquery=variant%3D{{urlencode:{{FULLPAGENAMEE}}}} 注册一个账户]''' ,加入H萌娘!|#default= 因为本页面被设计为只 有[[管理员]]才允许创建}} |
| result = ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
| | ---- |
| (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16),
| | 如您曾通过一个URL链接'''跳转至此'''却找不到页面,这往往是由于链接出现问题所造成的。请尝试在下方输入正确的条目名以搜索条目: |
| );
| | <inputbox> |
| }
| | type=search2 |
| return result;
| | placeholder= 搜索H萌娘 |
| };
| | inline=true |
| const api = new mw.Api();
| | break=no |
| const container = $("<table/>");
| | buttonlabel= 搜索标题 |
| container.html("<td> 加载中……</td>").css("border-collapse", "collapse");
| | </inputbox> |
| $(".tagfilterForm .mw-input").empty().append(container);
| | {{#widget:404search}} |
| const tags = await (async () => {
| | </div> |
| const result = [];
| |
| try {
| |
| const cache = JSON.parse(localStorage.getItem("AnnTools-tags"));
| |
| if (!$.isPlainObject(cache)
| |
| || typeof cache.timestamp !== "number" || cache.timestamp < new Date().getTime() - 24 * 60 * 60 * 1000
| |
| || !Array.isArray(cache.tags)) {
| |
| throw new Error();
| |
| } else {
| |
| for (const tag of cache.tags) {
| |
| if (!("name" in tag && "displayname" in tag && "description" in tag)) {
| |
| throw new Error();
| |
| }
| |
| }
| |
| }
| |
| result.push(...cache.tags);
| |
| } catch {
| |
| const eol = Symbol();
| |
| let tgcontinue = undefined;
| |
| while (tgcontinue !== eol) {
| |
| const _result = await api.post({
| |
| action: "query",
| |
| list: "tags",
| |
| tglimit: "max",
| |
| tgprop: "displayname|description|active",
| |
| tgcontinue,
| |
| });
| |
| if (_result.continue) {
| |
| tgcontinue = _result.continue.tgcontinue;
| |
| } else {
| |
| tgcontinue = eol;
| |
| }
| |
| result.push(..._result.query.tags.filter((tag) => "active" in tag).map((tag) => {
| |
| delete tag.active;
| |
| return tag;
| |
| }));
| |
| }
| |
| localStorage.setItem("AnnTools-tags", JSON.stringify({
| |
| timestamp: new Date().getTime(),
| |
| tags: result,
| |
| }));
| |
| }
| |
| return result;
| |
| })();
| |
| const select = $("<select/>");
| |
| let defaultValue = uuidv4();
| |
| while (tags.includes(defaultValue)) {
| |
| defaultValue = uuidv4();
| |
| }
| |
| select.html(`<option selected value="${defaultValue}">未选择(选中的标签将被过滤)</option>`).attr({
| |
| autocomplete: "none",
| |
| multiple: "multiple",
| |
| });
| |
| tags.forEach(({ displayname, description, name }) => {
| |
| const option = $("<option/>");
| |
| option.text(displayname).attr({
| |
| value: name,
| |
| title: `${description} (${name})`,
| |
| });
| |
| select.append(option);
| |
| });
| |
| const selectTd = $("<td/>");
| |
| selectTd.css("vertical-align", "middle");
| |
| selectTd.append(select);
| |
| container.empty().append(selectTd);
| |
| const typeCheckbox = $("<input/>");
| |
| const typeId = uuidv4();
| |
| typeCheckbox.attr({
| |
| type: "checkbox",
| |
| id: typeId,
| |
| title: "勾选以隐藏未指定标签",
| |
| });
| |
| const typeLabel = $("<label/>");
| |
| typeLabel.text("只显示指定标签的编辑记录").attr({
| |
| "for": typeId,
| |
| title: "勾选以隐藏未指定标签",
| |
| });
| |
| const methodCheckbox = $("<input/>");
| |
| const methodId = uuidv4();
| |
| methodCheckbox.attr({
| |
| type: "checkbox",
| |
| id: methodId,
| |
| });
| |
| const methodLabel = $("<label/>");
| |
| const checkboxTd = $("<td/>");
| |
| checkboxTd.css("vertical-align", "bottom");
| |
| checkboxTd.append(methodCheckbox);
| |
| checkboxTd.append(methodLabel);
| |
| checkboxTd.append('<div style="padding-left: .25em">按住 Ctrl 键可多选,按住 Shift 键可批量选择所 有 项</div>');
| |
| checkboxTd.append(typeCheckbox);
| |
| checkboxTd.append(typeLabel);
| |
| container.append(checkboxTd);
| |
| $(".mw-changeslist-line").each((_, ele) => {
| |
| ele.dataset.tags = Array.from(ele.classList).filter((cls) => cls.startsWith("mw-tag-")).map((cls) => cls.replace("mw-tag-", "")).join("|");
| |
| });
| |
| mw.loader.addStyleTag(".hidden { display: none !important; }");
| |
| select.add(typeCheckbox).add(methodCheckbox).on("change", () => {
| |
| const type = typeCheckbox.prop("checked");
| |
| const method = methodCheckbox.prop("checked");
| |
| const tags = select.val().map((tag) => tag.replace(/ /g, "_"));
| |
| Array.from(document.getElementsByClassName("mw-changeslist-line")).forEach((ele) => {
| |
| const eleTags = ele.dataset.tags.split("|");
| |
| if (method) {
| |
| if (eleTags.filter((tag) => !tags.includes(tag)).length > 0) {
| |
| ele.classList[type ? "add" : "remove"]("hidden");
| |
| } else {
| |
| ele.classList[type ? "remove" : "add"]("hidden");
| |
| }
| |
| } else {
| |
| if (eleTags.filter((tag) => tags.includes(tag)).length > 0) {
| |
| ele.classList[type ? "remove" : "add"]("hidden");
| |
| } else {
| |
| ele.classList[type ? "add" : "remove"]("hidden");
| |
| }
| |
| }
| |
| });
| |
| });
| |
| })());
| |
| // </pre>
| |