Skip to content

Commit 37b886d

Browse files
committed
Update the Demo
Let the user set the flickr tags for caching sample.
1 parent 497d6d0 commit 37b886d

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

demo.html

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
<body>
1515

1616
<h1>jQuery Cache Images v1.0 Plug-in</h1>
17+
<a href="index.html">Back to Index</a>
1718

1819
<p>Use the following buttons to perform some basic checks on the cache</p>
1920
<p>
2021
<button id="cacheLoadAll">Display all cached images</button>
2122
<button onclick="$('#statWindow').html('');">Empty Display</button>
2223
<button id="dropCache">Empty the Cache</button>
2324
</p>
24-
<div id="statWindow" style="text-align: center; border: 5px solid; min-height: 40px;"></div>
25+
<div id="statWindow" style="text-align: center; border: 5px solid; min-height: 40px; margin: 15px;"></div>
2526

2627
<p>Images are kept in browser's Local Storage as a base64 encoded string. Below are three images and an image that links to a non-existant file so it shows the default.</p>
2728

@@ -35,13 +36,17 @@ <h1>jQuery Cache Images v1.0 Plug-in</h1>
3536

3637
<h2>Flickr Test</h2>
3738
<div>
38-
Here is a dynamic example where we will fetch a bunch of images from Flickr, dynamically insert them into the page, and they all get cached.
39-
<br />
39+
Here is a dynamic example where we will fetch a bunch of images from Flickr, dynamically insert them into the page, and they all get cached. Some of the images are restricted by a same origin policy which will generate errors in your console. But this is a configuration issue with Flickr - not the caching. Presumably you'll have control of your content and can ensure it is accessible.
40+
</div>
41+
<div style="text-align: center; margin-top: 2em;">
42+
<label for="FlickrTags">Search Tags</label>
43+
<input type="text" id="FlickrTags" value="goat,pasture" />
4044
<button id="FlickrTest">Load Some Flickr Images</button>
45+
<button onclick="$('#flickrTest').html('');">Empty Display</button>
4146
</div>
4247

4348

44-
<div id="flickrTest">
49+
<div id="flickrTest" style="text-align: center; border: 5px solid; min-height: 40px; margin: 15px;">
4550

4651
</div>
4752

@@ -53,11 +58,14 @@ <h2>Flickr Test</h2>
5358
$(document).on('click','#dropCache', function(){ cacheImagesDrop(); });
5459
$(document).on('click','#cacheLoadAll', function(){ cacheImagesShowAll( $('#statWindow') ); });
5560
$(document).on('click','#FlickrTest', function(){
61+
if( $('#FlickrTags').val() === ''){
62+
$('#FlickrTags').val('goat,pasture');
63+
}
5664
var jxhr = $.ajax( 'http://api.flickr.com/services/feeds/photos_public.gne?tags=paris,church&lang=en-us&format=json',
5765
{ type: 'get',
5866
dataType: 'jsonp',
5967
jsonpCallback: 'jsonFlickrFeed',
60-
data: {'tags': 'goat,pasture',
68+
data: {'tags': $('#FlickrTags').val(),
6169
'lang': 'en-us',
6270
'format': 'json'},
6371
})

0 commit comments

Comments
 (0)