MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

/* this adds categories to sidebar (requires mod to LocalSettings.php) */ var one = document.querySelector("#catlist"); if(typeof(one) != 'undefined' && one !== null){ var children = document.querySelector("#catlinks").children; Array.prototype.forEach.call(children, function (child) {     one.appendChild(child);  }); }

/* add tag title to sidebar */ var catelement = document.getElementById("mw-normal-catlinks"); if(typeof(catelement) != 'undefined' && catelement !== null){ var cattar = document.getElementById("catlist"); if(typeof(cattar) != 'undefined' && cattar !== null){ cattar.insertAdjacentHTML('beforebegin', ' Tags: '); } }

/* add toc title to sidebar */ var element = document.getElementById("toc"); //If it isn't "undefined" and it isn't "null", then it exists. if(typeof(element) != 'undefined' && element !== null){ var target = document.getElementById("tweekiTOC"); if(typeof(target) != 'undefined' && target !== null){ target.insertAdjacentHTML('beforebegin', ' Table of contents: '); } }

/* remove ":" from sidebar category using jQuery */ // $('#mw-normal-catlinks').html(function(index, html){   // return html.replace(':', 'xxxxxx'); // });

// change links href, causes errors on some pages //document.getElementById('mw-normal-catlinks').innerHTML = document.getElementById('mw-normal-catlinks').innerHTML.replace("A",'asda');

// changes text but causes errors, removes links //document.getElementById('mw-normal-catlinks').innerText = document.getElementById('mw-normal-catlinks').innerText.replace("A",'dfsdf');

// jquery // $('#mw-normal-catlinks:contains("A")').text.replace("A", "dsdada") //$("#mw-normal-catlinks").text($("#mw-normal-catlinks").text.replace("A", "Bye")); // var $toptitle = $('#mw-normal-catlinks'); // if ( $toptitle.text == 'A' ) // No {} brackets necessary if it's just one line. //  $toptitle.text('New Word');

// causes errors //document.getElementById('mw-normal-catlinks').innerContent = document.getElementById('mw-normal-catlinks').innerContent.replace("A",'dfsdf'); /* Add tagcloud to sidebar (requires mod to LocalSettings.php) */ // document.querySelector('.tagcloudbox').innerHTML = ' \nmin_size=55\nexclude=browse\n \n';