Orkut Single Click

By V-i-k-a-s P-a-n-d-e-y Last update May 28, 2008 — Installed 4,503 times.
// ==UserScript==
// @name Orkut Single Click
// @namespace http://www.orkut.com/Profile.aspx?uid=3679968712288334242
// @description Single Click Access To Various Possible Options In Orkut.
// This script displays several letters with relevant orkut links which give single click access to different options
// @include http://www.orkut.co*/*
// @include https://www.orkut.co*/*
// @exclude http://www.orkut.co*/Privacy.aspx
// @exclude http://www.orkut.co*/About.aspx
//
// Developed by: Vikas Pandey <vickyvirgo2k@gmail.com>
// ==/UserScript==

// The latest version of this script is available for download at http://userscripts.org/scripts/show/5223

    var i = document.getElementsByTagName('a');
    main1:
    for ( var j = i.length-1; j>1; j-- ) {

// The following code removes extra code from Orkut Search pages
        if ( i[j].href.match("ClickTracker.") == "ClickTracker." ) {
            i[j].setAttribute("href", unescape(i[j].href.substring(i[j].href.indexOf("&url=")+5, i[j].href.indexOf("&psg="))) );
        }


// The following code changes all short profile displays to full profile displays
        if ( i[j].href.match("/Profile.") == "/Profile." ) {
            var k = i[j].href.indexOf("Profile.");
            i[j].href=i[j].href.substring(0, k) + "Full" + i[j].href.substring(k);
        }

// The following code prevents these tags to appearing at 'profile' in individual's profile page and at 'view profile' in community profile page in the left hand side column

        if ( i[j].innerHTML.toLowerCase().indexOf( "profile" ) > -1 ) {
            continue;
        }

// The following code prevents these tags to appearing alongwith images of individuals or profile so duplicate links wudn't be there
        if ( i[j].getElementsByTagName("img").length == 1 ) {
            continue;
        }

// The following code prevents these tags to appearing when the individual or a community has no image so duplicate links wudn't be there
        var idiv = i[j].getElementsByTagName('div');
        for ( var k = 0; k < idiv.length; k++) {
         	if ( idiv[k].getAttribute('class').match(/\bi_nophoto64\b/) != '' ) {
                continue main1;
            }
        }

        var linkdata = i[j].getAttribute("href");
        var linkparts = linkdata.split("?");

// adds the following options next to each profile link:
// P view Full Profile
// S view Scrapbook
// M send Message
// F view friendslist
// C view Mutual Communities
// P view Photo album
// V view Video
// A add as a friend


        var topurl = i[j].href.substring(0,i[j].href.indexOf(i[j].getAttribute("href")));
        if ( i[j].href.match("/FullProfile.") == "/FullProfile.") {

            var viewprofilelink = document.createElement("a");
            viewprofilelink.href = topurl + "FullProfile.aspx?" + linkparts[1];
            viewprofilelink.appendChild(document.createTextNode(" [P"));

            var viewscrapbooklink = document.createElement("a");
            viewscrapbooklink.href = topurl + "ScrapBook.aspx?" + linkparts[1];
            viewscrapbooklink.appendChild(document.createTextNode(" S"));

            var sendmessagelink = document.createElement("a");
            sendmessagelink.href = topurl + "Compose.aspx?" + linkparts[1];
            sendmessagelink.appendChild(document.createTextNode(" M"));

            var viewfriendslistlink = document.createElement("a");
            viewfriendslistlink.href = topurl + "FriendsList.aspx?" + linkparts[1];
            viewfriendslistlink.appendChild(document.createTextNode(" F"));

            var viewcommunitieslink = document.createElement("a");
            viewcommunitieslink.href = topurl + "ProfileC.aspx?" + linkparts[1] + "&tab=1";
            viewcommunitieslink.appendChild(document.createTextNode(" C"));

            var viewalbumlink = document.createElement("a");
            viewalbumlink.href = topurl + "AlbumList.aspx?" + linkparts[1];
            viewalbumlink.appendChild(document.createTextNode(" P"));

            var viewvideolink = document.createElement("a");
            viewvideolink.href = topurl + "FavoriteVideos.aspx?" + linkparts[1];
            viewvideolink.appendChild(document.createTextNode(" V"));

            var addasafriendlink = document.createElement("a");
            addasafriendlink.href = topurl + "FriendAdd.aspx?" + linkparts[1];
            addasafriendlink.appendChild(document.createTextNode(" A]"));

            i[j].parentNode.insertBefore( addasafriendlink, i[j].nextSibling);
            i[j].parentNode.insertBefore( viewvideolink, i[j].nextSibling);
            i[j].parentNode.insertBefore( viewalbumlink, i[j].nextSibling);
            i[j].parentNode.insertBefore( viewcommunitieslink, i[j].nextSibling);
            i[j].parentNode.insertBefore( viewfriendslistlink, i[j].nextSibling);
            i[j].parentNode.insertBefore( sendmessagelink, i[j].nextSibling);
            i[j].parentNode.insertBefore( viewscrapbooklink, i[j].nextSibling);
            i[j].parentNode.insertBefore( viewprofilelink, i[j].nextSibling);
        } // if

// adds the following options next to each community link:
// J join
// T view topics
// P post new topic
// P view Polls
// M view members list
// R report bogus
// U unjoin

        var topurl = i[j].href.substring(0,i[j].href.indexOf(i[j].getAttribute("href")) + 1);
        if ( i[j].href.match("/Community.") == "/Community." ) {
            var joinlink = document.createElement("a");
            joinlink.href = topurl + "CommunityJoin.aspx?" + linkparts[1];
            joinlink.appendChild(document.createTextNode(" [J"));

            var viewalltopicslink = document.createElement("a");
            viewalltopicslink.href = topurl + "CommTopics.aspx?" + linkparts[1];
            viewalltopicslink.appendChild(document.createTextNode(" T"));

            var postnewtopiclink = document.createElement("a");
            postnewtopiclink.href = topurl + "CommMsgPost.aspx?" + linkparts[1];
            postnewtopiclink.appendChild(document.createTextNode(" P"));

            var viewpollslink = document.createElement("a");
            viewpollslink.href = topurl + "CommPolls.aspx?" + linkparts[1];
            viewpollslink.appendChild(document.createTextNode(" P"));

            var viewmemberslink = document.createElement("a");
            viewmemberslink.href = topurl + "CommMembers.aspx?" + linkparts[1];
            viewmemberslink.appendChild(document.createTextNode(" M"));

            var reportboguslink = document.createElement("a");
            reportboguslink.href = topurl + "FlagCommunity.aspx?" + linkparts[1];
            reportboguslink.appendChild(document.createTextNode(" R"));

            var unjoinlink = document.createElement("a");
            unjoinlink.href = topurl + "CommunityUnjoin.aspx?" + linkparts[1];
            unjoinlink.appendChild(document.createTextNode(" U]"));

            i[j].parentNode.insertBefore( unjoinlink, i[j].nextSibling);
            i[j].parentNode.insertBefore( reportboguslink, i[j].nextSibling);
            i[j].parentNode.insertBefore( viewmemberslink, i[j].nextSibling);
            i[j].parentNode.insertBefore( viewpollslink, i[j].nextSibling);
            i[j].parentNode.insertBefore( postnewtopiclink, i[j].nextSibling);
            i[j].parentNode.insertBefore( viewalltopicslink, i[j].nextSibling);
            i[j].parentNode.insertBefore( joinlink, i[j].nextSibling);
        } // if

// adds the following options next to each topic
// R Read the topic
// P post reply to the topic

// adds the following options next to "First"/"Last" page of the topic:
// P post reply to the topic

        if ( i[j].href.match("/CommMsgs.") == "/CommMsgs." ) {
            if ( i[j].href.match("&na=") == "&na=" ) {
                if ( ( i[j].href.match("&na=1") == "&na=1" ) ||
                     ( i[j].href.match("&na=2") == "&na=2" ) ) {
                    var postreplylink = document.createElement("a");
                    var linkparts1 = linkparts[1].split("&na=");
                    postreplylink.href = topurl + "CommMsgPost.aspx?" + linkparts1[0];
                    postreplylink.appendChild(document.createTextNode(" [P]"));

                    i[j].parentNode.insertBefore( postreplylink ,i[j].nextSibling);
                }
            }
            else {
                var readtopiclink = document.createElement("a");
                readtopiclink.href = topurl + "CommMsgs.aspx?" + linkparts[1];
                readtopiclink.appendChild(document.createTextNode(" [R"));

                var postreplylink = document.createElement("a");
                postreplylink.href = topurl + "CommMsgPost.aspx?" + linkparts[1];
                postreplylink.appendChild(document.createTextNode(" P]"));

                i[j].parentNode.insertBefore( postreplylink ,i[j].nextSibling);
                i[j].parentNode.insertBefore( readtopiclink ,i[j].nextSibling);
            }
        } // if
    } // for j

// adds the following options at the end of Menu bar at the the second line on the left:
// Friend - Friends' list
// Fan - Fans list
// Book - Bookmarks
// Hot - Hot list
// Crush - Crush list
// Ignore - Ignore list
// Scrap - Scrapbook
// Album - Album
// Video - Video
// Feed - Feed
// Testi-gvn - Testimonials given
// Testi-rcd - Testimonials recieved
// Profile - Profile
// Smry - Edit Profile - Summary
// Soc - Edit Profile - Social
// Con - Edit Profile - Contacts
// Prof - Edit Profile - Professional
// Pers - Edit Profile - Personal
// Wish - Edit Profile - Wish list
// Orkut - Orkut Settings
// Google - Google Settings

// NOTE: Orkut has used some method to fix the top blue line, so it is not expanding to accomodate all the following options which are there on the line but are not becoming visible. If anyone knows solution of that, please share with me. TIA.

    var i=document.getElementsByTagName('ul');

    for ( var j = 0; j<i.length; j++ ) {
    	if ( i[j].className.match(/\bmenu\b/) == "menu" ) {
            i[j].innerHTML += '<li>&nbsp;<a href = topurl + "FriendsList.aspx">Friend</a>&nbsp;</li>' +
            '<li><a href = topurl + "ProfileF.aspx">Fan</a>&nbsp;</li>' +
            '<li><a href = topurl + "Marks.aspx?mid=1">BkMark</a>&nbsp;</li>' +
            '<li><a href = topurl + "Marks.aspx?mid=2">Hot</a>&nbsp;</li>' +
            '<li><a href = topurl + "Marks.aspx?mid=3">Crush</a>&nbsp;</li>' +
            '<li><a href = topurl + "Marks.aspx?mid=4">Ignore</a>&nbsp;</li>' +
            '<li><a href = topurl + "Scrapbook.aspx">Scrapbook</a>&nbsp;</li>' +
            '<li><a href = topurl + "AlbumList.aspx">Album</a>&nbsp;</li>' +
            '<li><a href = topurl + "FavoriteVideos.aspx">Video</a>&nbsp;</li>' +
            '<li><a href = topurl + "EditFeeds.aspx">Feed</a>&nbsp;</li>' +
            '<li><a href = topurl + "TestimonialView.aspx">Testi-gvn</a>&nbsp;</li>' +
            '<li><a href = topurl + "ProfileT.aspx">Testi-rcd</a>&nbsp;</li>' +
            '<li><a href = topurl + "FullProfile.aspx">Profile</a>&nbsp;</li>' +
            '<li><a href = topurl + "EditSummary.aspx">Smry</a>&nbsp;</li>' +
            '<li><a href = topurl + "EditSocial.aspx">Soc</a>&nbsp;</li>' +
            '<li><a href = topurl + "EditContact.aspx">Cont</a>&nbsp;</li>' +
            '<li><a href = topurl + "EditProfessional.aspx">Prof</a>&nbsp;</li>' +
            '<li><a href = topurl + "EditPersonal.aspx">Pers</a>&nbsp;</li>' +
            '<li><a href="https://www.google.com/accounts/ManageAccount?hl=en_US">Google</a>&nbsp;</li>' +
            '<li><a href = topurl + "Settings.aspx">Orkut</a></li>';
        } // if
    } // for j

