// ==UserScript==
// @name Orkut My Scrapbook link
// @namespace http://userscripts.org/scripts/show/3495
// @description Adds a link to your scrapbook at the top of every orkut page
// @include http://www.orkut.com/*
// ==/UserScript==
/*
* author: Edward Chewtoy
* http://www.orkut.com/Profile.aspx?uid=5837855081487293635
* feel free to modify or improve,
* feedback welcome
*/
function RunScript() {
add_link(window.document,document.evaluate('/HTML[1]/BODY[1]/TABLE[1]/TBODY[1]/TR[2]/TD[1]/A[7]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue, ' | <a style="text-decoration:none;color: black;" href="http://www.orkut.com/ScrapBook.aspx">My Scrapbook</a>',false,false);
}; // Ends RunScript
window.addEventListener("load", function() { RunScript() }, false);
//
function insertAfter(newNode, target) {
var parent = target.parentNode;
var refChild = target.nextSibling;
if(refChild != null)
parent.insertBefore(newNode, refChild);
else
parent.appendChild(newNode);
};
function add_link(doc, element, new_html, before, insert_as_block) {
var new_element;
if (insert_as_block) {
new_element = doc.createElement ("DIV");
} else {
new_element = doc.createElement ("SPAN");
};
new_element.innerHTML = new_html;
if (before) {
element.parentNode.insertBefore(new_element, element);
} else {
insertAfter(new_element, element);
};
};