Bahaidata
Bahaidata
Menu
About
Create an item
Create a property
Random item
Recent changes
Tools
What links here
Related changes
Upload file
Special pages
Printable version
Permanent link
Page information
Message
Discussion
View source
View history
Not logged in
Talk
Contributions
Create account
Log in
Navigation
About
Create an item
Create a property
Random item
Recent changes
Help
Definitions
List of items
List of properties
Tools
What links here
Related changes
Upload file
Special pages
Printable version
Permanent link
Page information

MediaWiki:Common.js

From Bahaidata
Jump to:navigation, search

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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
/*
CONTENTS

1. Create a url to traffic stats pages
*/

/* ADD A URL IN THE FOOTER TO TRAFFIC STATISTICS PAGES */
$(function () {
    var allowedNamespaces = [0];
    var ns = mw.config.get('wgNamespaceNumber');

    if (!allowedNamespaces.includes(ns) || mw.config.get('wgAction') !== 'view') return;

    var pageTitle = mw.config.get('wgPageName');
    var decodedTitle = pageTitle.replace(/_/g, ' ');
    var encodedTitle = encodeURIComponent(decodedTitle).replace(/%20/g, '+');

    var statsURL = 'https://digitalbahairesources.org/pageview-analysis?website_id=2&titles=%5B%22' +
        encodedTitle + '%22%5D&from_year=2024&from_month=7&to_year=2025&to_month=7';

    var $link = $('<a>')
        .attr('href', statsURL)
        .attr('target', '_blank')
        .text('📊 View Traffic Statistics')
        .css({ marginLeft: '1em' });

    var $container = $('#footer-info > div').first();
    if ($container.length) {
        $container.append($link);
    }
});
Retrieved from "https://bahaidata.org/index.php?title=MediaWiki:Common.js&oldid=25254"
This page was last edited on 17 July 2025, at 23:06.
Content is available under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License unless otherwise noted.
Privacy policy
About Bahaidata
Disclaimers
Powered by MediaWiki