You are viewing the MafiaScum.net Wiki. To play the game, visit the forum.

Northsidegal/Scripts: Difference between revisions

From MafiaWiki
Jump to navigation Jump to search
mNo edit summary
(lol)
Line 16: Line 16:
}}
}}


Scripts I've made or used for mafiascum. These require the "tampermonkey" browser extension (or something similar). If you use one, I'd really be interested in knowing. It's always nice to see people using your work, so feel free to PM me or something.  
Scripts I've made or used for mafiascum. These require the "tampermonkey" browser extension (or something similar). If you use one, I'd really be interested in knowing. It's always nice to see people using your work, so feel free to PM me or something. Or if you prefer you could write something on the guestbook on my main wiki page. Or you could write a heartfelt thank-you note, put it into a bottle and throw it into the ocean, hoping that one day it'll make its way to me. Whatever you prefer.


{{TOC}}
{{TOC}}

Revision as of 06:22, 1 June 2020

northsidegal   Played Games   Modded Games   Rulesets   Stats   Setups   Scripts    


Scripts I've made or used for mafiascum. These require the "tampermonkey" browser extension (or something similar). If you use one, I'd really be interested in knowing. It's always nice to see people using your work, so feel free to PM me or something. Or if you prefer you could write something on the guestbook on my main wiki page. Or you could write a heartfelt thank-you note, put it into a bottle and throw it into the ocean, hoping that one day it'll make its way to me. Whatever you prefer.

Highlight Posts

Change the "scum" and "town" lists to include flipped users, and this script will highlight those user's posts as red or green. You'll need to specify which thread it's for (keep the asterisk), and it won't work if you click on a post number rather than on a page number.

 // ==UserScript==
 // @name          Mafiascum: Highlight Alignments
 // @namespace     https://www.mafiascum.net/
 // @description   Highlight a flipped user's posts red or green depending on alignment
 // @include       https://forum.mafiascum.net/viewtopic.php?f=TODO&t=TODO*
 // @version       1.0
 // ==/UserScript==
 
 try {
    let thread = document.getElementById("page-body");
    let posts = thread.getElementsByClassName("post");
    let scum = ["TODO", "TODO"];
    let town = ["TODO", "TODO"];
    for(var i=0;i<posts.length;i++) {
       let post = posts[i];
       let profile = post.getElementsByClassName("postprofile")[0];
       let usernameLink = profile.getElementsByTagName("a")[0];
       let username = usernameLink.text;
       if(scum.includes(username)){
          post.setAttribute("style", "background-color: #b30000;");
       }
       if(town.includes(username)){
          post.setAttribute("style", "background-color: #009933;");
       }
    }
 } catch(e) {
    // Do nothing.
 }

Ignore A User

Use this to completely hide a specific player's posts. The "foe" feature already serves this purpose in discussion forums, but this works across the entire site, including for mafia games. I'm hesitant to include this because I think it promotes toxicity and I've only ever used it personally to ignore confirmed scum in a theme game, but I'm including it here anyways.

Credit goes to Aster, who created this originally. I have modified it.

 // ==UserScript==
 // @name          Mafiascum: Ignore
 // @namespace     https://www.mafiascum.net/
 // @description   Ignore a player
 // @include       https://forum.mafiascum.net/viewtopic.php?f=TODO&t=TODO*
 // @version       1.1
 // ==/UserScript==
 
 try {
    let thread = document.getElementById("page-body");
    let posts = thread.getElementsByClassName("post");
    for(var i=0;i<posts.length;i++) {
       let post = posts[i];
       let profile = post.getElementsByClassName("postprofile")[0];
       let usernameLink = profile.getElementsByTagName("a")[0];
       let username = usernameLink.text;
       if(username == "TODO") {
          let inner = post.getElementsByClassName("inner")[0];
          inner.innerText = "Ignored Post";
       }
    }
 } catch(e) {
    // Do nothing.
 }