function jsonFlickrApi(data) {
// data is the JSON object returned by flickr
... do stuff with the data here ...
r.removeScriptTag();
}
function sendRequest() {
var url = "http://api.flickr.com/services/rest/" +
"?method=flickr.interestingness.getList&format=json&api_key=xxxxxx";
var r = new JSONscriptRequest(url);
r.buildScriptTag(); // Build the script tag
r.addScriptTag(); // Execute (add) the script tag
} ]]>
Slightly modified JSONscriptRequest object, based on a script by Jason Levitt. The modifications were made to adapt it to svg, since the original script assumed an HTML environment.
this.headLoc = document.getElementsByTagName("defs").item(0);
var svgns = "http://www.w3.org/2000/svg";
var xlinkns = "http://www.w3.org/1999/xlink";
var s = this.scriptObj;
s = document.createElementNS(svgns,"script");
// Add script object attributes
s.setAttributeNS(null, "type",
"text/javascript");
s.setAttributeNS(xlinkns, "xlink:href",
this.fullUrl + this.noCacheIE);
s.setAttributeNS(null, "id", this.scriptId);
tag hack suffers from a problem. It allows a page to access data from any server in the web, which is really useful. Unfortunately, the data is returned in the form of a script. That script can deliver the data, but it runs with the same authority as scripts on the base page, so it is able to steal cookies or misuse the authorization of the user with the server. A rogue script can do destructive things to the relationship between the user and the base server. ]]>
- Douglas Crockford
.htaccess file, and enabling mod_rewrite and mod_proxy):
RewriteEngine on RewriteRule ^\/rest\/(.*)$ http://api.flickr.com/services/rest/$1 [P]
The thumbnails:
]]>
.thumb { clip-path: url(#c); pointer-events: none; }
.mediumthumb { clip-path: url(#c2); pointer-events: none; }
.photo { opacity: 0 }
.frame { fill: white; stroke: black }
.largeframe { opacity: 1 }
.frame:hover { stroke: lightblue; stroke-width: 6px }
.frame:focus { stroke: lightblue; stroke-width: 6px }
.button { fill: white; }
.button:hover { stroke: lightblue; stroke-width: 6px }
.button:focus { stroke: lightblue; stroke-width: 6px }
.disabled { fill: gray }
.buttontext { text-anchor: middle; font: 42px Arial Black; pointer-events: none }
]]>
Animating the clip:
]]>
The buttons:
> < ]]>