ISO Userscript: Information and Installation Guide

Talk about Forum Mafia feedback, suggestions, etc here.

Moderators: Metrion, FM Game Moderators

ISO Userscript: Information and Installation Guide

Postby Schultz128 » Thu Sep 13, 2018 3:20 pm

Sup nerds, you ever get tired of having to keep going back to the OP of a game to get onto someone's ISO?

What about those times you want an ISO for a person's posts in a thread outside of FM?

There's an easy work around for these issues, and this work around has been around for a while but most newer people don't know about it.


This workaround is known as an ISO Userscript.


What it do?

The ISO Userscript will make it so that there will be a link to a person's ISO in every post they make in any thread, and it looks like this:

Spoiler: Image



How it do?

The first step to get this userscript is to install an add-on into your browser known as Tampermonkey.

This add-on is available on:

  • Chrome
  • Firefox
  • Microsoft Edge
  • Safari
  • Opera Next

To install this add-on, simply go to https://tampermonkey.net/ and go to the tab with the browser you want to install this on. The tab will have a download link and additionally a video tutorial as to how to install it.

Once installed, there should be an icon for the program at the top right of your browser screen. Click on the icon and click on "Create a new script..."

Spoiler: Image


Now, you should be at a screen that looks like this:

Spoiler: Image


If you're here, perfect! What you'll need to do is delete all of the text currently on screen. Next, you'll need to copy the following text (credits to Varanus for this version of the coding) and paste it into the empty space:

Code: Select all
// ==UserScript==
// @name        FM Post Numberer
// @namespace   http://blankmediagames.com
// @author      deferentsheep
// @description Numbers posts and adds ISO
// @include     http://blankmediagames.com/phpbb/*
// @include     http://www.blankmediagames.com/phpbb/*
// @include     https://blankmediagames.com/phpbb/*
// @include     https://www.blankmediagames.com/phpbb/*
// @grantnone
// @version     1.0.8
// ==/UserScript==
// --------------------
// Configurable parameters, you may change values here
// If true, runs the script in every subforum, otherwise only in those specified by desiredForums.
var allForums = true;

// List of forums to run the script on if allForums is false. Works with subforums as well (e.g. "Forum Mafia" will enable the script in "Signups", "Game Threads", etc.).
var desiredForums = ["Game Threads", "FM Discussion"];

// --------------------

function actualThing() {

    var willRun = false;
    $(".icon-home > a").each(function(index, value) {
        var label = $(this).html();
        var i;
        for (i = 0; !willRun && i < desiredForums.length; i++) {
            if (label == desiredForums[i]) {
                willRun = true;
            }
        }
    });

    if (!allForums && !willRun) {
        return;
    }

    var threadURL = $("h2").first().children("a").first().attr("href");
    var threadNumber = "";
    var i = threadURL.search("&t=") + 3;
    while (!isNaN(threadURL[i])) {
        threadNumber += threadURL[i++];
    }

    var pageNumber = $(".pagination").find("strong").first().html();

    $(".post").each(function(index, value) {
        if ($(this).children(".inner").first().children(".postprofile").length === 0) {
            return;
        }

        var postID = $(this).attr("id").substring(1);
        var postNumber = (pageNumber - 1) * 25 + index;
        var authorLine = $(this).find(".author");
        var authorName = authorLine.find("strong").first().children("a").html();
        var authorString = authorLine.html();

        var insertIndex = authorString.search("</a>by") + 4;
        authorString = "Post <a href=\"./viewtopic.php?p=" + postID + "#p" + postID + "\"><strong>#" + postNumber + "</strong></a> " + authorString.substring(insertIndex, authorString.length);
        insertIndex = authorString.search("» ");
        authorString = authorString.substring(0, insertIndex) + " (<a href=\"./search.php?t=" + threadNumber + "&author=" + authorName + "\">ISO</a>)" + authorString.substring(insertIndex, authorString.length);
        authorLine.html(authorString);
    });
}

function loadScript(src, callback) {
    var s, r, t;
    r = false;
    s = document.createElement("script");
    s.type = "text/javascript";
    s.src = src;
    s.onload = s.onreadystatechange = function() {
        if (!r && (!this.readyState || this.readyState == "complete")) {
            r = true;
            callback();
        }
    };
    t = document.getElementsByTagName("script")[0];
    t.parentNode.insertBefore(s, t);
}

loadScript("//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js", actualThing);



Make sure you copied all of the text, there's a lot of it!

Once done, go to 'File' and click 'Save'.

If all goes well, you should have the ISO Userscript working once you're on the forums!

If you have any troubleshooting issues, let me know!


And just to clarify, this isn't my work, but I'm simply bringing up old news for the newer members!
User avatar
Schultz128
FM Awards: Creator
FM Awards: Creator
 
Posts: 410
Joined: Fri Apr 10, 2015 10:09 am

Re: ISO Userscript: Information and Installation Guide

Postby Kirize12 » Thu Sep 13, 2018 7:37 pm

Would this work on mobile?
Factional balance - understanding that whisper games are bad because they cause Town to win a disproportionate amount

Strategical balance - understanding that whisper games are bad because there's no reason to use any other strategy

Structural balance - understanding that disabling the Mayor's whispers, despite it fixing whisper games, means that a player can't use a core mechanic of the game and is still bad

This matters - educate yourself.
User avatar
Kirize12
Sponsor
Sponsor
 
Posts: 8965
Joined: Sun Oct 19, 2014 11:50 am
Location: Getting pagegets

Re: ISO Userscript: Information and Installation Guide

Postby Schultz128 » Thu Sep 13, 2018 8:00 pm

Kirize12 wrote:Would this work on mobile?


Unsure.
User avatar
Schultz128
FM Awards: Creator
FM Awards: Creator
 
Posts: 410
Joined: Fri Apr 10, 2015 10:09 am

Re: ISO Userscript: Information and Installation Guide

Postby BasicFourLife » Thu Sep 13, 2018 10:22 pm

nice
BasicFourLife
[Forum Mafia XVI] Winner
[Forum Mafia XVI] Winner
 
Posts: 1533
Joined: Sat Dec 17, 2016 6:47 am
Location: UTC +2/+3 - Somewhere hidden

Re: ISO Userscript: Information and Installation Guide

Postby TheWabbit » Fri Sep 14, 2018 1:22 pm

Dash2 wrote:I just tested it. Tampermonkey does indeed work on mobile if you have firefox

time to go firefox then

-----

is this somehow different from the old userscript?
Image

     

User avatar
TheWabbit
FM Awards: Mafia
FM Awards: Mafia
 
Posts: 1290
Joined: Mon May 09, 2016 10:37 pm
Location: GMT +8

Re: ISO Userscript: Information and Installation Guide

Postby Schultz128 » Fri Sep 14, 2018 1:39 pm

TheWabbit wrote:
Dash2 wrote:I just tested it. Tampermonkey does indeed work on mobile if you have firefox

time to go firefox then

-----

is this somehow different from the old userscript?


The code that I used in the OP was made by Varanus to have the first post in a thread (OP) be known as Post #0 rather than Post #1.
User avatar
Schultz128
FM Awards: Creator
FM Awards: Creator
 
Posts: 410
Joined: Fri Apr 10, 2015 10:09 am

Re: ISO Userscript: Information and Installation Guide

Postby Chemist1422 » Fri Sep 14, 2018 1:42 pm

nice

does it work with Safari?
Image


FM: 33-37
Last: SFM66
User avatar
Chemist1422
[Forum Mafia XVII] Winner
[Forum Mafia XVII] Winner
 
Posts: 852
Joined: Tue Mar 20, 2018 5:39 pm
Location: Fogbound Lake (CST/CDT)

Re: ISO Userscript: Information and Installation Guide

Postby ejjinami » Fri Sep 14, 2018 3:51 pm

it works
nice, thx
---------------------------------------------

11 : 9,5

Last updated: 03.12.2019
User avatar
ejjinami
Escort
Escort
 
Posts: 79
Joined: Sun May 14, 2017 12:22 pm


Return to FM Discussion

Who is online

Users browsing this forum: No registered users and 2 guests