MediaWiki:Gadget-CategoryAboveBelowImage.js
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.
/**
* @description: Move catlinks to top and leave clones at bottom.
* @author: [[User:Ianezz]] 2009 ([[Commons:Village_pump/Archive/2009Sep#CSS_placement_of_categories]]), based on [[:wikinews:Help:User_style#Moving_categories_to_top]]
* @author: [[User:Perhelion]] 2016/2017
**/
/*global mw*/
/*jshint curly:false*/
(function () {
'use strict';
if (mw.config.get('wgNamespaceNumber') !== -1) {
var c = document.getElementById('catlinks'),
b = document.getElementById('bodyContent') || document.getElementById('mw-content-text'), //|| c.parentNode
f = document.getElementById('file'),
cc = c.cloneNode(1); // Clone with secondary priority
// Insert clone at original position
if (cc.hasChildNodes()) {
cc.id = "";
cc.firstChild.id = "";
cc.lastChild.id = "";
b.insertBefore(cc, c);
}
// Move catlinks
if (f) f.appendChild(c);
else b.insertBefore(c, b.childNodes[0]);
}
})();