// Generated by CoffeeScript 1.6.3 /* jQuery Lighter Copyright 2013 Kevin Sylvestre 1.1.3 */ (function() { "use strict"; var $, Animation, Lighter, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; $ = jQuery; Animation = (function() { function Animation() {} Animation.transitions = { "webkitTransition": "webkitTransitionEnd", "mozTransition": "mozTransitionEnd", "oTransition": "oTransitionEnd", "transition": "transitionend" }; Animation.transition = function($el) { var el, result, type, _ref; el = $el[0]; _ref = this.transitions; for (type in _ref) { result = _ref[type]; if (el.style[type] != null) { return result; } } }; Animation.execute = function($el, callback) { var transition; transition = this.transition($el); if (transition != null) { return $el.one(transition, callback); } else { return callback(); } }; return Animation; })(); Lighter = (function() { Lighter.settings = { padding: 40, dimensions: { width: 960, height: 540 }, template: "
" }; Lighter.lighter = function($el, options) { var data; if (options == null) { options = {}; } data = $el.data('_lighter'); if (!data) { data = new Lighter($el, options); $el.data('_lighter', data); } return data; }; Lighter.prototype.$ = function(selector) { return this.$lighter.find(selector); }; function Lighter($el, settings) { if (settings == null) { settings = {}; } this.show = __bind(this.show, this); this.hide = __bind(this.hide, this); this.toggle = __bind(this.toggle, this); this.keyup = __bind(this.keyup, this); this.align = __bind(this.align, this); this.resize = __bind(this.resize, this); this.process = __bind(this.process, this); this.href = __bind(this.href, this); this.type = __bind(this.type, this); this.image = __bind(this.image, this); this.prev = __bind(this.prev, this); this.next = __bind(this.next, this); this.close = __bind(this.close, this); this.$ = __bind(this.$, this); this.$el = $el; if ((this.$el.data('width') != null) && (this.$el.data('height') != null)) { if (settings.dimensions == null) { settings.dimensions = { width: this.$el.data('width'), height: this.$el.data('height') }; } } this.settings = $.extend({}, Lighter.settings, settings); this.$lighter = $(this.settings.template); this.$overlay = this.$(".lighter-overlay"); this.$content = this.$(".lighter-content"); this.$container = this.$(".lighter-container"); this.$close = this.$(".lighter-close"); this.$prev = this.$(".lighter-prev"); this.$next = this.$(".lighter-next"); this.$body = this.$(".lighter-body"); this.width = this.settings.dimensions.width; this.height = this.settings.dimensions.height; this.align(); this.process(); } Lighter.prototype.close = function(event) { if (event != null) { event.preventDefault(); } if (event != null) { event.stopPropagation(); } return this.hide(); }; Lighter.prototype.next = function(event) { if (event != null) { event.preventDefault(); } return event != null ? event.stopPropagation() : void 0; }; Lighter.prototype.prev = function() { if (typeof event !== "undefined" && event !== null) { event.preventDefault(); } return typeof event !== "undefined" && event !== null ? event.stopPropagation() : void 0; }; Lighter.prototype.image = function(href) { return href.match(/\.(jpeg|jpg|jpe|gif|png|bmp)$/i); }; Lighter.prototype.type = function(href) { if (href == null) { href = this.href(); } return this.settings.type || (this.image(href) ? "image" : void 0); }; Lighter.prototype.href = function() { return this.$el.attr("href"); }; Lighter.prototype.process = function() { var href, image, type, _this = this; type = this.type(href = this.href()); this.$content.html((function() { switch (type) { case "image": return $("