Skip to content

Instantly share code, notes, and snippets.

@june29
Created May 7, 2010 09:35
Show Gist options
  • Save june29/393231 to your computer and use it in GitHub Desktop.
Save june29/393231 to your computer and use it in GitHub Desktop.
Show embed tag every photo page on Flickr
// ==UserScript==
// @name Flickr every photo share
// @namespace http://june29.jp/
// @description Show embed tag every photo page on Flickr
// @include http://www.flickr.com/photos/*/*/sizes/*/*
// @require http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js
// ==/UserScript==
(function() {
var ownerName = $("div.Owner a:last").text();
if (ownerName == "You") {
return;
}
var photoURL = $("div.DownloadThis > p > img").attr("src");
var photoPageURL = "http://www.flickr.com" + $("div.Bucket > table > tbody > tr > td > p > a").attr("href");
var photoTitle = document.title.replace("Flickr Photo Download: ", "");
var embedTag = <a href={photoPageURL} title={photoTitle + ' by ' + ownerName + ', on Flickr'}>
<img src={photoURL} alt={photoTitle} />
</a>.toXMLString();
$("p.EndBar")
.before(
$("<h3>To link to this photo on other websites you can either:</h3>"))
.before(
$("<p/>")
.append($("<b/>").text("1. "))
.append("Copy and paste this HTML into your webpage:"))
.before(
$("<p/>")
.append($("<textarea/>")
.attr({ wrap: "virtual", rows: 4, style: "width: 520px;", name: "textfield" })
.text(embedTag)
.focus(function() { this.select(); })
))
.before(
$("<p/>")
.append($("<b/>").text("2. "))
.append("Grab the photo's URL:"))
.before(
$("<p/>")
.append($("<input/>")
.attr({ type: "text", style: "width: 520px;", value: photoURL, name: "textfield" })
.focus(function() { this.select(); })));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment