// ==UserScript== // @name Lunarstorm Personalizer // @namespace http://www.lysator.liu.se/~jhs/userscript // @description Shows the owner's face in all guestbooks and diary entries // @include http://www.lunarstorm.se/gst/gst_guestbook.aspx* // @include http://www.lunarstorm.se/dry/dry_view.aspx* // ==/UserScript== /* .main,.mainraw { background:transparent !important; } table.box { background:#FFF url("http://photo.lunarstorm.se/large/422/%7B4224B6C6-4B3D-4B20-96C3-36CBC66BE35D%7D.jpg") no-repeat right 62px;} */ // Returns the screen coordinates in pixels from the window viewport function getScreenCoordinate( node ) { var x = node.offsetLeft; var y = node.offsetTop; while( node = node.offsetParent ) { x += node.offsetLeft; y += node.offsetTop; } return { x:x, y:y }; } // add a face in the node, offset x/y pixels right/down function renderFaceHere( at, x, y ) { x = (x||0) - 52; y = (y||0); var id = unescape( /userid=([^&]*)/i.exec( location.search )[1] ); var xy = getScreenCoordinate( at ); var tr = at.parentNode; var tc = tr.previousSibling; if( tc.nodeName == '#text' ) tc = tc.previousSibling; var tc = tc.getElementsByTagName( 'tr' ); var bc = tr.nextSibling.nextSibling.getElementsByTagName( 'td' ); var co = 'http://www.lysator.liu.se/~jhs/userscript/www.lunarstorm.se/gfx/'; var im = { w:305, h:407, src:id.substr(1,3) + '/' + id + '.jpg' }; var dx = Math.floor( /*xy.x*/-(im.w-199)/2 ) +'px', dy = (xy.y - 2) + 'px'; im.src = 'http://photo.lunarstorm.se/large/' + im.src; at.innerHTML = '