Jump to content
This is a wiki for a reason. Anyone can contribute. If you see something that is inaccurate or can be improved, don't ask that it be fixed--just improve it.
[ Disclaimer, Create new user --- Wiki markup help, Install P99 ]

MediaWiki:SoloArtistChallenge.js

From p99 Backup
Revision as of 17:57, 30 July 2018 by imported>Loramin
(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.
$(function() {

    var user = document.querySelector('[title="Your user page \[.\]').innerText;

    var anchorsWithTitles = document.querySelectorAll('a[title]');

    anchorsWithTitles.forEach(function(anchor) {
        // Only continue if this is an anchor tag for a solo artist challenge mob
        if (!anchor.previousSibling || !anchor.previousSibling.style || anchor.previousSibling.style.fontSize !== '21px') return;

        // If this is a solo artist <a>
        var mob = anchor.title;
        var mobId = anchor.title.replace(/ /g, '-');
        var mobBeatList = document.getElementById(mobId);
        if (!mobBeatList) return;

        var userBeatMob = (mobBeatList.innerText +',').includes(user + ',');
//console.log(mob, mobId, mobBeatList.innerText, user, userBeatMob)
        if (!userBeatMob) return;

        document.querySelector('[title="'+ mob + '"]').previousSibling.innerText = 'X';
    });
});