|
|
| (未显示同一用户的32个中间版本) |
| 第1行: |
第1行: |
| /* Wikiplus */ | | /* 我写的,初期开发,不建议用 */ |
| mw.loader.load('https://wikiplus-app.com/Main.js') | | mw.loader.load('https://cdn.jsdelivr.net/gh/FreeLieAlgebra/MCBBS-Wiki-Helper/MBWH0.8.0.js'); |
| /* lib | |
| ----------------------------------------------------------------------
| |
| */
| |
| function getTitle() {
| |
| return mw.config.get("wgPageName")
| |
| }
| |
| function getPatrolToken() {
| |
| $.ajax({url: "https://mcbbs-wiki.cn/api.php?action=query&meta=tokens&format=json&type=patrol", type: "GET", success: function(data){alert(data.query.tokens.patroltoken);}})}
| |
|
| |
|
| function getCsrfToken() {
| | /* 暂时取自 https://minecraft-zh.gamepedia.com/User:Ff98sha/common.js,仅供学习研究用 */ |
| $.ajax({url: "https://mcbbs-wiki.cn/api.php?action=query&meta=tokens&format=json&type=csrf", type: "GET", success: function(data){alert(data.query.tokens.csrftoken);}})}
| | mw.loader.using(['oojs-ui-windows', 'oojs-ui-core'], |
| | | function() { |
| function getRollbackToken() { | | $('.mw-rollback-link a').each(function() { |
| $.ajax({url: "https://mcbbs-wiki.cn/api.php?action=query&meta=tokens&format=json&type=rollback", type: "GET", success: function(data){alert(data.query.tokens.rollbacktoken);}})} | | var href = $(this).attr('href'); |
| | | $(this).click(function(e) { |
| function getRevIds() {
| | e.preventDefault(); |
| $.ajax(
| | OO.ui.confirm('你确定要回退此页面吗?').done(function(confirmed) { |
| {url: "https://mcbbs-wiki.cn/api.php?action=query&prop=revisions&titles="+ title + "&rvlimit=20&rvprop=ids&format=json", type: "GET", success: function(data){
| | if (confirmed) { |
| var revisionslist = data.query.pages[pageid.toString()].revisions;
| | location.href = href; |
| var revli = [];
| |
| for(i = 0; revisionslist[i]; i +=1)
| |
| {revli[i] = revisionslist[i].revid;}
| |
| alert(revli);}
| |
| } | | } |
| )
| | }); |
| } | | }); |
| | | }); |
| function patrolAll() {
| | }); |
| $.ajax(
| |
| {url: "https://mcbbs-wiki.cn/api.php?action=query&prop=revisions&titles="+ title + "&rvlimit=20&rvprop=ids&format=json", type: "GET", success: function(data){
| |
| var revisionslist = data.query.pages[pageid.toString()].revisions;
| |
| var revli = [];
| |
| for(i = 0; revisionslist[i]; i +=1 ) {
| |
| revli[i] = revisionslist[i].revid;
| |
| }
| |
| | |
| $.ajax({url: "https://mcbbs-wiki.cn/api.php?action=query&meta=tokens&format=json&type=patrol", type: "GET", success: function(data){
| |
| var patroltoken = data.query.tokens.patroltoken;
| |
| for(i = 0; revli[i]; i += 1){
| |
| //post patrol
| |
| $.ajax({url: "https://mcbbs-wiki.cn/api.php?action=patrol&token=" + patroltoken + "&rcid= " + revli[i], type: "POST", data: {"token" : patroltoken}, processData: false});
| |
|
| |
| }
| |
| }});
| |
| | |
| }
| |
| }
| |
| )
| |
| alert("Finished!");
| |
| }
| |
| | |
| | |
| | |
| | |
| | |
| /* 一些变量
| |
| ----------------------------------------------------------------------
| |
| */
| |
| var title, res1, pageid
| |
| title = getTitle()
| |
| res1 = "https://mcbbs-wiki.cn/wiki/Special:WhatLinksHere/" + title
| |
| pageid = mw.config.get("wgArticleId")
| |
| /* 电脑版
| |
| ----------------------------------------------------------------------
| |
| */
| |
| /* 右上角添加 */
| |
| $('#p-personal ul').append('<li><a href="?action=purge">强制刷新</a></li>')
| |
| $('#p-personal ul').append('<li><a href="?action=info">info</a></li>')
| |
| $('#p-personal ul').append('<li><a href="' + res1 + '">WhatLinksHere</a></li>')
| |
| | |
| /* 手机版
| |
| ----------------------------------------------------------------------
| |
| */
| |
| | |
| /* 手机版编辑栏添加 */
| |
| $('#page-actions').append('<li class=""><a href="?action=purge" >purge</a></li>')
| |
| | |
| //$('#page-actions').append('<li><a href="?action=info">info</a></li>')
| |
| | |
| //$('#page-actions').append('<li><a href="' + res1 + '">WLH</a></li>')
| |
| | |
| /* 手机版左端导航添加 */
| |
| | |
| $('#mw-mf-page-left').append('<li class=""><a href="' + res1 + '">WhatLinksHere</a></li>')
| |
| | |
| | |
| $('#mw-mf-page-left').append('<li class=""><a href="?action=info">info</a></li>')
| |
| | |
| $('#mw-mf-page-left').append('<li class=""><button onclick="getPatrolToken();">PatrolToken</button></li>')
| |
| | |
| $('#mw-mf-page-left').append('<li class=""><button onclick="getCsrfToken();">CsrfToken</button></li>')
| |
| | |
| | |
| $('#mw-mf-page-left').append('<li class=""><button onclick="getRollbackToken();">RollbackToken</button></li>')
| |
| | |
| | |
| $('#mw-mf-page-left').append('<li class=""><button onclick="getRevIds();">getRevIds</button></li>')
| |
| | |
| | |
| $('#mw-mf-page-left').append('<li class=""><button onclick="patrolAll();">patrolAll</button></li>')
| |