vishwamano

source of vishwamano.com
git clone git://git.ricketyspace.net/vishwamano.git
Log | Files | Refs

commit f7a57d10f077f0d99171e2b022b8d5e0bab08a40
parent 422fd4662387f13bca48c9c42853479caaf7f4cb
Author: rsiddharth <rsiddharth@ninthfloor.org>
Date:   Sun, 27 Mar 2016 17:43:33 +0000

Use un-minified photoset-grid.

Diffstat:
themes/bs3/Makefile | 2+-
themes/bs3/js/vm.min.js | 506++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 505 insertions(+), 3 deletions(-)

diff --git a/themes/bs3/Makefile b/themes/bs3/Makefile @@ -7,7 +7,7 @@ CUSTOM_CSS_OUT = css/custom.min.css CUSTOM_CSS_IN = css/custom.css JS_MIN_OUT = js/vm.min.js -JS_MIN_IN = js/jquery-1.11.3.min.js js/bootstrap.min.js js/vegas/vegas.min.js js/jquery-photoset-grid/jquery.photoset-grid.min.js js/jquery-colorbox/jquery.colorbox-min.js +JS_MIN_IN = js/jquery-1.11.3.min.js js/bootstrap.min.js js/vegas/vegas.min.js js/jquery-photoset-grid/jquery.photoset-grid.js js/jquery-colorbox/jquery.colorbox-min.js all: $(CSS_MIN_OUT) $(JS_MIN_OUT) diff --git a/themes/bs3/js/vm.min.js b/themes/bs3/js/vm.min.js @@ -23,13 +23,515 @@ d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector //# sourceMappingURL=vegas.min.js.map /** * photoset-grid - v1.0.1 - * 2014-12-03 + * 2014-04-08 * jQuery plugin to arrange images into a flexible grid * http://stylehatch.github.com/photoset-grid/ * * Copyright 2014 Jonathan Moore - Style Hatch */ -!function(a,b,c,d){"use strict";function e(b,c){this.element=b,this.options=a.extend({},g,c),this._defaults=g,this._name=f,this.init()}var f="photosetGrid",g={width:"100%",gutter:"0px",highresLinks:!1,lowresWidth:500,rel:"",borderActive:!1,borderWidth:"5px",borderColor:"#000000",borderRadius:"0",borderRemoveDouble:!1,onInit:function(){},onComplete:function(){}};e.prototype={init:function(){this.options.onInit(),this._setupRows(this.element,this.options),this._setupColumns(this.element,this.options)},_callback:function(a){this.options.onComplete(a)},_setupRows:function(b,c){if(c.layout)this.layout=c.layout;else if(a(b).attr("data-layout"))this.layout=a(b).attr("data-layout");else{for(var d="",e=1,f=0;f<a(b).find("img").length;f++)d+=e.toString();this.layout=d}this.rows=this.layout.split("");for(var g in this.rows)this.rows[g]=parseInt(this.rows[g],10);var h=a(b).find("img"),i=0;a.each(this.rows,function(a,b){var c=i,d=i+b;h.slice(c,d).wrapAll('<div class="photoset-row cols-'+b+'"></div>'),i=d}),a(b).find(".photoset-row:not(:last-child)").css({"margin-bottom":c.gutter})},_setupColumns:function(c,d){var e=this,f=function(e){function f(){var b=a(c).width().toString();b!==a(c).attr("data-width")&&(g.each(function(){var b=a(this).find("img:eq(0)");a(this).find("img").each(function(){var c=a(this);c.attr("height")<b.attr("height")&&(b=a(this)),parseInt(c.css("width"),10)>d.lowresWidth&&c.attr("data-highres")&&c.attr("src",c.attr("data-highres"))});var c=b.attr("height")*parseInt(b.css("width"),10)/b.attr("width"),e=Math.floor(.025*c);a(this).height(c-e),d.borderActive&&a(this).find(".photoset-content-border").each(function(){a(this).css({height:c-e})}),a(this).find("img").each(function(){var b=a(this).attr("height")*parseInt(a(this).css("width"),10)/a(this).attr("width"),d=.5*(c-b)+"px";a(this).css({"margin-top":d})})}),a(c).attr("data-width",b))}var g=a(c).find(".photoset-row"),h=a(c).find("img");d.highresLinks?(h.each(function(){var b;b=a(this).attr(a(this).attr("data-highres")?"data-highres":"src"),a(this).wrapAll('<a href="'+b+'" class="photoset-cell highres-link" />'),d.borderActive&&a(this).wrapAll('<span class="photoset-content-border" />')}),d.rel&&h.parent().attr("rel",d.rel)):h.each(function(){d.borderActive?(a(this).wrapAll('<div class="photoset-cell photoset-cell--border" />'),a(this).wrapAll('<div class="photoset-content-border" />')):a(this).wrapAll('<div class="photoset-cell" />')});var i=a(c).find(".photoset-cell"),j=a(c).find(".cols-1 .photoset-cell"),k=a(c).find(".cols-2 .photoset-cell"),l=a(c).find(".cols-3 .photoset-cell"),m=a(c).find(".cols-4 .photoset-cell"),n=a(c).find(".cols-5 .photoset-cell"),o=a(c).find(".photoset-content-border");a(c).css({width:d.width}),g.css({clear:"left",display:"block",overflow:"hidden"}),i.css({"float":"left",display:"block","line-height":"0","-webkit-box-sizing":"border-box","-moz-box-sizing":"border-box","box-sizing":"border-box"}),h.css({width:"100%",height:"auto"}),d.borderActive&&o.css({display:"block",border:d.borderWidth+" solid "+d.borderColor,"border-radius":d.borderRadius,overflow:"hidden","-webkit-box-sizing":"border-box","-moz-box-sizing":"border-box","box-sizing":"border-box"}),e&&h.each(function(){a(this).attr("height",a(this).height()),a(this).attr("width",a(this).width())}),j.css({width:"100%"}),k.css({width:"50%"}),l.css({width:"33.3%"}),m.css({width:"25%"}),n.css({width:"20%"});var p=parseInt(d.gutter,10);a(c).find(".photoset-cell:not(:last-child)").css({"padding-right":p/2+"px"}),a(c).find(".photoset-cell:not(:first-child)").css({"padding-left":p/2+"px"}),d.borderRemoveDouble&&(a(c).find(".photoset-row").not(":eq(0)").find(".photoset-content-border").css({"border-top":"none"}),a(c).find(".photoset-row").not(".cols-1").find(".photoset-content-border").not(":eq(0)").css({"border-left":"none"})),f(),a(b).on("resize",function(){f()})},g=!0,h=!0;a(c).find("img").each(function(){h&=!!a(this).attr("height")&!!a(this).attr("width")}),g=!h,g?a(c).imagesLoaded(function(){f(g),e._callback(c)}):(f(g),e._callback(c))}},a.fn[f]=function(b){return this.each(function(){a.data(this,"plugin_"+f)||a.data(this,"plugin_"+f,new e(this,b))})};var h="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";a.fn.imagesLoaded=function(b){function c(){var c=a(m),d=a(n);i&&(n.length?i.reject(k,c,d):i.resolve(k)),a.isFunction(b)&&b.call(g,k,c,d)}function e(a){f(a.target,"error"===a.type)}function f(b,d){b.src!==h&&-1===a.inArray(b,l)&&(l.push(b),d?n.push(b):m.push(b),a.data(b,"imagesLoaded",{isBroken:d,src:b.src}),j&&i.notifyWith(a(b),[d,k,a(m),a(n)]),k.length===l.length&&(setTimeout(c),k.unbind(".imagesLoaded",e)))}var g=this,i=a.isFunction(a.Deferred)?a.Deferred():0,j=a.isFunction(i.notify),k=g.find("img").add(g.filter("img")),l=[],m=[],n=[];return a.isPlainObject(b)&&a.each(b,function(a,c){"callback"===a?b=c:i&&i[a](c)}),k.length?k.bind("load.imagesLoaded error.imagesLoaded",e).each(function(b,c){var e=c.src,g=a.data(c,"imagesLoaded");return g&&g.src===e?void f(c,g.isBroken):c.complete&&c.naturalWidth!==d?void f(c,0===c.naturalWidth||0===c.naturalHeight):void((c.readyState||c.complete)&&(c.src=h,c.src=e))}):c(),i?i.promise(g):g};var i,j,k,l=a.event,m={_:0},n=0;i=l.special.throttledresize={setup:function(){a(this).on("resize",i.handler)},teardown:function(){a(this).off("resize",i.handler)},handler:function(b,c){var d=this,e=arguments;j=!0,k||(setInterval(function(){n++,(n>i.threshold&&j||c)&&(b.type="throttledresize",l.dispatch.apply(d,e),j=!1,n=0),n>9&&(a(m).stop(),k=!1,n=0)},30),k=!0)},threshold:0}}(jQuery,window,document); + + /*jshint browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict: true, undef: true, devel: true */ +;(function ( $, window, document, undefined ) { + + 'use strict'; + + // Plugin name and default settings + var pluginName = "photosetGrid", + defaults = { + // Required + // set the width of the container + width : '100%', + // the space between the rows / columns + gutter : '0px', + + // Optional + // wrap the images in a vs. div and link to the data-highres images + highresLinks : false, + // threshold for the lowres image, if container is > swap the data-highres + lowresWidth : 500, + // relational attr to apply to the links for lightbox use + rel : '', + + // add a border to each image + borderActive: false, + // set border width + borderWidth: '5px', + // set border color + borderColor: '#000000', + // set border radius + borderRadius: '0', + // if true it will remove "double" borders + borderRemoveDouble: false, + + // Call back events + onInit : function(){}, + onComplete : function(){} + }; + + // Plugin constructor + function Plugin( element, options ) { + this.element = element; + this.options = $.extend( {}, defaults, options ); + + this._defaults = defaults; + this._name = pluginName; + + this.init(); + } + + Plugin.prototype = { + + init: function() { + // Call the optional onInit event set when the plugin is called + this.options.onInit(); + + this._setupRows(this.element, this.options); + this._setupColumns(this.element, this.options); + + }, + + _callback: function(elem){ + // Call the optional onComplete event after the plugin has been completed + this.options.onComplete(elem); + }, + + _setupRows: function( elem, options ){ + // Convert the layout string into an array to build the DOM structures + if(options.layout) { + // Check for layout defined in plugin call + this.layout = options.layout; + } else if($(elem).attr('data-layout')) { + // If not defined in the options, check for the data-layout attr + this.layout = $(elem).attr('data-layout'); + } else { + // Otherwise give it a stacked layout (no grids for you) + // Generate a layout string of all ones based on the number of images + var stackedLayout = ""; + var defaultColumns = 1; + for (var imgs=0; imgs<$(elem).find('img').length; imgs++ ) { + stackedLayout = stackedLayout + defaultColumns.toString(); + } + this.layout = stackedLayout; + } + + // Dump the layout into a rows array + // Convert the array into all numbers vs. strings + this.rows = this.layout.split(''); + for (var i in this.rows ) { + this.rows[i] = parseInt(this.rows[i], 10); + } + + var $images = $(elem).find('img'); + var imageIndex = 0; + + $.each(this.rows, function(i, val){ + var rowStart = imageIndex; + var rowEnd = imageIndex + val; + + // Wrap each set of images in a row into a container div + $images.slice(rowStart, rowEnd).wrapAll('<div class="photoset-row cols-' + val + '"></div>'); + + imageIndex = rowEnd; + }); + + $(elem).find('.photoset-row:not(:last-child)').css({ + 'margin-bottom': options.gutter + }); + }, + + _setupColumns: function( elem, options ){ + + // Reference to this Plugin + var $this = this; + + var setupStyles = function(waitForImagesLoaded){ + var $rows = $(elem).find('.photoset-row'); + var $images = $(elem).find('img'); + + // Wrap the images in links to the highres or regular image + // Otherwise wrap in div.photoset-cell + if(options.highresLinks){ + $images.each(function(){ + var title; + // If the image has a title pass it on + if($(this).attr('title')){ + title = ' title="' + $(this).attr('title') + '"'; + } else { + title = ''; + } + var highres; + // If a highres image exists link it up! + if($(this).attr('data-highres')){ + highres = $(this).attr('data-highres'); + } else { + highres = $(this).attr('src'); + } + $(this).wrapAll('<a href="' + highres + '"' + title + ' class="photoset-cell highres-link" />'); + if(options.borderActive){ + $(this).wrapAll('<span class="photoset-content-border" />'); + } + }); + + // Apply the optional rel + if(options.rel){ + $images.parent().attr('rel', options.rel); + } + + } else { + $images.each(function(){ + if(options.borderActive){ + $(this).wrapAll('<div class="photoset-cell photoset-cell--border" />'); + $(this).wrapAll('<div class="photoset-content-border" />'); + } else { + $(this).wrapAll('<div class="photoset-cell" />'); + } + }); + } + + var $cells = $(elem).find('.photoset-cell'); + var $cols1 = $(elem).find('.cols-1 .photoset-cell'); + var $cols2 = $(elem).find('.cols-2 .photoset-cell'); + var $cols3 = $(elem).find('.cols-3 .photoset-cell'); + var $cols4 = $(elem).find('.cols-4 .photoset-cell'); + var $cols5 = $(elem).find('.cols-5 .photoset-cell'); + var $cellBorder = $(elem).find('.photoset-content-border'); + + // Apply styles initial structure styles to the grid + $(elem).css({ + 'width': options.width + }); + $rows.css({ + 'clear': 'left', + 'display': 'block', + 'overflow': 'hidden' + }); + $cells.css({ + 'float': 'left', + 'display': 'block', + 'line-height': '0', + '-webkit-box-sizing': 'border-box', + '-moz-box-sizing': 'border-box', + 'box-sizing': 'border-box' + }); + $images.css({ + 'width': '100%', + 'height': 'auto' + }); + if(options.borderActive){ + $cellBorder.css({ + 'display': 'block', + 'border': options.borderWidth + ' solid ' + options.borderColor, + 'border-radius': options.borderRadius, + 'overflow': 'hidden', + '-webkit-box-sizing': 'border-box', + '-moz-box-sizing': 'border-box', + 'box-sizing': 'border-box' + }); + } + + // if the imaged did not have height/width attr set them + if (waitForImagesLoaded) { + $images.each(function(){ + $(this).attr('height', $(this).height()); + $(this).attr('width', $(this).width()); + }); + } + + // Set the width of the cells based on the number of columns in the row + $cols1.css({ 'width': '100%' }); + $cols2.css({ 'width': '50%' }); + $cols3.css({ 'width': '33.3%' }); + $cols4.css({ 'width': '25%' }); + $cols5.css({ 'width': '20%' }); + + + var gutterVal = parseInt(options.gutter, 10); + // Apply 50% gutter to left and right + // this provides equal gutters a high values + $(elem).find('.photoset-cell:not(:last-child)').css({ + 'padding-right': (gutterVal / 2) + 'px' + }); + $(elem).find('.photoset-cell:not(:first-child)').css({ + 'padding-left': (gutterVal / 2) + 'px' + }); + + // If 'borderRemoveDouble' is true, let us remove the extra gutter border + if(options.borderRemoveDouble){ + $(elem).find('.photoset-row').not(':eq(0)').find('.photoset-content-border').css({'border-top': 'none'}); + $(elem).find('.photoset-row').not('.cols-1').find('.photoset-content-border').not(":eq(0)").css({'border-left': 'none'}); + } + + function resizePhotosetGrid(){ + + // Give the values a floor to prevent misfires + var w = $(elem).width().toString(); + + if( w !== $(elem).attr('data-width') ) { + $rows.each(function(){ + var $shortestImg = $(this).find('img:eq(0)'); + + $(this).find('img').each(function(){ + var $img = $(this); + if( $img.attr('height') < $shortestImg.attr('height') ){ + $shortestImg = $(this); + } + + if(parseInt($img.css('width'), 10) > options.lowresWidth && $img.attr('data-highres')){ + $img.attr('src', $img.attr('data-highres')); + } + }); + + // Get the row height from the calculated/real height/width of the shortest image + var rowHeight = ( $shortestImg.attr('height') * parseInt($shortestImg.css('width'), 10) ) / $shortestImg.attr('width'); + // Adding a buffer to shave off a few pixels in height + var bufferHeight = Math.floor(rowHeight * 0.025); + $(this).height( rowHeight - bufferHeight ); + + // If border is set to true, then add the parent row height to each .photoset-content-border + if(options.borderActive){ + $(this).find('.photoset-content-border').each(function(){ + $(this).css({'height': rowHeight - bufferHeight}); + }); + } + + $(this).find('img').each(function(){ + // Get the image height from the calculated/real height/width + var imageHeight = ( $(this).attr('height') * parseInt($(this).css('width'), 10) ) / $(this).attr('width'); + var marginOffset = ( (rowHeight - imageHeight) * 0.5 ) + 'px'; + $(this).css({ + 'margin-top' : marginOffset + }); + }); + + }); + $(elem).attr('data-width', w ); + } + + } + resizePhotosetGrid(); + + $(window).on("resize", function() { + resizePhotosetGrid(); + }); + + }; + + // By default the plugin will wait until all of the images are loaded to setup the styles + var waitForImagesLoaded = true; + var hasDimensions = true; + + // Loops through all of the images in the photoset + // if the height and width exists for all images set waitForImagesLoaded to false + $(elem).find('img').each(function(){ + hasDimensions = hasDimensions & ( !!$(this).attr('height') & !!$(this).attr('width') ); + }); + + waitForImagesLoaded = !hasDimensions; + + // Only use imagesLoaded() if waitForImagesLoaded + if(waitForImagesLoaded) { + $(elem).imagesLoaded(function(){ + setupStyles(waitForImagesLoaded); + $this._callback(elem); + }); + } else { + setupStyles(waitForImagesLoaded); + $this._callback(elem); + } + + + } + + }; + + // plugin wrapper around the constructor + $.fn[pluginName] = function ( options ) { + return this.each(function () { + if (!$.data(this, "plugin_" + pluginName)) { + $.data(this, "plugin_" + pluginName, new Plugin( this, options )); + } + }); + }; + + /*! + * jQuery imagesLoaded plugin v2.1.1 + * http://github.com/desandro/imagesloaded + * + * MIT License. by Paul Irish et al. + */ + + /*jshint curly: true, eqeqeq: true, noempty: true, strict: true, undef: true, browser: true */ + /*global jQuery: false */ + + // blank image data-uri bypasses webkit log warning (thx doug jones) + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='; + + $.fn.imagesLoaded = function( callback ) { + var $this = this, + deferred = $.isFunction($.Deferred) ? $.Deferred() : 0, + hasNotify = $.isFunction(deferred.notify), + $images = $this.find('img').add( $this.filter('img') ), + loaded = [], + proper = [], + broken = []; + + // Register deferred callbacks + if ($.isPlainObject(callback)) { + $.each(callback, function (key, value) { + if (key === 'callback') { + callback = value; + } else if (deferred) { + deferred[key](value); + } + }); + } + + function doneLoading() { + var $proper = $(proper), + $broken = $(broken); + + if ( deferred ) { + if ( broken.length ) { + deferred.reject( $images, $proper, $broken ); + } else { + deferred.resolve( $images ); + } + } + + if ( $.isFunction( callback ) ) { + callback.call( $this, $images, $proper, $broken ); + } + } + + function imgLoadedHandler( event ) { + imgLoaded( event.target, event.type === 'error' ); + } + + function imgLoaded( img, isBroken ) { + // don't proceed if BLANK image, or image is already loaded + if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) { + return; + } + + // store element in loaded images array + loaded.push( img ); + + // keep track of broken and properly loaded images + if ( isBroken ) { + broken.push( img ); + } else { + proper.push( img ); + } + + // cache image and its state for future calls + $.data( img, 'imagesLoaded', { isBroken: isBroken, src: img.src } ); + + // trigger deferred progress method if present + if ( hasNotify ) { + deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] ); + } + + // call doneLoading and clean listeners if all images are loaded + if ( $images.length === loaded.length ) { + setTimeout( doneLoading ); + $images.unbind( '.imagesLoaded', imgLoadedHandler ); + } + } + + // if no images, trigger immediately + if ( !$images.length ) { + doneLoading(); + } else { + $images.bind( 'load.imagesLoaded error.imagesLoaded', imgLoadedHandler ) + .each( function( i, el ) { + var src = el.src; + + // find out if this image has been already checked for status + // if it was, and src has not changed, call imgLoaded on it + var cached = $.data( el, 'imagesLoaded' ); + if ( cached && cached.src === src ) { + imgLoaded( el, cached.isBroken ); + return; + } + + // if complete is true and browser supports natural sizes, try + // to check for image status manually + if ( el.complete && el.naturalWidth !== undefined ) { + imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 ); + return; + } + + // cached images don't fire load sometimes, so we reset src, but only when + // dealing with IE, or image is complete (loaded) and failed manual check + // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f + if ( el.readyState || el.complete ) { + el.src = BLANK; + el.src = src; + } + }); + } + + return deferred ? deferred.promise( $this ) : $this; + }; + + /* + * throttledresize: special jQuery event that happens at a reduced rate compared to "resize" + * + * latest version and complete README available on Github: + * https://github.com/louisremi/jquery-smartresize + * + * Copyright 2012 @louis_remi + * Licensed under the MIT license. + * + * This saved you an hour of work? + * Send me music http://www.amazon.co.uk/wishlist/HNTU0468LQON + */ + + var $event = $.event, + $special, + dummy = {_:0}, + frame = 0, + wasResized, animRunning; + + $special = $event.special.throttledresize = { + setup: function() { + $( this ).on( "resize", $special.handler ); + }, + teardown: function() { + $( this ).off( "resize", $special.handler ); + }, + handler: function( event, execAsap ) { + // Save the context + var context = this, + args = arguments; + + wasResized = true; + + if ( !animRunning ) { + setInterval(function(){ + frame++; + + if ( frame > $special.threshold && wasResized || execAsap ) { + // set correct event type + event.type = "throttledresize"; + $event.dispatch.apply( context, args ); + wasResized = false; + frame = 0; + } + if ( frame > 9 ) { + $(dummy).stop(); + animRunning = false; + frame = 0; + } + }, 30); + animRunning = true; + } + }, + threshold: 0 + }; + + +})( jQuery, window, document ); /*! Colorbox 1.6.2 license: MIT