Custom Script

91 views
Skip to first unread message

Fire Cat

unread,
Aug 26, 2015, 4:09:04 AM8/26/15
to greasemonkey-users
Hi everyone!

I'm a total novice to scripting so I'm hoping to get some help here! I'm looking to change a script that was written for an adoptables site, that "catches" (clicks on) adoptables based on a specific text phrase. I want to change the script so that instead of catching it, it marks down that that particular adoptable was present on the site, marking this in another file I keep.

The aim is to collect statistics on what adoptables come onto the site and the frequency with which they appear. Is something like this possible??
Here's the original script:
// ==UserScript==
// @name        Dragcave egg monitor
// @namespace   http://localhost
// @description Monitor the location page and catch the egg you want.
// @include     http://dragcave.net/locations/*
// @version     1
// @grant    none
// ==/UserScript==
var container = document.getElementsByClassName("eggs");
for (var l = 0; l < container.length; l++) {
    container
[l].setAttribute('id', 'eggs');
   
var eggs = document.getElementById("eggs");
   
var divs = eggs.getElementsByTagName("div");
   
for (var i = 0; i < divs.length; i++) {
   
// See how the pattern goes and update the text for new releases and all the good stuff ^_^
       
if ((divs[i].innerHTML.indexOf("beautiful glow") != -1) || (divs[i].innerHTML.indexOf("very reflective") != -1)) {
           
var div = divs[i];
           
var link = divs[i].innerHTML.href;
           
for (var b = 0; b < div.childNodes.length; b++) {
               
var test = div.childNodes[0].href;
               
//window.location.href = test;
                open_in_new_tab
(test);
           
}
       
}
   
}
}

setTimeout
(function () { window.location.href = window.location.href }, 500);

function open_in_new_tab(url )
{
 
var win=window.open(url, '_blank');
  win
.focus();
}

Thanks in advanced!
Reply all
Reply to author
Forward
0 new messages