Orkut community Thread re-title (Greasemonkey)
This script allows you to change the titles of Orkut community threads while viewing them locally.
Tested with:
Ubuntu Hardy Heron 8.04
Firefox/3.0.1 (Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.1) Gecko/2008072820)
Greasemonkey 0.8.20080609.0
Of course, it's local - it doesn't actually affect the data on Orkut's servers and you don't need any special privileges in the community to use this.
Name changes are persistent (will remain even after the browser is restarted - I think the info is lost if you Ctrl+Shift+Del your cache).
Refer elsewhere for how to install a Greasemonkey user-script.
Test with: http://www.orkut.co.in/CommTopics.aspx?cmm=22317
This does have some minor bugs which I'll fix if someone is interested in using this.
// ==UserScript==
// @name Orkut Community Re-title 1.0
// @namespace tag:abhijitppai@gmail.com,2008-08-07:Algoretitle
// @description script to re-title Orkut community threads
// @include http://www.orkut.co.in/CommTopics.aspx*
// ==/UserScript==
function myclick() {
if(this.checked==true)
{
c = document.createElement('input');
c.type="text";
c.name="apt"+this.name;
c.value=GM_getValue(String(this.name),"");
this.parentNode.insertBefore(c, this.nextSibling);
}
else
{
c=document.getElementsByName("apt"+this.name)[0];
GM_setValue(String(this.name),c.value);
var link = this.parentNode.childNodes[1];
if(c.value!="")
{
//don't have old value saved yet
if(""==GM_getValue("orig"+this.name,""))
{
//save it
GM_setValue("orig"+this.name,link.innerHTML);
}
link.innerHTML = c.value;
link.style.color="red";
}
else
{
link.innerHTML = GM_getValue("orig"+this.name,"blank");
this.parentNode.childNodes[1].style.color="grey";
}
this.parentNode.removeChild(this.parentNode.childNodes[3]);
}
}
var allLinks, thisLink;
allLinks = document.evaluate(
'//a[@href]',
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (var i = 0; i < allLinks.snapshotLength; i++) {
thisLink = allLinks.snapshotItem(i);
var k = thisLink.href.search("&tid=");
if(k>0)
{
k=k+5;
b = document.createElement('input');
b.type="checkbox";
b.name=String(thisLink.href.substr(k));
vlue = GM_getValue(b.name,"");
if(vlue!="")
{
thisLink.innerHTML = vlue;
thisLink.style.color="red";
}
b.addEventListener("click", myclick, true);
//insert after
thisLink.parentNode.insertBefore(b, thisLink.nextSibling);
}
}
2 comments:
why does one need this? :)
If you look at thread titles at the "Algorithms" community for example, you will find that almost all threads begin with "MS Question" etc.. I prefer something like "LL remove node given pointer" etc., and since I look at these threads over time, it's cumbersome to click on all those similarly named threads and then realize that I've already read through it before.
And yes, it's not a need invented for a program. It's a program invented for a need.
This program, I believe, is directly extensible to show which threads have changed since you last saw them; a feature more widely useful, you think ?
Post a Comment