Userscript: Number of cards in browser tab.

Over the past six months or so I have been using a tiny userscrip I created to show how many cards are available on the browser tab for Fallen London (I keep the tab open all day).

It’s just a simple thing I whipped up for personal use so it has not been tested extensively. So far I haven’t had any problems with it but do keep in mind that this, like any addon, could cause bugs.

It might also not be something Failbetter would want to allow, if so, I will remove this post.

There is a much more involved option out there just for Chrome: Chandlery for Fallen London.

I also found this script that uses the same part of the page, I have not tested if both scripts work together: AdvTimers.

The script is a super simple hack; all it does is look at the text under the card deck, once a minute. It will take the text there and put it in the title of the page/tab, replacing the regular title (&quotFallen London!&quot). Should it not be able to find the deck info (because you are in a storylet, another Fallen London tab, etc.) it will display &quotNo deck found!&quot

To use the script you will need GreaseMonkey for Firefox, Tampermonkey for Chrome, or a similar addon for your browser.

Then all you need to do is create a new script, copying the script below into the editor window.

Below should be the script if the forum will allow the code to be saved:

// ==UserScript==
// @name Fallen London cards
// @namespace localhost
// @include http://fallenlondon.storynexus.com/Gap/*
// @version 1
// @grant none
// ==/UserScript==

setInterval(function() {

if (document.getElementsByClassName(&quotdeck-contents-description&quot).length != 0)
{
var Deck = document.getElementsByClassName(‘deck-contents-description’)[0].innerHTML;

var DeckShort = Deck.substr(0, 17);

document.title = DeckShort;

}
else
{
document.title = &quotNo deck found!"
}

}, 60 * 1000); // 60 * 1000 milsec

The script is now also available here.
edited by Corran on 6/22/2017

Note that Chandlery also shows the number of actions available. To show actions we can replace the above line with:

 [code]document.title = document.getElementById(&quotinfoBarCurrentActions&quot).parentElement.textContent + &quot:&quot + DeckShort;[/code]

By the downvote, I that it someone had a problem with the tweak? Not sure what that problem would be, but it might be a bit more robust to instead replace the three lines

}

}, 60 * 1000); // 60 * 1000 milsec

with

}
document.title = document.getElementById(&quotinfoBarCurrentActions&quot).parentElement.textContent + &quot:&quot + document.title;
}, 60 * 1000); // 60 * 1000 milsec

For example, this should display the number of actions available even if the deck isn’t visible.

The script has been updated to work with the June 2018 update.

It can still be installed from here.

I can confirm this still works.