Log in

View Full Version : Little script for Grease Monkey



Victor Seven
December 31st, 2011, 02:37 pm
Hello! The other day I downloaded Grease Monkey. That is a add-on for Firefox which let you create scritps for a web page. I was learning Java Script in the last days and I made this little script for practising. This script let you go directly to a post. You have copy this on your Grease Monkey, changing the "url_you_want_to_follow" for another url. You will see a new button in the top bar (where are located the "Forum" and the "What's new" buttons), called "My post". If you click there, you'll be redirected to that post. (or URL). :D
I will try to improve this, and I want to practise more. If you also know JavaScript and can improve the script or help me, say it! :heh:


// ==UserScript==
// @name ichigos
// @namespace *
// @include *
// ==/UserScript==

var pagina = location.host;

function creaboton()
{
var btn = document.createElement("A");
btn.id = "nuevoboton";
btn.innerHTML = "My post";
btn.href = "url_you_want_to_follow";

document.getElementById("navtabs").appendChild(btn);
}

if (pagina == "forums.ichigos.com")
{
creaboton();
}

It's not too much, but I'm learning ^^'.