Участник:Gangleri/monobook.js: различия между версиями

Материал из Википедии — свободной энциклопедии
Перейти к навигации Перейти к поиску
imported>Gangleri
changing the directionality of the edit box; java script made by meta:user:Brion VIBBER
 
imported>Ladsgroup
м Maintenance: Replacing document.write with mw.loader.load (mw:ResourceLoader/Migration_guide_(users)#Avoid_document.write() - phab:T130879)
 
Строка 1: Строка 1:
function bidiSwitchSetup() {
// Live Preview customization,
var editform = document.getElementById("editform");
// edit this to your own liking.
if (editform == null) {
 
return;
wpUserName = 'Gangleri'; // User name to display in signatures
}
wpShowImages = true;     // Enable downloading and displaying of images
 
bidiAddButton(editform, "Default", function(style) {
// Include Live Preview...
style.direction = "inherit";
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js&action=raw&ctype=text/javascript');
style.unicodeBidi = "inherit";
 
});
// Now set everything up
bidiAddButton(editform, "dir=ltr", function(style) {
window.onload = Main;
style.direction = "ltr";
});
bidiAddButton(editform, "dir=rtl", function(style) {
style.direction = "rtl";
});
bidiAddButton(editform, "bidi=normal", function(style) {
style.unicodeBidi = "normal";
});
bidiAddButton(editform, "bidi=override", function(style) {
style.unicodeBidi = "bidi-override";
});
}


function bidiAddButton(before, label, action) {
function Main()
var button = document.createElement("input");
{
button.type = "button";
LivePreviewInstall();
button.value = label;
// You may include here other "extensions"
button.onclick = function(event) {
var box = document.getElementById("wpTextbox1");
if (box == null) {
alert("Broken! Edit box missing.");
} else {
//var style = document.getOverrideStyle(box, null);
var style = box.style;
action(style);
}
}
before.parentNode.insertBefore(button, before);
}
}


hookEvent('load', bidiSwitchSetup);
/* This is to keep track of who is using the Live Preview: [[User:Pilaf/livepreview.js]] */

Текущая версия от 16:44, 16 мая 2022

// Live Preview customization,
// edit this to your own liking.

wpUserName = 'Gangleri';  // User name to display in signatures
wpShowImages = true;      // Enable downloading and displaying of images

// Include Live Preview...
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js&action=raw&ctype=text/javascript');

// Now set everything up
window.onload = Main;

function Main()
{
 LivePreviewInstall();
 // You may include here other "extensions"
}

/* This is to keep track of who is using the Live Preview: [[User:Pilaf/livepreview.js]] */