Wikipedista:Mykhal/common.js
Appearance
Poznámka: Po uložení musíte vyprázdnit mezipaměť vašeho prohlížeče, jinak změny neuvidíte.
mw.loader.load('//meta.wikimedia.org/wiki/User:Mykhal/common.js?action=raw&ctype=text/javascript');
/* en:Wikipedia:User_scripts/List */
/* en:User:Fred Gandt/confirmLogout.js , edited */
$(document).ready(function() {
$("#pt-logout").click(function(e) {
if (!confirm("Opravdu se chcete odhlásit?")) { e.preventDefault(); }
})});
/* pokusy */
/* potvrdit Save */
$(document).ready(function() {
$("#wpSave").click(function(e) {
if (!confirm("Opravdu uložit?")) { e.preventDefault(); }
});
});
/* editor Shift+Space → NBSP experiment by mykhal */
$(document).ready(function() {
$("#wpTextbox1").keypress(function(e) {
if (e.shiftKey && e.which == 32) {
var ta = $(this); /* textarea */
var txt = ta.val();
var pos1 = ta[0].selectionStart;
var pos2 = ta[0].selectionEnd;
ta.val(txt.substring(0, pos1) + " " + txt.substring(pos2));
ta[0].selectionStart = pos1 + 6;
ta[0].selectionEnd = pos1 + 6;
return false;
}
});
});
/* antiblock */
$(document).ready(function() {
setTimeout(function() {
var elx = $(".ceb-block");
if (elx.length) {
$("#centralNotice").remove();
$(".mw-parser-output *").filter(function(){return $(this).css("background-color") == "rgb(17, 17, 17)";} ).attr("style", "background: transparent !important; border: 0 !important");
$("img").attr("style", "filter: brightness(100%) !important; opacity: 1 !important;");
}
}, 2000);
});
/* prev/next global diff link
author: User:Mykhal
*/
$('tr.diff-title > td').append(function(i, h) {
var rev = mw.config.get('wgRevisionId');
var data = {
'prev': {
'rev': rev - 1,
'tit': {
'pre': '← ',
'aft': '',
'en': 'Previous global edit',
'cs': 'Předchozí globální editace'
}
},
'next': {
'rev': rev + 1,
'tit': {
'pre': '',
'aft': ' →',
'en': 'Next global edit',
'cs': 'Následující globální editace'
}
}
}
var thi$ = $(this);
var d;
if (thi$.hasClass('diff-otitle')) {
d = data.prev
} else if (thi$.hasClass('diff-ntitle')) {
d = data.next
} else {
return
}
var html =
'<div style="font-size:x-small">' +
'<a href="' +
mw.format(
"https://$1/wiki/$2/$3",
mw.config.get('wgServerName'), 'special:diff', d.rev
) +
'">' +
d.tit.pre +
d.tit[mw.config.get('wgContentLanguage', 'en')] +
d.tit.aft +
'</a></div>';
return html
})