MediaWiki:MoveArticleStates.js

From Wikivoyage
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// UNUSED/OBSOLETE SCRIPT
//
// previously referenced from Common.js and used to move the geo
// and dotm icons to the top-right corner of articles

function moveArticleStates() {
 var spacing = 10, coordPadding = 0, tagCoord, tagDoM;

 if (document.getElementById) {
  tagCoord = document.getElementById("geoCoord");
  tagDoM = document.getElementById("DoM");
  if (tagDoM != null) {
   coordPadding = ( /* tagDoM.getElementsByTagName("img").length */ + 2) * 28 + spacing;
   /* The styles of template:Title-icon and template:Title-icons must be rewritten to count the images */
   tagDoM.style.zIndex = 2;
  }
  if (tagCoord != null) tagCoord.style.paddingRight = coordPadding + 'px';
 }
}

$( document ).ready( moveArticleStates() );