Life In 19x19
http://lifein19x19.com/

l19 new post checking for the obsessive compulsive
http://lifein19x19.com/viewtopic.php?f=8&t=14256
Page 1 of 1

Author:  Kirby [ Fri May 26, 2017 2:36 pm ]
Post subject:  l19 new post checking for the obsessive compulsive

As many may have noticed, I'm somewhat obsessive about checking new posts on L19. I always want to notice when someone makes a new post, or what's happening on the forum. Most of the time, there aren't that many posts in the day, so I waste a lot of time checking new posts just to see an empty page.

I wrote this short script that will check the site for me:
Code:
<script>
var xhr;
var newestTopic = "";
var different = false;
function reqListener() {
   document.open();
   if (xhr.readyState == XMLHttpRequest.DONE) {
      var doc = new DOMParser().parseFromString(xhr.responseText, "text/html");
      var topics = doc.getElementsByClassName("topictitle");
      var details = doc.getElementsByClassName("topicdetails");      
      var topTopic = topics[0].innerHTML + details[0].innerHTML;
      if (newestTopic != "" && newestTopic != topTopic)
      {
         different = true;
      }
      newestTopic = topTopic;
   }
   
   if (different)
   {
      alert("A new post has been made.");
      window.location.replace("https://lifein19x19.com/search.php?search_id=newposts");
   }
}

function loadPage() {
   xhr = new XMLHttpRequest();
   xhr.addEventListener("load", reqListener);
   xhr.open('GET', 'https://lifein19x19.com/search.php?search_id=newposts', false);
   xhr.send();
}
loadPage();
setInterval(loadPage,5000);
</script>

The idea is, every 5 seconds, it makes a new request to check the new posts page. If it detects a difference in the latest new post, either in post title or reply count, a javascript alert is fired, and the page redirects to L19. The big difference between this and me manually checking is that the javascript alert steals focus, so I can keep the browser minimized and do whatever work I want to do. But whenever there's a new post, the window pops up automatically.

Not really sure if this is helpful to anyone else, but maybe it can help me to calm down a little bit, do more work, and stop checking the site so often (well, at least delegate that to the script).

Author:  Bonobo [ Fri May 26, 2017 4:34 pm ]
Post subject:  Re: l19 new post checking for the obsessive compulsive

You could simply have written “for Tom aka Bonobo” in the title :-D

So, how do I use it? Is it a bookmarklet?

TIA, Tom

Author:  Kirby [ Fri May 26, 2017 4:58 pm ]
Post subject:  Re: l19 new post checking for the obsessive compulsive

Just copy it into a text editor and save it as an html file. Open the file in your browser, and it's just a blank page until someone posts.

Author:  Bonobo [ Fri May 26, 2017 5:13 pm ]
Post subject:  Re: l19 new post checking for the obsessive compulsive

Thanks, will try it out :-)

Author:  ez4u [ Fri May 26, 2017 6:30 pm ]
Post subject:  Re: l19 new post checking for the obsessive compulsive

LOL, I saw this and misinterpreted the topic. I thought it was about checking for obsessive compulsive behavior among L19 posters somehow. When I looked at K's OP I saw that I was wrong.

However, when I thought carefully, I realized that is still available as a form of self test. Your level of OC behavior can be measured by the numerical value that you put in ...
Code:
setInterval(loadPage,5000)


Luckily L19 probably isn't popular enough that this new device will bring down the server, but who knows! :)

Author:  Kirby [ Fri May 26, 2017 8:00 pm ]
Post subject:  Re: l19 new post checking for the obsessive compulsive

Well, not really a new device - just a bit of JavaScript. But it kept me semi productive today.

Better solution would be to have more self control, but I tried that before and it seems to be a losing battle :blackeye:

Author:  Bonobo [ Sat May 27, 2017 4:08 am ]
Post subject:  Re: l19 new post checking for the obsessive compulsive

Didn't seem to work for me, but I think I prefer just having the “unread posts” tab open since I look at most new posts/replies anyway. I could just set a JS to reload it every ten minutes for me so whenever I come back here again I could see the new posts/comments already, but hitting cmd+R every other hour works fine for me actually ;-)

I just wish I could stop the posts in the Malkovich dept. from appearing here … would it be possible to have an “unsubscribe” mechanism for specific sub-forums?

Author:  pnprog [ Mon Jun 05, 2017 6:46 am ]
Post subject:  Re: l19 new post checking for the obsessive compulsive

Good script! :tmbup:

But, checking every 5 seconds seems too much for me (it's more than 17000 per day :shock: ). I think checking every 60 seconds would be more reasonable.

Author:  FuriousGeorge [ Mon Jun 19, 2017 8:16 am ]
Post subject:  Re: l19 new post checking for the obsessive compulsive

I'm glad I'm not the only one that keeps impulsively checking for new posts. You all are enabling my addiction by normalizing my behavior! :P

Author:  Kirby [ Mon Jun 19, 2017 8:54 pm ]
Post subject:  Re: l19 new post checking for the obsessive compulsive

FuriousGeorge wrote:
I'm glad I'm not the only one that keeps impulsively checking for new posts. You all are enabling my addiction by normalizing my behavior! :P


Ideally, I'd like everything to just go to my email inbox. Then I can have one webpage open that has everything that I'm interested in checking. You can setup email notifications or thread alerts, but in my experience, you don't receive email for quite some time after a post has been made.

Maybe it's better to just have more self-control, and have a designated time of the day where you check L19. For example, maybe I could check the site every day at 8:00pm to see what's happened throughout the day...

But what if I missed something interesting, and people... chat about it without me?

That's where the fear kicks in... :-S

Author:  FuriousGeorge [ Tue Jun 20, 2017 4:06 am ]
Post subject:  Re: l19 new post checking for the obsessive compulsive

I have no clue if this will help, but sometimes when I'm faced with a willpower issue (or a task I don't really care to do) I have to leverage something external to help me check the behavior (only superhumans can get by on willpower alone). Usually I set timers, something like: for the next 30 minutes I can only do X and not Y or Z, and then when the timers up THEN I can do Y or Z (like a reward).

Seems a bit goofy, but often I'll get enough momentum and focus that I'll be able to continue past the timer, and then I don't feel quite as guilty about Y or Z.

I only mention it because I've had to start doing this to myself for Go. For the next however many minutes I can't obsess over Go, either here at L19 or reading material or watching videos or streams. If I don't limit the behavior, I'll find that I have been chasing the Go rabbit for an hour or more without realizing it. :oops:

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/