MediaWiki:Common.js: Difference between revisions

From Kshatriya Wiki
mNo edit summary
mNo edit summary
Line 18: Line 18:
}
}


$(document).ready(function () {
//coffee
  var bmcScript = document.createElement("script");
mw.loader.using('mediawiki.util', function () {
  bmcScript.setAttribute("data-name", "BMC-Widget");
  $(function () {
  bmcScript.setAttribute("data-cfasync", "false");
    var script = document.createElement('script');
  bmcScript.src = "https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js";
    script.setAttribute('src', 'https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js');
  bmcScript.setAttribute("data-id", "rajanyaofficial");
    script.setAttribute('data-name', 'BMC-Widget');
  bmcScript.setAttribute("data-description", "Support me on Buy me a coffee!");
    script.setAttribute('data-cfasync', 'false');
  bmcScript.setAttribute("data-message", "Support monthly. Be a silent force behind the movement.");
    script.setAttribute('data-id', 'rajanyaofficial');
  bmcScript.setAttribute("data-color", "#5F7FFF");
    script.setAttribute('data-description', 'Support me on Buy me a coffee!');
  bmcScript.setAttribute("data-position", "Right");
    script.setAttribute('data-message', 'Support monthly. Be a silent force behind the movement.');
  bmcScript.setAttribute("data-x_margin", "18");
    script.setAttribute('data-color', '#5F7FFF');
  bmcScript.setAttribute("data-y_margin", "18");
    script.setAttribute('data-position', 'Right');
 
    script.setAttribute('data-x_margin', '18');
  document.body.appendChild(bmcScript);
    script.setAttribute('data-y_margin', '18');
    document.body.appendChild(script);
  });
});
});

Revision as of 13:10, 10 July 2025

/* Any JavaScript here will be loaded for all users on every page load. */
// Google Analytics for GA4 (G-5MQXEFVQBE)
var gtagScript = document.createElement("script");
gtagScript.src = "https://www.googletagmanager.com/gtag/js?id=G-5MQXEFVQBE";
gtagScript.async = true;
document.head.appendChild(gtagScript);

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-5MQXEFVQBE');

// Remove View History tab & Recent Changes link for anonymous users
if (!mw.config.get('wgUserName')) {
  $('#ca-history').remove(); // Removes history tab
  $('#n-recentchanges').remove(); // Removes recent changes link
  $('a[title="Special:RecentChanges"]').remove(); // Extra check
}

//coffee
mw.loader.using('mediawiki.util', function () {
  $(function () {
    var script = document.createElement('script');
    script.setAttribute('src', 'https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js');
    script.setAttribute('data-name', 'BMC-Widget');
    script.setAttribute('data-cfasync', 'false');
    script.setAttribute('data-id', 'rajanyaofficial');
    script.setAttribute('data-description', 'Support me on Buy me a coffee!');
    script.setAttribute('data-message', 'Support monthly. Be a silent force behind the movement.');
    script.setAttribute('data-color', '#5F7FFF');
    script.setAttribute('data-position', 'Right');
    script.setAttribute('data-x_margin', '18');
    script.setAttribute('data-y_margin', '18');
    document.body.appendChild(script);
  });
});