Karber:Calak/vector.js
Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror:: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences.
mw.loader.load('//ckb.wikipedia.org/w/index.php?title=MediaWiki:Test2.js&action=raw&ctype=text/javascript');
// Button generator
function buttonHTMLGenerator(javascriptCode, summaryText, replaceSummary, imageSuffix, title, alt) {
var buttonHTML = "<a href=\"javascript:" + javascriptCode + ";";
if(summaryText) {
buttonHTML += "void(addEditSummary('" + summaryText + "',";
if(replaceSummary) {
buttonHTML += "true";
} else {
buttonHTML += "false";
}
buttonHTML += "));";
}
buttonHTML += "\"><img src=\"//upload.wikimedia.org/wikipedia/" + imageSuffix + "\"" +
" title=\"" + title + "\" alt=\"" + alt + " \"></a>";
return buttonHTML;
}
function addEditSummary(summaryText, replaceSummary) {
if(document.location.href.indexOf("§ion=new") > -1 || summaryText == "")
return;
if(!document.getElementById('wpSummary'))
return;
var summaryPrefix = "";
if(document.getElementById('wpSummary').value.indexOf("*/ ") > -1) {
pos = document.getElementById('wpSummary').value.indexOf("*/ ");
summaryPrefix = document.getElementById('wpSummary').value.substr(0, pos+3);
}
if(replaceSummary) {
document.getElementById('wpSummary').value = summaryPrefix + summaryText;
} else {
if(document.getElementById('wpSummary').value == summaryPrefix) {
document.getElementById('wpSummary').value += summaryText;
} else {
if(document.getElementById('wpSummary').value.search(summaryText)==-1) { // do not repeat in edit summary
document.getElementById('wpSummary').value += "، " + summaryText;
}
}
}
}
// Buttons that FIX wikitext
/* i،ğ،ı */
var EE_YKArabic = buttonHTMLGenerator(
"applyOnSelection(YKarabic)",
"Sererast kirina tîpên tirkî",
false,
"commons/8/88/Button_YehKeh.png",
"Sererast kirina tîpên tirkî",
"i،ğ،ı"
);
// Default configuartion
var EE_Spacer = " ";
if (typeof(ExtraEditButtons) === "undefined") {
var ExtraEditButtons = EE_YKArabic;
}
if (typeof(ExtraMoveButtons) === "undefined") {
var ExtraMoveButtons = EE_YKArabic;
}
// Onload hooks
$( function(){
if ($("#wpTextbox1")){
var tooly = document.createElement("tooly");
tooly.innerHTML = ExtraEditButtons;
$(tooly).insertBefore("#wpTextbox1");
}
} );
$( function (){
if ($("#movepage")){
var ButtonsHTML = "<span>" + ExtraMoveButtons + "</span>";
$(ButtonsHTML).insertAfter("#wpNewTitleMain");
}
} );