Szerkesztő:Gargaj/monobook.js
Megjegyzés: közzététel után frissítened kell a böngésződ gyorsítótárát, hogy lásd a változásokat.
- Firefox / Safari: tartsd lenyomva a Shift gombot és kattints a Frissítés gombra a címsorban, vagy használd a Ctrl–F5 vagy Ctrl–R (Macen ⌘–R) billentyűkombinációt
- Google Chrome: használd a Ctrl–Shift–R (Macen ⌘–Shift–R) billentyűkombinációt
- Internet Explorer / Edge: tartsd nyomva a Ctrl-t, és kattints a Frissítés gombra, vagy nyomj Ctrl–F5-öt
- Opera: Nyomj Ctrl–F5-öt
//document.write('<sc'+'ript type="text/javascript" src="'
// + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
// + '&action=raw&ctype=text/javascript&dontcountme=s"></scr'+'ipt>');
popupFixRedits = true;
popupFixDabs = true;
// -*- mode:java; coding:utf-8 -*-
// <nowiki>
// from http://hu.wikipedia.org/wiki/User:Nagytibi/monobook.js
// Generates the box element containing the spec chars.
function replaceRegexp(replaceWhat, replaceWith, modifiers)
{
if (modifiers == null) modifiers = "";
var pattern = new RegExp(replaceWhat, modifiers);
var obj_ta = document.editform.wpTextbox1;
obj_ta.value = obj_ta.value.replace(pattern, replaceWith);
}
// Replaces Latin 1 chars with properly encoded Hungarian Latin 2 equivalents
function fixLatin1Chars() {
replaceRegexp("Õ", "Ő", "g");
replaceRegexp("Û", "Ű", "g");
replaceRegexp("õ", "ő", "g");
replaceRegexp("û", "ű", "g");
replaceRegexp("ő", "ő", "g");
replaceRegexp("ű", "ű", "g");
}
// Replaces English style "" quotes with Hungarian „”
function fixHungarianQuotes() {
replaceRegexp("\"([^\"]*)\"", "„$1”", "mg");
}
// Translate dates from English format to Hungarian
// Currently it only handles linkified dates
function translateDatesEnHu() {
var months = [
["January", "január"],
["February", "február"],
["March", "március"],
["April", "április"],
["May", "május"],
["June", "június"],
["July", "július"],
["August", "augusztus"],
["September", "szeptember"],
["October", "október"],
["November", "november"],
["December", "december"]
];
for (var i = 0; i < months.length; i++) {
var enMonth = months[i][0];
var huMonth = months[i][1];
// alert("Replacing " + enMonths + " with " + huMonth);
// $1 = "15", $2 = "2005"
replaceRegexp("\\[\\[" + enMonth + " (\\d+)\\]\\],?\\s*\\[\\[(\\d{4})\\]\\]", "[[$2]]. [[" + huMonth + " $1]].", "gm");
}
}
// Replace all occurences of a user-entered regexp with a user entered replacement
function customReplaceForm() {
var form =
'Cseréld ezt a reguláris kifejezést: <input id="customReplaceThis" type="text" size="40"> ' +
'erre: <input id="customReplaceWith" type="text" size="40"> ' +
'<input id="customReplaceCS" type="checkbox"> méretérzékeny <b>::</b> ' +
'<a href="javascript:performCustomReplace()">csere</a>';
insertCustomForm(form);
document.getElementById('customReplaceThis').focus();
}
function performCustomReplace() {
var replaceThis = document.getElementById('customReplaceThis');
var replaceWith = document.getElementById('customReplaceWith');
var cs = document.getElementById('customReplaceCS');
var flags = "gm";
if (!cs.checked) {
flags += "i";
}
replaceRegexp(replaceThis.value, replaceWith.value, flags);
}
function insertCustomForm(formText) {
var customBar = document.getElementById('customBar');
if (customBar == null) return;
var customForm = document.createElement('div');
customForm.setAttribute('id', 'customForm');
customForm.setAttribute('style', 'margin-bottom:2px;border:1px solid #aaaaaa;padding:3px');
customForm.innerHTML =
'<img id="customFormClose" src="http://upload.wikimedia.org/wikipedia/hu/b/bd/Close.png" ' +
'align="right" style="margin:2px" onClick="deleteCustomForm()" ' +
'onmouseover="document.images.namedItem(\'customFormClose\').src=\'http://upload.wikimedia.org/wikipedia/hu/c/cf/Close-hl.png\'" ' +
'onmouseout="document.images.namedItem(\'customFormClose\').src=\'http://upload.wikimedia.org/wikipedia/hu/b/bd/Close.png\'"' +
'onmousedown="document.images.namedItem(\'customFormClose\').src=\'http://upload.wikimedia.org/wikipedia/hu/e/eb/Close-dn.png\'">' +
formText;
var oldForm = document.getElementById('customForm');
if (oldForm != null) {
customBar.parentNode.replaceChild(customForm, oldForm);
} else {
customBar.parentNode.insertBefore(customForm, customBar);
}
}
function deleteCustomForm() {
var customForm = document.getElementById('customForm');
if (customForm != null)
customForm.parentNode.removeChild(customForm);
}
// Initializes edit box
function myOnloadHook() {
var specChars = document.getElementById('specialchars');
specChars.innerHTML =
"<p><a href=\"/wiki/Wikip%C3%A9dia:K%C3%BCl%C3%B6nleges_karakterek\"><b>Karakterek</b></a>: · "+
"<a href=\"javascript:insertTags('á','','')\">á</a> " +
"<a href=\"javascript:insertTags('é','','')\">é</a> " +
"<a href=\"javascript:insertTags('í','','')\">í</a> " +
"<a href=\"javascript:insertTags('ó','','')\">ó</a> " +
"<a href=\"javascript:insertTags('ö','','')\">ö</a> " +
"<a href=\"javascript:insertTags('ő','','')\">ő</a> " +
"<a href=\"javascript:insertTags('ú','','')\">ú</a> " +
"<a href=\"javascript:insertTags('ü','','')\">ü</a> " +
"<a href=\"javascript:insertTags('ű','','')\">ű</a> " +
"<a href=\"javascript:insertTags('Á','','')\">Á</a> " +
"<a href=\"javascript:insertTags('É','','')\">É</a> " +
"<a href=\"javascript:insertTags('Í','','')\">Í</a> " +
"<a href=\"javascript:insertTags('Ó','','')\">Ó</a> " +
"<a href=\"javascript:insertTags('Ö','','')\">Ö</a> " +
"<a href=\"javascript:insertTags('Ő','','')\">Ő</a> " +
"<a href=\"javascript:insertTags('Ú','','')\">Ú</a> " +
"<a href=\"javascript:insertTags('Ü','','')\">Ü</a> " +
"<a href=\"javascript:insertTags('Ű','','')\">Ű</a> · " +
"<a href=\"javascript:fixLatin1Chars()\">kalapos</a> · " +
"<a href=\"javascript:fixHungarianQuotes()\">idézőjel</a> · " +
"<a href=\"javascript:translateDatesEnHu()\">dátum</a> · " +
"<a href=\"javascript:customReplaceForm()\">egyedi</a>" +
"</p>";
}
if (window.addEventListener != null) window.addEventListener("load", myOnloadHook, false);
else if (window.attachEvent) window.attachEvent("onload", myOnloadHook);
importScript('User:Cacycle/wikEd.js');
// </nowiki>