Permalink
Browse files

* image descriptions now shown

* removed mouse wheel plugin from example
* changed style of album title
  • Loading branch information...
1 parent 77536e2 commit 299eeb606cbc6a3da7df3b0c64d1312b7fce62b8 @alanhamlett committed Jan 16, 2012
Showing with 27 additions and 18 deletions.
  1. +0 −1 example.html
  2. +2 −2 jquery.picasagallery-1.0.0.css
  3. +25 −15 jquery.picasagallery-1.0.0.js
View
@@ -6,7 +6,6 @@
<link href="http://ahamlett.com/fancybox/jquery.fancybox-1.3.1.css" rel="stylesheet" type="text/css" />
<link href="./jquery.picasagallery-1.0.0.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script>
- <script src="http://ahamlett.com/fancybox/jquery.mousewheel-3.0.2.pack.js" type="text/javascript"></script>
<script src="http://ahamlett.com/fancybox/jquery.fancybox-1.3.1.js" type="text/javascript"></script>
<script src="./jquery.picasagallery-1.0.0.js" type="text/javascript"></script>
<script type="text/javascript">
@@ -12,8 +12,8 @@
text-decoration: underline;
}
.picasagallery_title {
- margin: 0px 10px 10px 10px; /* top right bottom left */
- font-size: 12pt;
+ margin: 10px 10px 10px 10px; /* top right bottom left */
+ font-size: 13pt;
}
.picasagallery_album {
float: left;
@@ -40,7 +40,7 @@
// restore album list from hidden div if exists
if(data.loaded) {
$this.children('div:last').html('loading...').hide();
- $this.children('p:first').text('Photo Gallery');
+ $this.children('span[class="picasagallery_title"]:first').html('');
$this.children('div:first').show();
busy = false;
return;
@@ -56,13 +56,13 @@
$.getJSON(url, 'callback=?', function(json) {
// initialize album html content
- $this.html("<p class='picasagallery_header'>Photo Gallery</p><div></div><div></div>");
+ $this.html("<span class='picasagallery_header'>Photo Gallery</span><span class='picasagallery_title'></span><div></div><div></div>");
$this.children('div:last').hide();
- $this.children('p:first').click(picasagallery_load_albums);
+ $this.children('span[class="picasagallery_header"]:first').click(picasagallery_load_albums);
// loop through albums
for(i = 0; i < json.feed.entry.length; i++) {
- var album_title = json.feed.entry[i].title.$t;
+ var album_title = htmlencode(json.feed.entry[i].title.$t);
// skip this album if in hide_albums array
if($.inArray(album_title, data.hide_albums) > -1) {
@@ -104,29 +104,32 @@
// initialize album html content
dom.children('div:last').html('loading...').show();
dom.children('div:first').hide();
- dom.children('p:first').text('Back To Album List');
// make ajax call to get album's images
$.getJSON(url, 'callback=?', function(json) {
- // add html for album's title
- dom.children('div:last').html(
- "<p class='picasagallery_title'><strong>Album:</strong> " +
- json.feed.title.$t +
- "</p>"
- );
-
+ // set album's title
+ dom.children('span[class="picasagallery_title"]:first').html('<strong>Album:</strong> ' + json.feed.title.$t);
+
+ // reset album html
+ dom.children('div:last').html('');
+
// loop through album's images
for(i = 0; i < json.feed.entry.length; i++) {
-
+
+ // get image description
+ var summary = htmlencode(json.feed.entry[i].summary.$t);
+
// add html for this image
dom.children('div:last').append(
"<a rel='picasagallery_thumbnail' class='picasagallery_thumbnail' href='" +
json.feed.entry[i].content.src +
"'><img src='" +
json.feed.entry[i].media$group.media$thumbnail[1].url +
"' alt='" +
- json.feed.entry[i].title.$t +
+ summary +
+ "' title='" +
+ summary +
"'/></a>"
);
}
@@ -140,14 +143,21 @@
'transitionOut' : 'none',
'titlePosition' : 'outside',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
- return '<span id="fancybox-title-outside">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + '<br>Hint: Use the mouse scroll wheel</span>';
+ return '<span id="fancybox-title-outside">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + '<br>' + title + '</span>';
}
});
busy = false;
});
};
+ var htmlencode = function(str) {
+ while(str.search("'") + str.search('"') + str.search("<") + str.search(">") > -4) {
+ str = str.replace("'","&#39;").replace('"', "&#34;").replace("<","&lt;").replace(">","&gt;");
+ }
+ return str;
+ }
+
var picasagallery_error = function(msg) {
if (typeof console === "undefined" || typeof console.error === "undefined") {
if( typeof console.log === "undefined" ) {

0 comments on commit 299eeb6

Please sign in to comment.