Navigate
Home
ArticleWiki
Forum
Newsletter
Links
Tech News
Welcome Guest.
Username:

Password:

Remember me

AutoSurf Greasemonkey Script
Welcome, Guest. Please login or register.
February 09, 2012, 03:27:27 AM
11513 Posts in 1262 Topics by 496 Members
Latest Member: Beerdernill
Experts Round Table Network  |  Clientside Technology  |  Javascript  |  AutoSurf Greasemonkey Script « previous next »
Pages: [1]
Author Topic: AutoSurf Greasemonkey Script  (Read 2533 times)
CrYpTiC_MauleR
Site Builder

Offline Offline

Posts: 501



WWW
« on: December 14, 2007, 05:55:39 PM »

Code
Language: javascript (GeSHi-highlighted)
// ==UserScript==
// @name          AutorSurf
// @description  Automatically Surfs The Internet
// @include       *
// ==/UserScript==
 
var elems = document.getElementsByTagName('a');
var rand1 = String.fromCharCode(97 + Math.round(Math.random() * 25));
var google = 'http://www.google.com/search?q=' + rand1 + '&safe=off';
 
if (0 < elems.length)
{
   const regex = new RegExp('^http://');
   var rand2 = Math.floor(Math.random() * elems.length);
   var redirect = elems[rand2].getAttribute('href');
   if (!regex.test(redirect))
   {
       redirect ='http://' + document.domain + redirect;
   }
}
 
GM_xmlhttpRequest
({
   method:'HEAD', url:redirect, onload:function(http_request)
   {
       window.location = ((4 == http_request.readyState) && ('OK' == http_request.statusText))
           ? redirect
           : google;
   }
})[code]
[/code]

I made the above script to surf the web by picking a random url from the page and then redirecting to it and then starting the process over. If it can't find a url or the url fails to connect through the AJAX check then it is to redirect to a Google search where the search is a random letter and then choose a random url from that page and process starts again. I tried this out on a few sites and it would stop redirecting after several successful redirects. Anyone know what is wrong with it or what other error checks I can include?

Btw this is not for some click fraud gimmick. I just made a fresh AdBlock list and have noticed that the hit count for many filters are at zero or one. I want to have Firefox surf the web with AdBlock so I can see from the hits what filters will likely be tripped and what filters are just useless to have. I already had all my bookmarks opened in tabs (kudos to Firefox 3 for not crashing or locking up while opening over 200 bookmarks at the same time) and that covers what my personal browsing habits will encounter. Now I am trying to tweak it more so any help is appreciated. Thanks!
Logged

[x] Fight | www.crypticmauler.com
"You must be
Pages: [1]
« previous next »
    Jump to: