Aktuelle Version |
Dein Text |
Zeile 1: |
Zeile 1: |
| /* Jedes JavaScript hier wird für alle Benutzer für jede Seite geladen. */ | | /** Collapsible tables ********************************************************* |
| | * |
| | * Description: Allows tables to be collapsed, showing only the header. See |
| | * [[Wikipedia:NavFrame]]. |
| | * Maintainers: [[User:R. Koot]] |
| | */ |
| | | |
| //=============================================================
| | var autoCollapse = 2; |
| //*** Configuration for "star" logo in front of interwiki links to Featured Articles
| | var collapseCaption = "hide"; |
| | var expandCaption = "show"; |
| | | |
| /** set to false in Special:Mypage/monobook.js to switch off this "feature" */
| | function collapseTable( tableIndex ) |
| var linkFA_enabled = true; | | { |
| | var Button = document.getElementById( "collapseButton" + tableIndex ); |
| | var Table = document.getElementById( "collapsibleTable" + tableIndex ); |
| | | |
| /** description that is displayed when cursor hovers above FA interwiki links */
| | if ( !Table || !Button ) { |
| var linkFA_description = "Dieser Artikel wurde als exzellent bewertet.";
| | return false; |
| | } |
| | | |
| // linkFA_bullet and linkFA_style werden nur für cologneblue, nostalgia and standard verwendet,
| | var Rows = Table.rows; |
| // für monobook und simple siehe [[MediaWiki:Common.css]]
| |
| | | |
| /** image to use instead of the standard bullet (for cologneblue, nostalgia and standard */
| | if ( Button.firstChild.data == collapseCaption ) { |
| var linkFA_bullet = "http://upload.wikimedia.org/wikipedia/commons/d/d0/Monobook-bullet-star-transparent.png";
| | for ( var i = 1; i < Rows.length; i++ ) { |
|
| | Rows[i].style.display = "none"; |
| /** style to use for the linkFA_bullet img */
| | } |
| var linkFA_style = "margin-right: 0.2em;"; | | Button.firstChild.data = expandCaption; |
|
| | } else { |
| /**
| | for ( var i = 1; i < Rows.length; i++ ) { |
| * star logo for featured articles in other languages,
| | Rows[i].style.display = Rows[0].style.display; |
| * see Template:Link_FA and MediaWiki:Common.css
| |
| */
| |
| addOnloadHook(function() {
| |
| // early exit when disabled
| |
| if (!linkFA_enabled) return;
| |
|
| |
| // skins need to be treated differently
| |
| if (skin == "monobook" || skin == "simple") {
| |
| newer(); | |
| }
| |
| else if (skin == "cologneblue" || skin == "nostalgia" || skin == "standard") {
| |
| older();
| |
| } | |
|
| |
| /** skin == "monobook" || skin == "simple" */
| |
| function newer() {
| |
| // links are to replaced in p-lang only
| |
| var pLang = document.getElementById("p-lang");
| |
| if (!pLang) return;
| |
| var lis = pLang.getElementsByTagName("li");
| |
| for (var i = 0; i < lis.length; i++) { | |
| var li = lis[i]; | |
| // only links with a corresponding Link_FA template are interesting
| |
| if (!document.getElementById(li.className + "-fa")) continue;
| |
| // additional class so the template can be hidden with CSS
| |
| li.className += " FA";
| |
| // change title
| |
| li.title = linkFA_description;
| |
| } | | } |
| | Button.firstChild.data = collapseCaption; |
| } | | } |
| | } |
| | | |
| /** skin == "cologneblue" || skin == "nostalgia" || skin == "standard" */
| | function createCollapseButtons() |
| function older() {
| | { |
| // these root elements can contain FA-links
| | var tableIndex = 0; |
| var rootIds = new Array("topbar", "footer");
| | var NavigationBoxes = new Object(); |
| for (var i=0; i<rootIds.length; i++) {
| | var Tables = document.getElementsByTagName( "table" ); |
| var rootId = rootIds[i];
| |
| var root = document.getElementById(rootId);
| |
| if (!root) continue;
| |
|
| |
| // if the root exists, try to decorate all the links within
| |
| var links = root.getElementsByTagName("a");
| |
| for (var j=0; j<links.length; j++) {
| |
| var link = links[j];
| |
| decorate(link);
| |
| }
| |
| }
| |
| }
| |
| | | |
| /** id necessary, modify a link to show the FA-star (older) */ | | for ( var i = 0; i < Tables.length; i++ ) { |
| function decorate(link) {
| | if ( hasClass( Tables[i], "collapsible" ) ) { |
| // exit if not a FA-link
| |
| var lang = link.title.split(":")[0]; // not precise enough
| |
| var fa = document.getElementById("interwiki-" + lang + "-fa");
| |
| if (!fa) return; | |
| // possible problem owing the standard skin: "Link FA" template is transcluded with a non-interwiki parameter, for example "Special"
| |
| // result: links to special pages in the topbar and/or footer might also be marked as a Featured Article
| |
| | | |
| // build an image-node for the FA-star
| | /* only add button and increment count if there is a header row to work with */ |
| var img = document.createElement("img");
| | var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0]; |
| img.setAttribute("src", linkFA_bullet);
| | if (!HeaderRow) continue; |
| img.setAttribute("alt", linkFA_description);
| | var Header = HeaderRow.getElementsByTagName( "th" )[0]; |
| img.setAttribute("style", linkFA_style);
| | if (!Header) continue; |
| | | |
| // decorate the link with the image
| | NavigationBoxes[ tableIndex ] = Tables[i]; |
| link.appendChild(img);
| | Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex ); |
| link.appendChild(link.removeChild(link.firstChild));
| |
| link.setAttribute("title", linkFA_description);
| |
| }
| |
| });
| |
| | | |
| //==============================================================================
| | var Button = document.createElement( "span" ); |
| //*** Fügt einen Link "Alle Sprachen" auf der Hauptseite unter die Sprachverweise hinzu
| | var ButtonLink = document.createElement( "a" ); |
| | var ButtonText = document.createTextNode( collapseCaption ); |
| | | |
| addOnloadHook(function() {
| | Button.style.styleFloat = "right"; |
| // only on the main page
| | Button.style.cssFloat = "right"; |
| if ( wgTitle != 'Hauptseite' || wgNamespaceNumber != 0 ) return;
| | Button.style.fontWeight = "normal"; |
| | Button.style.textAlign = "right"; |
| | Button.style.width = "6em"; |
| | | |
| try {
| | ButtonLink.style.color = Header.style.color; |
| var node = document.getElementById( "p-lang" )
| | ButtonLink.setAttribute( "id", "collapseButton" + tableIndex ); |
| .getElementsByTagName('div')[0]
| | ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" ); |
| .getElementsByTagName('ul')[0];
| | ButtonLink.appendChild( ButtonText ); |
| | | |
| var aNode = document.createElement( 'a' );
| | Button.appendChild( document.createTextNode( "[" ) ); |
| var liNode = document.createElement( 'li' );
| | Button.appendChild( ButtonLink ); |
| | Button.appendChild( document.createTextNode( "]" ) ); |
| | | |
| aNode.appendChild( document.createTextNode( 'Alle Sprachen' ) );
| | Header.insertBefore( Button, Header.childNodes[0] ); |
| aNode.setAttribute( 'href' , 'http://de.wikipedia.org/wiki/Wikipedia:Sprachen' );
| | tableIndex++; |
| liNode.appendChild( aNode );
| | } |
| liNode.className = 'interwiki-completelist';
| |
| node.appendChild( liNode );
| |
| } catch(e) {
| |
| // lets just ignore what's happened
| |
| } | | } |
| });
| |
| | | |
|
| | for ( var i = 0; i < tableIndex; i++ ) { |
| //==============================================================================
| | if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) { |
| //*** Verändert die Tabellensortierfunktion so, dass auch deutsche Tausenderpunkt und Dezimalkommata gehen
| | collapseTable( i ); |
| // Original aus sv.wikipedia.org
| | } |
| | | } |
| function ts_parseFloat(num) {
| |
| if (!num) return 0;
| |
| num = num.replace(/\./g, "");
| |
| num = num.replace(/,/, ".");
| |
| num = parseFloat(num);
| |
| return (isNaN(num) ? 0 : num); | |
| } | | } |
| | | |
| //==============================================================================
| | addOnloadHook( createCollapseButtons ); |
| //*** forcePreview: erzwungene vorschau für IPs
| |
| | | |
| /* | | /** Dynamic Navigation Bars (experimental) ************************************* |
| * Zwingt IPs zuerst die Vorschau zu benutzen, bevor sie speichern können. | | * |
| * Copyright Marc Mongenet, 2006 aus frwp | | * Description: See [[Wikipedia:NavFrame]]. |
| | * Maintainers: UNMAINTAINED |
| */ | | */ |
| addOnloadHook(function() {
| |
| if (wgUserName != null || wgAction != "edit") return;
| |
| saveButton = document.getElementById("wpSave");
| |
| if (!saveButton) return;
| |
| saveButton.disabled = true;
| |
| saveButton.value = "Seite speichern (Bitte erst die Vorschau benutzen)";
| |
| saveButton.style.fontWeight = "normal";
| |
| document.getElementById("wpPreview").style.fontWeight = "bold";
| |
| });
| |
| | | |
| //============================================================================== | | // set up the words in your language |
| //*** Fügt der Suche weitere Suchengines hinzu (kopiert aus eswp)
| | var NavigationBarHide = '[' + collapseCaption + ']'; |
| | var NavigationBarShow = '[' + expandCaption + ']'; |
| | | |
| /* | | // shows and hides content and picture (if available) of navigation bars |
| document.write('<script type="text/javascript" src="'
| | // Parameters: |
| + '/w/index.php?title=MediaWiki:SpezialSuche.js'
| | // indexNavigationBar: the index of navigation bar to be toggled |
| + '&action=raw&ctype=text/javascript&dontcountme=s&smaxage=3600"></script>');
| | function toggleNavigationBar(indexNavigationBar) |
| */
| | { |
| | var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); |
| | var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); |
| | | |
| //================================================================================
| | if (!NavFrame || !NavToggle) { |
| //*** force the loading of another JavaScript file (Kopie von [[Commons:Common.js]])
| | return false; |
| // Local Maintainer: [[Commons:User:Dschwen]]
| | } |
| | | |
| function includePage(name) {
| | // if shown now |
| document.write('<script type="text/javascript" src="' + wgScript + '?title='
| | if (NavToggle.firstChild.data == NavigationBarHide) { |
| + name
| | for ( |
| + '&action=raw&ctype=text/javascript"><\/script>');
| | var NavChild = NavFrame.firstChild; |
| } | | NavChild != null; |
| | NavChild = NavChild.nextSibling |
| | ) { |
| | if ( hasClass( NavChild, 'NavPic' ) ) { |
| | NavChild.style.display = 'none'; |
| | } |
| | if ( hasClass( NavChild, 'NavContent') ) { |
| | NavChild.style.display = 'none'; |
| | } |
| | } |
| | NavToggle.firstChild.data = NavigationBarShow; |
| | | |
| //================================================================================ | | // if hidden now |
| //*** import Onlyifuploading-functions
| | } else if (NavToggle.firstChild.data == NavigationBarShow) { |
| // SEE ALSO [[MediaWiki:Onlyifuploading.js]]
| | for ( |
| | var NavChild = NavFrame.firstChild; |
| | NavChild != null; |
| | NavChild = NavChild.nextSibling |
| | ) { |
| | if (hasClass(NavChild, 'NavPic')) { |
| | NavChild.style.display = 'block'; |
| | } |
| | if (hasClass(NavChild, 'NavContent')) { |
| | NavChild.style.display = 'block'; |
| | } |
| | } |
| | NavToggle.firstChild.data = NavigationBarHide; |
| | } |
| | } |
| | | |
| if (wgCanonicalSpecialPageName == "Upload") {
| | // adds show/hide-button to navigation bars |
| document.write('<script type="text/javascript" src="/w/index.php?title=MediaWiki:Onlyifuploading.js&action=raw&ctype=text/javascript&dontcountme=s"></script>'); | | function createNavigationBarToggleButton() |
| }
| | { |
| | var indexNavigationBar = 0; |
| | // iterate over all < div >-elements |
| | var divs = document.getElementsByTagName("div"); |
| | for( |
| | var i=0; |
| | NavFrame = divs[i]; |
| | i++ |
| | ) { |
| | // if found a navigation bar |
| | if (hasClass(NavFrame, "NavFrame")) { |
| | | |
| //================================================================================
| | indexNavigationBar++; |
| //*** Dynamic Navigation Bars
| | var NavToggle = document.createElement("a"); |
| | NavToggle.className = 'NavToggle'; |
| | NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); |
| | NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); |
| | | |
| // set up the words in your language
| | var NavToggleText = document.createTextNode(NavigationBarHide); |
| var NavigationBarHide = 'Einklappen'; | | for ( |
| var NavigationBarShow = 'Ausklappen';
| | var NavChild = NavFrame.firstChild; |
| | NavChild != null; |
| | NavChild = NavChild.nextSibling |
| | ) { |
| | if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) { |
| | if (NavChild.style.display == 'none') { |
| | NavToggleText = document.createTextNode(NavigationBarShow); |
| | break; |
| | } |
| | } |
| | } |
| | | |
| // set up max count of Navigation Bars on page,
| | NavToggle.appendChild(NavToggleText); |
| // if there are more, all will be hidden
| | // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) |
| // NavigationBarShowDefault = 0; // all bars will be hidden
| | for( |
| // NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
| | var j=0; |
| if (typeof NavigationBarShowDefault == 'undefined' ) {
| | j < NavFrame.childNodes.length; |
| var NavigationBarShowDefault = 1;
| | j++ |
| }
| | ) { |
|
| | if (hasClass(NavFrame.childNodes[j], "NavHead")) { |
| // shows and hides content and picture (if available) of navigation bars | | NavFrame.childNodes[j].appendChild(NavToggle); |
| // Parameters:
| | } |
| // indexNavigationBar: the index of navigation bar to be toggled
| | } |
| function toggleNavigationBar(indexNavigationBar)
| | NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); |
| {
| | } |
| var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
| | } |
| var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
| | } |
|
| |
| if (!NavFrame || !NavToggle) {
| |
| return false;
| |
| }
| |
|
| |
| // if shown now
| |
| if (NavToggle.firstChild.data == NavigationBarHide) {
| |
| for (
| |
| var NavChild = NavFrame.firstChild;
| |
| NavChild != null;
| |
| NavChild = NavChild.nextSibling
| |
| ) {
| |
| if (NavChild.className == 'NavPic') {
| |
| NavChild.style.display = 'none';
| |
| }
| |
| if (NavChild.className == 'NavContent') {
| |
| NavChild.style.display = 'none';
| |
| }
| |
| if (NavChild.className == 'NavToggle') {
| |
| NavChild.firstChild.data = NavigationBarShow;
| |
| }
| |
| }
| |
|
| |
| // if hidden now
| |
| } else if (NavToggle.firstChild.data == NavigationBarShow) {
| |
| for (
| |
| var NavChild = NavFrame.firstChild;
| |
| NavChild != null;
| |
| NavChild = NavChild.nextSibling
| |
| ) {
| |
| if (NavChild.className == 'NavPic') {
| |
| NavChild.style.display = 'block';
| |
| }
| |
| if (NavChild.className == 'NavContent') {
| |
| NavChild.style.display = 'block';
| |
| }
| |
| if (NavChild.className == 'NavToggle') {
| |
| NavChild.firstChild.data = NavigationBarHide;
| |
| }
| |
| }
| |
| }
| |
| } | |
| | | |
| // adds show/hide-button to navigation bars
| | addOnloadHook( createNavigationBarToggleButton ); |
| function createNavigationBarToggleButton()
| |
| {
| |
| var indexNavigationBar = 0;
| |
| // iterate over all < div >-elements
| |
| var divs = document.getElementsByTagName("div");
| |
| for (var i=0; i<divs.length; i++) {
| |
| var NavFrame = divs[i];
| |
| // if found a navigation bar
| |
| if (NavFrame.className == "NavFrame") {
| |
|
| |
| indexNavigationBar++;
| |
| var NavToggle = document.createElement("a");
| |
| NavToggle.className = 'NavToggle';
| |
| NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
| |
| NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
| |
|
| |
| var NavToggleText = document.createTextNode(NavigationBarHide);
| |
| NavToggle.appendChild(NavToggleText);
| |
|
| |
| // add NavToggle-Button as first div-element
| |
| // in < div class="NavFrame" >
| |
| NavFrame.insertBefore(
| |
| NavToggle,
| |
| NavFrame.firstChild
| |
| );
| |
| NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
| |
| }
| |
| }
| |
| // if more Navigation Bars found than Default: hide all
| |
| if (NavigationBarShowDefault < indexNavigationBar) {
| |
| for(
| |
| var i=1;
| |
| i<=indexNavigationBar;
| |
| i++
| |
| ) {
| |
| toggleNavigationBar(i);
| |
| }
| |
| }
| |
|
| |
| }
| |
|
| |
| addOnloadHook(createNavigationBarToggleButton); | |
|
| |
| //================================================================================
| |
| //*** import Onlyifediting-functions
| |
| // SEE ALSO [[MediaWiki:Onlyifediting.js]]
| |
|
| |
| if (document.URL.indexOf("action=edit") > 0 || document.URL.indexOf("action=submit") > 0) {
| |
| document.write('<script type="text/javascript" src="/w/index.php?title=MediaWiki:Onlyifediting.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
| |
| }
| |