MediaWiki:Common.js

Revision as of 14:02, 29 January 2026 by FrankMuraca (talk | contribs) (Created page with "Any JavaScript here will be loaded for all users on every page load.: mw.hook('wikipage.content').add(function () { var container = document.getElementById('buymeacoffee'); if (!container) return; // Prevent duplicate insertion if (container.dataset.loaded === '1') return; container.dataset.loaded = '1'; var script = document.createElement('script'); script.src = 'https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js'; script.setAttribute('data-...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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. */

mw.hook('wikipage.content').add(function () {
  var container = document.getElementById('buymeacoffee');
  if (!container) return;

  // Prevent duplicate insertion
  if (container.dataset.loaded === '1') return;
  container.dataset.loaded = '1';

  var script = document.createElement('script');
  script.src = 'https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js';
  script.setAttribute('data-name', 'bmc-button');
  script.setAttribute('data-slug', 'Raleighpedia');
  script.setAttribute('data-color', '#FFDD00');
  script.setAttribute('data-font', 'Lato');
  script.setAttribute('data-text', 'Buy Raleighpedia a coffee');
  script.setAttribute('data-outline-color', '#000000');
  script.setAttribute('data-font-color', '#000000');
  script.setAttribute('data-coffee-color', '#ffffff');

  container.appendChild(script);
});