MediaWiki:Common.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
(47 tussenliggende versies door 3 gebruikers niet weergegeven) | |||
Regel 1: | Regel 1: | ||
+ | /* |
||
+ | * Standaard samenvatting bij Speciaal: Uploaden |
||
+ | */ |
||
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) { |
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) { |
||
− | jQuery(function($) { |
+ | jQuery(function($) { |
+ | alert("Deze uploadpagina werkt niet meer, ga naar de pagina Wikikids:Uploaden, om je plaatje te uploaden. "); |
||
− | uploadDescription = document.getElementById('wpUploadDescription'); |
||
+ | uploadDescription = document.getElementById('wpUploadDescription'); |
||
− | var doubleBracket = '{' + '{'; |
||
+ | var doubleBracket = '{' + '{'; |
||
+ | uploadDescription.value = 'Je kunt geen plaatje uploaden via deze methode. Ga naar WikiKids:Uploaden, om een plaatje te uploaden!'; |
||
− | uploadDescription.value = doubleBracket + 'Afbeelding\n|Wat staat er precies op de afbeelding?=\n|Waar heb je de afbeelding vandaan?=\n|Schrijf de complete link van de vindplaats op=\n|Wie heeft de afbeelding gemaakt?=\n|Heb je toestemming om de afbeelding te uploaden?=\n|Welke licentie?=\n}}\n<!-- VERPLICHT: Vergeet niet een licentie te selecteren EN een auteur EN een bron in te vullen! -->'; |
||
− | } ); |
+ | } ); |
} |
} |
||
+ | /* |
||
− | //Als het goed is wordt de scrollbalk nu niet weergegeven, maar word het suggestievakje wat groter... |
||
+ | * Het script voor de woordenboek sjablonen (Sjabloon:Wbwoord en Sjabloon: Wbbetekenis) |
||
− | os_max_lines_per_suggest = 10; |
||
+ | */ |
||
− | |||
+ | var Wbq = ""; |
||
− | /**********************************/ |
||
+ | var Wbx = ""; |
||
− | /* Pas op: Dit is een woordenboek */ |
||
+ | var Wby = ""; |
||
− | /* script */ |
||
+ | var Wbz = ""; |
||
− | /* Sumurai8; contact: OP */ |
||
+ | var WbK = "x"; //keep it? |
||
− | /* Maakt 'tooltips' mogelijk */ |
||
− | /* Zie Sjabloon:Wbwoord */ |
||
− | /* Sjabloon:Wbbetekenis */ |
||
− | /**********************************/ |
||
− | |||
− | var Wbq = "" |
||
− | var Wbx = "" |
||
− | var Wby = "" |
||
− | var Wbz = "" |
||
− | var WbK = "x" //keep it? |
||
function enableTips() { |
function enableTips() { |
||
− | + | for(var counter=1;counter<99;counter++) { |
|
− | + | Wbx = document.getElementById('woordenboek'+counter); |
|
− | + | Wbq = document.getElementById('woordenboekX'+counter); |
|
− | + | if(!Wbx) { |
|
− | + | break; |
|
+ | } |
||
− | } |
||
− | + | Wbq.style.display = "none"; |
|
− | + | Wbx.style.display = ""; |
|
− | + | Wbx.onmouseover = showWbTip; |
|
− | + | Wbx.onmouseout = hideWbTip; |
|
− | + | Wbx.onclick = keepWbTip; |
|
− | + | } |
|
} |
} |
||
Regel 44: | Regel 39: | ||
function showWbTip() { |
function showWbTip() { |
||
− | + | if (WbK == "x") { |
|
− | + | Wbz = this.id; |
|
− | + | Wbz = Wbz.substring(11,Wbz.length); |
|
− | + | Wby = document.getElementById('wbcontent'+Wbz); |
|
− | + | Wby.style.display = ""; |
|
− | + | } |
|
} |
} |
||
function hideWbTip() { |
function hideWbTip() { |
||
− | + | if (WbK == "x") { |
|
− | + | Wby.style.display = "none"; |
|
− | + | } |
|
} |
} |
||
function keepWbTip() { |
function keepWbTip() { |
||
− | + | if (WbK == "x") { |
|
− | + | WbK = "v"; |
|
− | + | } |
|
− | + | else { |
|
− | + | WbK = "x"; |
|
− | + | } |
|
} |
} |
||
+ | /* |
||
− | // Sinds de 1.26 upgrade wordt alleen in de WikiKids-skin nog de 'custom sidebar' van een MediaWiki-pagina gehaald. |
||
+ | * Automatisch een icoon weergeven rechtsboven de pagina wanneer deze beveiligd is |
||
− | // In Monobook en Vector zullen we voor nu ff dit moeten gebruiken -- Southparkfan 17/07/2016 |
||
+ | */ |
||
− | jQuery( function( $ ) { |
||
+ | jQuery(function($) { |
||
− | if ( mw.config.get( "skin" ) != "wikikids" ) { |
||
− | + | if (mw.config.get('wgPageName') == mw.config.get('wgMainPageTitle') |
|
+ | || mw.config.get('wgCanonicalNamespace') == "Special" |
||
− | $( '<div class="portlet" id="p-buttons"></div>' ).insertAfter( '#p-search' ); |
||
− | + | || typeof(mw.config.get('wgRestrictionEdit')) == "undefined" |
|
+ | ) { |
||
− | $( '<div class="portlet" id="p-buttons"></div>' ).insertAfter( '#p-tb' ); |
||
+ | // Hoofdpagina, speciale pagina of niet beschermbaar |
||
+ | return false; |
||
+ | } |
||
+ | if ($('#bodyContent').length === 0) { |
||
+ | // Kan geen tekst vinden |
||
+ | return false; |
||
+ | } |
||
+ | |||
+ | // Juiste beveligingssjabloon uitzoeken. |
||
+ | if (mw.config.get('wgRestrictionEdit')[0] != null && mw.config.get('wgRestrictionEdit')[0] == 'sysop') { |
||
+ | // Alleen moderatoren kunnen bewerken |
||
+ | var templateTitle = 'Beveiligd'; |
||
+ | var nodeId = 'templ_Beveiligd'; |
||
+ | } else if (mw.config.get('wgRestrictionEdit')[0] != null && mw.config.get('wgRestrictionEdit') == 'autoconfirmed') { |
||
+ | // Alleen automatisch bevestigde gebruikers kunnen bewerken. |
||
+ | var templateTitle = 'SemiBeveiligd'; |
||
+ | var nodeId = 'templ_SemiBeveiligd'; |
||
+ | } else if (mw.config.get('wgRestrictionMove')[0] != null) { |
||
+ | // Het verplaatsen van de pagina is beveiligd. |
||
+ | var templateTitle = 'TitelBeveiligd'; |
||
+ | var nodeId = 'templ_TitelBeveiligd'; |
||
+ | } else { |
||
+ | // De pagina is niet beveiligd. |
||
+ | return false; |
||
+ | } |
||
+ | |||
+ | // Get template from API. |
||
+ | $.getJSON( |
||
+ | mw.util.wikiScript('api'), |
||
+ | { |
||
+ | format: 'json', |
||
+ | action: 'parse', |
||
+ | text: '{{' + encodeURIComponent(templateTitle) + '}}', |
||
+ | contentmodel: 'wikitext' |
||
+ | }, |
||
+ | function(obj) { |
||
+ | $('.mw-indicators').before(obj['parse']['text']['*']); |
||
+ | } |
||
+ | ); |
||
+ | }); |
||
+ | |||
+ | /* |
||
+ | * Inklapbare div |
||
+ | */ |
||
+ | var UitklapDivHide = 'Inklappen'; |
||
+ | var UitklapDivShow = 'Uitklappen'; |
||
+ | |||
+ | // shows and hides content of Uitklap divs |
||
+ | // Parameters: |
||
+ | // indexUitklapDiv: the index of Uitklap div to be toggled |
||
+ | var toggleUitklapDiv = window.toggleUitklapDiv = function(indexUitklapDiv) { |
||
+ | var UitklapToggle = document.getElementById('UitklapToggle' + indexUitklapDiv); |
||
+ | var UitklapFrame = document.getElementById('UitklapFrame' + indexUitklapDiv); |
||
+ | var UitklapChild; |
||
+ | |||
+ | if (!UitklapFrame || !UitklapToggle) { |
||
+ | return false; |
||
+ | } |
||
+ | |||
+ | // if shown now |
||
+ | if (UitklapToggle.firstChild.data === UitklapDivHide) { |
||
+ | for ( |
||
+ | UitklapChild = UitklapFrame.firstChild; |
||
+ | UitklapChild !== null; |
||
+ | UitklapChild = UitklapChild.nextSibling |
||
+ | ) { |
||
+ | if (UitklapChild.className === 'UitklapContent') { |
||
+ | UitklapChild.style.display = 'none'; |
||
+ | } |
||
+ | if (UitklapChild.className === 'UitklapToggle') { |
||
+ | UitklapChild.firstChild.data = UitklapDivShow; |
||
+ | } |
||
+ | } |
||
+ | |||
+ | // if hidden now |
||
+ | } else if (UitklapToggle.firstChild.data === UitklapDivShow) { |
||
+ | for ( |
||
+ | UitklapChild = UitklapFrame.firstChild; |
||
+ | UitklapChild !== null; |
||
+ | UitklapChild = UitklapChild.nextSibling |
||
+ | ) { |
||
+ | if (UitklapChild.className === 'UitklapContent') { |
||
+ | UitklapChild.style.display = 'block'; |
||
+ | } |
||
+ | if (UitklapChild.className === 'UitklapToggle') { |
||
+ | UitklapChild.firstChild.data = UitklapDivHide; |
||
+ | } |
||
} |
} |
||
− | |||
− | $( "#p-buttons" ).append( '<div id="p-boomhut"><a href="/Wikikids:Boomhut"><img src="/images/3/38/Boomhut_klein.gif" border="0"></a></div>' ); |
||
− | $( "#p-buttons" ).append( '<div id="p-alarm"><a href="/Wikikids:Alarm"><img src="/images/8/88/Alarm_klein.gif" border="0"></a></div>' ); |
||
} |
} |
||
− | } |
+ | }; |
+ | // adds show/hide-button to navigation bars |
||
− | jQuery(function($) { |
||
+ | function createUitklapDivToggleButton() { |
||
− | if (mw.config.get('wgPageName') == mw.config.get('wgMainPageTitle') |
||
+ | var indexUitklapDiv = 0; |
||
− | || mw.config.get('wgCanonicalNamespace') == "Special" |
||
+ | var i, u, UitklapFrame; |
||
− | || typeof(mw.config.get('wgRestrictionEdit')) == "undefined" |
||
+ | // iterate over all < div >-elements |
||
− | ) { |
||
+ | for (i = 0; (UitklapFrame = document.getElementsByTagName('div')[i]); i++) { |
||
− | // Hoofdpagina, speciale pagina of niet beschermbaar |
||
+ | // if found a navigation bar |
||
− | return false; |
||
+ | if (UitklapFrame.className === 'UitklapFrame' || UitklapFrame.className === 'UitklapFrameNoClear') { |
||
− | } |
||
+ | indexUitklapDiv++; |
||
− | if ($('#bodyContent')['length'] == 0) { |
||
+ | var UitklapToggle = document.createElement('a'); |
||
− | // Kan geen tekst vinden |
||
+ | UitklapToggle.className = 'UitklapToggle'; |
||
− | return false; |
||
+ | UitklapToggle.setAttribute('id', 'UitklapToggle' + indexUitklapDiv); |
||
− | } |
||
+ | $(UitklapToggle).data('mwUitklapFrameIndex', indexUitklapDiv).click(function (e) { |
||
+ | toggleUitklapDiv($(this).data('mwUitklapFrameIndex')); |
||
+ | e.preventDefault(); |
||
+ | }); |
||
+ | var UitklapToggleText = document.createTextNode(UitklapDivHide); |
||
− | // Juiste beveligingssjabloon uitzoeken. |
||
+ | UitklapToggle.appendChild(UitklapToggleText); |
||
− | if (mw.config.get('wgRestrictionEdit')[0] != null && mw.config.get('wgRestrictionEdit')[0] == 'sysop') { |
||
− | // Alleen moderatoren kunnen bewerken |
||
− | var templateTitle = 'Beveiligd'; |
||
− | var nodeId = 'templ_Beveiligd'; |
||
− | } else if (mw.config.get('wgRestrictionEdit')[0] != null && mw.config.get('wgRestrictionEdit') == 'autoconfirmed') { |
||
− | // Alleen automatisch bevestigde gebruikers kunnen bewerken. Effectief nutteloos op deze wiki, dus geen sjabloon |
||
− | return false; |
||
− | } else if (mw.config.get('wgRestrictionMove')[0] != null) { |
||
− | // Het verplaatsen van de pagina is beveiligd. |
||
− | var templateTitle = 'TitelBeveiligd'; |
||
− | var nodeId = 'templ_TitelBeveiligd'; |
||
− | } else { |
||
− | // De pagina is niet beveiligd. |
||
− | return false; |
||
− | } |
||
+ | // add NavToggle-Button as first div-element |
||
− | // Get template from API. |
||
+ | // in < div class="UitklapFrame" > |
||
− | $.getJSON( |
||
+ | UitklapFrame.insertBefore(UitklapToggle, UitklapFrame.firstChild); |
||
− | mw.util.wikiScript('api'), |
||
+ | UitklapFrame.setAttribute('id', 'UitklapFrame' + indexUitklapDiv); |
||
− | { |
||
+ | } |
||
− | format: 'json', |
||
+ | } |
||
− | action: 'parse', |
||
+ | for (u = 1; u <= indexUitklapDiv; u++) { |
||
− | text: '{{' + encodeURIComponent(templateTitle) + '}}', |
||
+ | toggleUitklapDiv(u); |
||
− | contentmodel: 'wikitext' |
||
+ | } |
||
− | }, |
||
+ | } |
||
− | function(obj) { |
||
− | $('.mw-indicators').before(obj['parse']['text']['*']); |
||
− | } |
||
− | ); |
||
+ | $(createUitklapDivToggleButton); |
||
− | }); |
||
+ | |||
+ | jQuery(function(){$('#sidebar').append($('#p-tb'))}); |
||
+ | /** |
||
+ | * Collapsible tables |
||
+ | * Allows tables to be collapsed, showing only the header. See [[:en:Wikipedia:NavFrame]]. |
||
+ | * Maintainers: [[:en:User:R. Koot]] |
||
+ | */ |
||
+ | var autoCollapse = 2; |
||
+ | var collapseCaption = 'verbergen'; |
||
+ | var expandCaption = 'weergeven'; |
||
+ | function collapseTable(tableIndex) { |
||
− | //Automatische suggestie voor een al bestaand artikel over dit onderwerp in het enkelvoud |
||
+ | var Button = document.getElementById('collapseButton' + tableIndex); |
||
− | jQuery( function() { |
||
+ | var Table = document.getElementById('collapsibleTable' + tableIndex); |
||
− | if( $('.mw-newarticletext').length ) { |
||
− | + | var i; |
|
− | if( wgTitle.split(" ").length > 1 ) { |
||
− | return false; |
||
− | } |
||
− | //Werken -> Werk |
||
− | if( wgTitle.substring( wgTitle.length - 2 ) == "en" ) { |
||
− | titles.push( wgTitle.substring( 0, wgTitle.length - 2 ) ); |
||
− | } |
||
− | //Musicals -> Musical |
||
− | if( wgTitle.substring( wgTitle.length - 1 ) == "s" ) { |
||
− | titles.push( wgTitle.substring( 0, wgTitle.length - 1 ) ); |
||
− | } |
||
− | //Fora -> Forum |
||
− | if( wgTitle.substring( wgTitle.length - 1 ) == "a" ) { |
||
− | titles.push( wgTitle.substring( 0, wgTitle.length - 1 ) + "um" ); |
||
− | } |
||
− | //Technici -> Technicus |
||
− | if( wgTitle.substring( wgTitle.length - 1 ) == "i" ) { |
||
− | titles.push( wgTitle.substring( 0, wgTitle.length - 1 ) + "us" ); |
||
− | } |
||
− | if( titles.length ) { |
||
− | $('.mw-newarticletext').append( $('<div></div>').addClass("mw-articleAlert") ); |
||
− | $.get("http://wikikids.wiki.kennisnet.nl/api.php?action=query&prop=info&inprop=url&format=json&titles="+titles.join("|"), function( data ) { |
||
− | for(page in data['query']['pages']) { |
||
− | if( data['query']['pages'][page]['missing'] != "" && data['query']['pages'][page]['redirect'] != "" ) { |
||
− | $('.mw-articleAlert').html('<b>Let op:</b> Er bestaat mogelijk al een artikel over dit onderwerp op deze pagina: <a href="'+data['query']['pages'][page]['fullurl']+'">'+data['query']['pages'][page]['title']+'</a>. Controleer dit eerst!').addClass("errorbox"); |
||
− | } |
||
− | } |
||
− | } ); |
||
− | } |
||
− | } |
||
− | } ); |
||
+ | if (!Table || !Button) { |
||
− | // ============================================================ |
||
+ | return false; |
||
− | // BEGIN Dynamisch inklapbare div |
||
− | + | } |
|
+ | |||
− | // set up the words in your language |
||
+ | var Rows = Table.getElementsByTagName('tr'); |
||
− | var UitklapDivHide = 'Inklappen'; |
||
+ | |||
− | var UitklapDivShow = 'Uitklappen'; |
||
+ | if (Button.firstChild.data === collapseCaption) { |
||
− | |||
+ | for (i = 1; i < Rows.length; i++) { |
||
− | // shows and hides content of Uitklap divs |
||
+ | Rows[i].style.display = 'none'; |
||
− | // Parameters: |
||
− | // indexUitklapDiv: the index of Uitklap div to be toggled |
||
− | var toggleUitklapDiv = window.toggleUitklapDiv = function(indexUitklapDiv) { |
||
− | var UitklapToggle = document.getElementById('UitklapToggle' + indexUitklapDiv); |
||
− | var UitklapFrame = document.getElementById('UitklapFrame' + indexUitklapDiv); |
||
− | var UitklapChild; |
||
− | |||
− | if (!UitklapFrame || !UitklapToggle) { |
||
− | return false; |
||
} |
} |
||
+ | Button.firstChild.data = expandCaption; |
||
− | |||
+ | } else { |
||
− | // if shown now |
||
+ | for (i = 1; i < Rows.length; i++) { |
||
− | if (UitklapToggle.firstChild.data === UitklapDivHide) { |
||
+ | Rows[i].style.display = Rows[0].style.display; |
||
− | for ( |
||
− | UitklapChild = UitklapFrame.firstChild; |
||
− | UitklapChild !== null; |
||
− | UitklapChild = UitklapChild.nextSibling |
||
− | ) { |
||
− | if (UitklapChild.className === 'UitklapContent') { |
||
− | UitklapChild.style.display = 'none'; |
||
− | } |
||
− | if (UitklapChild.className === 'UitklapToggle') { |
||
− | UitklapChild.firstChild.data = UitklapDivShow; |
||
− | } |
||
− | } |
||
− | |||
− | // if hidden now |
||
− | } else if (UitklapToggle.firstChild.data === UitklapDivShow) { |
||
− | for ( |
||
− | UitklapChild = UitklapFrame.firstChild; |
||
− | UitklapChild !== null; |
||
− | UitklapChild = UitklapChild.nextSibling |
||
− | ) { |
||
− | if (UitklapChild.className === 'UitklapContent') { |
||
− | UitklapChild.style.display = 'block'; |
||
− | } |
||
− | if (UitklapChild.className === 'UitklapToggle') { |
||
− | UitklapChild.firstChild.data = UitklapDivHide; |
||
− | } |
||
− | } |
||
} |
} |
||
+ | Button.firstChild.data = collapseCaption; |
||
− | }; |
||
− | + | } |
|
+ | } |
||
− | // adds show/hide-button to navigation bars |
||
+ | |||
− | function createUitklapDivToggleButton() { |
||
+ | function createCollapseButtons() { |
||
− | var indexUitklapDiv = 0; |
||
− | + | var tableIndex = 0; |
|
+ | var NavigationBoxes = {}; |
||
− | // iterate over all < div >-elements |
||
− | + | var Tables = document.getElementsByTagName('table'); |
|
+ | var i; |
||
− | // if found a navigation bar |
||
+ | |||
− | if (UitklapFrame.className === 'UitklapFrame' || UitklapFrame.className === 'UitklapFrameNoClear') { |
||
+ | for (i = 0; i < Tables.length; i++) { |
||
− | |||
+ | if ($(Tables[i]).hasClass('collapsible')) { |
||
− | indexUitklapDiv++; |
||
+ | NavigationBoxes[tableIndex] = Tables[i]; |
||
− | var UitklapToggle = document.createElement('a'); |
||
+ | Tables[i].setAttribute('id', 'collapsibleTable' + tableIndex); |
||
− | UitklapToggle.className = 'UitklapToggle'; |
||
+ | |||
− | UitklapToggle.setAttribute('id', 'UitklapToggle' + indexUitklapDiv); |
||
+ | var Button = document.createElement('span'); |
||
− | $(UitklapToggle).data('mwUitklapFrameIndex', indexUitklapDiv).click(function (e) { |
||
+ | var ButtonLink = document.createElement('a'); |
||
− | toggleUitklapDiv($(this).data('mwUitklapFrameIndex')); |
||
+ | var ButtonText = document.createTextNode(collapseCaption); |
||
+ | |||
+ | Button.style.styleFloat = 'right'; |
||
+ | Button.style.cssFloat = 'right'; |
||
+ | Button.style.fontWeight = 'normal'; |
||
+ | Button.style.textAlign = 'right'; |
||
+ | Button.style.width = "6em"; |
||
+ | |||
+ | ButtonLink.setAttribute('id', 'collapseButton' + tableIndex); |
||
+ | $(ButtonLink).data('mwCollapsibleTableIndex', tableIndex).click(function (e) { |
||
+ | collapseTable($(this).data('mwCollapsibleTableIndex')); |
||
e.preventDefault(); |
e.preventDefault(); |
||
− | + | }); |
|
+ | ButtonLink.appendChild(ButtonText); |
||
− | |||
+ | |||
− | var UitklapToggleText = document.createTextNode(UitklapDivHide); |
||
− | + | Button.appendChild(document.createTextNode('[')); |
|
+ | Button.appendChild(ButtonLink); |
||
− | |||
+ | Button.appendChild(document.createTextNode(']')); |
||
− | // add NavToggle-Button as first div-element |
||
+ | |||
− | // in < div class="UitklapFrame" > |
||
+ | var Header = Tables[i].getElementsByTagName('tr')[0].getElementsByTagName('th')[0]; |
||
− | UitklapFrame.insertBefore(UitklapToggle, UitklapFrame.firstChild); |
||
+ | /* only add button and increment count if there is a header row to work with */ |
||
− | UitklapFrame.setAttribute('id', 'UitklapFrame' + indexUitklapDiv); |
||
+ | if (Header) { |
||
+ | Header.insertBefore(Button, Header.childNodes[0]); |
||
+ | tableIndex++; |
||
} |
} |
||
} |
} |
||
+ | } |
||
− | for (u = 1; u <= indexUitklapDiv; u++) { |
||
+ | |||
− | toggleUitklapDiv(u); |
||
+ | for (i = 0; i < tableIndex; i++) { |
||
+ | if ($(NavigationBoxes[i]).hasClass('collapsed') || (tableIndex >= autoCollapse && $(NavigationBoxes[i]).hasClass( 'autocollapse'))) { |
||
+ | collapseTable(i); |
||
} |
} |
||
} |
} |
||
+ | } |
||
− | |||
− | $(createUitklapDivToggleButton); |
||
− | |||
− | // EIND Dynamisch inklapbare div |
||
− | // ============================================================ |
||
+ | $(createCollapseButtons); |
||
− | jQuery(function(){$('#column-one').append($('#p-tb'))}); |
||
+ | /* |
||
+ | * Automatisch legen van de samenvatting op Speciaal:Verwijderen |
||
+ | */ |
||
function legen_verwijdersamenvatting() { |
function legen_verwijdersamenvatting() { |
||
− | + | document.getElementById('wpReason').value = ''; |
|
− | + | document.getElementById('wpReason').focus(); |
|
} |
} |
||
− | if ( |
+ | if (mw.config.get('wgAction') === 'delete') { |
− | + | $(legen_verwijdersamenvatting); |
|
+ | } |
||
+ | |||
+ | |||
+ | /* |
||
+ | * Maakt portaalbanners even groot als de pagina zelf is. Wordt gebruikt met het sjabloon Portaalafbeelding. |
||
+ | */ |
||
+ | function fixWidthPortaalAfbeelding () { |
||
+ | if (document.getElementsByClassName('portaalafbeelding').length) { |
||
+ | var bodyContentWidth = document.getElementById('bodyContent').offsetWidth; |
||
+ | for (var x = 0; x < document.getElementsByClassName('portaalafbeelding').length; x++) { |
||
+ | var portaalafbeelding = document.getElementsByClassName('portaalafbeelding')[x].getElementsByTagName('img')[0]; |
||
+ | portaalafbeelding.height = bodyContentWidth/portaalafbeelding.width*portaalafbeelding.height; |
||
+ | portaalafbeelding.width = bodyContentWidth; |
||
+ | } |
||
+ | } |
||
+ | } |
||
+ | |||
+ | $(fixWidthPortaalAfbeelding); |
||
+ | |||
+ | /* |
||
+ | * Vervangt de link onderin de pagina naar Speciaal:Categorieën naar PIM-systeem. |
||
+ | */ |
||
+ | |||
+ | function categorieToPIMLink () { |
||
+ | if (document.getElementById('mw-normal-catlinks')) { |
||
+ | var linkscat = document.getElementById('mw-normal-catlinks').getElementsByTagName("a"); |
||
+ | linkscat[0].href = '/PIM-systeem'; |
||
+ | } |
||
+ | } |
||
+ | |||
+ | $(categorieToPIMLink); |
||
+ | |||
+ | /* |
||
+ | * Vervangt de tekst bij de interwiki voor Wikipedia van 'Nederlands' door 'Wikipedia' |
||
+ | */ |
||
+ | function veranderInterwikiNederlandstaligeWikipedia() { |
||
+ | if (document.querySelector('a[lang="nl"][hreflang="nl"].interlanguage-link-target')) { |
||
+ | document.querySelector('a[lang="nl"][hreflang="nl"].interlanguage-link-target').innerText = "Wikipedia"; |
||
+ | } |
||
+ | } |
||
+ | |||
+ | $(veranderInterwikiNederlandstaligeWikipedia); |
||
+ | |||
+ | /* |
||
+ | * Gemodificeerd editcount script op Gebruiker:Apoo/Editcount |
||
+ | */ |
||
+ | mw.loader.load('https://wikikids.nl/index.php?title=User:Apoo/EditCount.js&action=raw&ctype=text/javascript'); |
||
+ | |||
+ | /* |
||
+ | * Langere toevoegingen die beter op een andere pagina kunnen staan; zoals TVB en de handtekening in de boomhut. |
||
+ | */ |
||
+ | mw.loader.load('https://wikikids.nl/index.php?title=Gebruiker:Rots61/JS-TVB.js&action=raw&ctype=text/javascript'); |
||
+ | mw.loader.load('https://wikikids.nl/index.php?title=Gebruiker:Rots61/JS-HandtekeninginBoomhut.js&action=raw&ctype=text/javascript'); |
||
+ | |||
+ | /* |
||
+ | * Script waardoor de bezoekers gelogd worden; [[Gebruiker:Rots61/JS-Statistieken.js]]. |
||
+ | * |
||
+ | * Voegt een speciale pagina toe waardoor de statistieken inzichtelijk worden gemaakt. [[Gebruiker:Rots61/JS-WikiStats.js]]. |
||
+ | */ |
||
+ | |||
+ | if (mw.config.get('wgUserEditCount') >= 5 || mw.storage.get('disableLoggingWS')) {//Alleen voor gebruikers met bijdragen |
||
+ | mw.loader.load('//wikikids.nl/index.php?title=Gebruiker:Rots61/JS-WikiStats.js&action=raw&ctype=text/javascript'); |
||
+ | } else { |
||
+ | mw.loader.load('//wikikids.nl/index.php?title=Gebruiker:Rots61/JS-Statistieken.js&action=raw&ctype=text/javascript'); |
||
} |
} |
Versie van 13 dec 2023 01:39
/*
* Standaard samenvatting bij Speciaal: Uploaden
*/
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) {
jQuery(function($) {
alert("Deze uploadpagina werkt niet meer, ga naar de pagina Wikikids:Uploaden, om je plaatje te uploaden. ");
uploadDescription = document.getElementById('wpUploadDescription');
var doubleBracket = '{' + '{';
uploadDescription.value = 'Je kunt geen plaatje uploaden via deze methode. Ga naar WikiKids:Uploaden, om een plaatje te uploaden!';
} );
}
/*
* Het script voor de woordenboek sjablonen (Sjabloon:Wbwoord en Sjabloon: Wbbetekenis)
*/
var Wbq = "";
var Wbx = "";
var Wby = "";
var Wbz = "";
var WbK = "x"; //keep it?
function enableTips() {
for(var counter=1;counter<99;counter++) {
Wbx = document.getElementById('woordenboek'+counter);
Wbq = document.getElementById('woordenboekX'+counter);
if(!Wbx) {
break;
}
Wbq.style.display = "none";
Wbx.style.display = "";
Wbx.onmouseover = showWbTip;
Wbx.onmouseout = hideWbTip;
Wbx.onclick = keepWbTip;
}
}
$(enableTips);
function showWbTip() {
if (WbK == "x") {
Wbz = this.id;
Wbz = Wbz.substring(11,Wbz.length);
Wby = document.getElementById('wbcontent'+Wbz);
Wby.style.display = "";
}
}
function hideWbTip() {
if (WbK == "x") {
Wby.style.display = "none";
}
}
function keepWbTip() {
if (WbK == "x") {
WbK = "v";
}
else {
WbK = "x";
}
}
/*
* Automatisch een icoon weergeven rechtsboven de pagina wanneer deze beveiligd is
*/
jQuery(function($) {
if (mw.config.get('wgPageName') == mw.config.get('wgMainPageTitle')
|| mw.config.get('wgCanonicalNamespace') == "Special"
|| typeof(mw.config.get('wgRestrictionEdit')) == "undefined"
) {
// Hoofdpagina, speciale pagina of niet beschermbaar
return false;
}
if ($('#bodyContent').length === 0) {
// Kan geen tekst vinden
return false;
}
// Juiste beveligingssjabloon uitzoeken.
if (mw.config.get('wgRestrictionEdit')[0] != null && mw.config.get('wgRestrictionEdit')[0] == 'sysop') {
// Alleen moderatoren kunnen bewerken
var templateTitle = 'Beveiligd';
var nodeId = 'templ_Beveiligd';
} else if (mw.config.get('wgRestrictionEdit')[0] != null && mw.config.get('wgRestrictionEdit') == 'autoconfirmed') {
// Alleen automatisch bevestigde gebruikers kunnen bewerken.
var templateTitle = 'SemiBeveiligd';
var nodeId = 'templ_SemiBeveiligd';
} else if (mw.config.get('wgRestrictionMove')[0] != null) {
// Het verplaatsen van de pagina is beveiligd.
var templateTitle = 'TitelBeveiligd';
var nodeId = 'templ_TitelBeveiligd';
} else {
// De pagina is niet beveiligd.
return false;
}
// Get template from API.
$.getJSON(
mw.util.wikiScript('api'),
{
format: 'json',
action: 'parse',
text: '{{' + encodeURIComponent(templateTitle) + '}}',
contentmodel: 'wikitext'
},
function(obj) {
$('.mw-indicators').before(obj['parse']['text']['*']);
}
);
});
/*
* Inklapbare div
*/
var UitklapDivHide = 'Inklappen';
var UitklapDivShow = 'Uitklappen';
// shows and hides content of Uitklap divs
// Parameters:
// indexUitklapDiv: the index of Uitklap div to be toggled
var toggleUitklapDiv = window.toggleUitklapDiv = function(indexUitklapDiv) {
var UitklapToggle = document.getElementById('UitklapToggle' + indexUitklapDiv);
var UitklapFrame = document.getElementById('UitklapFrame' + indexUitklapDiv);
var UitklapChild;
if (!UitklapFrame || !UitklapToggle) {
return false;
}
// if shown now
if (UitklapToggle.firstChild.data === UitklapDivHide) {
for (
UitklapChild = UitklapFrame.firstChild;
UitklapChild !== null;
UitklapChild = UitklapChild.nextSibling
) {
if (UitklapChild.className === 'UitklapContent') {
UitklapChild.style.display = 'none';
}
if (UitklapChild.className === 'UitklapToggle') {
UitklapChild.firstChild.data = UitklapDivShow;
}
}
// if hidden now
} else if (UitklapToggle.firstChild.data === UitklapDivShow) {
for (
UitklapChild = UitklapFrame.firstChild;
UitklapChild !== null;
UitklapChild = UitklapChild.nextSibling
) {
if (UitklapChild.className === 'UitklapContent') {
UitklapChild.style.display = 'block';
}
if (UitklapChild.className === 'UitklapToggle') {
UitklapChild.firstChild.data = UitklapDivHide;
}
}
}
};
// adds show/hide-button to navigation bars
function createUitklapDivToggleButton() {
var indexUitklapDiv = 0;
var i, u, UitklapFrame;
// iterate over all < div >-elements
for (i = 0; (UitklapFrame = document.getElementsByTagName('div')[i]); i++) {
// if found a navigation bar
if (UitklapFrame.className === 'UitklapFrame' || UitklapFrame.className === 'UitklapFrameNoClear') {
indexUitklapDiv++;
var UitklapToggle = document.createElement('a');
UitklapToggle.className = 'UitklapToggle';
UitklapToggle.setAttribute('id', 'UitklapToggle' + indexUitklapDiv);
$(UitklapToggle).data('mwUitklapFrameIndex', indexUitklapDiv).click(function (e) {
toggleUitklapDiv($(this).data('mwUitklapFrameIndex'));
e.preventDefault();
});
var UitklapToggleText = document.createTextNode(UitklapDivHide);
UitklapToggle.appendChild(UitklapToggleText);
// add NavToggle-Button as first div-element
// in < div class="UitklapFrame" >
UitklapFrame.insertBefore(UitklapToggle, UitklapFrame.firstChild);
UitklapFrame.setAttribute('id', 'UitklapFrame' + indexUitklapDiv);
}
}
for (u = 1; u <= indexUitklapDiv; u++) {
toggleUitklapDiv(u);
}
}
$(createUitklapDivToggleButton);
jQuery(function(){$('#sidebar').append($('#p-tb'))});
/**
* Collapsible tables
* Allows tables to be collapsed, showing only the header. See [[:en:Wikipedia:NavFrame]].
* Maintainers: [[:en:User:R. Koot]]
*/
var autoCollapse = 2;
var collapseCaption = 'verbergen';
var expandCaption = 'weergeven';
function collapseTable(tableIndex) {
var Button = document.getElementById('collapseButton' + tableIndex);
var Table = document.getElementById('collapsibleTable' + tableIndex);
var i;
if (!Table || !Button) {
return false;
}
var Rows = Table.getElementsByTagName('tr');
if (Button.firstChild.data === collapseCaption) {
for (i = 1; i < Rows.length; i++) {
Rows[i].style.display = 'none';
}
Button.firstChild.data = expandCaption;
} else {
for (i = 1; i < Rows.length; i++) {
Rows[i].style.display = Rows[0].style.display;
}
Button.firstChild.data = collapseCaption;
}
}
function createCollapseButtons() {
var tableIndex = 0;
var NavigationBoxes = {};
var Tables = document.getElementsByTagName('table');
var i;
for (i = 0; i < Tables.length; i++) {
if ($(Tables[i]).hasClass('collapsible')) {
NavigationBoxes[tableIndex] = Tables[i];
Tables[i].setAttribute('id', 'collapsibleTable' + tableIndex);
var Button = document.createElement('span');
var ButtonLink = document.createElement('a');
var ButtonText = document.createTextNode(collapseCaption);
Button.style.styleFloat = 'right';
Button.style.cssFloat = 'right';
Button.style.fontWeight = 'normal';
Button.style.textAlign = 'right';
Button.style.width = "6em";
ButtonLink.setAttribute('id', 'collapseButton' + tableIndex);
$(ButtonLink).data('mwCollapsibleTableIndex', tableIndex).click(function (e) {
collapseTable($(this).data('mwCollapsibleTableIndex'));
e.preventDefault();
});
ButtonLink.appendChild(ButtonText);
Button.appendChild(document.createTextNode('['));
Button.appendChild(ButtonLink);
Button.appendChild(document.createTextNode(']'));
var Header = Tables[i].getElementsByTagName('tr')[0].getElementsByTagName('th')[0];
/* only add button and increment count if there is a header row to work with */
if (Header) {
Header.insertBefore(Button, Header.childNodes[0]);
tableIndex++;
}
}
}
for (i = 0; i < tableIndex; i++) {
if ($(NavigationBoxes[i]).hasClass('collapsed') || (tableIndex >= autoCollapse && $(NavigationBoxes[i]).hasClass( 'autocollapse'))) {
collapseTable(i);
}
}
}
$(createCollapseButtons);
/*
* Automatisch legen van de samenvatting op Speciaal:Verwijderen
*/
function legen_verwijdersamenvatting() {
document.getElementById('wpReason').value = '';
document.getElementById('wpReason').focus();
}
if (mw.config.get('wgAction') === 'delete') {
$(legen_verwijdersamenvatting);
}
/*
* Maakt portaalbanners even groot als de pagina zelf is. Wordt gebruikt met het sjabloon Portaalafbeelding.
*/
function fixWidthPortaalAfbeelding () {
if (document.getElementsByClassName('portaalafbeelding').length) {
var bodyContentWidth = document.getElementById('bodyContent').offsetWidth;
for (var x = 0; x < document.getElementsByClassName('portaalafbeelding').length; x++) {
var portaalafbeelding = document.getElementsByClassName('portaalafbeelding')[x].getElementsByTagName('img')[0];
portaalafbeelding.height = bodyContentWidth/portaalafbeelding.width*portaalafbeelding.height;
portaalafbeelding.width = bodyContentWidth;
}
}
}
$(fixWidthPortaalAfbeelding);
/*
* Vervangt de link onderin de pagina naar Speciaal:Categorieën naar PIM-systeem.
*/
function categorieToPIMLink () {
if (document.getElementById('mw-normal-catlinks')) {
var linkscat = document.getElementById('mw-normal-catlinks').getElementsByTagName("a");
linkscat[0].href = '/PIM-systeem';
}
}
$(categorieToPIMLink);
/*
* Vervangt de tekst bij de interwiki voor Wikipedia van 'Nederlands' door 'Wikipedia'
*/
function veranderInterwikiNederlandstaligeWikipedia() {
if (document.querySelector('a[lang="nl"][hreflang="nl"].interlanguage-link-target')) {
document.querySelector('a[lang="nl"][hreflang="nl"].interlanguage-link-target').innerText = "Wikipedia";
}
}
$(veranderInterwikiNederlandstaligeWikipedia);
/*
* Gemodificeerd editcount script op Gebruiker:Apoo/Editcount
*/
mw.loader.load('https://wikikids.nl/index.php?title=User:Apoo/EditCount.js&action=raw&ctype=text/javascript');
/*
* Langere toevoegingen die beter op een andere pagina kunnen staan; zoals TVB en de handtekening in de boomhut.
*/
mw.loader.load('https://wikikids.nl/index.php?title=Gebruiker:Rots61/JS-TVB.js&action=raw&ctype=text/javascript');
mw.loader.load('https://wikikids.nl/index.php?title=Gebruiker:Rots61/JS-HandtekeninginBoomhut.js&action=raw&ctype=text/javascript');
/*
* Script waardoor de bezoekers gelogd worden; [[Gebruiker:Rots61/JS-Statistieken.js]].
*
* Voegt een speciale pagina toe waardoor de statistieken inzichtelijk worden gemaakt. [[Gebruiker:Rots61/JS-WikiStats.js]].
*/
if (mw.config.get('wgUserEditCount') >= 5 || mw.storage.get('disableLoggingWS')) {//Alleen voor gebruikers met bijdragen
mw.loader.load('//wikikids.nl/index.php?title=Gebruiker:Rots61/JS-WikiStats.js&action=raw&ctype=text/javascript');
} else {
mw.loader.load('//wikikids.nl/index.php?title=Gebruiker:Rots61/JS-Statistieken.js&action=raw&ctype=text/javascript');
}