User:Ochloese/vector.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
$(function () {
// template shortcut
var search = document.querySelector('#searchInput');
if (search) {
search.addEventListener('input', function(e){
e.target.value = e.target.value.replace(/^{{/,'Template:');
});
}
// replace some text
[
{selector: '#wpSave', value: '編輯'},
{selector: '#wpPreview', value: '預覽'},
{selector: '#wpDiff', value: '差異'}
].forEach(function(pair){
var match = document.querySelector(pair.selector);
if ( match ){
match.value = pair.value;
}
});
const sandboxNode = document.querySelector('#pt-sandbox>a');
if (sandboxNode) {
sandboxNode.href = '/w/index.php?title=User:Ochloese/sandbox';
sandboxNode.classList.remove('new');
}
}());
// Interface customization
/*(function($){
$(function(){
$('<li id="pt-mysub"><a href="http://zh.wikipedia.org/wiki/Special:PrefixIndex/User:Ochloese">Sub-page</a></li><li id="pt-mysb"><a href="http://zh.wikipedia.org/wiki/User:Ochloese/sandbox">Sandbox</a></li><li id="pt-mycss"><a href="http://zh.wikipedia.org/wiki/User:Ochloese/vector.css">CSS</a></li><li id="pt-myjs"><a href="http://zh.wikipedia.org/wiki/User:Ochloese/vector.js">JS</a></li>').insertAfter("#pt-mytalk");
$("#wpTextbox1").prop('readonly', false)
$("#t-upload a").attr("href","/wiki/Special:Upload");
});
})(window.jQuery);
// User page style safety
(function($){
$(function(){
$("div").each(function(){
if ( ( ($(this).css("position") == "fixed") || ($(this).css("position") == "absolute") ) && (parseInt( $(this).css("z-index") ) >= 10) && (parseInt( $(this).css("width") ) >= 50) && (parseInt( $(this).css("height") ) >= 50) && ($(this).css("visibility") != "hidden") && ($(this).css("display" != "none") ) ) {
$('<div id="styleSafety" style="width:100%; max-height:42em; overflow:auto;" />').insertAfter("#jump-to-nav");
$(this).appendTo("#styleSafety");
$("<hr />").appendTo("#styleSafety");
$(this).css("position","inherit");
}
});
});
})(window.jQuery);
// Auto purge
(function($){
$(function(){
A = window.location.href+'?action=purge';
$.ajax({url: A});
});
})(window.jQuery);
// Commons auto-redirect
(function($){
$(function(){
if ($('.sharedUploadNotice tr td p b a').length ) {
window.location.href = $('.sharedUploadNotice tr td p b a').attr('href');
}
});
})(window.jQuery); */