WidgetPad.com
Widgets
Search
Help
Signup
Login
Dashboard
My widgets
Favorites
Widgets
Search
Account
Help
Logout
Flickr feed display
/ widget.js
window.addEventListener("load", function() { try { WidgetPad.log("Start hello world"); /* To prevent scrolling, call WidgetPad.noscroll(true); */ WidgetPad.noscroll(true); // A few global variables ctx = document.getElementById("canvas").getContext("2d"); images = new Array(); imageCount = 0; displayedImage = 0; $("canvas").click(function() { ++ displayedImage; displayedImage = displayedImage % imageCount; ctx.fillStyle = 'rgba(255,255,255,255)'; ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.drawImage(images[displayedImage], 0, 0); }); $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=sunset&lang=en-us&format=json&jsoncallback=?", function(data) { // display the first image image = new Image(); $(image).load(function() { ctx.drawImage(image, 0, 0); }); image.src = data.items[0].media.m; // load the other images $.each(data.items, function(i,item) { var thisImage = new Image(); thisImage.src = item.media.m; images[imageCount] = thisImage; ++imageCount; }); }); } catch (e) { WidgetPad.error(e); } }, false);
Provided by
WidgetPad Inc
.
Login
E-mail:
Password:
Close
|
Signup
|