User:Rcsprinter123/pageviews.js

(function {  if (mw.config.get('wgAction') !== 'view') return;  var infoPage = mw.util.getUrl(mw.config.get('wgPageName'), { action: 'info', useLang: 'en' })  $.ajax({ url: infoPage, type: 'get', success: function (html) { var text = $(html).find('table').text var monthlyViews = text.match(/Page views in the past 30 days(.+)/) var visitingwatchers = text.match(/Number of page watchers who visited recent edits(.+)/) var floatRight = $('#coordinates').length === 0 $('#siteSub').append(`       ${monthlyViews ? `/ ${monthlyViews[1]} monthly views`:}${visitingwatchers && monthlyViews ? ',':}        ${visitingwatchers ? `${visitingwatchers[1]} active watchers`:}      `) } }) })