你现在正在访问的是萌娘百科用于保存和管理图片、音频等媒体文件的子项目萌娘共享,想要回到萌娘百科,请使用浏览器上的返回按钮、或点击这里
“User:Func/vector.js”的版本间的差异
(// Edit via Wikiplus) |
|||
第114行: | 第114行: | ||
document.body.removeChild(input); | document.body.removeChild(input); | ||
}); | }); | ||
+ | }); | ||
+ | |||
+ | $(function() { | ||
+ | var self = $('#p-cactions .menu ul'); | ||
+ | if (!self.find('li')[0] || $('.will2Be2Deleted')[0] || mw.config.get('wgUserGroups').indexOf('patroller') === -1) return; | ||
+ | $('<a/>', { | ||
+ | attr: { | ||
+ | href: "#", | ||
+ | title: "挂删本页[alt-shift-d]", | ||
+ | accesskey: 'd' | ||
+ | }, | ||
+ | text: '挂删' | ||
+ | }).on('click', function() { | ||
+ | var reason = prompt('挂删的理由【将会替换全文内容】\n【空白则使用默认理由(不在收录范围内)】\n【取消则不进行挂删】:'), | ||
+ | self = $(this); | ||
+ | if (reason === null) return; | ||
+ | if (reason === '') reason = '不在收录范围内'; | ||
+ | var loadingBox = $('<div/>', { | ||
+ | css: { | ||
+ | position: 'fixed', | ||
+ | top: '0', | ||
+ | left: '0', | ||
+ | height: '100vh', | ||
+ | width: '100vw', | ||
+ | transition: 'opacity .73s linear', | ||
+ | color: 'black', | ||
+ | 'padding-top': '49vh', | ||
+ | 'background-color': 'rgba(255,255,255,0.73)', | ||
+ | 'text-align': 'center' | ||
+ | } | ||
+ | }).append('<img src="https://img.moegirl.org.cn/common/d/d1/Windows_10_loading.gif" style="height: 1em; margin-top: -.25em;">正在挂删中……'), | ||
+ | reasonText = reason ? '|' + reason : '', | ||
+ | api = new mw.Api(); | ||
+ | loadingBox.endOut = function endOut() { | ||
+ | this.css('color', 'red').text('挂删失败……').delay(1000).queue(function() { | ||
+ | $(this).css('opacity', '0').delay(730).queue(function() { | ||
+ | $(this).remove(); | ||
+ | $(document.body).css('overflow', 'auto'); | ||
+ | $(this).dequeue(); | ||
+ | }); | ||
+ | $(this).dequeue(); | ||
+ | }); | ||
+ | }; | ||
+ | $(document.body).append(loadingBox).css('overflow', 'hidden'); | ||
+ | api.postWithToken('csrf', { | ||
+ | action: 'edit', | ||
+ | format: 'json', | ||
+ | title: mw.config.get('wgPageName'), | ||
+ | text: '<noinclude>{{即将删除' + reasonText + '|user=' + mw.config.get("wgUserName") + '}}</noinclude>', | ||
+ | summary: '挂删:' + reason, | ||
+ | nocreate: true, | ||
+ | watchlist: 'preferences' | ||
+ | }).then(function(d) { | ||
+ | if (d.error) return loadingBox.endOut(); | ||
+ | loadingBox.css('color', 'green').text('挂删成功!即将刷新……'); | ||
+ | window.setTimeout(function() { | ||
+ | window.location.reload(); | ||
+ | }, 730) | ||
+ | }, loadingBox.endOut.bind(loadingBox)); | ||
+ | }).appendTo($('<li/>', { | ||
+ | attr: { | ||
+ | id: 'ca-registerToDelete' | ||
+ | } | ||
+ | }).prependTo(self)); | ||
}); | }); |
2021年8月7日 (六) 22:29的版本
// 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.target = "_blank"; editLink.text = "编辑"; parent.append(editLink); var moveLink = document.createElement("a"); moveLink.href = "/Special:MovePage/File:" + encodeURIComponent(headings[m].text); moveLink.target = "_blank"; moveLink.text = "移动"; parent.append(moveLink); } } $( function() { if ( mw.config.get("wgCanonicalSpecialPageName") === "Contributions" ) { rallbackInit(); } editEveryWhere(); var ele = $('#wpNewTitleMain input')[0]; ele.value = ele.value.replace('pfbg', 'skin_bg'); $("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); }); }); $(function() { var self = $('#p-cactions .menu ul'); if (!self.find('li')[0] || $('.will2Be2Deleted')[0] || mw.config.get('wgUserGroups').indexOf('patroller') === -1) return; $('<a/>', { attr: { href: "#", title: "挂删本页[alt-shift-d]", accesskey: 'd' }, text: '挂删' }).on('click', function() { var reason = prompt('挂删的理由【将会替换全文内容】\n【空白则使用默认理由(不在收录范围内)】\n【取消则不进行挂删】:'), self = $(this); if (reason === null) return; if (reason === '') reason = '不在收录范围内'; var loadingBox = $('<div/>', { css: { position: 'fixed', top: '0', left: '0', height: '100vh', width: '100vw', transition: 'opacity .73s linear', color: 'black', 'padding-top': '49vh', 'background-color': 'rgba(255,255,255,0.73)', 'text-align': 'center' } }).append('<img src="https://img.moegirl.org.cn/common/d/d1/Windows_10_loading.gif" style="height: 1em; margin-top: -.25em;">正在挂删中……'), reasonText = reason ? '|' + reason : '', api = new mw.Api(); loadingBox.endOut = function endOut() { this.css('color', 'red').text('挂删失败……').delay(1000).queue(function() { $(this).css('opacity', '0').delay(730).queue(function() { $(this).remove(); $(document.body).css('overflow', 'auto'); $(this).dequeue(); }); $(this).dequeue(); }); }; $(document.body).append(loadingBox).css('overflow', 'hidden'); api.postWithToken('csrf', { action: 'edit', format: 'json', title: mw.config.get('wgPageName'), text: '<noinclude>{{即将删除' + reasonText + '|user=' + mw.config.get("wgUserName") + '}}</noinclude>', summary: '挂删:' + reason, nocreate: true, watchlist: 'preferences' }).then(function(d) { if (d.error) return loadingBox.endOut(); loadingBox.css('color', 'green').text('挂删成功!即将刷新……'); window.setTimeout(function() { window.location.reload(); }, 730) }, loadingBox.endOut.bind(loadingBox)); }).appendTo($('<li/>', { attr: { id: 'ca-registerToDelete' } }).prependTo(self)); });