MediaWiki-diskusjon:Monobook.js

Sideinnholdet støttes ikke på andre språk.
Fra Wikipedia, den frie encyklopedi

Jeg vil gjerne ha lagt inn muligheten til å la én sammenklappelig mal være sammenklappet i utgangspunktet. Koden skal finnes et sted i nedenstående Kph 3. sep 2006 kl. 20:15 (UTC)

// ============================================================ // BEGIN Dynamic Navigation Bars // NEEDS Enable multiple onload functions

// set up the words in your language var NavigationBarHide = 'Einklappen'; var NavigationBarShow = 'Ausklappen';

// set up max count of Navigation Bars on page, // if there are more, all will be hidden // NavigationBarShowDefault = 0; // all bars will be hidden // NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden var NavigationBarShowDefault = 1;


// shows and hides content and picture (if available) of navigation bars // Parameters: // indexNavigationBar: the index of navigation bar to be toggled function toggleNavigationBar(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 function createNavigationBarToggleButton() {

  var indexNavigationBar = 0;
  // iterate over all < div >-elements
  for(
          var i=0; 
          NavFrame = document.getElementsByTagName("div")[i]; 
          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);
      }
  }

}

aOnloadFunctions[aOnloadFunctions.length] = createNavigationBarToggleButton;

// END Dynamic Navigation Bars // ============================================================

extra toolbar[rediger kilde]

 if (mwCustomEditButtons) {
/*   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
     "speedTip": "Omdirigering",
     "tagOpen": "#REDIRECT [[",
     "tagClose": "]]",
     "sampleText": "Målside"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",
     "speedTip": "Overstreking",
     "tagOpen": "<s>",
     "tagClose": "</s>",
     "sampleText": "Overstreket tekst"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",
     "speedTip": "Linjeskift",
     "tagOpen": "<br />",
     "tagClose": "",
     "sampleText": ""};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",
     "speedTip": "Hevet skrift",
     "tagOpen": "<sup>",
     "tagClose": "</sup>",
     "sampleText": "Hevet tekst"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",
     "speedTip": "Senket skrift",
     "tagOpen": "<sub>",
     "tagClose": "</sub>",
     "sampleText": "Senket tekst"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",
     "speedTip": "Liten skrift",
     "tagOpen": "<small>",
     "tagClose": "</small>",
     "sampleText": "Liten skrift"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",
     "speedTip": "Sett inn skjult tekst (vises kun i kildekoden)",
     "tagOpen": "<!-- ",
     "tagClose": " -->",
     "sampleText": "Skjult tekst"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",
     "speedTip": "Sett inn bildegalleri",
     "tagOpen": "\n<gallery>\n",
     "tagClose": "\n</gallery>",
     "sampleText": "Image:Example.jpg|Bildetekst1\nImage:Example.jpg|Bildetekst2"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",
     "speedTip": "Sitér tekst",
     "tagOpen": "<blockquote>\n",
     "tagClose": "\n</blockquote>",
     "sampleText": "Sitat"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",
     "speedTip": "Sett inn tabell",
     "tagOpen": '{| class="wikitable"\n|-\n',
     "tagClose": "\n|}",
     "sampleText": "! overskrift 1\n! overskrift 2\n! overskrift 3\n|-\n| rad 1, celle 1\n| rad 1, celle 2\n| rad 1, celle 3\n|-\n| rad 2, celle 1\n| rad 2, celle 2\n| rad 2, celle 3"};
*/

 mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/2/26/Button_latinas.png",
     "speedTip": "Sett inn «»",
     "tagOpen": "«",
     "tagClose": "»",
     "sampleText": "sitat"};

Hello, it seems that this wiki is using LinkFA in this skin, but forgot to enable it for all skins: the block containing the LinkFA function should be moved to MediaWiki:Common.js instead. Nemo 26. jul. 2014 kl. 00:51 (CEST)[svar]

Announced JavaScript change for badges implementation[rediger kilde]

Hi! I want to let you know that in near future badges will be deployed on Wikidata and the Wikipedias. They help us with displaying the good and featured article icons next to the sitelinks and will replace the javascript hack which is used at the moment together with the Link GA and Link FA templates. To avoid an overlap where the current system and the new feature conflict, I will add a minor fix to your Monobook.js which adds the class names to the interwiki links. This is part of my task as a global edit interface editor for the Wikidata team. Thanks, Bene* (diskusjon) 18. aug. 2014 kl. 22:29 (CEST)[svar]

Broken JavaScript[rediger kilde]

MediaWiki developers found that this page probably breaks JavaScript for users (example: not seeing the buttons when editing a page). You probably need to edit this .js page and/or MediaWiki:Gadgets-definition as in the examples at phabricator:T122755. List more pages to check.

If you have questions or need help, please ask at phabricator:T164242. You can login with your wiki account. Best wishes, Nemo 14. mai 2017 kl. 11:49 (CEST)[svar]