Jump to content

MediaWiki:Common.js

From Artemis Archive
Revision as of 03:08, 21 April 2025 by Bxuwd (talk | contribs) (Created page with "Any JavaScript here will be loaded for all users on every page load.: $(function() { // Create the link element var reportLink = $('<li>') .attr('id', 'pt-report-abuse') .append( $('<a>') .attr('href', mw.util.getUrl('Report_Animal_Abuse')) // Assumes page is named Report_Animal_Abuse .text('Report Abuse') ); // Try to insert it before the login link, or after the ULS link var loginLink = $('#pt-login'); var ulsLink = $('...")
(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. */
$(function() {
  // Create the link element
  var reportLink = $('<li>')
    .attr('id', 'pt-report-abuse')
    .append(
      $('<a>')
        .attr('href', mw.util.getUrl('Report_Animal_Abuse')) // Assumes page is named Report_Animal_Abuse
        .text('Report Abuse')
    );

  // Try to insert it before the login link, or after the ULS link
  var loginLink = $('#pt-login');
  var ulsLink = $('#pt-uls'); // ULS link/button ID

  if (loginLink.length) {
    reportLink.insertBefore(loginLink);
  } else if (ulsLink.length) {
     reportLink.insertAfter(ulsLink);
  } else {
    // Fallback: Append to the end of the personal tools list (may need adjustment based on skin)
    $('#p-personal ul').append(reportLink);
  }
});