Χρήστης:Geraki/monobook.js
Σημείωση: Μετά την αποθήκευση πρέπει να καθαρίσετε την προσωρινή μνήμη του browser σας για να δείτε τις αλλαγές: Mozilla: πατήστε Reload (ή Ctrl-R), IE / Opera: Ctrl-F5, Safari: Cmd-R, Konqueror Ctrl-R.
//
var addOnloadFunction=function(f) {
if (window.addEventListener) window.addEventListener("load",f,false);
else if (window.attachEvent) window.attachEvent("onload",f);
else {
var oldOnload='_old_onload_'+addOnloadFunction.uid;
addOnloadFunction[oldOnload] = window.onload ? window.onload : function () {};
window.onload = function() { addOnloadFunction[oldOnload](); f(); }
++addOnloadFunction.uid;
}
}
addOnloadFunction.uid=0;
function addlilink(tabs, url, name, id, title, key){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
if(id)
{
if(key && title)
{
ta[id] = [key, title];
}
else if(key)
{
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tabs, url, name, id, title, key);
}
// This will add an [edit top] link at the top of all pages except preview pages
// by User:Pile0nades
setTimeout("editTopLink()", 0) // this is equivalent of onload
function editTopLink() {
// if this is preview page or generated page, stop
if(document.getElementById("wikiPreview") || window.location.href.indexOf("w/index.php?title=Special:") != -1) return;
// get the page title
var pageTitle = document.title.split(" - ")[0].replace(" ", "_");
// create div and set innerHTML to link
var divContainer = document.createElement("div");
divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-top:3px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">επεξεργασία εισαγωγής</a>]</div>';
// insert divContainer into the DOM before the h1
document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
}
function addToolboxLink(url, name, id){
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, url, name, id);
}
function addlilink(tabs, url, name, id, title, key){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
if(id) {
if(key && title) ta[id] = [key, title];
else if(key) ta[id] = [key, ''];
else if(title) ta[id] = ['', title];
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tabs, url, name, id, title, key);
}
function addPurge(){
ta['ca-purge'] = ['g', 'Καθαρισμός της εσωτερικής cache για αυτή τη σελίδα'];
var x = document.getElementById('ca-history');
if(!x) return;
if(x.children) x = x.children[0].href;
else x = x.childNodes[0].href;
addTab(x.replace(/=history/, "=purge"), 'καθαρισμός', 'ca-purge');
akeytt();
}
function replace() {
var s = prompt("Search regexp?");
if(s) {
var r = prompt("Replace regexp?");
if(!r && r != '') return;
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(new RegExp(s, "g"), r);
}
}
function morelinks() {
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tabs, 'javascript:replace()', 'αντικατ.', '');
}
if (document.title.indexOf("Επεξεργασία") == 0) {
if (window.addEventListener) window.addEventListener("load", morelinks, false);
else if (window.attachEvent) window.attachEvent("onload", morelinks);
}
regexTool('Αρίθμηση στίχων','stixoi()');
/****************
*** define tool scripts
****************/
function stixoi() {
regex(/([0-9]+)/g,'{{r|$1}}');
reason('Αρίθμηση στίχων με r');
doaction('diff');
}
//