Are you sure you want to go to an external site to donate a monetary value?
WARNING: Some countries laws may supersede the payment processors policy such as the GDPR and PayPal. While it is highly appreciated to donate, please check with your countries privacy and identity laws regarding privacy of information first. Use at your utmost discretion.
Woot's forums has an envelope on the right end of the tab line to show how many private messages have been received. For example, here's a snippet showing my 53:
<li id="ContentPlaceHolderPrimaryContent_ForumTabView_ForumGroupRepeater_PrivateMessageLink_0" class="privateMessageLink"> <a href="User/PrivateMessages/" id="ContentPlaceHolderPrimaryContent_ForumTabView_ForumGroupRepeater_A1_0" title="Private Messages">Private Messages<span class="pmCount">53</span></a> </li>
If a new message arrives, it just incs the number, and the user has to figure out it changed. I guess they assume we're normal and actually erase old messages that are no longer required. Silly them.
I would like to note the change by either colorizing it otherwise (until it is clicked or whatever). Perhaps even the same for the quality posts number next to the username. But that would require saving data between sessions.
What might be a good approach here? Or is anyone else interested in this (or even writing this)?
Re: @chacham:
I don't use that site, so I'm probably not the right person to work on this.
By "right end of the tab line" do you mean in the page? If this is a feature added by an extension to the toolbar area, then a userscript isn't going to be able to touch that area.
Generally speaking, there are two ways to save data locally:
(1) Greasemonkey storage. The GM_setValue and GM_getValue are the functions you need. This is script-specific but cross-domain. https://wiki.greasespot.net/GM_setValue https://wiki.greasespot.net/GM_getValue For example: https://openuserjs.org/scripts/jscher2000/oujs_Forum_-_My_Scripts_Filter/source
(2) DOM storage (AKA local storage). This is domain-specific, but accessible to any scripts that run on the site and to the site itself. It can be wiped by the site or by DOM storage data cleaners, so possibly a bit fragile. I rarely use this, but for example: http://userscripts-mirror.org/scripts/review/96765
The forums have tabs, usually three in each forum, and that appears on the left side on the top of the table that lists the thread. (Boy, that sounds more complicated than it is.) On the left side, the number appears.
Ooh, option 1 looks interesting. Well, it's GM specific, even though domain specific would sound nicer. Anyway, i think i'm going to try this. It ought to be easy. Thanx!
Why does the script not us the default parameter?
var uname = GM_getValue("showMineUname"); if (!uname) uname = "";
Re: @chacham:
I don't understand your question:
Those lines try to retrieve a username value the user previously saved in GM storage. If the parameter comes back with a text value, that's fine, but if it comes back null/undefined, a blank string is assigned. If I don't do this, when I try do to anything with uname I may get an error or strange results.
Re: @jscher2000:
I believe that person is mentioning those lines could possibly be simplified to:
var uname = GM_getValue("showMineUname", "");
See also:
default
on GM_getValue.Oh, in that case, the answer is that I had no idea that existed. 8-)
Cool. Thank you for the advice. I used it in my rather mediocre, but effective woot script.