Difference between revisions of "MediaWiki:Common.js"
From Direct-Mind.Org
(Created page with "→Any JavaScript here will be loaded for all users on every page load.: /* ref: http://en.wikipedia.org/wiki/Help:User_style#Moving_categories_to_top Moving categories to...") |
|||
Line 7: | Line 7: | ||
/* doesn't work in Firefox | |||
function catsattop() { | function catsattop() { | ||
var cats = document.getElementById('catlinks'); | var cats = document.getElementById('catlinks'); | ||
var bc = document.getElementById('bodyContent'); | var bc = document.getElementById('bodyContent'); | ||
bc.insertBefore(cats, bc.childNodes[0]); | bc.insertBefore(cats, bc.childNodes[0]); | ||
} | |||
*/ | |||
function categoryToTop() { | |||
var thebody = document.getElementById('contentTop'); | |||
var categories = document.getElementById('catlinks'); | |||
if (categories != null) { | |||
categories.parentNode.removeChild (categories); | |||
thebody.parentNode.insertBefore(categories, thebody); | |||
} | |||
} | } |
Revision as of 15:23, 9 January 2015
/* Any JavaScript here will be loaded for all users on every page load. */ /* ref: http://en.wikipedia.org/wiki/Help:User_style#Moving_categories_to_top Moving categories to top[edit] The following code moves the category box to the top of the article. Of course, you might want to apply some CSS to make it look prettier: */ /* doesn't work in Firefox function catsattop() { var cats = document.getElementById('catlinks'); var bc = document.getElementById('bodyContent'); bc.insertBefore(cats, bc.childNodes[0]); } */ function categoryToTop() { var thebody = document.getElementById('contentTop'); var categories = document.getElementById('catlinks'); if (categories != null) { categories.parentNode.removeChild (categories); thebody.parentNode.insertBefore(categories, thebody); } }