MediaWiki:Common.js

From VRChat Wiki
Revision as of 01:57, 4 October 2024 by Arie² (talk | contribs)

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

// Lightweight analytics by Plausible.io
!function(t) {
	var e = t.createElement("script");
	
	e.setAttribute("defer", "defer");
	e.setAttribute("data-domain", "wiki.vrchat.com");
	
	e.setAttribute("event-page-name", mw.config.get("wgTitle"));
	e.setAttribute("event-page-language", mw.config.get("wgPageContentLanguage"));
	e.setAttribute("event-page-namespace", mw.config.get("wgFormattedNamespaces")[mw.config.get("wgNamespaceNumber")]);
	
	e.setAttribute("event-theme", mw.config.get("skin"));
	e.setAttribute("event-action", mw.config.get("action"));
	
	e.setAttribute("event-is-logged-in", mw.config.get("wgUserName") !== null);
	const wgUserGroups = mw.config.get("wgUserGroups");
	e.setAttribute("event-is-maintainer", wgUserGroups.includes("community-mod")
		|| wgUserGroups.includes("moderator")
		|| wgUserGroups.includes("sysop"));
	
	e.src = "https://plausible.io/js/script.pageview-props.outbound-links.js";
	t.head.appendChild(e)
}(document);

importScript("MediaWiki:Template:MainPageInfopush.js");
importScript("MediaWiki:VisitorsIndicator.js");