用户:星海子/common.js

来自萌娘文库
跳转至: 导航搜索

注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:前往菜单 → 设置(Mac为Opera → Preferences),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件
//InPageEdit
mw.loader.load('https://fastly.jsdelivr.net/npm/mediawiki-inpageedit');
window.InPageEdit = window.InPageEdit || {};
InPageEdit.myPreference = {
	"outSideClose":true, "editMinor":true, "noConfirmEdit": true, "redLinkQuickEdit":false,
	"editSummary":"    $section$oldid // Edit Via InPageEdit", "watchList": "nochange",
	"plugins":["toolbox.js","edit-any-page.js","quick-thank.js","code-mirror/script.js","wiki-editor.js"],
	"codeMirrorTheme": (mw.config.get("wgNamespaceNumber")%2 == 0 && (mw.config.get("wgTitle").includes(".js") || mw.config.get("wgTitle").includes(".css") || mw.config.get("wgNamespaceNumber") === 274)) ? "solarized" : "juejin"
};
mw.hook("InPageEdit").add(function (ctx) {
	var InPageEdit = ctx.InPageEdit, _msg = ctx._msg, wgPageName = mw.config.get("wgRelevantPageName"), wgRevisionId = mw.config.get("wgRevisionId");
	$("#ca-edit").after(
		$("<li>", { id: "ca-quick-edit", "class": "collapsible"}).append(
			$("<span>").append( $("<a>", { href: "javascript:void(0)", text: _msg("quick-edit") })
			.on("click", function () { InPageEdit.quickEdit({ page: wgPageName, revision: wgRevisionId || undefined });
			})
			)
		)
	);
});
$.when( mw.loader.using( ['mediawiki.util'] ), $.ready )
.then( function () { 
	mw.util.addPortletLink("p-navigation","/index.php?title=Special:Newpages&hideredirs=0&namespace=all","所有新页面",null,null,null,"#n-sidebar-newfiles");
	mw.util.addPortletLink("p-navigation", "/Special:Contributions/机娘星海酱","机器人贡献",null,null,null,"#n-sidebar-newfiles");
	mw.util.addPortletLink("p-navigation", "/Special:Log/星海-adminbot","机器人日志",null,null,null,"#n-sidebar-newfiles");
	mw.util.addPortletLink("p-navigation", "/Special:AbuseFilter","AbuseFilter");
	$("#t-sidebar-delete a, #t-sidebar-expandtemplates a, #t-sidebar-changecontentmodel a").attr("target","_blank");
	if ( mw.config.get("wgNamespaceNumber") === 14 || mw.config.get("wgCanonicalSpecialPageName") === "Whatlinkshere" ){
		$( mw.util.addPortletLink("p-cactions", $("#ca-masseditregex a").attr('href') , "批量正则编辑", "ca-MassEditRegex", "批量正则编辑") ).attr("class","patroller-show"); //MassEditRegex
	}
	if ( mw.config.get("wgNamespaceNumber") === 14 ){
		mw.loader.load('https://fastly.jsdelivr.net/gh/lovelyCARDINAL/moegirl/NEC.min.js'); //NullEditInCategory
	}
});
mw.loader.load('https://zh.moegirl.org.cn/index.php?title=User:星海子/js/markblocked.js&action=raw&ctype=text/javascript');//封禁用户标识
mw.loader.load('https://fastly.jsdelivr.net/gh/lovelyCARDINAL/moegirl/MR.min.js');//批量回退&撤销
/* Hotcat */
window.hotcat_use_category_links = false;
mw.loader.using("mediawiki.user", function () {
	$('body').delegate('#hotcatCommitForm', 'submit', function () {
		var submitType = this.wpDiff;
		if (submitType && (!this.oldid || this.oldid.value == '0')) {
			this.wpEditToken.value = mw.user.tokens.get("csrfToken");
			submitType.name = submitType.value = 'wpSave';
		}
		return true;
	});
});
/* Popups */
window.popupStructure = 'menus';
window.popupHideDelay = '0.1';
window.popupActionsMenu = false;
window.popupShortcutKeys = true;
window.popupImages = false;
window.popupFixRedirs = true;
window.popupRedirAutoClick = 'wpSave';
window.popupFixDabs = true;
window.popupDabsAutoClick = 'wpSave';
window.popupImageLinks = false;