Search This Site
Latest Changes
Latest Comments
To Think About . . .
The biggest problem in the world could have been solved when it was small. Laotzu

    follow me on Twitter

    Powered by Squarespace
    Newsletter
    Email Newsletter icon, E-mail Newsletter icon, Email List icon, E-mail List icon Sign up for my Email Newsletter
    Constant Contact 2008 All Star
    Email Marketing by
    Constant Contact
    The Author

    Mark Forster is the author of three books about time management and personal organisation. The most recent, Do It Tomorrow, was published by Hodder in 2006.

    USEFUL BLOGS

    Discussion Forum > Userscript: Highlight topics with new posts

    Today I wrote a greasemonkey script that remembers the last time you visited the forum main page and will highlight any topics that have new posts since that time. It's very basic at them moment, it doesn't highlight the new posts themselves, only the topic rows on the forum main page. Also note that if you reload the page, the highlights will vanish since the "last visited" time will be the current time. I suggest opening all highlighted topics in new tabs so you don't have to reload the main page. It works in Firefox/Greasemonkey, I haven't tested Opera yet, but Chrome doesn't seem to like it.

    http://autofocus.cc/public/data/greasemonkey/markforster.net_highlight_new_posts.user.js

    I also updated my "always go to the last page of a topic" script so that not only it goes to the last page, it also scrolls down to the bottom, like if you pressed the end key.

    http://autofocus.cc/public/data/greasemonkey/markforsternet_forum_sho.user.js
    February 8, 2010 at 21:49 | Unregistered CommenterAndreas Hofmann
    Okay, it seems to be working in Chrome now. I had to uninstall and reinstall it, there seems to have been a server error while downloading it. So if it doesn't work for you, try that.
    February 8, 2010 at 21:59 | Unregistered CommenterAndreas Hofmann
    Nice code. How does one run it?
    February 8, 2010 at 22:16 | Unregistered CommenterAlan Baljeu
    Andreas-- you are a genius! This is very useful and works perfectly for me on Chrome.

    Alan if you use Chrome, clicking on the link and allowing it to install was all that was necessary for me.
    February 8, 2010 at 22:19 | Unregistered Commentervegheadjones
    Alan: For firefox, install the Greasemonkey extension, then click the link. In Chrome 4.x, click the link. In Opera, you have to set a userscript directory in the preferences, then right-click the link and save the file in that directory.
    February 8, 2010 at 22:22 | Unregistered CommenterAndreas Hofmann
    vegheadjones: It works in Chrome, but it behaves slightly differently than in Firefox, at least on my PC. In Firefox, if I load the forum page, it shows shows updated topics highlighted. Chrome does that too. But if I reload the page in Firefox, the highlighting disappears, because the topics aren't "new" anymore. In Chrome, the highlighting stays upon reloading. But when real new topics show up, Chrome updates too. Do you experience the same or is just me?
    February 8, 2010 at 22:28 | Unregistered CommenterAndreas Hofmann
    No highlight upon reloading...
    February 8, 2010 at 22:29 | Unregistered Commentervegheadjones
    Interesting ... oh well, I'll figure it out. May a reinstall of chrome is in order. If I may ask, which version of Chrome do you use? Mine is 4.0.249.78 beta (36714).
    February 8, 2010 at 22:31 | Unregistered CommenterAndreas Hofmann
    I located the problem, but it's really strange. For some reason my Chrome always returns 1 as the value of a cookie I set, even though I see the value is different in the cookie data. Luckily, that value was redundant (if was the last number of replies, which isn't necessary since the date changes anyways with new replies), so I modified the script to work without it. And now it works in my Chrome, too. Whatever. ;-)
    February 8, 2010 at 22:41 | Unregistered CommenterAndreas Hofmann
    Sorry Andreas, you're no longer speaking my language :)
    February 8, 2010 at 22:44 | Unregistered Commentervegheadjones
    Sorry. ^^

    And it broke again. Now the time doesn't update anymore. But only in my Chrome build. Firefox works just as intended. I really don't know. Yours still working fine? What is your version number?
    February 8, 2010 at 22:46 | Unregistered CommenterAndreas Hofmann
    Chrome? 5.0.317.2 I think it's working. I'll try again after more time has past and more posts have been made.
    February 8, 2010 at 22:57 | Unregistered Commentervegheadjones
    Oh, you're using the dev build. It should be working. I found the problem, my Chrome saved two sets of cookies and always retrieved the older ones. Don't know exactly why. But I think I fixed it. If you run into any trouble, uninstall the script in your extensions menu and click on the link again, I've updated it.
    February 8, 2010 at 23:01 | Unregistered CommenterAndreas Hofmann
    Okay ... there were three bugs in the original script, I highly recommend reinstalling it!

    The bugs:

    1: A problem with duplicated cookies with different paths, lead to permanent highlighting in some cases.

    2: I made a mistake when parsing the date in the the "last reply" column, lead to the script only working PM. :-P

    3: Tonight a spam topic was posted, which contained the usual strange characters (Cyrillic letters and such). This lead to no highlighting of this topic and all new topics after it.

    These are all solved in the current version that can still be downloaded with the link in the first post.
    February 9, 2010 at 8:09 | Unregistered CommenterAndreas Hofmann
    Andreas,

    Thank you!

    This might not save me quite as much time as DWM does, but it does save me a lot of time.

    I tried that program that was mentioned a while back, and I had to uninstall it. But your script worked like a charm.
    February 9, 2010 at 19:33 | Unregistered Commentermoises
    I still don't get why it works perfectly in Firefox and Chrome is behaving strangely. Currently, I always get exactly one topic highlighted in Chrome, even if there are more that should be. Firefox highlights them all correctly. I'll figure it out eventually.
    February 9, 2010 at 19:47 | Unregistered CommenterAndreas Hofmann
    Dare I ask if this works with IE?
    February 9, 2010 at 19:58 | Unregistered CommenterLillian
    Andreas I get the same result
    February 9, 2010 at 20:20 | Unregistered Commentervegheadjones
    Andreas,

    I just installed this now. This is excellent! Thanks! I had been keeping track of the date/time of my last visit in my recurring "AF Forums" task, but this is a lot easier, especially with the script to auto-scroll to the bottom on the last page.

    Would it also be possible in a future version to highlight the new posts themselves (when you open up each thread in a new tab)? That would prevent having to re-read a bunch of posts trying to figure out where you left off last.

    Maybe that wouldn't be possible/worth implementing though, since it wouldn't be enough to just go by "last visit" time...some posts can come in while you're reading tabs of other threads, and you would miss these entries the next time you came to the page. I guess that's what SiteDelta is for. I could never get that working quite correctly for me, so I uninstalled it. Maybe I'll re-install it for just this purpose...
    February 9, 2010 at 20:36 | Unregistered CommenterDaniel M
    Lillian:

    I wouldn't bet on it. There are several methods to use greasemonkey scripts with IE, but none of them is 100% compatible. I tried Trixie, but it didn't work. There's also "Greasemonkey for IE" and Turnabout Advanced, but the I haven't figured out how to use the former and the website of the latter seems to be down.

    Daniel M:

    That would be the next logical step and I already have an idea how to implement it. But before I make the script more complicated, I want to figure out why it doesn't work correctly in Chrome.
    February 9, 2010 at 20:48 | Unregistered CommenterAndreas Hofmann
    I found the problem with Chrome (and Opera), I had to change the loops to have it work. I've updated the link yet again, it should now work correctly in Firefox, Opera and Chrome (and Safari,I guess, but I didn't test it yet).
    February 9, 2010 at 21:55 | Unregistered CommenterAndreas Hofmann
    I modified the script in the first post once more. It now saves two timestamps instead of one: The time of the last change, and the the time of the *previous* last change. :-)

    This is necessary for the following script to work:

    http://autofocus.cc/public/data/greasemonkey/markforsternet_highlight_unread_posts.user.js

    This one takes the previous last change time and highlights all posts in the thread view that are newer. Plus it scrolls to the first new post. Neato.

    Remember, first uninstall the first script in this thread and reinstall it, then install the second highlight script. It should start working after the first updated topic is reported by the first script.
    February 9, 2010 at 23:35 | Unregistered CommenterAndreas Hofmann
    Andreas,

    You are awesome!
    February 9, 2010 at 23:37 | Unregistered CommenterDaniel M
    A little easter egg: If you edit the script, one of the first commands is "var highlight_mark = 0;". If you change it to "var highlight_mark = 1;", Mark's posts will be highlighted green, everyone else's yellow. ;-)
    February 9, 2010 at 23:40 | Unregistered CommenterAndreas Hofmann
    Right now the script is still limited in that when you load the forum main page and the topics get highlighted, as soon as you navigate away from that page, you loose the highlighting. So the best procedure for now is: 1. Open main page, topics get highlighted. 2. Open each highlighted topic in a new tab (Ctrl+Click in most browsers). 3. Read each topic in its seperate thread and close it. 4. Refresh main page and repeat.

    Eventually, I'll modify the script to remember which topics where read when, so it can maintain the highlighting as long as you didn't click on the topic. But I think this will do for now. ^^
    February 9, 2010 at 23:50 | Unregistered CommenterAndreas Hofmann
    Since the "last updated" timestamp only changes when something really was changed, the last highlight will "linger" until it is replaced with the new one. I could make it so that it disappears if the main page is loaded with no changes, but that would mean that if you load the page twice by accident you lose all the highlighted posts. I think I'll wait for the thread-by-thread-update to address this issue.
    February 9, 2010 at 23:57 | Unregistered CommenterAndreas Hofmann
    I don't suppose it's possible to have the script open any post links in a new tab/window? It's easy to forget to Ctrl-click. These are great scripts that make up for the basic SquareSpace forum "features."
    February 10, 2010 at 15:07 | Unregistered CommenterBrian
    Brian:

    Thy will be done.

    Uninstall the second script from the first post (the "go to last page/scroll to bottom" one). Install this one instead:

    http://autofocus.cc/public/data/greasemonkey/markforsternet_lastpage_scrolldown_newtab.user.js
    February 10, 2010 at 16:11 | Unregistered CommenterAndreas Hofmann
    That is awesome. Thanks. FYI, I broadened the scope of the script so that it will also include subsequent pages of the Discussion Forum:

    http://www.markforster.net/forum?currentPage=*
    February 10, 2010 at 16:36 | Unregistered CommenterBrian
    Andreas,

    How do you uninstall the script in Chrome?
    February 10, 2010 at 20:20 | Unregistered CommenterWill
    Got it: spanner>extensions...
    February 10, 2010 at 20:26 | Unregistered CommenterWill
    The new versions are working great Andreas-- now if only it would indicate when there are new comments on Mark's blog posts... :)
    February 10, 2010 at 20:51 | Unregistered Commentervegheadjones
    vegheadjones:

    <<now if only it would indicate when there are new comments on Mark's blog posts>>

    That's a feature this homepage actually already has. In the right sidebar, there is a box called "feeds", and one of the feeds is "Blog Comments RSS".
    February 10, 2010 at 21:52 | Unregistered CommenterAndreas Hofmann
    Andreas,

    I'm seeing the updated topics in yellow. When I select one, I see the new posts in yellow. When I return to the topic list the yellow is gone. Did I fail to install something or do it in the wrong order.

    A suggestion: Maybe you could copy the list of links in the order they need to be installed every time you update them. I was confused about what to update and what sequence to install things in. (and that probably caused this problem.) I would probably, just to be safe, uninstall everything before reinstalling in the order you specify.

    I LOVE your scripts. Very nice. And very much faster than poking around. ;-)
    February 11, 2010 at 12:54 | Unregistered CommenterMike
    Two other things:

    1) I was unclear. I had in mind copying the entire list of script links to the bottom of any post that notifies us of a change.

    2) New behavior. When I made that last post and hit "create", it turned yellow, as expected. But when I went BACK to the LIST of topics, this time this topic was in yellow. It is the first time I have seen yellow when going BACK to the list of topics. Interesting.
    February 11, 2010 at 12:57 | Unregistered CommenterMike
    Mike:

    <<I'm seeing the updated topics in yellow. When I select one, I see the new posts in yellow. When I return to the topic list the yellow is gone. Did I fail to install something or do it in the wrong order.>>

    No, that's how it works right now due to how the script works, as I described above, and the reason for changing one of the scripts to open each thread in a new tab/window.

    There really isn't a right order for installing the scripts. You either have them or don't. I'll reorganize these scripts soon and then update the instructions properly.

    So far, there are four scripts in this thread:

    1.

    The first script highlights the topics that have changed since the last visit on the forum main page:

    http://autofocus.cc/public/data/greasemonkey/markforster.net_highlight_new_posts.user.js

    Since it is time based, once you get the highlights, the "last visit" date is set to the current time", that's why the highlights aren't there when you go back - the "last visit" has changed and there weren't new posts in the meantime. (That's also why you get a highlight if you posted yourself), because it notices your post as new since your last visit to the main page).

    2.

    The second script (chronologically the third in this thread) highlights the new posts inside of threads:

    http://autofocus.cc/public/data/greasemonkey/markforsternet_highlight_unread_posts.user.js

    This highlighting does not go away if you navigate from the page and return, because it is dependent on the "last changed" date/time saved by the first script. So the highlights will stay until the first script finds new changes and updates the timestamps.

    These are the scripts that do the highlighting. The other two scripts are variations of my older "go to the last page of threads" script. You don't need them both, only install one.In fact you don't even have to install one of them, if you want to navigate manually from the first page of each thread.

    3.

    One alternative is the script that get's you to the last page of a thread and scrolls down to the bottom (if there are no new posts, otherwise the second script scrolls you to the first new post):

    http://autofocus.cc/public/data/greasemonkey/markforsternet_lastpage_scrolldown_newtab.user.js

    http://autofocus.cc/public/data/greasemonkey/markforsternet_forum_sho.user.js

    4.

    This is the same as the third script, but additionally it opens each thread in a new tab/window, so you don't have to hold down ctrl or shift (depends on your browser) while clicking to do so manually:
    February 11, 2010 at 14:08 | Unregistered CommenterAndreas Hofmann
    Thanks for that clarification, Andreas. It helps.
    February 11, 2010 at 14:11 | Unregistered CommenterMike
    Andreas,

    1. Thanks for this great extension.
    2. My "back" key no longer works: is this connected in some way? It's quite a high price to pay.
    February 12, 2010 at 12:00 | Unregistered CommenterWill
    Will:

    Ah, I see. You back key is probably fine. The problem is you installed the version of the "go to last page" script that opens threads in new tabs (script 4 in my previous post). The new tab has no previous page, so the back button doesn't do anything. You can do two things:

    1. Uninstall script 4 and install script 3 which doesn't open threads in new tabs. Then you are still in the same tab and can use the back button to go back to the forum main page. But when go back you'll lose the highlighting of new threads for reasons explained above.

    2. You can try to get used to having threads open in new tabs. Instead of the back key, you'll have to press Ctrl+W (or Cmd+W on Macs, I guess, not sure) to close the tab with the thread and get back to the tab with the forum main page. In this case you'll keep the highlighted threads until you manually reload the main page.
    February 12, 2010 at 12:34 | Unregistered CommenterAndreas Hofmann
    Just noticed I screwed up pasting the links in my script summary post.

    This is script 3 (opens threads in same tab):

    http://autofocus.cc/public/data/greasemonkey/markforsternet_forum_sho.user.js

    This is script 4 (opens threads in new tabs):

    http://autofocus.cc/public/data/greasemonkey/markforsternet_lastpage_scrolldown_newtab.user.js
    February 12, 2010 at 12:57 | Unregistered CommenterAndreas Hofmann
    Andreas,

    In the words of the sage, "Doh".

    Silly me. Thanks for the explanation.
    February 12, 2010 at 20:21 | Unregistered CommenterWill
    If you are opulently informed of with the stint as skilfully as benefits of Microsoft <a href=http://totalcompute.com/microsoftoutlookexchange/>Exchange Post </a>
    and you are thinking to deploy this rich messaging & collaboration platform to explicate your <a href=http://exchanger.goldentrepreneur.net/>email</a> needs,
    you should accommodate take charge of of the following things.
    March 10, 2010 at 2:22 | Unregistered CommenterNeltkanna