|
I've made a second set of changes to maintain the positioning of the photo caption.
1. newdiv attributes changed
2. additional CSS added for photoImgDiv
Here's the full code:
// ==UserScript==
// @name Show Image URL
// @namespace http://www.flickr.com/photos/gustavog
// @include http://www.flickr.com/photos/*/*
// ==/UserScript==
var images = document.evaluate(
'//div[starts-with(@id,"photoImgDiv")]//img',
document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
var image = images.snapshotItem(0);
GM_addStyle("div.photoImgDiv { position: relative; }");
var newdiv = document.createElement('div');
var urltext = '[URL]';
var text = document.createTextNode(urltext);
var link = document.createElement('a');
link.setAttribute('href', image.src);
link.appendChild(text);
newdiv.appendChild(link);
newdiv.setAttribute('style', 'position:absolute;right:0;top:-1.75em;');
image.parentNode.appendChild(newdiv, image);
|