MediaWiki:Common.js: Verskil tussen weergawes
Content deleted Content added
kopieer vanaf Wikipedia |
No edit summary |
||
Lyn 185: | Lyn 185: | ||
} |
} |
||
/** 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]] |
|||
*/ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
{ |
|||
⚫ | |||
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"; |
|||
} |
|||
⚫ | |||
InterwikiLinks[i].title = "Hierdie artikel geniet voorbladartikelstatus in 'n ander taal"; |
|||
} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
/* |
/* |
||
Déplacement des [modifier] |
Déplacement des [modifier] |
||
-------------------------- |
-------------------------- |
||
Correction des titres qui s'affichent mal en raison de limitations dues à MediaWiki. |
Correction des titres qui s'affichent mal en raison de limitations dues à MediaWiki. |
||
Lyn 239: | Lyn 235: | ||
} |
} |
||
addOnloadHook(setModifySectionStyle); |
addOnloadHook(setModifySectionStyle); |
||
/** |
|||
* MainPage-tab |
|||
* On the main page (and its associated namespaces and actions (Talk, edit, history etc.) this script will put "Main Page" instead of "Article" or "Page" in the first tab |
|||
⚫ | |||
* @source: http://www.mediawiki.org/wiki/Snippets/Main_Page_tab |
|||
* @rev: 2 |
|||
*/ |
|||
jQuery( document ).ready( function( $ ) { |
|||
var title = mw.config.get( 'wgTitle' ); |
|||
var hasMainPageTab = (title == 'Tuisblad'); // Title of the main page |
|||
if ( hasMainPageTab ){ |
|||
$( '#ca-nstab-main a' ).text( title ); |
|||
⚫ | |||
} ); |
Wysiging soos op 23:16, 17 Februarie 2011
/* 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);
/**
* MainPage-tab
* On the main page (and its associated namespaces and actions (Talk, edit, history etc.) this script will put "Main Page" instead of "Article" or "Page" in the first tab
*
* @source: http://www.mediawiki.org/wiki/Snippets/Main_Page_tab
* @rev: 2
*/
jQuery( document ).ready( function( $ ) {
var title = mw.config.get( 'wgTitle' );
var hasMainPageTab = (title == 'Tuisblad'); // Title of the main page
if ( hasMainPageTab ){
$( '#ca-nstab-main a' ).text( title );
}
} );