//<pre>
function add_link(url, name)
{
//replace_editing_help(url, name); // remove the "//" at the start of this line to replace the "editing help" under the edit window with the links
//before_editbox(url, name); // remove the "//" at the start of this line to place the links before the editing box
//the following options are skin-specific.
//monobook_tab(url, name); // remove the "//" at the start of this line to place the links in tabs in the monobook skin
//monobook_toolbox(url, name); // remove the "//" at the start of this line to place the links in the toolbox in the monobook skin
//classic_header(url, name); // remove the "//" at the start of this line to place the links in the header in the classic skin
//classic_quickbar(url, name); // remove the "//" at the start of this line to place the links in the quickbar in the classic skin
//nostalgia_header(url, name); // remove the "//" at the start of this line to place the links in the header in the nostalgia skin
//cologneblue_quickbar(url, name); // remove the "//" at the start of this line to place the links in the quickbar in the cologne blue skin
}
function before_editbox(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
na.appendChild(document.createTextNode(name));
var form = document.editform;
var x;
for (x = form.firstChild; x; x = x.nextSibling)
if (x.tagName == 'BR')
{
form.insertBefore(document.createTextNode(' | '), x);
form.insertBefore(na, x);
break;
}
else if (x.tagName == 'TEXTAREA')
{
form.insertBefore(na, x);
form.insertBefore(document.createElement('br'), x);
break;
}
}
function replace_editing_help(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
na.appendChild(document.createTextNode(name));
var form = document.editform;
var em = form.getElementsByTagName('em');
if (em.length > 1)
form.replaceChild(na, em); // we haven't yet removed the "editing help" link, so replace it
else
{
// either there's a br and a list of templates, or the editpage-copywarn div
var x;
for (x = em; x && x.tagName != "BR" && x.tagName != "DIV"; x = x.nextSibling);
if (!x)
{ // didn't find anything! so just append
form.appendChild(document.createTextNode(' | '));
form.appendChild(na);
}
else
{
form.insertBefore(document.createTextNode(' | '), x);
form.insertBefore(na, x);
}
}
}
function monobook_tab(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.appendChild(na);
document.getElementById('p-cactions').getElementsByTagName('ul').appendChild(li);
}
function monobook_toolbox(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.appendChild(na);
document.getElementById('p-tb').getElementsByTagName('ul').appendChild(li);
}
function classic_header(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
na.appendChild(document.createTextNode(name));
var td = document.getElementById('topbar').getElementsByTagName('table').getElementsByTagName('td').getElementsByTagName('p');
if (td.hasChildNodes())
td.appendChild(document.createTextNode(' | '));
td.appendChild(na);
}
function classic_quickbar(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
na.appendChild(document.createTextNode(name));
document.getElementById('quickbar').appendChild(na);
}
function nostalgia_header(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
na.appendChild(document.createTextNode(name));
var bar = document.getElementById('topbar');
var br = bar.getElementsByTagName('br');
bar.insertBefore(document.createTextNode(' | '), br);
bar.insertBefore(na, br);
}
function cologneblue_quickbar(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
na.appendChild(document.createTextNode(name));
var qb = document.getElementById("quickbar");
qb.appendChild(na);
qb.appendChild(document.createElement('br'));
}
function sig()
{
return ' ~~' + '~~';
}
// End of generic code
function transwiki_log()
{
var title = prompt("Title?");
if (title)
{
var target = prompt("To project?")
if (target)
{
if (target == "k" || target == "K" || target == "d" || target == "D")
target = "wikt";
else if (target == "s" || target == "S")
target = "wikisource";
else if (target == "c" || target == "C")
target = "commons";
var txt = document.editform.wpTextbox1;
var vfdd = prompt("Vfd at? (y/Y for ], or empty for none");
if (vfdd == "y" || vfdd == "Y")
vfdd = " (])";
else if (vfdd == "n" || vfdd == "N" || vfdd == "")
vfdd = "";
else
vfdd = " (])";
txt.value += "*] → ]" + sig() + vfdd;
document.editform.wpSummary.value = "] transwikied to ]" + vfdd;
}
}
}
function transwiki_to()
{
var target = prompt("Transwiki to?\nwiKt/Books/Source/Commons/Meta/Quote");
if (target == "k" || target == "K" || target == "d" || target == "D")
target = "en.wiktionary";
else if (target == "b" || target == "B")
target = "en.wikibooks";
else if (target == "s" || target == "S")
target = "wikisource";
else if (target == "c" || target == "C")
target = "commons.wikimedia";
else if (target == "m" || target == "M")
target = "meta.wikimedia";
else if (target == "q" || target == "Q")
target = "en.wikiquote";
else
{
window.alert("Unknown target.");
return;
}
var url = new String(document.location);
url = url.replace(/en\.wikipedia/, target);
url = url.replace(/index\.php\?title=/, "index.php?title=Transwiki:");
window.location = url;
}
function onload_transwiki()
{
if (document.title.indexOf("Editing ") == 0)
{
if (document.title.indexOf("Editing Wikipedia:Transwiki log") == 0)
add_link('javascript:transwiki_log()', 'Log entry');
else
add_link('javascript:transwiki_to()', 'TranswikiTo');
}
//add_link("https://wikifreehand.com/en/Wikipedia:Transwiki log", 'Transwiki log'); // remove the "//" from the start of this line to add a link to the transwiki log. You may want to use a specific add_link function instead, e.g. monobook_toolbox, so it doesn't appear in the same place as the editting links.
}
addOnloadHook(onload_transwiki);
//</pre>