1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Buttons

Discussion in 'Code Snippets and Tutorials' started by Fexxel, Aug 23, 2009.

  1. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    Call me out as much as possible? All critisim/help apreciated.
    What exactly am I doing wrong?

    Code (Text):
    1. // ==UserScript==
    2. // @name           Test
    3. // @namespace      Test
    4. // @description    Test
    5. // @include        http://www.google.com/
    6. // ==/UserScript==
    7. var add = document.createElement("button");
    8. add.textContent= "View Todays Comic!";
    9. add.addEventListener("click", function() {
    10. window.open('http://www.explosm.net/comics/1772/')
    11. }
    12.  
    Doesn't make a button on google, doesnt do anything actually.
    So what am I doing wrong? Thanks :-D
     
  2. Rider

    Rider Level IV

    Joined:
    Jun 25, 2008
    Messages:
    941
    Likes Received:
    72
    Location:
    Canada =D
    Try this ;

    Code (Text):
    1.  
    2. table = document.evaluate('//td[@class="navtd"]/font[@class="navtd"]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0); //assuming there is exactly one table
    3. var button = document.createElement("a");
    4. button.href = "http://google.com"; // your link here
    5. var image = document.createElement("img");
    6. image.src = "http://whatever.com/image.jpg"; // your button source here
    7. button.appendChild(image);
    8. table.appendChild(button);
    9.  
     
  3. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    So I put that as:
    Code (Text):
    1.  
    2. // ==UserScript==
    3. // @name           test
    4. // @namespace      z
    5. // @description    test
    6. // @include        *
    7. // ==/UserScript==
    8. table = document.evaluate('//td[@class="navtd"]/font[@class="navtd"]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0); //assuming there is exactly one table
    9. var button = document.createElement("a");
    10. button.href = "http://explosm.net"; // your link here
    11. var image = document.createElement("img");
    12. image.src = "http://btc.montana.edu/ceres/html/Polar/images/circle.jpg";
    13. button.appendChild(image);
    14. table.appendChild(button);
    Nothing happened...? (I made a random circle the img source)
     
  4. jazzeh

    jazzeh Level I

    Joined:
    Jan 1, 2008
    Messages:
    144
    Likes Received:
    15
    You need to put the button on the page and you need to do that before you try to add an event listener
    Code (Text):
    1.  
    2.  
    3. // ==UserScript==
    4. // @name           Test
    5. // @namespace      Test
    6. // @description    Test
    7. // @include        http://www.google.com/
    8. // ==/UserScript==
    9. var add = document.createElement("button");
    10. add.innerHTML = "View Todays Comic!";
    11. document.body.appendChild(add);  // you can use other methods to place the button where you like.
    12. add.addEventListener("click", function() {
    13. window.open('http://www.explosm.net/comics/1772/');}, false
    14. }
    15.  
    16.  
     
    Fexxel likes this.
  5. steinn

    steinn Level I

    Joined:
    Jun 13, 2009
    Messages:
    105
    Likes Received:
    11
    Location:
    Brazil
    you forget to add }, false) in the end..

    try=
    Code (Text):
    1.  
    2. // ==UserScript==
    3. // @name           Test
    4. // @namespace      Test
    5. // @description    Test
    6. // @include        http://www.google.com/
    7. // ==/UserScript==
    8.  
    9. var add = document.createElement("button");
    10. add.value = "View Todays Comic!";
    11. document.body.appendChild(add);  // you can use other methods to place the button where you like.
    12. add.addEventListener("click", function() {window.open('http://www.explosm.net/comics/1772/');}, false)
    13.  
    Do you have console² instaled on your firefox?
    if you don´t, please do me a favor, install that.
    https://addons.mozilla.org/en-US/firefox/addon/1815

    click ctrl + shift +j and look at console and check for errors.
     
  6. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    Alrighty.
    Now I got a tiny lil button. How do I make it big?
    Suggestions?

    PS:
    This is a rolling project learning experience XD (Writing your suggestions down in notepad to learn lol)
     
  7. steinn

    steinn Level I

    Joined:
    Jun 13, 2009
    Messages:
    105
    Likes Received:
    11
    Location:
    Brazil
    you wanna a big button?
    like, "click here to open a new page"?

    Try:
    Code (Text):
    1.  
    2. // ==UserScript==
    3. // @name           Test
    4. // @namespace      Test
    5. // @description    Test
    6. // @include        http://www.google.com/
    7. // ==/UserScript==
    8.  
    9. var add = document.createElement("input");
    10. add.type = "button";
    11. add.value = "View Todays Comic!";
    12. document.body.appendChild(add);  // you can use other methods to place the button where you like.
    13. add.addEventListener("click", function() {window.open('http://www.explosm.net/comics/1772/');}, false)
    14.  
     
  8. jazzeh

    jazzeh Level I

    Joined:
    Jan 1, 2008
    Messages:
    144
    Likes Received:
    15
    If you use createElement button then you should use innerHTML
    If you use createElement input then the type is button and the value is the button text.

    Code (Text):
    1.  
    2. var add = document.createElement("button");
    3. add.innerHTML = "View Todays Comic!";
    4. document.body.appendChild(add);  // you can use other methods to place the button where you like.
    5. add.addEventListener("click", function() {
    6.   window.open('http://www.explosm.net/comics/1772/');
    7. }, false)
    8.  
     
  9. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    Could I make the button have, inside the innerhtml thing, a picture?
    like..
    ....
    add.innerHTML = <img src="http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg", border = 0">;
    ....

    You guys pwn btw!
    Thanks,
    Fexxel
     
  10. steinn

    steinn Level I

    Joined:
    Jun 13, 2009
    Messages:
    105
    Likes Received:
    11
    Location:
    Brazil
    /\ yes you can add the image.
     
  11. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    Care to alaborate? :kiss:
     
  12. steinn

    steinn Level I

    Joined:
    Jun 13, 2009
    Messages:
    105
    Likes Received:
    11
    Location:
    Brazil
    Well, you can´t make the image inside the button (sorry i didn´t say that before...)
    But you can make a DIV.

    Code (Text):
    1.  
    2. // ==UserScript==
    3. // @name           Test
    4. // @namespace      Test
    5. // @description    Test
    6. // @include        http://www.google.com/
    7. // ==/UserScript==
    8.  
    9. var add = document.createElement("div");
    10. add.innerHTML = "<img src='http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg', border = '0'>";
    11. document.body.appendChild(add);  // you can use other methods to place the button where you like.
    12. add.addEventListener("mouseover", function() {this.style.cursor="pointer";}, false) // this will fake a link, since, when you click, a new tab will open
    13. add.addEventListener("click", function() {window.open('http://www.explosm.net/comics/1772/');}, false)
    14.  
    Or you can creat a image too...
    Code (Text):
    1.  
    2. // ==UserScript==
    3. // @name           Test
    4. // @namespace      Test
    5. // @description    Test
    6. // @include        http://www.google.com/
    7. // ==/UserScript==
    8.  
    9. var add = document.createElement("img");
    10. add.src = "http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg";
    11. add.style.border = '0';
    12. document.body.appendChild(add);  // you can use other methods to place the button where you like.
    13. add.addEventListener("mouseover", function() {this.style.cursor="pointer";}, false) // this will fake a link, since, when you click, a new tab will open
    14. add.addEventListener("click", function() {window.open('http://www.explosm.net/comics/1772/');}, false)
    15.  
    Try it yourself...
     
    Fexxel likes this.
  13. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    Alrighty, (+Rep'd btw)
    So I now know how to make a button and an image that clicks to a webpage.

    And say I wanted to make the img smaller:

    Code (Text):
    1. var add = document.createElement("div");
    2. add.innerHTML = "<img src='http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg', length = '100' width = '100' border = '0'>";
    3. document.body.appendChild(add);  // you can use other methods to place the button where you like.
    4. add.addEventListener("mouseover", function() {this.style.cursor="pointer";}, false) // this will fake a link, since, when you click, a new tab will open
    5. add.addEventListener("click", function() {window.open('http://www.explosm.net/comics/1772/');}, false)
    Correct?

    and if I wanted it to click to be smaller I could..

    Code (Text):
    1. var add = document.createElement("div");
    2. add.innerHTML = "<img src='http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg', border = '0'>";
    3. document.body.appendChild(add);  // you can use other methods to place the button where you like.
    4. add.addEventListener("mouseover", function() {this.style.cursor="pointer";}, false) // this will fake a link, since, when you click, a new tab will open
    5. add.addEventListener("click", function() {"<img src=http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg', length = '100' width = '100' border = '0'>";}, false)

    Now if I wanted to put the img somewhere else...
    (Lets move to neopets.com shall we?)
    How would I put it say, in the left side, or say, in the top left corner of the page?
    You said you use
    "document.body.appendchild(add);" and mentioned other methods.
    What other methods are there, and which ones the easiest to use (in terms of moving the object to diff. places)

    Thanks SOO MUCH Steinn!

    I will dedicate meh progs to youz!!!,

    Fexxel
     
  14. steinn

    steinn Level I

    Joined:
    Jun 13, 2009
    Messages:
    105
    Likes Received:
    11
    Location:
    Brazil
    if you wanna a smaller image, don´t use innertHTML = "img width height"
    use, style.width, style.height

    like:
    Code (Text):
    1.  
    2. var add = document.createElement("img");
    3. add.src = "http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg"
    4. add.style.width = "100px"
    5. add.style.height = "100px"
    6. add.style.border = "0";
    7. document.body.appendChild(add);  // you can use other methods to place the button where you like.
    8. add.addEventListener("mouseover", function() {this.style.cursor="pointer";}, false) // this will fake a link, since, when you click, a new tab will open
    9. add.addEventListener("click", function() {window.open('http://www.explosm.net/comics/1772/');}, false)
    10.  
    If you wanna rezise the image when you click, use the code:
    Code (Text):
    1.  
    2. var add = document.createElement("img");
    3. add.src = "http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg"
    4. document.body.appendChild(add);  // you can use other methods to place the button where you like.
    5. add.addEventListener("mouseover", function() {this.style.cursor="pointer";}, false) // this will fake a link, since, when you click, a new tab will open
    6. add.addEventListener("click", function() {this.style.width="100px"; this.style.height="100px";}, false)
    7.  

    For place the image in somewhere, you have to "attack" an object.
    For example if you wanna place the image in sider bar of neopets:


    Use the code:
    Code (Text):
    1.  
    2. var add = document.createElement("img");
    3. add.src = "http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg"
    4. document.getElementsByClassName( 'sidebar' )[0].appendChild(add);  // you can use other methods to place the button where you like.
    5. add.addEventListener("mouseover", function() {this.style.cursor="pointer";}, false) // this will fake a link, since, when you click, a new tab will open
    6. add.addEventListener("click", function() {this.style.width="100px"; this.style.height="100px";}, false)
    7.  

    you saw the "getElementsByClassName('siderbar')[0]?
    So, you will ad the image in the sidebar..
    If you wanna add the image in the top, you can use:
    Code (Text):
    1.  
    2. var add = document.createElement("img");
    3. add.src = "http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg"
    4. var place = document.getElementById( 'content' );
    5. place.parentNode.insertBefore(add, place);// you can use other methods to place the button where you like.
    6. add.addEventListener("mouseover", function() {this.style.cursor="pointer";}, false) // this will fake a link, since, when you click, a new tab will open
    7. add.addEventListener("click", function() {this.style.width="100px"; this.style.height="100px";}, false)
    8.  
    Just know how to attack an element.
    Look at another scripts and search how they attack that elements...

    what do you wanna creat?
    I can help you...
     

    Attached Files:

  15. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    So I could do...

    Code (Text):
    1.  
    2. var add = document.createElement("img");
    3. add.src = "http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg"
    4. document.getElementsByClassName( 'bottom' )[0].appendChild(add);  // you can use other methods to place the button where you like.
    5. add.addEventListener("mouseover", function() {this.style.cursor="pointer";}, false) // this will fake a link, since, when you click, a new tab will open
    6. add.addEventListener("click", function() {this.style.width="100px"; this.style.height="100px";}, false)
    7.  
    or
    Code (Text):
    1.  
    2. var add = document.createElement("img");
    3. add.src = "http://hoox.files.wordpress.com/2008/02/cyanide-and-happiness-pizza.jpg"
    4. document.getElementsByClassName( 'top' )[0].appendChild(add);  // you can use other methods to place the button where you like.
    5. add.addEventListener("mouseover", function() {this.style.cursor="pointer";}, false) // this will fake a link, since, when you click, a new tab will open
    6. add.addEventListener("click", function() {this.style.width="100px"; this.style.height="100px";}, false)
    7.  
    ?
    Alright, looks like I needa learn how to attack that thing XD.
    Could I find the name of the places in the html source of the page?

    Anyways, I was just doing this for general knowledge but.. I have an idea :p
    An igloo helper. Theres a button in the sidebar that says "Check the Igloo!", and when you get there it sets the url from...
    http://www.neopets.com/winter/igloo.phtml to http://www.neopets.com/winter/igloo2.phtml
    (You can't directly go to http://www.neopets.com/winter/igloo2.phtml because you need the refferal of igloo.phtml...)

    --OR--
    A button that flashes when its 3 seconds before the jobs are going to refresh (xx:09:57 NST) and makes an alert (I figured out how to do that btw XD) saying "Visit job page! about to refresh!!!"
    And then when you click the button it brings you to the basic jobs so you can grab one.
    Good?

    -Added the Style.width and width px thing to notes, as well as 'sidebar'[0]-
    YOU ROX!!!! <3

    I'll +Rep you ASAP..
    Fexxel
     
  16. steinn

    steinn Level I

    Joined:
    Jun 13, 2009
    Messages:
    105
    Likes Received:
    11
    Location:
    Brazil
    Install the script mason, he change the refferal...
    i change the whole refferal from neopets (i guess).
    https://addons.mozilla.org/en-US/firefox/addon/10636

    There is an tutorial on this script that shows how to install and config mason:
    http://userscripts.org/scripts/show/54076
    just change the snowager for igloo.

    ----
    Yes you can attack in that way...
    Search on google for "xpath", "document.getElements"
    than you learn how to attack an element.
    Don´t forget to install firebug, console² and xpath checker. (search at addons.mozzila.)

    ---
    About the jobs warning, i´m studying how to do that..
    it´s not too hard, i know how to get neopian time... So i just need time to do that, finish my actual scripts...
    Will open a new page when the employment is done.
    Also checks if you´re make all jobs...

    I was think aabout one that grabbs the best job too..

    ----
    I don´t like to change neopets layout, TNT can check if you´re doing or not, so, it´s not good.
     
  17. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    -About the layout changing:
    Then can you put it in the side bars? (Not the sidebar, but outside the neopets layout. the grey area when you maximize the screen with a large computer.

    -Oof, I'm not at the stage where I can handle grabbing the best job :p. I'd like to make a script something like this though...

    WEll, I'll do this in rough vb.net...
    if strhtml.contains("10:00") then
    w.request("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic")
    end if
    if strhtml.contains("20:00")..
    ect...

    I have absolutely no idea how to do that in javascript...

    ----
    As for xpath, I didnt find anything on google...
    What I gathered was that it's for looking through XML files... And then you do that line of code you said... "document.getElements" to get the elements (like sidebar)?


    EDIT:
    OOH! FOUND A NICE TIDBIT!

    Code (Text):
    1. if (document.body.innerHTML.indexOf("xxx")>-1) {action}
    So I could make that...

    Code (Text):
    1.  
    2. // ==UserScript==
    3. // @name            Neopets Job Navigator
    4. // @namespace   http://userscripts.org
    5. // @description at 10:00 NST, 20:00 NST, 30:00 NST, 40:00 NST, 50:00 NST and 00:00 NST you are brought to the basic jobs page of neopets.com
    6. // @author         Steinn+Fex Fo' Life!
    7. // @include     http://*.neopets.com/*
    8. // @exclude http://images.neopets.com/*
    9. // @exclude        http://*.neopets.com/ads*
    10. // ==/UserScript==
    11.  
    12. if (document.body.innerHTML.indexOf("10:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    13. else if (document.body.innerHTML.indexOf("20:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}   
    14. else if (document.body.innerHTML.indexOf("30:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}           
    15. else if (document.body.innerHTML.indexOf("40:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    16. else if (document.body.innerHTML.indexOf("50:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    17. else if (document.body.innerHTML.indexOf("00:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    18. else if (document.body.innerHTML.indexOf("10:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}       
    19. else if (document.body.innerHTML.indexOf("20:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}   
    20. else if (document.body.innerHTML.indexOf("30:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}           
    21. else if (document.body.innerHTML.indexOf("40:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    22. else if (document.body.innerHTML.indexOf("50:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    23. else if (document.body.innerHTML.indexOf("00:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}   
    24. end if
    25.  
    I think I might need something to go before the if part...
    A before statement thing.
     
  18. steinn

    steinn Level I

    Joined:
    Jun 13, 2009
    Messages:
    105
    Likes Received:
    11
    Location:
    Brazil
    Well, if domain is http://www.neopets.com they can see if you change the layout or not..
    they are not checking this now, but, someday...

    chelsa ask me that, so, look my answer (i don´t wanna write again :p)
    Well, a big friend mine creat this function...
    You can get the actual time, the exactly time when you call the function.
    keep the instructions and you will understand.

    First, add in the header of the script the code:

    Code (Text):
    1.  
    2.     // @require        http://userscripts.org/scripts/source/54000.user.js
    3.  

    Should stay something like that:

    Code (Text):
    1.  
    2.     // @name           test
    3.     // @namespace      Steinn
    4.     // @description    test
    5.     // @require        http://userscripts.org/scripts/source/54000.user.js
    6.     // @include        *neopets.com*
    7.  

    It´s really important you add this... (here´s where the function is lol)
    after you add this part, SAVE the script on your computer, in somewhere like, my documents.
    After save, open again in the browser and install...
    You can upload the script in some page and install. But the most important, its the part when you install him again.
    If you didn´t do this part, the script doesn´t work...

    Now its just you get the time:

    Code (Text):
    1.  
    2.     var nst = NeopetsDocument.Time(true); //this will get time whole tim and date
    3.  
    4.     var h = nst.getHours(); // this will get hours
    5.     var m = nst.getMinutes(); // minutes
    6.     var s = nst.getSeconds(); // seconds
    7.     alert(h + ":" + m + ":" + s); // alert for see the result.
    8.  


    Like a told you, i dindn´t creat this script.
    This guy create:
    http://userscripts.org/users/wesley

    This is the script:
    http://userscripts.org/scripts/show/54000

    Like license is GNU GPL, you can copy the code ;)

    If you really wanna study, you have to read a lot...
    Look at this pages:
    http://www-xray.ast.cam.ac.uk/~jgraham/ ... orial.html

    I can teach you somethings, cause there´s any good tutorial for learn that...

    Look,
    How to attack sidebar using getelements:
    Code (Text):
    1. document.getElementsByClassName("sidebar")[0]; // its important you add this 0. he shows what element he wants to attack. if its the first, the second, thirt...
    Now look how to attack using xPATH:
    Code (Text):
    1. document.evaluate("//td[@class='sidebar']",document,null,8,null).singleNodeValue;
    Or
    Code (Text):
    1. document.evaluate("/html/body/div/div[3]/table/tbody/tr/td/div[3]/table/tbody/tr/td",document,null,8,null).singleNodeValue;
    Use the best option to attack
    don´t forget, you have to install firebug, xpath checker, console²
     
  19. steinn

    steinn Level I

    Joined:
    Jun 13, 2009
    Messages:
    105
    Likes Received:
    11
    Location:
    Brazil
    Sorry double post but i need...

    About you code, so, what happend if its: 22:01?
    The script will not work....
     
  20. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    The employment agency restocks its jobs at 10:00, 20:00, 30:00, ect.. (every 10 minutes)... You don't need 22:01.
    ---
    As for xpath:
    I couldn't find xpath finder but I found xpath Checker...
    https://addons.mozilla.org/en-US/firefox/addon/1095
    I put it on my firefox, along with firebug and console. (Console is awesome by the way)
    --
    Code (Text):
    1. if (document.body.innerHTML.indexOf("10:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    2. else if (document.body.innerHTML.indexOf("20:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}  
    3. else if (document.body.innerHTML.indexOf("30:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}        
    4. else if (document.body.innerHTML.indexOf("40:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    5. else if (document.body.innerHTML.indexOf("50:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    6. else if (document.body.innerHTML.indexOf("00:00 pm NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    7. else if (document.body.innerHTML.indexOf("10:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}      
    8. else if (document.body.innerHTML.indexOf("20:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}  
    9. else if (document.body.innerHTML.indexOf("30:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}        
    10. else if (document.body.innerHTML.indexOf("40:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    11. else if (document.body.innerHTML.indexOf("50:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}
    12. else if (document.body.innerHTML.indexOf("00:00 am NST")>-1) {window.open("http://www.neopets.com/faerieland/employ/employment.phtml?type=jobs&voucher=basic");}  
    13. end if
    So It won't work?...
    Edit:
    Tested the script, it doesn't work!!!
    According to console, I need something in the beggining... before the if part..