你现在正在访问的是萌娘百科用于保存和管理图片、音频等媒体文件的子项目萌娘共享,想要回到萌娘百科,请使用浏览器上的返回按钮、或点击这里
“User:Func/vector.js”的版本间的差异
小 |
小 |
||
第89行: | 第89行: | ||
parent.append(editLink); | parent.append(editLink); | ||
var moveLink = document.createElement("a"); | var moveLink = document.createElement("a"); | ||
− | moveLink.href = "/Special:MovePage" + headings[m]. | + | moveLink.href = "/Special:MovePage/File:" + encodeURIComponent(headings[m].text); |
moveLink.text = "移动"; | moveLink.text = "移动"; | ||
parent.append(moveLink); | parent.append(moveLink); |
2021年7月24日 (六) 19:47的版本
// mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=text/javascript'); mw.loader.load('https://wikiplus-app.com/Main.js'); mw.loader.load('https://zh.moegirl.org.cn/index.php?title=User:東東君/js/Wikiplus-replace.js&action=raw&ctype=text/javascript'); mw.loader.load("https://zh.moegirl.org.cn/index.php?title=User:Func/HotCat.js&action=raw&ctype=text/javascript"); mw.loader.load('https://zh.moegirl.org.cn/index.php?title=MediaWiki:Gadget-popups-main.js&action=raw&ctype=text/javascript'); function rallbackInit() { var alledit = $(".mw-contributions-current"); for( var m = 0, len = alledit.length; m < len; m++ ) { var newChk = document.createElement("input"); newChk.type = "checkbox"; newChk.setAttribute("data-title", alledit[m].getElementsByClassName("mw-contributions-title")[0].innerText); newChk.setAttribute("data-revid", alledit[m].getAttribute("data-mw-revid")); alledit[m].prepend(newChk); } $(".mw-contributions-list").prepend('<div><div style="float:right;" class="mw-history-revisionactions"><button type="submit" name="undobackbatch" value="1" class="contributions-undo-button">撤销选中版本</button><button type="submit" name="rollbackbatch" value="1" class="contributions-rollback-button">回退选中页面</button></div><div class="mw-checkbox-toggle-controls">选择:<a class="mw-checkbox-all" role="button" tabindex="0">全选</a>、<a class="mw-checkbox-none" role="button" tabindex="0">全不选</a>、<a class="mw-checkbox-invert" role="button" tabindex="0">反选</a></div></div>'); var $checkboxes = $('li input[type="checkbox"]'); function selectAll(check) { $checkboxes.prop('checked', check); } $('.mw-checkbox-all').click(function() { selectAll(true); }); $('.mw-checkbox-none').click(function() { selectAll(false); }); $('.mw-checkbox-invert').click(function() { $checkboxes.prop('checked', function(i, val) { return !val; }); }); const api = new mw.Api(); $('.contributions-rollback-button').click(function() { const checked = $(".mw-contributions-list li :checkbox:checked"); const user = mw.config.get("wgRelevantUserName"); if (!confirm("您确定要回退这些页面吗?(选中了" + checked.length + "个页面)")) { return; } console.log("开始回退..."); for( var m = 0, len = checked.length; m < len; m++ ) { var title = checked[m].getAttribute("data-title"); try { api.postWithToken("rollback", { action: "rollback", format: "json", title: title, user: user, tags: "Automation tool", summary: "//Rollback" }).done( console.log("回退成功:" + title) ); } catch (e) { console.log("回退失败:" + e instanceof Error ? e.stack.split("\n")[1].trim() : JSON.stringify(e)); } } }); $('.contributions-undo-button').click(function() { const checked = $(".mw-contributions-list li :checkbox:checked"); const user = mw.config.get("wgRelevantUserName"); if (!confirm("您确定要撤销这些版本吗?(选中了" + checked.length + "个页面)")) { return; } console.log("开始撤销..."); for( var m = 0, len = checked.length; m < len; m++ ) { var title = checked[m].getAttribute("data-title"); var revid = checked[m].getAttribute("data-revid"); try { api.postWithToken("csrf", { action: "edit", format: "json", title: title, undo: revid, tags: "Automation tool", summary: "//Undo" }).done( console.log("撤销成功:" + title) ); } catch (e) { console.log("撤销失败:" + e instanceof Error ? e.stack.split("\n")[1].trim() : JSON.stringify(e)); } } }); } function editEveryWhere() { var headings = $(".galleryfilename"); for( var m = 0, len = headings.length; m < len; m++ ) { var parent = $(headings[m]).parent(); var editLink = document.createElement("a"); editLink.href = "/index.php?title=" + encodeURIComponent(headings[m].text) + "&action=edit"; editLink.text = "编辑"; parent.append(editLink); var moveLink = document.createElement("a"); moveLink.href = "/Special:MovePage/File:" + encodeURIComponent(headings[m].text); moveLink.text = "移动"; parent.append(moveLink); } } $( function() { if ( mw.config.get("wgCanonicalSpecialPageName") === "Contributions" ) { rallbackInit(); } editEveryWhere(); $("ul").on("copy", function () { event.returnValue = false; var text = window.getSelection().toString(); const input = document.createElement('input'); document.body.appendChild(input); input.setAttribute('value', text.replace(/[\xA0\u1680\u180E\u2000-\u200B\u200E\u200F\u2028-\u202F\u205F\u3000]*/g, "")); // 去除 &lmr;等 input.select(); document.execCommand('copy'); document.body.removeChild(input); }); });