(function(window) { 'use strict'; /* -------------------- Infopanel -------------------- */ function Infopanel(options) { this.options = extend({}, this.options); extend(this.options, options); this._init(); } Infopanel.prototype.options = { position: 'top' }; Infopanel.prototype._init = function() { this.position = this.options.position; this.wrapper = $('
').prependTo('body'); this.panels = {}; }; Infopanel.prototype.add = function(options) { var id = this.getUniqueID(); var params = options; params['infopanel'] = this; params['id'] = 'info-' + id; this.panels[id] = new InfoItem(params); }; Infopanel.prototype.getUniqueID = function() { return new Date().valueOf() + '_' + Math.floor((Math.random() + 1) * 2000).toString(); }; window.Infopanel = Infopanel; /* -------------------- InfoItem -------------------- */ function InfoItem(options) { this.options = extend({}, this.options); extend(this.options, options); this._init(); this._initEvents(); } InfoItem.prototype.options = { bgcolor: 'primary', title: '', content: '', contentsize: 'md', hideafter: 0 }; InfoItem.prototype._init = function() { var $this = this; this.infopanel = this.options.infopanel; this.id = this.options.id; this.bgcolor = this.options.bgcolor; this.title = this.options.title; this.content = this.options.content; this.buttons = this.options.buttons; this.contentsize = this.options.contentsize; this.hideafter = this.options.hideafter; this.wrapper = $(''); this.container = $('