Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

jquery picasa, cookie, and disqus

  • Loading branch information...
commit d530f9b596d97b2440648f566c2663e43f9cb1dd 1 parent 6444f6a
@lancejpollard authored
View
2  README.markdown
@@ -61,6 +61,8 @@ The source of the [Cached Commons](http://cachedcommons.org) is [here](http://gi
- [JSBeautifier](http://jsbeautifier.org/)
- [jQuery Globalization](http://github.com/nje/jquery-glob)
- [Sencha](http://www.sencha.com/)
+- http://www.w3avenue.com/2010/07/26/jqueryrotate-cross-browser-image-rotation/
+- http://github.com/technoweenie/jquery.doubletap
## Tests
View
4 _source/posts/libraries/jquery.textile
@@ -17,6 +17,10 @@ title: JQuery and Plugins
* "JQuery Autoscroll (scrolling, animation, mouse wheel)":/javascripts/jquery/jquery.autoScroll.js
** "Home":http://jdsharp.us/jQuery/plugins/AutoScroll/
** "Demos":http://jdsharp.us/jQuery/plugins/AutoScroll/demo.php
+* "JQuery Disqus (comments, disqus)":/javascripts/jquery/jquery.disqus.js
+** "Home":http://viatropos.com/blog/jquery-disqus-plugin
+* "JQuery Picasa (picasa, images)":/javascripts/jquery/jquery.picasa.js
+** "Home":http://viatropos.com/blog/picasa-jquery-plugin
* "JQuery BlockUI (modal, popup, ui, alert)":/javascripts/jquery/jquery.blockUI-2.33.js
** "Home":http://jquery.malsup.com/block/
** "Demos":http://jquery.malsup.com/block/#demos
View
2  _source/public/javascripts/application.js
@@ -189,6 +189,6 @@ $(document).ready(function() {
if (hash && hash != "") {
hash = hash.match(/-post$/) ? hash : (hash + "-post");
alert(hash);
- window.location.hash = hash;
+ window.location.hash = hash + "-post";
}
});
View
1  javascripts/jquery/jquery.class-min.js
@@ -0,0 +1 @@
+(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(g){var f=this.prototype;a=true;var e=new this();a=false;for(var d in g){e[d]=typeof g[d]=="function"&&typeof f[d]=="function"&&b.test(g[d])?(function(h,i){return function(){var k=this._super;this._super=f[h];var j=i.apply(this,arguments);this._super=k;return j}})(d,g[d]):g[d]}function c(){if(!a&&this.init){this.init.apply(this,arguments)}}c.prototype=e;c.constructor=c;c.extend=arguments.callee;return c}})();
View
1  javascripts/jquery/jquery.classy-min.js
@@ -0,0 +1 @@
+(function(){var a=false,c=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;jQuery.Class=function(){};jQuery.Class.create=function(h){var g=this.prototype;a=true;var f=new this();a=false;for(var e in h){f[e]=typeof h[e]=="function"&&typeof g[e]=="function"&&c.test(h[e])?(function(i,j){return function(){var l=this._super;this._super=g[i];var k=j.apply(this,arguments);this._super=l;return k}})(e,h[e]):h[e]}function d(){if(!a&&d.prototype.init){return d.prototype.init.apply(this,arguments)}}d.prototype=f;d.prototype.constructor=d;d.extend=arguments.callee;return d};jQuery.querySelectorAll=function(){return jQuery.apply(jQuery,arguments)};jQuery.querySelector=function(){return jQuery.querySelectorAll.apply(jQuery,arguments)[0]};jQuery.fn.forEach=function(d){return this.each(function(e){d(this,e)})};jQuery.fn.attach=function(e){var d=e.attach||(new e).attach||function(){};return this.forEach(function(f){d.call(e,f)})};jQuery.DOM=b(["prepend","append",["before","insertBefore"],["after","insertAfter"],"wrap","wrapInner","wrapAll","clone","empty","remove","replaceWith",["removeAttr","removeAttribute"],["addClass","addClassName"],["hasClass","hasClassName"],["removeClass","removeClassName"],["offset","getOffset"]],[["text","Text"],["html","HTML"],["attr","Attribute"],["val","Value"],["height","Height"],["width","Width"],["css","CSS"]]);jQuery.Traverse=b([["children","getChildElements"],["find","getDescendantElements"],["next","getNextSiblingElements"],["nextAll","getAllNextSiblingElements"],["parent","getParentElements"],["parents","getAncestorElements"],["prev","getPreviousSiblingElements"],["prevAll","getAllPreviousSiblingElements"],["siblings","getSiblingElements"],["filter","filterSelector"]]);jQuery.Events=b([["bind","addEventListener"],["unbind","removeEventListener"],["trigger","triggerEvent"],"hover","toggle"]);jQuery.fn.buildAnimation=function(e){var d=this;return{start:function(){d.animate(e)},stop:function(){d.stop()}}};jQuery.Effects=b(["show","hide","toggle","buildAnimation","queue","dequeue"]);jQuery.fn.ajax=jQuery.ajax;jQuery.Ajax=b([["ajax","request"],["load","loadAndInsert"],["ajaxSetup","setup"],["serialize","getSerializedString"],["serializeArray","getSerializedArray"]]);function b(e,d){var f={};jQuery.each(d||[],function(h,g){if(!(g instanceof Array)){g=[g,g]}e.push([g[0],"get"+g[1]],[g[0],"set"+g[1]])});jQuery.each(e,function(h,g){var j=g;if(g instanceof Array){j=g[1];g=g[0]}f[j]=jQuery.Class.create({init:function(){var i=Array.prototype.slice.call(arguments);if(this.constructor==f[j]){this.arguments=i}else{return f[j].prototype.attach.apply(f[j],i)}},arguments:[],attach:function(l){var i=arguments.length==1?this.arguments:Array.prototype.slice.call(arguments,1);if(i.length){var k=i[i.length-1];if(typeof k=="function"){i[i.length-1]=function(){var m=Array.prototype.slice.call(arguments);return k.apply(this,[this].concat(m))}}}return jQuery.fn[g].apply(jQuery(l),i)}})});return f}})();
View
1  javascripts/jquery/jquery.cookie-min.js
@@ -0,0 +1 @@
+jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};
View
1  javascripts/jquery/jquery.disqus-min.js
@@ -0,0 +1 @@
+(function(a){function d(e){return a("<div />").html(e).text()}function c(e){return a("<div />").text(e).html()}function b(f){var e=f.substring(0,4).toLowerCase().match(/<br\/?>/);if(e){f=f.substring(e[0].length,f.length-1);return b(f)}else{return f}}a.fn.disqus=function(e){if(a(this).get(0)==null){return}var e=a.extend({domain:"",title:"",message:"",url:window.location.href,developer:0,no_style:false,iframe_css:null,ready:null,added:null,markdown:false,prettify:false,show_count:false,interval:100},e);window.disqus_no_style=e.no_style;window.disqus_iframe_css=disqus_iframe_css=e.iframe_css;disqus_developer=e.developer;disqus_container_id=this.attr("id");disqus_url=e.url;disqus_title=e.title;disqus_message=e.message;this.empty();var g=a(this);if(e.markdown==true){if(!("AttackLab" in window)){}}if(e.prettify==true){if(!("prettyPrint" in window)){}}a.ajax({type:"GET",url:"http://"+e.domain+".disqus.com/embed.js",dataType:"script",cache:true});if(e.show_count==true){var f=a("<a id='dsq-comment-count-for-this' class='dsq-comment-count' style='display:none;' href='"+window.location.href+"'>");f.appendTo(a("body")).disqusLink(e.domain)}a.disqus.ready(function(){if(e.ready){e.ready.apply(g)}setInterval(function(){a.disqus.added(function(h){if(e.markdown==true){a.disqus.toMarkdown(h)}if(e.added){e.added.apply(h,[h])}});a.disqus.edit(function(h){if(e.edit){e.edit.apply(h,[h])}});if(e.prettify==true){a.disqus.prettify()}})},e.interval)};a.disqus={links:function(e,f){var e=a(e);window.disqus_shortname=f;if(e.get(0)==null){return}e.each(function(i,j){var j=a(j);var g=j.attr("href").toLowerCase();var k=g.match(/^http(?:s)?:\/\//);if(!k){g=window.location.protocol+"//"+window.location.host+g}var h=g.match(/#disqus_thread/);if(!h){g+="#disqus_thread"}j.attr("href",g).addClass("dsq-comment-count")});a.ajax({type:"GET",url:"http://disqus.com/forums/"+f+"/count.js",dataType:"script",cache:true})},reactionCount:function(){var e=a("a#dsq-comment-count-for-this").html();var f=0;if(e){f=parseInt(e.match(/\d+\s+Comments\s+and\s+(\d+)\s+Reactions/i)[1])}return f},commentCount:function(){var e=a("a#dsq-comment-count-for-this").html();var f=0;if(e){f=parseInt(e.match(/(\d+)\s+Comments\s+and\s+\d+\s+Reactions/i)[1])}return f},ready:function(g){var f=100;var e=setInterval(function(){var h=a("#dsq-comments-title").get(0)!=null;if(h){clearInterval(e);g()}},f)},added:function(f){var e=a(".dsq-comment-message:not(.processed)");if(e.get(0)){f(e)}},edit:function(f){var e=a(".dsq-edit-textarea:not(.processed)");if(e.get(0)){e.val(e.val().replace(/<br>/g,"\n"));e.addClass("processed");f(e)}},toMarkdown:function(e){e.each(function(h,j){j=a(j);var l=j.html();var k=new Attacklab.showdown.converter();var f;try{f=l.match(/([\s\n]+)/)[1];l=l.substring(Math.max(0,f.length-1),l.length-1)}catch(g){}l=l.replace(/<br>(<br>+)?(\s+)?/g,"\n$1$2").replace(/\n<br>/g,"\n\n");l=k.makeHtml(l);l=a("<div>"+l+"</div>");var i=false;a("code",l).replaceWith(function(){var m=a(this).html();if(m){return"<code>"+c(m).replace(/&amp;/g,"&").replace(/&amp;/g,"&")+"</code>"}else{return""}});j.html(l.children());j.addClass("processed")})},prettify:function(){if(a("pre:not(.prettyprint)").get(0)){var e=a("pre");e.each(function(){var f=a(this);if(f.hasClass("prettyprint")){f.removeClass("prettyprint")}else{f.addClass("prettyprint");var h=b(a("code",this).html());try{}catch(g){}f.html("<code>"+h+"</code>");changed=true}});prettyPrint();e.addClass("prettyprint")}}};a.fn.disqusLink=function(e){return a.disqus.links(this,e)}})(jQuery);
View
272 javascripts/jquery/jquery.disqus.js
@@ -1,63 +1,53 @@
/**
* jQuery Disqus Plugin
- * ====================
*
- * $Id: jquery.disqus.js,v 1.1.2.5 2009/07/20 16:35:11 robloach Exp $
- *
- * Copyright (c) 2009 Rob Loach (http://robloach.net)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright (c) 2010 Lance Pollard (@viatropos)
+ * Licensed under the MIT (MIT-LICENSE.txt)
+ * Based off Rob Loach's jquery disqus plugin (http://robloach.net)
*/
-
-/*
- * Usage
- * -----
- *
- * Display all the comments for an article:
- * <div id="disqus_thread"><a href="http://MYDOMAINNAME.disqus.com/?url=ref">Discuss this topic on Disqus.</a></div>
- *
- * $('#disqus_thread').disqus({
- * domain: 'MYDOMAINNAME', // REQUIRED
- * title: 'The title of the article',
- * message: 'A short description of the article.'
- * url: 'http://example.com/myarticle.html',
- * developer: 1 // 0 if production.
- * });
- *
- * Display the number of comments in a link:
- * <a href="/myarticle.html#disqus_thread">Comments</a>
- *
- * $.disqusLinks('MYDOMAINNAME');
- */
-(function(jQuery) {
- /**
- * Displays the comments for an article in the given element.
- *
- * <div id="disqus_thread"><a href="http://MYDOMAINNAME.disqus.com/?url=ref">Discuss this topic on Disqus.</a></div>
- *
- * $('#disqus_thread').disqus({
- * domain: 'MYDOMAINNAME', // REQUIRED
- * title: 'The title of the article',
- * message: 'A short description of the article.'
- * url: 'http://example.com/myarticle.html',
- * developer: 1 // 0 if production.
- * });
- */
- jQuery.fn.disqus = function(options) {
-
+(function($) {
+
+ function unescapeHTML(html) {
+ return $("<div />").html(html).text();
+ }
+ function escapeHTML(html) {
+ return $("<div />").text(html).html();
+ }
+ function removeBreaks(text) {
+ var match = text.substring(0, 4).toLowerCase().match(/<br\/?>/);
+ if (match) {
+ text = text.substring(match[0].length, text.length - 1);
+ return removeBreaks(text);
+ } else {
+ return text;
+ }
+ }
+
+ $.fn.disqus = function(options) {
+ if ($(this).get(0) == null) {
+ return;
+ }
// Merge in the default options.
- var options = jQuery.extend({
+ var options = $.extend({
domain: '',
title: '',
message: '',
url: window.location.href,
developer: 0,
- no_style: false
+ no_style: false,
+ iframe_css: null,
+ ready: null,
+ added: null,
+ markdown: false,
+ prettify: false,
+ show_count: false,
+ interval: 100 // how often we should check to see if disqus is ready
}, options);
-
+
// Set the options for Disqus and prepare the element.
window.disqus_no_style = options.no_style; // document.write causes a whitescreen so prevent it.
- // var disqus_iframe_css = "http://www.my-blog-url.com/disqus-form.css";
+
+ window.disqus_iframe_css = disqus_iframe_css = options.iframe_css;
disqus_developer = options.developer;
disqus_container_id = this.attr('id');
disqus_url = options.url;
@@ -65,37 +55,185 @@
disqus_message = options.message;
this.empty();
+ var comments = $(this);
+
+ if (options.markdown == true) {
+ if (!("AttackLab" in window)) {
+ // $.getScript();
+ }
+ }
+ if (options.prettify == true) {
+ if (!("prettyPrint" in window)) {
+ // $.getScript();
+ }
+ }
+
// Make the AJAX call to Disqus for the comments.
- jQuery.ajax({
+ $.ajax({
type: 'GET',
- url: 'http://martini.disqus.com/embed.js',
+ url: 'http://' + options.domain + '.disqus.com/embed.js',
dataType: 'script',
cache: true
});
- };
- /**
- * Processes the comment links.
- *
- * <a href="http://example.com/myarticle.html#disqus_thread">Comments</a>
- *
- * $.disqusLinks('MYDOMAINNAME');
- */
- jQuery.disqusLinks = function(domain) {
- // Create the query.
- var query = '?';
- jQuery("a[href$='#disqus_thread']").each(function(i) {
- query += 'url' + i + '=' + encodeURIComponent($(this).attr('href')) + '&';
- });
- // Make sure we are actually processing some links.
- if (query.length > 2) {
+ if (options.show_count == true) {
+ var link = $("<a id='dsq-comment-count-for-this' class='dsq-comment-count' style='display:none;' href='" + window.location.href + "'>");
+ link.appendTo($("body")).disqusLink(options.domain);
+ }
+
+ $.disqus.ready(function() {
+ if (options.ready) {
+ options.ready.apply(comments);
+ }
+ setInterval(function() {
+ $.disqus.added(function(comments) {
+ if (options.markdown == true) {
+ $.disqus.toMarkdown(comments);
+ }
+ if (options.added) {
+ options.added.apply(comments, [comments]);
+ }
+ });
+ $.disqus.edit(function (textarea) {
+ if (options.edit) {
+ options.edit.apply(textarea, [textarea]);
+ }
+ });
+ if (options.prettify == true) {
+ $.disqus.prettify();
+ }
+ });
+ }, options.interval);
+ };
+ $.disqus = {
+ links: function(links, domain) {
+ var links = $(links);
+
+ // Create the query.
+ window.disqus_shortname = domain;
+
+ if (links.get(0) == null)
+ return;
+
+ links.each(function(index, element) {
+ var element = $(element);
+ var href = element.attr("href").toLowerCase();
+ var absolute = href.match(/^http(?:s)?:\/\//);
+ if (!absolute) {
+ href = window.location.protocol + "//" + window.location.host + href;
+ }
+ var hasHash = href.match(/#disqus_thread/);
+ if (!hasHash) {
+ href += "#disqus_thread";
+ }
+ element.attr("href", href).addClass("dsq-comment-count");
+ });
// Make the AJAX call to get the number of comments.
- jQuery.ajax({
+ $.ajax({
type: 'GET',
- url: 'http://disqus.com/forums/' + domain + '/get_num_replies.js' + query,
+ url: 'http://disqus.com/forums/' + domain + '/count.js',
dataType: 'script',
cache: true
});
+ },
+
+ reactionCount: function() {
+ var string = $("a#dsq-comment-count-for-this").html();
+ var count = 0;
+ if (string)
+ count = parseInt(string.match(/\d+\s+Comments\s+and\s+(\d+)\s+Reactions/i)[1]);
+ return count;
+ },
+
+ commentCount: function() {
+ var string = $("a#dsq-comment-count-for-this").html();
+ var count = 0;
+ if (string)
+ count = parseInt(string.match(/(\d+)\s+Comments\s+and\s+\d+\s+Reactions/i)[1]);
+ return count;
+ },
+
+ ready: function(callback) {
+ var interval = 100;
+ var check_disqus = setInterval(function() {
+ var disqusLoaded = $("#dsq-comments-title").get(0) != null;
+ if (disqusLoaded) {
+ clearInterval(check_disqus);
+ callback();
+ }
+ }, interval)
+ },
+
+ added: function(callback) {
+ var comments = $(".dsq-comment-message:not(.processed)");
+ if (comments.get(0)) {
+ callback(comments);
+ }
+ },
+
+ edit: function(callback) {
+ var textarea = $(".dsq-edit-textarea:not(.processed)");
+ if (textarea.get(0)) {
+ textarea.val(textarea.val().replace(/<br>/g, "\n"));
+ textarea.addClass("processed");
+ callback(textarea);
+ }
+ },
+
+ toMarkdown: function(comments) {
+ comments.each(function(index, element) {
+ element = $(element);
+ var text = element.html();
+ var converter = new Attacklab.showdown.converter();
+ var spaces;
+ try {
+ spaces = text.match(/([\s\n]+)/)[1];
+ text = text.substring(Math.max(0, spaces.length - 1), text.length - 1);
+ } catch (error) {}
+
+ text = text.replace(/<br>(<br>+)?(\s+)?/g, "\n$1$2").replace(/\n<br>/g, "\n\n")
+ // text = text.replace(/\<br\>/g, "\n");
+
+ text = converter.makeHtml(text);
+ text = $("<div>" + text + "</div>");
+ var right = false;
+ $("code", text).replaceWith(function() {
+ var html = $(this).html();
+ if (html) {
+ return "<code>" + escapeHTML(html).replace(/&amp;/g, "&").replace(/&amp;/g, "&") + "</code>";
+ } else {
+ return "";
+ }
+ });
+
+ element.html(text.children());
+ element.addClass("processed");
+ });
+ },
+
+ prettify: function() {
+ if ($("pre:not(.prettyprint)").get(0)) {
+ var codes = $("pre");
+ codes.each(function() {
+ var code = $(this);
+ if (code.hasClass("prettyprint")) {
+ code.removeClass("prettyprint");
+ } else {
+ code.addClass("prettyprint");
+ var text = removeBreaks($("code", this).html());
+ try {
+ //$("br", code).replaceWith("\n");
+ } catch (e) {}
+ code.html("<code>" + text + "</code>");
+ changed = true;
+ }
+ });
+ prettyPrint();
+ codes.addClass("prettyprint");
+ }
}
+ }
+ $.fn.disqusLink = function(domain) {
+ return $.disqus.links(this, domain);
};
})(jQuery);
View
1  javascripts/jquery/jquery.picasa-min.js
@@ -0,0 +1 @@
+(function(a){a.picasa={albums:function(b,d){var c="http://picasaweb.google.com/data/feed/base/user/:user_id?alt=json&kind=album&hl=en_US&access=visible&fields=entry(id,media:group(media:content,media:description,media:keywords,media:title))&callback=?";c=c.replace(/:user_id/,b);a.getJSON(c,function(g){var e=null;var f=[];a.each(g.feed.entry,function(j,h){e={id:h.id["$t"].split("?")[0].split("albumid/")[1],title:h["media$group"]["media$title"]["$t"],description:h["media$group"]["media$description"]["$t"],thumb:h["media$group"]["media$content"][0]["url"],};e.images=function(i){a.picasa.images(b,e.id,i)};f.push(e)});d(f)})},images:function(d,c,g){var e="http://picasaweb.google.com/data/feed/base/user/:user_id/albumid/:album_id?alt=json&kind=photo&hl=en_US&fields=entry(title,gphoto:numphotos,media:group(media:content,media:thumbnail))&callback=?";e=e.replace(/:user_id/,d).replace(/:album_id/,c);var f=null;var b=[];a.getJSON(e,function(h){a.each(h.feed.entry,function(k,j){f=j["media$group"]["media$content"][0];f.title=j.title["$t"];f.thumbs=[];a.each(j["media$group"]["media$thumbnail"],function(i,l){f.thumbs.push(l)});b.push(f)});g(b)})}};a.fn.picasaAlbums=function(b,c){a.picasa.albums(b,function(d){if(c){c(d)}})};a.fn.picasaGallery=function(c,b,e){var d=a(this);a.picasa.images(c,b,function(f){if(e){e(f)}else{var g="<ul class='picasa-album'>\n";a.each(f,function(j,h){g+=" <li class='picasa-image'>\n";g+=" <a class='picasa-image-large' href='"+h.url+"'>\n";g+=" <img class='picasa-image-thumb' src='"+h.thumbs[1].url+"'/>\n";g+=" </a>\n";g+=" </li>\n"});g+="</ul>";d.append(g)}})}})(jQuery);
View
72 javascripts/jquery/jquery.picasa.js
@@ -0,0 +1,72 @@
+(function($) {
+ $.picasa = {
+ albums: function(user, callback) {
+ var url = "http://picasaweb.google.com/data/feed/base/user/:user_id?alt=json&kind=album&hl=en_US&access=visible&fields=entry(id,media:group(media:content,media:description,media:keywords,media:title))&callback=?";
+ url = url.replace(/:user_id/, user);
+ $.getJSON(url, function(data) {
+ var album = null;
+ var albums = [];
+ $.each(data.feed.entry, function(i, element) {
+ album = {
+ id: element.id["$t"].split("?")[0].split("albumid/")[1],
+ title: element["media$group"]["media$title"]["$t"],
+ description: element["media$group"]["media$description"]["$t"],
+ thumb: element["media$group"]["media$content"][0]["url"],
+ }
+ album.images = function(callback) {
+ $.picasa.images(user, album.id, callback);
+ }
+ albums.push(album);
+ });
+ callback(albums);
+ });
+ },
+
+ images: function(user, album, callback) {
+ var url = "http://picasaweb.google.com/data/feed/base/user/:user_id/albumid/:album_id?alt=json&kind=photo&hl=en_US&fields=entry(title,gphoto:numphotos,media:group(media:content,media:thumbnail))&callback=?";
+ url = url.replace(/:user_id/, user).replace(/:album_id/, album);
+ var image = null;
+ var images = [];
+ $.getJSON(url, function(data) {
+ $.each(data.feed.entry, function(i, element) {
+ image = element["media$group"]["media$content"][0];
+ image.title = element.title["$t"];
+ image.thumbs = [];
+ $.each(element["media$group"]["media$thumbnail"], function(j, j_element) {
+ image.thumbs.push(j_element);
+ });
+ images.push(image);
+ });
+ callback(images);
+ });
+ }
+ };
+
+ $.fn.picasaAlbums = function(user, callback) {
+ $.picasa.albums(user, function(images) {
+ if (callback) {
+ callback(images);
+ }
+ });
+ };
+
+ $.fn.picasaGallery = function(user, album, callback) {
+ var scope = $(this);
+ $.picasa.images(user, album, function(images) {
+ if (callback) {
+ callback(images);
+ } else {
+ var picasaAlbum = "<ul class='picasa-album'>\n";
+ $.each(images, function(i, element) {
+ picasaAlbum += " <li class='picasa-image'>\n";
+ picasaAlbum += " <a class='picasa-image-large' href='" + element.url + "'>\n";
+ picasaAlbum += " <img class='picasa-image-thumb' src='" + element.thumbs[1].url + "'/>\n";
+ picasaAlbum += " </a>\n";
+ picasaAlbum += " </li>\n";
+ });
+ picasaAlbum += "</ul>";
+ scope.append(picasaAlbum);
+ }
+ });
+ }
+})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.