I had to make another tiny update to my flickr cc attribution helper script, more or less fixing my own goofs. The thing that was happening was the attribution was not appearing on your own photos (if you were logged into flickr), but you would see it on other creative commons licensed images… this only about 10 days after the last update.
I saw it myself- my own short term fix was to open a web browser where I was not logged into flickr.
If you want some details, scroll on other wise, get the new scripts (still on the burner is to enable the Chrome one to be updated, for now you have to delete it an re-install) (see what a lousy coder I am?).
The way these work is that your browser invokes them only on pages from flickr.com. It uses something known as XML Path Language (XPath) to find certainly elements in the web page structure. It figures out if the flickr page is even creative commons licensed by looking for a particular span element that flickr uses to wrap the little icons:
<span class="ccIcn ccIcnSmall">...</span>
or the exact code:
var iscc = document.evaluate("//span[@class='ccIcn ccIcnSmall']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
It then does a few gymnastics to assemble the attribution code embedded in a textarea box.
Now the tricky part was finding where to insert that in the page when the script modifies the output. It needs to find a specific div and than append the HTML for the attribution after it.
What I had done on the last update was find two possible places- there was one div and class used when it is for someone else’s page, and a difference div and class when it is your own photo. It’s tricky, because when flickr decides to make a change to their output, it can break my script.
And this recent break is as simple as on your own photos, it seemed to have added an extraneous space in a class name- it should be:
but sometime in the last few days, someone slipped on their template add the class name had an extra space
They will likely fix this, so I retreated, and instead of trying to find the two different divs, I was able to hang the output after the div for the entire right side sidebar (I thought I had tried this before, but it seemed to work today).
If I was better I would code it as some sort of overlay or interface that slides in from the side. I really do not want to have to tweak the code each time flickr tweaks their templates for output.
I have to say, these fixes are easier to test and check in Firefox. I can locate the script inside my preference files, make changes, and they are reflected when the page is reloaded. Chrome is a bit more obtuse.
I am hard core dedicated to keeping the attribution tools afloat.
And as a bit of curious, I wonder if it is a bit of code humor or a typo/mispelling that the div id for the sidebar is named sidecar.
The post "Yet Another Flickr CC Attribution Helper Update" was originally assembled from spare parts of a 1957 Chevy at CogDogBlog (https://cogdogblog.com/2013/05/yet-another-attribution-helper-update/) on May 14, 2013.