MediaWiki:Common.js: Verskil tussen weergawes
Content deleted Content added
k Weergawe 5031 deur Adriaan ongedaan gemaak (Bespreking). |
kopieer vanaf Wikipedia |
||
Lyn 1: | Lyn 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ |
|||
function returnObjById( id ) |
function returnObjById( id ) |
||
{ |
{ |
||
Lyn 9: | Lyn 11: | ||
return returnVar; |
return returnVar; |
||
} |
} |
||
function insertTagsTo_(tagOpen, tagClose, sampleText, outputid) { |
function insertTagsTo_(tagOpen, tagClose, sampleText, outputid) { |
||
var txtarea = document.getElementById(outputid); |
var txtarea = document.getElementById(outputid); |
||
Lyn 63: | Lyn 65: | ||
txtarea.caretPos = document.selection.createRange().duplicate(); |
txtarea.caretPos = document.selection.createRange().duplicate(); |
||
} |
} |
||
/** Extra toolbar options ****************************************************** <nowiki> |
/** Extra toolbar options ****************************************************** <nowiki> |
||
* |
* |
||
Lyn 84: | Lyn 88: | ||
mwCustomEditButtons[mwCustomEditButtons.length] = { |
mwCustomEditButtons[mwCustomEditButtons.length] = { |
||
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png", |
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png", |
||
"speedTip": " |
"speedTip": "Deurstreep teks", |
||
"tagOpen": "<s>", |
"tagOpen": "<s>", |
||
"tagClose": "</s>", |
"tagClose": "</s>", |
||
"sampleText": " |
"sampleText": "Deurstreep teks"}; |
||
mwCustomEditButtons[mwCustomEditButtons.length] = { |
mwCustomEditButtons[mwCustomEditButtons.length] = { |
||
Lyn 145: | Lyn 149: | ||
"sampleText": "! hoof 1\n! hoof 2\n! hoof 3\n|-\n| ry 1, sel 1\n| ry 1, sel 2\n| ry 1, sel 3\n|-\n| ry 2, sel 1\n| ry 2, sel 2\n| ry 2, sel 3"}; |
"sampleText": "! hoof 1\n! hoof 2\n! hoof 3\n|-\n| ry 1, sel 1\n| ry 1, sel 2\n| ry 1, sel 3\n|-\n| ry 2, sel 1\n| ry 2, sel 2\n| ry 2, sel 3"}; |
||
} |
} |
||
//fix edit summary prompt for undo |
|||
//this code fixes the fact that the undo function combined with the "no edit summary prompter" causes problems if leaving the |
|||
//edit summary unchanged |
|||
//this was added by [[User:Deskana]], code by [[User:Tra]] |
|||
⚫ | |||
if (document.location.search.indexOf("undo=") != -1 |
|||
&& document.getElementsByName('wpAutoSummary')[0]) { |
|||
document.getElementsByName('wpAutoSummary')[0].value=''; |
|||
⚫ | |||
⚫ | |||
/* |
/* |
||
== Small search keyboard == |
== Small search keyboard == |
||
; Author: Maciej Jaros [[:pl:User:Nux]] |
; Author: Maciej Jaros [[:pl:User:Nux]] |
||
; Licence: CC-BY or [http://opensource.org/licenses/gpl-license.php GNU General Public License v2] |
; Licence: CC-BY or [http://opensource.org/licenses/gpl-license.php GNU General Public License v2] |
||
*/ |
*/ |
||
if (wgNamespaceNumber == -1 && wgPageName=="Spesiaal:Search") |
if (wgNamespaceNumber == -1 && wgPageName=="Spesiaal:Search") |
||
Lyn 190: | Lyn 184: | ||
subEl.parentNode.insertBefore(newEl, subEl); |
subEl.parentNode.insertBefore(newEl, subEl); |
||
} |
} |
||
/** Interwiki links to featured articles *************************************** |
|||
* |
|||
* Description: Highlights interwiki links to featured articles (or |
|||
* equivalents) by changing the bullet before the interwiki link |
|||
* into a star. |
|||
* Maintainers: [[User:R. Koot]] |
|||
*/ |
|||
function LinkFA() |
|||
{ |
|||
if ( document.getElementById( "p-lang" ) ) { |
|||
var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" ); |
|||
for ( var i = 0; i < InterwikiLinks.length; i++ ) { |
|||
if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) { |
|||
InterwikiLinks[i].className += " FA" |
|||
InterwikiLinks[i].title = "Hierdie artikel geniet voorbladartikelstatus in 'n ander taal"; |
|||
} |
|||
} |
|||
} |
|||
⚫ | |||
⚫ | |||
/* |
|||
Déplacement des [modifier] |
|||
-------------------------- |
|||
Correction des titres qui s'affichent mal en raison de limitations dues à MediaWiki. |
|||
Copyright 2006, Marc Mongenet. Licence GPL et GFDL. |
|||
The function looks for <span class="editsection">, and move them |
|||
at the end of their parent and display them inline in small font. |
|||
var oldEditsectionLinks=true disables the function. |
|||
*/ |
|||
function setModifySectionStyle() { |
|||
try { |
|||
if (!(typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false)) return; |
|||
var spans = document.getElementsByTagName("span"); |
|||
for (var s = 0; s < spans.length; ++s) { |
|||
var span = spans[s]; |
|||
if (span.className == "editsection") { |
|||
span.style.fontSize = "xx-small"; |
|||
span.style.fontWeight = "normal"; |
|||
span.style.cssFloat = span.style.styleFloat = "none"; |
|||
span.parentNode.appendChild(document.createTextNode(" ")); |
|||
span.parentNode.appendChild(span); |
|||
} |
|||
⚫ | |||
} catch (e) { /* something went wrong */ } |
|||
} |
|||
addOnloadHook(setModifySectionStyle); |
Wysiging soos op 19:06, 7 Oktober 2007
/* Any JavaScript here will be loaded for all users on every page load. */
function returnObjById( id )
{
if (document.getElementById)
var returnVar = document.getElementById(id);
else if (document.all)
var returnVar = document.all[id];
else if (document.layers)
var returnVar = document.layers[id];
return returnVar;
}
function insertTagsTo_(tagOpen, tagClose, sampleText, outputid) {
var txtarea = document.getElementById(outputid);
if (!txtarea)
return
;
// IE
if (document.selection && !is_gecko) {
var theSelection = document.selection.createRange().text;
if (!theSelection)
theSelection=sampleText;
txtarea.focus();
if (theSelection.charAt(theSelection.length - 1) == " ") { // exclude ending space char, if any
theSelection = theSelection.substring(0, theSelection.length - 1);
document.selection.createRange().text = tagOpen + theSelection + tagClose + " ";
} else {
document.selection.createRange().text = tagOpen + theSelection + tagClose;
}
// Mozilla
} else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
var replaced = false;
var startPos = txtarea.selectionStart;
var endPos = txtarea.selectionEnd;
if (endPos-startPos)
replaced = true;
var scrollTop = txtarea.scrollTop;
var myText = (txtarea.value).substring(startPos, endPos);
if (!myText)
myText=sampleText;
if (myText.charAt(myText.length - 1) == " ") { // exclude ending space char, if any
subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " ";
} else {
subst = tagOpen + myText + tagClose;
}
txtarea.value = txtarea.value.substring(0, startPos) + subst +
txtarea.value.substring(endPos, txtarea.value.length);
txtarea.focus();
//set new selection
if (replaced) {
var cPos = startPos+(tagOpen.length+myText.length+tagClose.length);
txtarea.selectionStart = cPos;
txtarea.selectionEnd = cPos;
} else {
txtarea.selectionStart = startPos+tagOpen.length;
txtarea.selectionEnd = startPos+tagOpen.length+myText.length;
}
txtarea.scrollTop = scrollTop;
}
// reposition cursor if possible
if (txtarea.createTextRange)
txtarea.caretPos = document.selection.createRange().duplicate();
}
/** Extra toolbar options ****************************************************** <nowiki>
*
* Description: UNDOCUMENTED
* Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R. Koot]]
*/
//This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All.
// This is based on the original code on Wikipedia:Tools/Editing tools
// To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/monobook.js]]
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
"speedTip": "Aanstuur",
"tagOpen": "#REDIRECT [[",
"tagClose": "]]",
"sampleText": "Bladsynaam hier"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",
"speedTip": "Deurstreep teks",
"tagOpen": "<s>",
"tagClose": "</s>",
"sampleText": "Deurstreep teks"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",
"speedTip": "Lynbreuk",
"tagOpen": "<br />",
"tagClose": "",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",
"speedTip": "Boskrif",
"tagOpen": "<sup>",
"tagClose": "</sup>",
"sampleText": "Boskrif"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",
"speedTip": "Onderskrif",
"tagOpen": "<sub>",
"tagClose": "</sub>",
"sampleText": "Onderskrif"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",
"speedTip": "Klein teks",
"tagOpen": "<small>",
"tagClose": "</small>",
"sampleText": "Klein teks"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",
"speedTip": "Verskuilde kommentaar",
"tagOpen": "<!-- ",
"tagClose": " -->",
"sampleText": "Kommentaar"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",
"speedTip": "Galery",
"tagOpen": "\n<gallery>\n",
"tagClose": "\n</gallery>",
"sampleText": "Beeld:Voorbeeld.jpg|Onderskrif1\nBeeld:Voorbeeld.jpg|Onderskrif2"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",
"speedTip": "Haal aan",
"tagOpen": "<blockquote>\n",
"tagClose": "</blockquote>\n",
"sampleText": "'n Blok aangehaalde teks"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",
"speedTip": "Tabel",
"tagOpen": '{| class="prettytable"\n|-\n',
"tagClose": "\n|}",
"sampleText": "! hoof 1\n! hoof 2\n! hoof 3\n|-\n| ry 1, sel 1\n| ry 1, sel 2\n| ry 1, sel 3\n|-\n| ry 2, sel 1\n| ry 2, sel 2\n| ry 2, sel 3"};
}
/*
== Small search keyboard ==
; Author: Maciej Jaros [[:pl:User:Nux]]
; Licence: CC-BY or [http://opensource.org/licenses/gpl-license.php GNU General Public License v2]
*/
if (wgNamespaceNumber == -1 && wgPageName=="Spesiaal:Search")
{
addOnloadHook(addSearchKeyboard);
}
function addSearchKeyboard() {
var subEl = returnObjById('results');
var newEl = document.createElement('div');
newEl.className = 'search_keyboard';
newEl.innerHTML = "\
<b>Sleutelbordjie:\
<a onclick=\"insertTagsTo_('ä','','','lsearchbox');return false\" href=\"#\">ä</a>\
<a onclick=\"insertTagsTo_('ç','','','lsearchbox');return false\" href=\"#\">ç</a>\
<a onclick=\"insertTagsTo_('è','','','lsearchbox');return false\" href=\"#\">è</a>\
<a onclick=\"insertTagsTo_('é','','','lsearchbox');return false\" href=\"#\">é</a>\
<a onclick=\"insertTagsTo_('ë','','','lsearchbox');return false\" href=\"#\">ë</a>\
<a onclick=\"insertTagsTo_('ê','','','lsearchbox');return false\" href=\"#\">ê</a>\
<a onclick=\"insertTagsTo_('ï','','','lsearchbox');return false\" href=\"#\">ï</a>\
<a onclick=\"insertTagsTo_('î','','','lsearchbox');return false\" href=\"#\">î</a>\
<a onclick=\"insertTagsTo_('ö','','','lsearchbox');return false\" href=\"#\">ö</a>\
<a onclick=\"insertTagsTo_('ô','','','lsearchbox');return false\" href=\"#\">ô</a>\
<a onclick=\"insertTagsTo_('ü','','','lsearchbox');return false\" href=\"#\">ü</a>\
<a onclick=\"insertTagsTo_('û','','','lsearchbox');return false\" href=\"#\">û</a></b>\
";
newEl.style.cssText = 'margin-left:25%; width:50%; font-size:small;';
subEl.parentNode.insertBefore(newEl, subEl);
}
/** Interwiki links to featured articles ***************************************
*
* Description: Highlights interwiki links to featured articles (or
* equivalents) by changing the bullet before the interwiki link
* into a star.
* Maintainers: [[User:R. Koot]]
*/
function LinkFA()
{
if ( document.getElementById( "p-lang" ) ) {
var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
for ( var i = 0; i < InterwikiLinks.length; i++ ) {
if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
InterwikiLinks[i].className += " FA"
InterwikiLinks[i].title = "Hierdie artikel geniet voorbladartikelstatus in 'n ander taal";
}
}
}
}
addOnloadHook( LinkFA );
/*
Déplacement des [modifier]
--------------------------
Correction des titres qui s'affichent mal en raison de limitations dues à MediaWiki.
Copyright 2006, Marc Mongenet. Licence GPL et GFDL.
The function looks for <span class="editsection">, and move them
at the end of their parent and display them inline in small font.
var oldEditsectionLinks=true disables the function.
*/
function setModifySectionStyle() {
try {
if (!(typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false)) return;
var spans = document.getElementsByTagName("span");
for (var s = 0; s < spans.length; ++s) {
var span = spans[s];
if (span.className == "editsection") {
span.style.fontSize = "xx-small";
span.style.fontWeight = "normal";
span.style.cssFloat = span.style.styleFloat = "none";
span.parentNode.appendChild(document.createTextNode(" "));
span.parentNode.appendChild(span);
}
}
} catch (e) { /* something went wrong */ }
}
addOnloadHook(setModifySectionStyle);