[request] Facebook Image2profile linker

in Ideas and script requests
Subscribe to [request] Facebook Image2profile linker 9 posts, 3 voices



GoodSoul Scriptwright

Hi there,

most of the facebook images have an UID tag, e.g.:
<img uid="123456789" size="n" linked="no" title="" alt="" src="http://profile.ak.facebook.com/v229/1525/39/n123456789_4567.jpg">

it would be nice if this can be a link to the profile, e.g.:
<a href="http://www.new.facebook.com/profile.php?id=123456789"><img uid="123456789" size="n" linked="no" title="" alt="" src="http://profile.ak.facebook.com/v229/1525/39/n123456789_4567.jpg">}</a>

so I could use this on some of the apps I'm using at facebook - is that possible?

thanks

 
Ronen Mendez... User

another "hole" in fb security, lol
I'd like to see something like that too

 
Mikado Scriptwright

Try this (untested - not a fb user):

for (var i = 0; i < document.images.length; i++) {
	var ci = document.images[i], cid;
	if ((cid = ci.getAttribute('uid')) && (ci.parentNode.tagName != 'A')) {
		var cl = document.createElement('a');
		cl.href = 'http://www.new.facebook.com/profile.php?id=' + cid;
		ci.parentNode.insertBefore(cl, ci).appendChild(ci);
	}
}

 
GoodSoul Scriptwright

Thanks Mikado - it works (but sometimes not, after clicking trough a couple of images)!

Is it okay for you if I add this script with credits to you to Userscripts.org?

 
GoodSoul Scriptwright

Ok, I played a little and there is a little problem. For e.g. using the "Are you Interessted" App. Click 4-5 times the "skip" button and the images don't get linked anymore. I think its due to the reason that its all ajax. :| any ideas how to fix this?

 
Mikado Scriptwright

If it's really ajax, you just need to wrap this code into listener function:

function process() {
	document.body.removeEventListener('DOMNodeInserted', process, false);
	// previous code
	document.body.addEventListener('DOMNodeInserted', process, false);
}
process();

 
GoodSoul Scriptwright

now it works like a charm. thank you very much. will put this as a script online with all credits to you pointing to this topic as well. thanks a lot again!

 
Ronen Mendez... User

once you do that GoodSoul, can you also post the link to it here?

 
GoodSoul Scriptwright

Get this: http://userscripts.org/scripts/show/31229

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel