// ==UserScript== // @name rewriteAvatars // @namespace jjb // @description Rewrites friend pictures to add functions such as "Send message", "View pictures", etc // @include *.myspace.com/* // ==/UserScript== var re=new RegExp("friendid=([0-9]+)","i"); // / var cameraPic='http://www.packetsmiter.com/images/CAMERA.gif'; var mailPic='http://www.packetsmiter.com/images/MAIL16A.gif'; var viewCommentPic='http://www.packetsmiter.com/images/CNT.GIF'; var addCommentPic='http://www.packetsmiter.com/images/PROP.gif'; var allLinks, thisLink; allLinks = document.evaluate( '//a[contains(@href,"user.viewprofile")]/img', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0; i < allLinks.snapshotLength; i++) { thisLink = allLinks.snapshotItem(i).parentNode; // do something with thisLink //print(thisLink.href); var matches=re.exec(thisLink.href); if (matches && matches[1]) { var friendID=matches[1]; newElement = document.createElement('p'); picURL="http://viewmorepics.myspace.com/index.cfm?fuseaction=user.viewPicture&friendID="+friendID; profileURL="http://www.myspace.com/"+friendID; messageURL="http://messaging.myspace.com/index.cfm?fuseaction=mail.message&friendID="+friendID; viewCommentURL="http://comment.myspace.com/index.cfm?fuseaction=user.viewComments&friendID="+friendID; addCommentURL="http://comment.myspace.com/index.cfm?fuseaction=user.viewProfile_commentForm&friendID="+friendID; newElement.innerHTML=' \ Send Message \ View comments \ Add comments'; thisLink.parentNode.insertBefore(newElement, thisLink.nextSibling); } }