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 ("mepedia.416inc.com/wiki/Special:Statistics").done (function (response){ $('span.totalnumbderofviews').text(($(response).find('#mw-hitcounters-statistics-views-total>.mw-statistics-numbers').text)); });