Recent posts by OptoGeek

Subscribe to Recent posts by OptoGeek 11 posts found

Apr 17, 2008
OptoGeek 11 posts

Topic: Userscripts.org discussion / Spam and malware

Yet another one: http://userscripts.org/users/50342

 
Apr 14, 2008
OptoGeek 11 posts

Topic: Userscripts.org discussion / Spam and malware

This one is spam too: http://userscripts.org/users/50148

 
Apr 14, 2007
OptoGeek 11 posts

Topic: Ideas and script requests / Script request: Rewrite all links

I'll try to get to it sometime this weekend -- sorry, it's been a busy couple of days for me.

 
Apr 13, 2007
OptoGeek 11 posts

Topic: Ideas and script requests / script that blocks all web pages except for a whitelist of pages you specify

I've had that script on my system for a while, but I keep disabling it when I REALLY want to see what's new at Lifehacker... then it's all down hill after that. So, basically, it's ineffective if you're OCD like me (note: I'm not really OCD... well, not clinically anyway).

 
Apr 13, 2007
OptoGeek 11 posts

Topic: Ideas and script requests / Script request: Rewrite all links

So what you're saying is you want it to attach to the end of any URL that appears anywhere in the document no matter what it points at or what sort of object it's a part of? Is that correct? I'm really curious as to what the ultimate goal of this is?

 
Apr 12, 2007
OptoGeek 11 posts

Topic: Ideas and script requests / Script request: Rewrite all links

Perhaps I'm not understanding what you want it to do exactly. The way I understood it was that you want it to rewrite all the hyperlinks on a given page. Is that not correct? Or did you also want to append that string to any URL contained within the source code of the document? (ie., CSS includes, javascript includes, img source elements, etc.) Please try to clarify exactly what you were looking for.

 
Apr 12, 2007
OptoGeek 11 posts

Topic: Ideas and script requests / Script request: Rewrite all links

Ok, so I decided to do it for you anyway even though you didn't ask. It's below, but I still didn't make any modifications to what you wanted appended (the whole "?" versus "?sd=" thing I mentioned above.


// ==UserScript==
// @name         URL Appender
// @description  appends ?vaultx.co.za to the end of certain URLs
// @include      http://domain.com*
// ==/UserScript==

var url;
var exts = new Array(".gif",".mp3",".php",".html",".png",".jpg");

for (var i=0; i<document.links.length; i++) {
	url = window.document.links[i];

	for (var j=0; j<exts.length; j++) {
		if(url.pathname.indexOf(exts[j]) != -1) 
		{
			if (url.href.indexOf("?") == -1) {
				window.document.links[i].href += "?";
			}
			else {
				window.document.links[i].href += "&sd=";
			}
			window.document.links[i].href += "vaultx.co.za";
		}
	}
}

 
Apr 12, 2007
OptoGeek 11 posts

Topic: Ideas and script requests / Script request: Rewrite all links

Also, be sure to modify the line that specifies the file extensions you want to apply it to. This is easy if there aren't many. But, if you like, I can modify the code so that there's a single variable at the top that you can modify to simply list out all the extensions you want (for example: var exts = "php,gif,png,foo";) But of course, that will require a bit more code under the hood.

 
Apr 12, 2007
OptoGeek 11 posts

Topic: Ideas and script requests / Script request: Rewrite all links

The code below should do exactly what you requested in your post, although it seems kind of odd to me that you want to append ?vaultx.co.ca to the end of a URL. That's not a correct querystring. You have the right idea with the &sd= for appending to a preexisting string. Perhaps you meant you want to append ?sd=vaultx.co.ca ... if that is what you intended, you can modify my code below to say "?sd=" rather than just "?" on line 15.


// ==UserScript==
// @name         URL Appender
// @description  appends ?vaultx.co.za to the end of certain URLs
// @include      http://domain.com*
// ==/UserScript==

var url;

for (var i=0; i<document.links.length; i++) {
	url = window.document.links[i];

	if((url.pathname.indexOf(".gif") != -1 || url.pathname.indexOf(".php") != -1)) 
	{
		if (url.href.indexOf("?") == -1) {
			window.document.links[i].href += "?";
		}
		else {
			window.document.links[i].href += "&sd=";
		}
		window.document.links[i].href += "vaultx.co.za";
	}

}

 
Apr 12, 2007
OptoGeek 11 posts

Topic: Ideas and script requests / Script request: Rewrite all links

Just modifying Gabe's code here. Javascript has built-in arrays for various objects. I believe links are one of them, so you should be able to loop through all the links on any given page and modify them... [the code I initially posted here was all wrong, refer below]

 
Apr 9, 2007
OptoGeek 11 posts

Topic: Ideas and script requests / Gmail Attachment Progress Bar

Just an idea for a Gmail script. I hate not knowing how much longer I have to wait for my attachment to upload when sending an email. A progress bar, or percentage indicator, would make for an excellent script. If I had the time I would make an attempt at writing one, but, alas, I'm an OptoGeek... not a CompSciGeek... so I have to spend all my time studying eyeballs. Anyone want to take a stab at it (writing the script, I mean; not my eyeball)?