message.min.js 24 KB

1
  1. !function(){var a,b=window.Messenger;a=window.Messenger=function(){return a._call.apply(this,arguments)},window.Messenger.noConflict=function(){return window.Messenger=b,a}}(),window.Messenger._=function(){if(window._)return window._;var a=Array.prototype,b=Object.prototype,c=Function.prototype,d=(a.push,a.slice),e=(a.concat,b.toString);b.hasOwnProperty;var f=a.forEach,g=(a.map,a.reduce,a.reduceRight,a.filter),h=(a.every,a.some,a.indexOf,a.lastIndexOf,Array.isArray,Object.keys),i=c.bind,j={},k={},l=j.each=j.forEach=function(a,b,c){if(null!=a)if(f&&a.forEach===f)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,e=a.length;e>d;d++)if(b.call(c,a[d],d,a)===k)return}else for(var g in a)if(j.has(a,g)&&b.call(c,a[g],g,a)===k)return};j.result=function(a,b){if(null==a)return null;var c=a[b];return j.isFunction(c)?c.call(a):c},j.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}};var m=0;return j.uniqueId=function(a){var b=++m+"";return a?a+b:b},j.filter=j.select=function(a,b,c){var d=[];return null==a?d:g&&a.filter===g?a.filter(b,c):(l(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},l(["Arguments","Function","String","Number","Date","RegExp"],function(a){j["is"+a]=function(b){return e.call(b)=="[object "+a+"]"}}),j.defaults=function(a){return l(d.call(arguments,1),function(b){if(b)for(var c in b)null==a[c]&&(a[c]=b[c])}),a},j.extend=function(a){return l(d.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},j.keys=h||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)j.has(a,c)&&(b[b.length]=c);return b},j.bind=function(a,b){if(a.bind===i&&i)return i.apply(a,d.call(arguments,1));var c=d.call(arguments,2);return function(){return a.apply(b,c.concat(d.call(arguments)))}},j.isObject=function(a){return a===Object(a)},j}(),window.Messenger.Events=function(){if(window.Backbone&&Backbone.Events)return Backbone.Events;var a=function(){var a=/\s+/,b=function(b,c,d,e){if(!d)return!0;if("object"==typeof d)for(var f in d)b[c].apply(b,[f,d[f]].concat(e));else{if(!a.test(d))return!0;for(var g=d.split(a),h=0,i=g.length;i>h;h++)b[c].apply(b,[g[h]].concat(e))}},c=function(a,b){var c,d=-1,e=a.length;switch(b.length){case 0:for(;e>++d;)(c=a[d]).callback.call(c.ctx);return;case 1:for(;e>++d;)(c=a[d]).callback.call(c.ctx,b[0]);return;case 2:for(;e>++d;)(c=a[d]).callback.call(c.ctx,b[0],b[1]);return;case 3:for(;e>++d;)(c=a[d]).callback.call(c.ctx,b[0],b[1],b[2]);return;default:for(;e>++d;)(c=a[d]).callback.apply(c.ctx,b)}},d={on:function(a,c,d){if(!b(this,"on",a,[c,d])||!c)return this;this._events||(this._events={});var e=this._events[a]||(this._events[a]=[]);return e.push({callback:c,context:d,ctx:d||this}),this},once:function(a,c,d){if(!b(this,"once",a,[c,d])||!c)return this;var e=this,f=_.once(function(){e.off(a,f),c.apply(this,arguments)});return f._callback=c,this.on(a,f,d),this},off:function(a,c,d){var e,f,g,h,i,j,k,l;if(!this._events||!b(this,"off",a,[c,d]))return this;if(!a&&!c&&!d)return this._events={},this;for(h=a?[a]:_.keys(this._events),i=0,j=h.length;j>i;i++)if(a=h[i],e=this._events[a]){if(g=[],c||d)for(k=0,l=e.length;l>k;k++)f=e[k],(c&&c!==f.callback&&c!==f.callback._callback||d&&d!==f.context)&&g.push(f);this._events[a]=g}return this},trigger:function(a){if(!this._events)return this;var d=Array.prototype.slice.call(arguments,1);if(!b(this,"trigger",a,d))return this;var e=this._events[a],f=this._events.all;return e&&c(e,d),f&&c(f,arguments),this},listenTo:function(a,b,c){var d=this._listeners||(this._listeners={}),e=a._listenerId||(a._listenerId=_.uniqueId("l"));return d[e]=a,a.on(b,"object"==typeof b?this:c,this),this},stopListening:function(a,b,c){var d=this._listeners;if(d){if(a)a.off(b,"object"==typeof b?this:c,this),b||c||delete d[a._listenerId];else{"object"==typeof b&&(c=this);for(var e in d)d[e].off(b,c,this);this._listeners={}}return this}}};return d.bind=d.on,d.unbind=d.off,d};return a()}(),function(){var a,b,c,d,e,f,g,h,i,j,k,l={}.hasOwnProperty,m=function(a,b){function c(){this.constructor=a}for(var d in b)l.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},n=[].slice,o=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};a=jQuery,f=null!=(i=window._)?i:window.Messenger._,d=null!=(j="undefined"!=typeof Backbone&&null!==Backbone?Backbone.Events:void 0)?j:window.Messenger.Events,c=function(){function b(b){a.extend(this,d),f.isObject(b)&&(b.el&&this.setElement(b.el),this.model=b.model),this.initialize.apply(this,arguments)}return b.prototype.setElement=function(b){return this.$el=a(b),this.el=this.$el[0]},b.prototype.delegateEvents=function(a){var b,c,d,e,g,h,i;if(a||(a=f.result(this,"events"))){this.undelegateEvents(),b=/^(\S+)\s*(.*)$/,i=[];for(d in a){if(g=a[d],f.isFunction(g)||(g=this[a[d]]),!g)throw Error('Method "'+a[d]+'" does not exist');e=d.match(b),c=e[1],h=e[2],g=f.bind(g,this),c+=".delegateEvents"+this.cid,i.push(""===h?this.jqon(c,g):this.jqon(c,h,g))}return i}},b.prototype.jqon=function(a,b,c){var d;return null!=this.$el.on?(d=this.$el).on.apply(d,arguments):(null==c&&(c=b,b=void 0),null!=b?this.$el.delegate(b,a,c):this.$el.bind(a,c))},b.prototype.jqoff=function(a){var b;return null!=this.$el.off?(b=this.$el).off.apply(b,arguments):(this.$el.undelegate(),this.$el.unbind(a))},b.prototype.undelegateEvents=function(){return this.jqoff(".delegateEvents"+this.cid)},b.prototype.remove=function(){return this.undelegateEvents(),this.$el.remove()},b}(),g=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return m(c,b),c.prototype.defaults={hideAfter:10,scroll:!0,closeButtonText:"&times;"},c.prototype.initialize=function(b){return null==b&&(b={}),this.shown=!1,this.rendered=!1,this.messenger=b.messenger,this.options=a.extend({},this.options,b,this.defaults)},c.prototype.show=function(){var a;return this.rendered||this.render(),this.$message.removeClass("messenger-hidden"),a=this.shown,this.shown=!0,a?void 0:this.trigger("show")},c.prototype.hide=function(){var a;return this.rendered?(this.$message.addClass("messenger-hidden"),a=this.shown,this.shown=!1,a?this.trigger("hide"):void 0):void 0},c.prototype.cancel=function(){return this.hide()},c.prototype.update=function(b){var c,d=this;return f.isString(b)&&(b={message:b}),a.extend(this.options,b),this.lastUpdate=new Date,this.rendered=!1,this.events=null!=(c=this.options.events)?c:{},this.render(),this.actionsToEvents(),this.delegateEvents(),this.checkClickable(),this.options.hideAfter?(this.$message.addClass("messenger-will-hide-after"),null!=this._hideTimeout&&clearTimeout(this._hideTimeout),this._hideTimeout=setTimeout(function(){return d.hide()},1e3*this.options.hideAfter)):this.$message.removeClass("messenger-will-hide-after"),this.options.hideOnNavigate?(this.$message.addClass("messenger-will-hide-on-navigate"),null!=("undefined"!=typeof Backbone&&null!==Backbone?Backbone.history:void 0)&&Backbone.history.on("route",function(){return d.hide()})):this.$message.removeClass("messenger-will-hide-on-navigate"),this.trigger("update",this)},c.prototype.scrollTo=function(){return this.options.scroll?a.scrollTo(this.$el,{duration:400,offset:{left:0,top:-20}}):void 0},c.prototype.timeSinceUpdate=function(){return this.lastUpdate?new Date-this.lastUpdate:null},c.prototype.actionsToEvents=function(){var a,b,c,d,e=this;c=this.options.actions,d=[];for(b in c)a=c[b],d.push(this.events['click [data-action="'+b+'"] a']=function(a){return function(c){return c.preventDefault(),c.stopPropagation(),e.trigger("action:"+b,a,c),a.action.call(e,c,e)}}(a));return d},c.prototype.checkClickable=function(){var a,b,c,d;c=this.events,d=[];for(b in c)a=c[b],d.push("click"===b?this.$message.addClass("messenger-clickable"):void 0);return d},c.prototype.undelegateEvents=function(){var a;return c.__super__.undelegateEvents.apply(this,arguments),null!=(a=this.$message)?a.removeClass("messenger-clickable"):void 0},c.prototype.parseActions=function(){var b,c,d,e,f,g;c=[],f=this.options.actions;for(e in f)b=f[e],d=a.extend({},b),d.name=e,null==(g=d.label)&&(d.label=e),c.push(d);return c},c.prototype.template=function(b){var c,d,e,f,g,h,i,j,k,l,m=this;for(g=a("<div class='messenger-message message alert "+b.type+" message-"+b.type+" alert-"+b.type+"'>"),b.showCloseButton&&(e=a('<button type="button" class="messenger-close" data-dismiss="alert">'),e.html(b.closeButtonText),e.click(function(){return m.cancel(),!0}),g.append(e)),h=a('<div class="messenger-message-inner">'+b.message+"</div>"),g.append(h),b.actions.length&&(d=a('<div class="messenger-actions">')),l=b.actions,j=0,k=l.length;k>j;j++)i=l[j],c=a("<span>"),c.attr("data-action",""+i.name),f=a("<a>"),f.html(i.label),c.append(a('<span class="messenger-phrase">')),c.append(f),d.append(c);return g.append(d),g},c.prototype.render=function(){var b;return this.rendered?void 0:(this._hasSlot||(this.setElement(this.messenger._reserveMessageSlot(this)),this._hasSlot=!0),b=a.extend({},this.options,{actions:this.parseActions()}),this.$message=a(this.template(b)),this.$el.html(this.$message),this.shown=!0,this.rendered=!0,this.trigger("render"))},c}(c),e=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return m(b,a),b.prototype.initialize=function(){return b.__super__.initialize.apply(this,arguments),this._timers={}},b.prototype.cancel=function(){return this.clearTimers(),this.hide(),null!=this._actionInstance&&null!=this._actionInstance.abort?this._actionInstance.abort():void 0},b.prototype.clearTimers=function(){var a,b,c,d;c=this._timers;for(a in c)b=c[a],clearTimeout(b);return this._timers={},null!=(d=this.$message)?d.removeClass("messenger-retry-soon messenger-retry-later"):void 0},b.prototype.render=function(){var a,c,d,e;b.__super__.render.apply(this,arguments),this.clearTimers(),d=this.options.actions,e=[];for(c in d)a=d[c],e.push(a.auto?this.startCountdown(c,a):void 0);return e},b.prototype.renderPhrase=function(a,b){var c;return c=a.phrase.replace("TIME",this.formatTime(b))},b.prototype.formatTime=function(a){var b;return b=function(a,b){return a=Math.floor(a),1!==a&&(b+="s"),"in "+a+" "+b},0===Math.floor(a)?"now...":60>a?b(a,"second"):(a/=60,60>a?b(a,"minute"):(a/=60,b(a,"hour")))},b.prototype.startCountdown=function(a,b){var c,d,e,f,g=this;return null==this._timers[a]?(c=this.$message.find("[data-action='"+a+"'] .messenger-phrase"),d=null!=(f=b.delay)?f:3,10>=d?(this.$message.removeClass("messenger-retry-later"),this.$message.addClass("messenger-retry-soon")):(this.$message.removeClass("messenger-retry-soon"),this.$message.addClass("messenger-retry-later")),(e=function(){var f;return c.text(g.renderPhrase(b,d)),d>0?(f=Math.min(d,1),d-=f,g._timers[a]=setTimeout(e,1e3*f)):(g.$message.removeClass("messenger-retry-soon messenger-retry-later"),delete g._timers[a],b.action())})()):void 0},b}(g),h=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return m(c,b),c.prototype.tagName="ul",c.prototype.className="messenger",c.prototype.messageDefaults={type:"info"},c.prototype.initialize=function(b){return this.options=null!=b?b:{},this.history=[],this.messageDefaults=a.extend({},this.messageDefaults,this.options.messageDefaults)},c.prototype.render=function(){return this.updateMessageSlotClasses()},c.prototype.findById=function(a){return f.filter(this.history,function(b){return b.msg.options.id===a})},c.prototype._reserveMessageSlot=function(b){var c,d,e=this;for(c=a("<li>"),c.addClass("messenger-message-slot"),this.$el.prepend(c),this.history.push({msg:b,$slot:c}),this._enforceIdConstraint(b),b.on("update",function(){return e._enforceIdConstraint(b)});this.options.maxMessages&&this.history.length>this.options.maxMessages;)d=this.history.shift(),d.msg.remove(),d.$slot.remove();return c},c.prototype._enforceIdConstraint=function(a){var b,c,d,e,f;if(null!=a.options.id)for(f=this.history,c=0,d=f.length;d>c;c++)if(b=f[c],e=b.msg,null!=e.options.id&&e.options.id===a.options.id&&a!==e){if(a.options.singleton)return void a.hide();e.hide()}},c.prototype.newMessage=function(a){var b,c,d,f,h=this;return null==a&&(a={}),a.messenger=this,g=null!=(c=null!=(d=Messenger.themes[null!=(f=a.theme)?f:this.options.theme])?d.Message:void 0)?c:e,b=new g(a),b.on("show",function(){return a.scrollTo&&"fixed"!==h.$el.css("position")?b.scrollTo():void 0}),b.on("hide show render",this.updateMessageSlotClasses,this),b},c.prototype.updateMessageSlotClasses=function(){var a,b,c,d,e,f,g;for(d=!0,b=null,a=!1,g=this.history,e=0,f=g.length;f>e;e++)c=g[e],c.$slot.removeClass("messenger-first messenger-last messenger-shown"),c.msg.shown&&c.msg.rendered&&(c.$slot.addClass("messenger-shown"),a=!0,b=c,d&&(d=!1,c.$slot.addClass("messenger-first")));return null!=b&&b.$slot.addClass("messenger-last"),this.$el[""+(a?"remove":"add")+"Class"]("messenger-empty")},c.prototype.hideAll=function(){var a,b,c,d,e;for(d=this.history,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.msg.hide());return e},c.prototype.post=function(b){var c;return f.isString(b)&&(b={message:b}),b=a.extend(!0,{},this.messageDefaults,b),c=this.newMessage(b),c.update(b),c},c}(c),b=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return m(c,b),c.prototype.doDefaults={progressMessage:null,successMessage:null,errorMessage:"Error connecting to the server.",showSuccessWithoutError:!0,retry:{auto:!0,allow:!0},action:a.ajax},c.prototype.hookBackboneAjax=function(b){var c,d=this;if(null==b&&(b={}),null==window.Backbone)throw"Expected Backbone to be defined";return b=f.defaults(b,{id:"BACKBONE_ACTION",errorMessage:!1,successMessage:"Request completed successfully.",showSuccessWithoutError:!1}),c=function(a){var c;return c=f.extend({},b,a.messenger),d["do"](c,a)},null!=Backbone.ajax?(Backbone.ajax._withoutMessenger&&(Backbone.ajax=Backbone.ajax._withoutMessenger),(null==b.action||b.action===this.doDefaults.action)&&(b.action=Backbone.ajax),c._withoutMessenger=Backbone.ajax,Backbone.ajax=c):Backbone.sync=f.wrap(Backbone.sync,function(){var b,d,e;return e=arguments[0],b=arguments.length>=2?n.call(arguments,1):[],d=a.ajax,a.ajax=c,e.call.apply(e,[this].concat(n.call(b))),a.ajax=d})},c.prototype._getHandlerResponse=function(a){return a===!1?!1:a===!0||null==a?!0:a},c.prototype._parseEvents=function(a){var b,c,d,e,f,g,h;null==a&&(a={}),f={};for(e in a)d=a[e],c=e.indexOf(" "),g=e.substring(0,c),b=e.substring(c+1),null==(h=f[g])&&(f[g]={}),f[g][b]=d;return f},c.prototype._normalizeResponse=function(){var a,b,c,d,e,g,h;for(c=arguments.length>=1?n.call(arguments,0):[],d=null,e=null,a=null,g=0,h=c.length;h>g;g++)b=c[g],"success"===b||"timeout"===b||"abort"===b?d=b:null!=(null!=b?b.readyState:void 0)&&null!=(null!=b?b.responseText:void 0)?e=b:f.isObject(b)&&(a=b);return[d,a,e]},c.prototype.run=function(){var b,c,d,e,g,h,i,j,k,l,m,p=this;if(h=arguments[0],k=arguments[1],b=arguments.length>=3?n.call(arguments,2):[],null==k&&(k={}),h=a.extend(!0,{},this.messageDefaults,this.doDefaults,null!=h?h:{}),c=this._parseEvents(h.events),d=function(a,b){var c;return c=h[a+"Message"],f.isFunction(c)?c.call(p,a,b):c},i=null!=(m=h.messageInstance)?m:this.newMessage(h),null!=h.id&&(i.options.id=h.id),null!=h.progressMessage&&i.update(a.extend({},h,{message:d("progress",null),type:"info"})),g={},f.each(["error","success"],function(e){var j;return j=k[e],g[e]=function(){var g,l,m,q,r,s,t,u,v,w,x,y,z,A,B;return s=arguments.length>=1?n.call(arguments,0):[],v=p._normalizeResponse.apply(p,s),r=v[0],g=v[1],u=v[2],"success"===e&&null==i.errorCount&&h.showSuccessWithoutError===!1&&(h.successMessage=null),"error"===e&&(null==(w=h.errorCount)&&(h.errorCount=0),h.errorCount+=1),m=h.returnsPromise?s[0]:"function"==typeof j?j.apply(null,s):void 0,t=p._getHandlerResponse(m),f.isString(t)&&(t={message:t}),"error"!==e||0!==(null!=u?u.status:void 0)&&"abort"!==r?"error"===e&&null!=h.ignoredErrorCodes&&(x=null!=u?u.status:void 0,o.call(h.ignoredErrorCodes,x)>=0)?void i.hide():(l={message:d(e,u),type:e,events:null!=(y=c[e])?y:{},hideOnNavigate:"success"===e},q=a.extend({},h,l,t),"number"==typeof(null!=(z=q.retry)?z.allow:void 0)&&q.retry.allow--,"error"===e&&(null!=u?u.status:void 0)>=500&&(null!=(A=q.retry)?A.allow:void 0)?(null==q.retry.delay&&(q.retry.delay=4>q.errorCount?10:300),q.hideAfter&&(null==(B=q._hideAfter)&&(q._hideAfter=q.hideAfter),q.hideAfter=q._hideAfter+q.retry.delay),q._retryActions=!0,q.actions={retry:{label:"retry now",phrase:"Retrying TIME",auto:q.retry.auto,delay:q.retry.delay,action:function(){return q.messageInstance=i,setTimeout(function(){return p["do"].apply(p,[q,k].concat(n.call(b)))},0)}},cancel:{action:function(){return i.cancel()}}}):q._retryActions&&(delete q.actions.retry,delete q.actions.cancel,delete h._retryActions),i.update(q),t&&q.message?(Messenger(f.extend({},p.options,{instance:p})),i.show()):i.hide()):void i.hide()}}),!h.returnsPromise)for(l in g)e=g[l],j=k[l],k[l]=e;return i._actionInstance=h.action.apply(h,[k].concat(n.call(b))),h.returnsPromise&&i._actionInstance.then(g.success,g.error),i},c.prototype["do"]=c.prototype.run,c.prototype.ajax=function(){var b,c;return c=arguments[0],b=arguments.length>=2?n.call(arguments,1):[],c.action=a.ajax,this.run.apply(this,[c].concat(n.call(b)))},c.prototype.expectPromise=function(a,b){return b=f.extend({},b,{action:a,returnsPromise:!0}),this.run(b)},c.prototype.error=function(a){return null==a&&(a={}),"string"==typeof a&&(a={message:a}),a.type="error",this.post(a)},c.prototype.info=function(a){return null==a&&(a={}),"string"==typeof a&&(a={message:a}),a.type="info",this.post(a)},c.prototype.success=function(a){return null==a&&(a={}),"string"==typeof a&&(a={message:a}),a.type="success",this.post(a)},c}(h),a.fn.messenger=function(){var c,d,e,g,i,j,k,l;return e=arguments[0],d=arguments.length>=2?n.call(arguments,1):[],null==e&&(e={}),c=this,null!=e&&f.isString(e)?(l=c.data("messenger"))[e].apply(l,d):(i=e,null==c.data("messenger")&&(h=null!=(j=null!=(k=Messenger.themes[i.theme])?k.Messenger:void 0)?j:b,c.data("messenger",g=new h(a.extend({el:c},i))),g.render()),c.data("messenger"))},window.Messenger._call=function(b){var c,d,e,f,g,h,i,j,k,l,m;if(h={extraClasses:"messenger-fixed messenger-on-bottom messenger-on-right",theme:"future",maxMessages:9,parentLocations:["body"]},b=a.extend(h,a._messengerDefaults,Messenger.options,b),null!=b.theme&&(b.extraClasses+=" messenger-theme-"+b.theme),i=b.instance||Messenger.instance,null==b.instance){for(k=b.parentLocations,d=null,e=null,l=0,m=k.length;m>l;l++)if(j=k[l],d=a(j),d.length){f=j;break}i?a(i._location).is(a(f))||(i.$el.detach(),d.prepend(i.$el)):(c=a("<ul>"),d.prepend(c),i=c.messenger(b),i._location=f,Messenger.instance=i)}return null!=i._addedClasses&&i.$el.removeClass(i._addedClasses),i.$el.addClass(g=""+i.className+" "+b.extraClasses),i._addedClasses=g,i},a.extend(Messenger,{Message:e,Messenger:b,themes:null!=(k=Messenger.themes)?k:{}}),a.globalMessenger=window.Messenger=Messenger}.call(this),function(){var a,b,c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};a=jQuery,c='<div class="messenger-spinner">\n <span class="messenger-spinner-side messenger-spinner-side-left">\n <span class="messenger-spinner-fill"></span>\n </span>\n <span class="messenger-spinner-side messenger-spinner-side-right">\n <span class="messenger-spinner-fill"></span>\n </span>\n</div>',b=function(b){function d(){return d.__super__.constructor.apply(this,arguments)}return e(d,b),d.prototype.template=function(){var b;return b=d.__super__.template.apply(this,arguments),b.append(a(c)),b},d}(window.Messenger.Message),window.Messenger.themes.flat={Message:b}}.call(this),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.2.0",c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(c.$body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one("bsTransitionEnd",function(){c.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(300):c.$element.trigger("focus").trigger(e)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;if(this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(150):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(150):f()}else b&&b()},c.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),$(".chat").on("shown.bs.modal",function(){$(this).find("iframe").attr("src","http://code.davidawindham.com:8080")}),$(".chat").on("hidden.bs.modal",function(){$(this).find("iframe").attr("src","http://code.davidawindham.com:8080").remove()});