MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */ // Globals at https://www.mediawiki.org/wiki/Manual:Interface/JavaScript

// GOOGLE ANALYTICS (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function{ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date;a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-60945029-2', 'auto'); ga('send', 'pageview'); // END GOOGLE ANALYTICS

// Require a summary on edit pages $('#editform').submit(function (e) {   var summary = $('#wpSummary');    // https://www.mediawiki.org/wiki/Manual:Namespace#Built-in_namespaces    if (wgPageName.match(/^(User|Talk|Module|.*?_talk):/) || !summary.val.match(/^(\/\*.*?\*\/)?\s*$/)) {        return;    }    summary[0].scrollIntoView;    alert("Please enter a summary of the changes you are making in the designated text box.");    summary.focus;    e.preventDefault; });

//Override template:totalviews to get the number of total views of the website $.ajax ("/wiki/Special:Statistics").done (function (response){ $('span.totalnumbderofviews').text(($(response).find('#mw-hitcounters-statistics-views-total>.mw-statistics-numbers').text)); });

//Add text around donate button if (wgUserLanguage == "en"){ $("li#n-donate").prepend(' Did this page help you? '); $("li#n-donate").append(' Help us grow MEpedia. '); } else { $("li#n-donate").prepend(' '); }

//Set color to specific categories

//For Medical hypotheses category if (wgCategories.includes ("Medical hypotheses")){ //$(".mw-body-content").css ("background-color","#dae6ff"); //$(".toc").css ("background-color","#dae6ff"); $(".firstHeading").prepend (' This is a Medical hypothesis page ');

// pivot fix $("h1.title").prepend (' This is a Medical hypothesis page '); }

//For Potential treatments category if (wgCategories.includes ("Potential treatments")){ //$(".mw-body-content").css ("background-color","#f8d6c2"); //$(".toc").css ("background-color","#f8d6c2"); $(".firstHeading").prepend (' This is a Potential treatments page ');

// pivot fix $("h1.title").prepend (' This is a Potential treatments page '); }