MediaWiki:Common.js: Difference between revisions

From Kshatriya Wiki
No edit summary
Tag: Manual revert
No edit summary
Line 37: Line 37:
   link.style.boxShadow = "0 4px 6px rgba(0,0,0,0.2)";
   link.style.boxShadow = "0 4px 6px rgba(0,0,0,0.2)";
   document.body.appendChild(link);
   document.body.appendChild(link);
});
$(document).ready(function () {
  var container = document.createElement("div");
  container.style.textAlign = "center";
  container.style.margin = "10px 0";
  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", "rajanyaofficial");
  script.setAttribute("data-color", "#FFDD00");
  script.setAttribute("data-emoji", "🛡️");
  script.setAttribute("data-font", "Bree");
  script.setAttribute("data-text", "Support Our Work");
  script.setAttribute("data-outline-color", "#000000");
  script.setAttribute("data-font-color", "#000000");
  script.setAttribute("data-coffee-color", "#ffffff");
  container.appendChild(script);
  // Insert button at top of content area
  if (mw.util && mw.util.$content) {
    mw.util.$content.prepend(container);
  } else {
    document.body.insertBefore(container, document.body.firstChild);
  }
});
});

Revision as of 13:22, 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
$(document).ready(function () {
  var link = document.createElement('a');
  link.href = "https://www.buymeacoffee.com/rajanyaofficial";
  link.textContent = "🛡️ Support Monthly";
  link.target = "_blank";
  link.style.position = "fixed";
  link.style.bottom = "20px";
  link.style.right = "20px";
  link.style.background = "#5F7FFF";
  link.style.color = "#fff";
  link.style.padding = "10px 15px";
  link.style.borderRadius = "8px";
  link.style.fontFamily = "Poppins, sans-serif";
  link.style.fontSize = "14px";
  link.style.zIndex = "9999";
  link.style.textDecoration = "none";
  link.style.boxShadow = "0 4px 6px rgba(0,0,0,0.2)";
  document.body.appendChild(link);
});


$(document).ready(function () {
  var container = document.createElement("div");
  container.style.textAlign = "center";
  container.style.margin = "10px 0";

  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", "rajanyaofficial");
  script.setAttribute("data-color", "#FFDD00");
  script.setAttribute("data-emoji", "🛡️");
  script.setAttribute("data-font", "Bree");
  script.setAttribute("data-text", "Support Our Work");
  script.setAttribute("data-outline-color", "#000000");
  script.setAttribute("data-font-color", "#000000");
  script.setAttribute("data-coffee-color", "#ffffff");

  container.appendChild(script);

  // Insert button at top of content area
  if (mw.util && mw.util.$content) {
    mw.util.$content.prepend(container);
  } else {
    document.body.insertBefore(container, document.body.firstChild);
  }
});