Programming request

Moderators: Erik Mortis, (Shireroth) Steward, (Shireroth) Kaiser

Post Reply
User avatar
Scott Alexander
Posts: 1778
Joined: Sun Dec 19, 2010 1:20 am

Programming request

Post by Scott Alexander »

I liked the idea in the latest XKCD alt-text to make you wait 30 seconds before going to a time-wasting website. Someone on the XKCD forums has created a script that does this, but it has a flaw for my purposes. I waste a lot of time on forums like Bastion. I think a 30 second wait before going to the Bastion forum would be a good idea. But the way the script works now, it gives a 30 second wait before loading every single Bastion webpage - ie 30 seconds when going to the site, 30 seconds when clicking on General, and 30 seconds before opening a thread in General. This is much too much.

My request is that someone modify the script to activate only on the first instance of visiting a website, and then to stop working until I move away from that site. So once I take the 30 second wait to go to Bastion the first time, I don't have to do any more Bastion waiting unless I navigate away to Bastion and then want to come back.

I am willing to pay in SCUE currency or barter for graphics or anything else I know how to do. Don't bother telling me how pathetic it is that I need a script like this - I already know I have a hopelessly addictive personality. And you people wonder why I never drink :?

The original script is:

Code: Select all

// Ed O'Loughlin 20100-02-18
// Released to the public domain.
//
// ==UserScript==
// @name           Delay Timewaster Sites
// @namespace      http://neataudio.com
// @description    Make certain pages invisible for 30 seconds. Based on Gina Trapani's Invisibility Cloak & inspired by the ALT tag on http://xkcd.com/862/
// @version        1.0
// @include        *facebook*
// @include        *youtube*
// @include        *xkcd*
// @include       http://flickr.com/*
// @include       http://*.flickr.com/*
// @include       http://metafilter.com/*
// @include       http://*.metafilter.com/*
// @include       http://reader.*.com/
// @include       http://*google.com/reader/*
// @include       http://news.ycombinator.com/*
// @include       *twitter*
// ==/UserScript==
//

var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty;
 

(function () {
	// EDIT THE NEXT LINE TO SET THE HOUR AFTER WHICH SITES SHOULD APPEAR
	// HOURS IN MILITARY TIME, SO 15 = 3PM
	var surf_time_after = 17;
	// END EDIT
	
	var oldBodyStyle;
	var bodyElem;

	var tstamp = new Date();

	if (tstamp.getHours() < surf_time_after )
	{
		bodyElem = (document.getElementsByTagName("body")[0]);
		oldBodyStyle = bodyElem.getAttribute('style');
		bodyElem.setAttribute('style', 'display:none!important');
		setTimeout(__bind(function(){bodyElem.setAttribute('style',oldBodyStyle)}, this),30000);
	}
})();

Kaiser Magni I
Posts: 172
Joined: Tue Jan 11, 2011 10:51 pm

Re: Programming request

Post by Kaiser Magni I »

I looks to me that if you add just http://www.bastionunion.org without any asterisks, and always go to that particular address as your bookmark, it should do as you want, since going back to the main page will be http://www.bastionunion.org/index.php

User avatar
ari
Grim Auxiliator
Posts: 1802
Joined: Sun Nov 21, 2010 9:45 pm

Re: Programming request

Post by ari »

Yeah, before I put my time into it, I'd like to ask whether some variation of Corey's solution is usable. For instance I always enter Bastion by way of the new posts list. If I were to use this script for the purpose of reminding me not to go to Bastion so often I'd just have it trigger on that single URL.
Lord Furniture
Not even partially responsible for Malarboria; will take the blame for Caverden, though!
Tallest and therefore Greatest of the Janitors
Eternal Watcher of #micronations

Demon of Fides
Posts: 771
Joined: Sun Nov 28, 2010 12:01 am

Re: Programming request

Post by Demon of Fides »

View New Posts = win.
Hier post ich, ich kann nicht anders

User avatar
Scott Alexander
Posts: 1778
Joined: Sun Dec 19, 2010 1:20 am

Re: Programming request

Post by Scott Alexander »

Oho. I thought the stars at the end were some sort of line-ending convention. Thanks, script works fine now and I'm finding it quite useful.

Kaiser Magni I
Posts: 172
Joined: Tue Jan 11, 2011 10:51 pm

Re: Programming request

Post by Kaiser Magni I »

Hurray! I can fix things!

Post Reply

Return to “Esagila of Raynor”