User:机智的小鱼君/global.js

importArticles({   type: 'script',    articles: [        'u:dev:QuickCreateUserPage/code.js',//快速建立用户页        'w:dev:QuickCreateMessageWallGreeting/code.js',//快速建立问候语        'u:dev:WallGreetingButton/code.js',//留言墙问候语按钮        'u:dev:AjaxCommentDelete/code.js',//快速删除留言墙，没什么JB用        'u:dev:AjaxUndo/code.js',//快速撤销        'u:dev:RailWAM/code.js',//显示当前社区WAM        'u:dev:FindAndReplace/code.js',//寻找替换功能        'u:dev:DisplayTimer/code.js',//右下角的刷新时钟        'u:dev:ReferencePopups/code.js',        'u:dev:Thread Inspection/code.js',//显示被移除的留言墙        'u:dev:ShowUserGroups.js',//显示用户组        'u:dev:CodeQuickLinks/code.js',//查看社区所有JS        'u:dev:LastEdited/code.js',//页面最近更改摘要        'u:dev:SeeMoreActivityButton/code.js',//维基动态显示查看差异按钮        'u:dev:AjaxRename/code.js',//快速重命名        'u:dev:LinkPreview/code.js',//伪·预览        'u:dev:Rollback/code.js',//伪·回退        'u:dev:RefreshThreads/code.js',//自动刷新帖子 'u:dev:CategoryRenameAuto-update/code.js',//重命名系列分类 'u:dev:GlobalEditcount/code.js',//全域编辑信息 'u:dev:RedirectManagement/code.js',//快速解决损坏重定向 'u:dev:QuickToolsv2/code.js',//万能工具 'u:dev:QuickDiff/code.js',//快速查看差异 'u:dev:QuickLogs/code.js',//伪日志 'u:dev:StickySummary.js',//固定编辑摘要 'u:dev:AjaxRC/code.js',//自动刷新 'u:dev:MassEdit/code.js',//编辑工具 // 'u:dev:MediaWiki:MobileEditor.js',//移动版编辑器 'u:dev:RandomPageShortcut/code.js',//随机页面 'u:dev:BlogLink/code.js', /*组JS*/ "u:dev:BotoneraPopups/BotoneraPopups.js", "u:dev:BotoneraPopups/WikiArticle.js", "u:dev:BotoneraPopups/UILang/en.js", "u:dev:BotoneraPopups/code.js",//popup ] }); /* 用于快速建立系列 */ var qtUserPageTemplate = '\n\n\n==SUBPAGES==\n';//快速建立的用户页内容 var qtEnableUserPageOverwrite = true;//覆盖现有内容 var qtMessageWallGreetingTemplate = '';//快速建立的问候语内容 var qtEnableMessageWallGreetingOverwrite = true;//覆盖现有内容 /* 页面预览 */ window.pPreview = $.extend(true, window.pPreview, {RegExp: (window.pPreview || {}).RegExp || {} }); window.pPreview.wholepage = true; window.pPreview.debug = true; /* 自动刷新配置 */ window.ajaxRefresh = 10000; window.AjaxRCRefreshText = '自动刷新'; window.AjaxRCRefreshHoverText = '自动刷新这个页面'; /*MassEdit*/ window.massEditConfig = {   editSummary:"这是超级无敌的"+""+"脚本"+""+"操作DESU", }; /** 预览颜色 **/ if(wgAction == 'edit' || wgAction == 'submit') {	$('#mw-content-text').prepend(' 预览颜色   ');	$('#colorhex').keyup(function { if($('#colorhex').val[0] == '#') { var hexColor = $('#colorhex').val; } else if($('#colorhex').val !== '') { var hexColor = $('#colorhex').val; } else { var hexColor = ''; }		$('#sample').html('' + hexColor + ' '); }); } /******************************************************* $(function { if ((mw.config.get('skin') !== 'oasis' ) || (window.UsefulDropdown)) { return; }    var i18n = { zh: { // Chinese buttonTitle: '快捷工具', protect: '保护页面', ajaxContent: 'AJAX 刷新', quickDelete: '快速删除', stubTemplate: '+小作品模板', deleteTemplate: '+删除模板', addCustomTemplate: '自定义模板', contentRefreshed: '内容刷新成功！' },       en: { // Chinese buttonTitle: '快捷工具', protect: '保护页面', ajaxContent: 'AJAX 刷新', quickDelete: '快速删除', stubTemplate: '+小作品模板', deleteTemplate: '+删除模板', addCustomTemplate: '自定义模板', contentRefreshed: '内容刷新成功！' },       };   var lang = mw.config.get('wgContentLanguage'), elementContent = $.extend(i18n.en, i18n[lang.split('-')[0]], i18n[lang]); $('.page-header__contribution-buttons').append("" +   "" +    " " + elementContent.buttonTitle + " " +    "" +    "" +    "" +    "  " +    "" +    "" +    "" + elementContent.protect +"" +    "" + elementContent.ajaxContent +"</a></li>" + "" + elementContent.quickDelete +"</a></li>" + "重定向到此</a></li>" + "重定向到</a></li>" + "" + elementContent.addCustomTemplate +"</a></li>" + "</ul>" + "  ");    // Protection     $('a#num1').click(function { var protectiontime = prompt('时限:'); var protectionreason = prompt('原因:'); if (protectiontime) { new mw.Api.post({               action: 'protect',                title: mw.config.get('wgPageName'),                reason: protectionreason,                expiry: protectiontime,                protections: 'edit=sysop',                token: mw.user.tokens.get('editToken')            }).done(function(d) {                if (d.error) {                    new BannerNotification('Error while protecting article: ' + d.error.code, 'error').show;                } else {                    new BannerNotification('Successfully protected article', 'success').show;                }            }).fail(function {                new BannerNotification('Error while protecting article', 'error').show;            }); }   });    // AJAX refresh    $('a#num2,a.usefulbtn').on("click", function refreshArticle { var $temp = $(' '); $temp.load(window.location.href + ' #mw-content-text', function {               var $newContent = $temp.children('#mw-content-text');                if ($newContent.length) {                    $('#mw-content-text').replaceWith($newContent);                    mw.util.$content = $newContent;                }            }        ); $temp.remove; new BannerNotification(elementContent.contentRefreshed, 'success').show; });   // REDIRECT FROM    $('a#num3').click(function { var redirectfrom = prompt('要重定向到'+wgPageName+'的页面'); new mw.Api.post({           action: 'edit',            title: redirectfrom,            summary: "使用API直接写入的页面",            text:'#REDIRECT '+wgPageName+'',            token: mw.user.tokens.get('editToken')        }); });   // REDIRECT TO    $('a#num4').click(function { var redirectto = prompt('要将'+wgPageName+'重定向到哪'); new mw.Api.post({           action: 'edit',            title: wgPageName,            summary: "使用API直接写入的页面",            text:'#REDIRECT '+redirectto+'',            token: mw.user.tokens.get('editToken')        }); });   //Adding ability to have any other template via an input box.    // adding deletion template     $('a#num5').click(function { var templatename = prompt('Template Name:'); new mw.Api.post({           action: 'edit',            title: wgPageName,            summary: "使用API直接执行的添加模版的操作，如有疑问请联系机智的小鱼君",            prependtext: " \n",            token: mw.user.tokens.get('editToken')        }).done(function(d) {            if (d.error) {                new BannerNotification('Error adding template: ' + d.error.code, 'error').show;            } else {                new BannerNotification('Successfully added template!', 'success').show;            }        }).fail(function {            new BannerNotification('Error while adding template', 'error').show;        }); });   // Quick Deletion of article $('a#num7').click(function { new mw.Api.post({       action: 'delete',        title: wgPageName,         reason: "使用API直接执行的的快速删除操作，如有疑问请联系机智的小鱼君",        token: mw.user.tokens.get('editToken')                    }) .done(function {                        location.reload;                    }); }); window.UsefulDropdown = true; }); /******************************************************* $(function {   if ((mw.config.get('skin') !== 'oasis' ) || (window.Quickredirect)) {        return;     }    var RedirectToBtn = 'REDIRECT TO';    var RedirectFromBtn = 'REDIRECT FROM';    $('.page-header__contribution-buttons ul.wds-list').append('<li style="cursor: pointer;">'+RedirectToBtn+'</a></li>'+'<li style="cursor: pointer;">'+RedirectFromBtn+'</a></li>');    // REDIRECT FROM    $('a.redirect-from').click(function { var redirectfrom = prompt('Which page do you want to redirect to'+wgPageName+'?'); if (redirectfrom === null ){ return; }       new mw.Api.post({            action: 'edit',            title: redirectfrom,            summary: "\/\/Quick redirect",            text:'#REDIRECT '+wgPageName+'',            token: mw.user.tokens.get('editToken')        }) .done(function {            alert("Successful redirecting "+redirectfrom+" to "+wgPageName);//成功后提示        }); });   // REDIRECT TO    $('a.redirect-to').click(function { var redirectto = prompt('Which page do you want to redirect '+wgPageName+' to?'); if (redirectto === null ){ return; }       new mw.Api.post({            action: 'edit',            title: wgPageName,            summary: "\/\/Quick redirect",            text:'#REDIRECT '+redirectto+'',            token: mw.user.tokens.get('editToken')        }) .done(function  {                        alert("Successful redirecting "+wgPageName+" to "+redirectto);//成功后提示                        window.location.href="/wiki/"+wgPageName+"?action=purge";//打开重定向到的页面        }); });   window.Quickredirect = true; });
 * 改编自dev.wikia.com/Mediawiki:UsefulDropdown/code.js
 * Quick redirect
 * !TESTING 05:27, May 9, 2018 (UTC)
 * ©Copyright：机智的小鱼君
 * Logs
 * 05:30, May 9, 2018 (UTC)：发布测试
 * **05:49, May 9, 2018 (UTC)：添加了取消功能