// Release: v1.5 dated May 27, 2008
// Orkut changed its url from .com to .co.in so, added support for all top-level domains now.
//
// Release: v1.4 dated May 01, 2008
// opens FullProfile instead of newly introduced short Profile
// opens AlbumList.aspx instead of deprecated Album.aspx
// "R report abuse" has been removed as it was hardly being used
// added "C view Mutual Communities" of a person
// prohibited these link tags from unnecessarily appearing multiple times with same item
    
// Release: v1.3 dated July 06, 2007
// included https in scope
// added options for Video, Feeds and Polls
// Added Page URLs on top of each page to facilitate it appear in screenshots
// Added V with the community topics to to make threads with invisible subjects reachable
// removed the effect of Urchin Click Tracker in Universal Search Page
// removed several options which were rarely used
// updating to make it work for changed Orkut codes
//
// Release: v1.2 dated Oct 18, 2006
// Some users put invisible characters in their name, their profile was not reachable by clicking on their names
// Some users have no pic or too small pic, their profile was not reachable by clicking on their pic
// Hence, added P with profiles to make them reachable,
// Some display letters changed for easy understanding
//
// Release: v1.1 dated Aug 26, 2006
// script name modified
// [I] added in communities to invite friends, some link letters modified, links are now not displayed with pics.
// [W] added in profiles to write testimonials, some link letters modified, links are now not displayed with pics.
// [P] (post reply in a topic): code modified
// Top right menu bar modified, Settings: Google/ Orkut added
// Top left menu bar modified, "Friend Fan Book Hot Crush Ignore | Scrap Album Testi-gvn Testi-rcd | Profile Gen Int Con Ph Wish Prof added"
//
// Release: v1.0 dated Aug 12, 2006