用户:夕舞八弦/common.js
< 用户:夕舞八弦
跳转到导航
跳转到搜索
注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:前往菜单 → 历史(Mac为Opera → Preferences),或按Ctrl-Shift-Del,然后清除浏览数据 → 勾选“已缓存的图片和文件” → 清除数据。
(window.RLQ = window.RLQ || []).push(function () {
//mw.loader.load('/index.php?title=User:梅林/js/pair.js&action=raw&ctype=text/javascript');
if (!!!mw.config.get('wgMFMode')) {
$(document).ready(function () {
mw.util.addPortletLink('p-personal', '/index.php?title=' + mw.config.get('wgPageName') + '&action=view&debug=true', 'debug', '', '', '', '#pt-userpage');
mw.util.addPortletLink('p-personal', '/w/Widget:TagSearch', 'TagSearch', '', '', '', '#pt-userpage');
mw.util.addPortletLink('p-personal', '/w/特殊:版本', '版本', '', '', '', '#pt-userpage');
mw.util.addPortletLink('p-personal', '/w/widget:8sandbox', '8sandbox', '', '', '', '#pt-userpage');
mw.util.addPortletLink('p-personal', '/w/用户:Optexeon/GameInfo', 'gameInfo', '', '', '', '#pt-userpage');
mw.util.addPortletLink('p-personal', 'https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual', 'lua手册', '', '', '', '#pt-userpage');
});
}
var interval = setInterval(function () {
if (typeof mw.Api == 'function') {
clearInterval(interval);
var url = window.location.pathname;
url = decodeURI(url);
url = url.substr(3);
var ns;
var api = new mw.Api();
api.get({
"action": "query",
"prop": "pageprops",
"titles": url
}).done(function (data) {
for (var temO in data.query.pages) {
var o = data.query.pages[temO];
ns = o.ns;
if (ns !== 0) {
url = url.substr(url.indexOf(":") + 1);
}
var api2 = new mw.Api();
api2.get({
"action": "query",
"list": "allpages",
"apprefix": url,
"aplimit": 500,
"apnamespace": ns
}).done(function (data2) {
data2.query.allpages.forEach(function (v) {
console.log("https://fgo.wiki/w/" + v.title.replace(/ /g, "_"));
});
});
}
});
}
}, 1);
});
if (/action=(edit|submit)/.test(location.href)) {
if (/title=Widget:/.test(location.href)) {
var wpText = $('#wpTextbox1');
console.log('preventTab');
wpText[0].addEventListener(
'keydown', function (e) {
var kc = e.keyCode || e.which;
if (kc === 9) {
var start = wpText[0].selectionStart;
var end = wpText[0].selectionEnd;
wpText[0].value = wpText[0].value.substring(0, start) + '\t' + wpText[0].value.substring(end);
wpText[0].selectionStart = wpText[0].selectionEnd = start + 1;
e.preventDefault();
}
}
);
}
}
$().ready(function () {
$('.toc-custom').remove();
var b = $("<div id='rightToc'><div id='rtocbt'>目<br/>录</div></div>");
b.append($('#toc').children('ul').clone().removeAttr("style"));
$("#toc").after(b);
IsAnim = false;
b.ready(function () {
$("#rightToc").children("ul").wrap("<div id='rtoculw'></div>");
$("#rtoculw").children("ul").attr('id', 'rtocul');
console.log($("#rtoculw").outerWidth());
$("#rightToc").css("marginRight", -$("#rtoculw").outerWidth());
$('#rtocbt').on('mouseover', function () {
if (IsAnim) {
return;
}
IsAnim = true;
$("#rightToc").animate({
marginRight: '5px'
}, "fast", function () {
IsAnim = false;
$('#rightToc').addClass('rtshow');
$('#rightToc').removeClass('rthide');
});
});
$($("#rtoculw")[0]).on('mouseleave', function () {
if (IsAnim) {
return;
}
IsAnim = true;
$("#rightToc").animate({
marginRight: -$("#rtoculw").outerWidth()
}, "fast", function () {
IsAnim = false;
$('#rightToc').addClass('rthide');
$('#rightToc').removeClass('rtshow');
});
});
});
});