/** * jQuery RESTful Gallery - v2.0 - 5/18/2012 * http://www.flashyourweb.com/gallery2/embed_samples/g3_rest.php * * Copyright (c) 2012 "suprsidr" Wayne Patterson * License: http://www.opensource.org/licenses/mit-license.php */ (function(window, $, PhotoSwipe){ $.fn.g3rest = function(options) { var rest = $.extend({}, $.fn.g3rest.defaults, options); return this.each(function() { var el = this, pager = { page: 0, html: '' }, max = $(window).width() > $(window).height()?$(window).width():$(window).height(); // if screen width is > 1000 show fullsize else resize max = max <= 1000?max:0; $(window).hashchange( function(){ if(location.hash.indexOf('page') > -1){ var parts = location.hash.replace('#', '/').split('/page/'); getItems(rest.url + parts[0], {output: 'jsonp', scope: 'direct', page: parseInt(parts[1]) - 1}); } else if (location.hash != '') { getItems(rest.url + location.hash.replace('#', '/'), {output: 'jsonp', scope: 'direct', page: 0}); } else { getItems(rest.url + '/item/' + rest.initial, {output: 'jsonp', scope: 'direct', page: 0}); } }) setup(rest.key); // setup any further ajax requests to use these params function setup(key){ $(el).empty().append($('
').addClass('ajax-title').append('

')) .append($('