mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-15 08:34:11 +03:00
Remove compiled files from the reository
This commit is contained in:
parent
ac55ecc545
commit
58aec22fc3
14
.gitignore
vendored
14
.gitignore
vendored
@ -27,3 +27,17 @@ src/mibew/vendor
|
||||
|
||||
# Do not index node.js modules that are used for building
|
||||
src/node_modules
|
||||
|
||||
# Do not index compiled js files of the core
|
||||
src/mibew/js/compiled/*
|
||||
!src/mibew/js/compiled/.keep
|
||||
|
||||
# Do not index compiled files of chat styles
|
||||
src/mibew/styles/dialogs/default/templates_compiled/client_side/*
|
||||
!src/mibew/styles/dialogs/default/templates_compiled/client_side/.keep
|
||||
src/mibew/styles/dialogs/default/js/compiled/*
|
||||
!src/mibew/styles/dialogs/default/js/compiled/.keep
|
||||
|
||||
# Do not index compiled files of page styles
|
||||
src/mibew/styles/pages/default/templates_compiled/client_side/*
|
||||
!src/mibew/styles/pages/default/templates_compiled/client_side/.keep
|
||||
|
0
src/mibew/js/compiled/.keep
Normal file
0
src/mibew/js/compiled/.keep
Normal file
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function detectAgent(){for(var e=["opera","msie","safari","firefox","netscape","mozilla"],t=navigator.userAgent.toLowerCase(),n=0;n<e.length;n++){var a=e[n];if(-1!=t.indexOf(a)){if(myAgent=a,!window.RegExp)break;var r=new RegExp(a+"[ /]?([0-9]+(.[0-9]+)?)");null!=r.exec(t)&&(myVer=parseFloat(RegExp.$1));break}}myRealAgent=myAgent,"Gecko"==navigator.product&&(myAgent="moz")}function getEl(e){return document.getElementById(e)}var myAgent="",myVer=0,myRealAgent="";detectAgent();
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t){var a=e.Application;a.addRegions({mainRegion:"#main-region"}),a.addInitializer(function(n){switch(e.PluginOptions=n.plugins||{},e.Objects.server=new e.Server(t.extend({interactionType:MibewAPIChatInteraction},n.server)),e.Objects.Models.page=new e.Models.Page(n.page),n.startFrom){case"chat":a.Chat.start(n.chatOptions);break;case"survey":a.Survey.start(n.surveyOptions);break;case"leaveMessage":a.LeaveMessage.start(n.leaveMessageOptions);break;case"invitation":a.Invitation.start(n.invitationOptions);break;default:throw new Error("Dont know how to start!")}}),a.on("start",function(){e.Objects.server.runUpdater()})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Views.MessagesCollection=e.Views.CollectionBase.extend({itemView:e.Views.Message,className:"messages-collection"})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Views.StatusCollection=e.Views.CollectionBase.extend({itemView:e.Views.Status,className:"status-collection"})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,s,t){e.Collections.Messages=s.Collection.extend({model:e.Models.Message,initialize:function(){this.periodicallyCalled=[],this.periodicallyCalled.push(e.Objects.server.callFunctionsPeriodically(t.bind(this.updateMessagesFunctionBuilder,this),t.bind(this.updateMessages,this)))},finalize:function(){for(var s=0;s<this.periodicallyCalled.length;s++)e.Objects.server.stopCallFunctionsPeriodically(this.periodicallyCalled[s])},updateMessages:function(s){s.lastId&&e.Objects.Models.thread.set({lastId:s.lastId});for(var t,l,a,i,d=e.Models.Message.prototype.KIND_PLUGIN,o=[],n=0,r=s.messages.length;r>n;n++)t=s.messages[n],t.kind==d?"object"==typeof t.data&&null!==t.data&&(l=t.plugin||!1,a="process:"+(l!==!1?l+":":"")+"plugin:message",i={messageData:t,model:!1},this.trigger(a,i),i.model&&(i.model.get("id")||i.model.set({id:t.id}),o.push(i.model))):o.push(new e.Models.Message(t));o.length>0&&this.add(o)},updateMessagesFunctionBuilder:function(){var s=e.Objects.Models.thread,t=e.Objects.Models.user;return[{"function":"updateMessages",arguments:{"return":{messages:"messages",lastId:"lastId"},references:{},threadId:s.get("id"),token:s.get("token"),lastId:s.get("lastId"),user:!t.get("isAgent")}}]},add:function(){var e=Array.prototype.slice.apply(arguments),t=s.Collection.prototype.add.apply(this,e);return this.trigger("multiple:add"),t}})}(Mibew,Backbone,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(t,e){t.Collections.Status=e.Collection.extend({comparator:function(t){return t.get("weight")}})}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(i){i.Regions={},i.Layouts={},i.Application=new Backbone.Marionette.Application}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,a){e.Layouts.Chat=a.Marionette.Layout.extend({template:Handlebars.templates["chat/layout"],regions:{controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:{selector:"#messages-region",regionType:e.Regions.Messages},statusRegion:"#status-region",messageFormRegion:"#message-form-region"},serializeData:function(){var a=e.Objects.Models;return{page:a.page.toJSON(),user:a.user.toJSON()}}})}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t){e.Layouts.Invitation=t.Marionette.Layout.extend({template:Handlebars.templates["invitation/layout"],regions:{messagesRegion:{selector:"#invitation-messages-region",regionType:e.Regions.Messages}}})}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,a){e.Layouts.LeaveMessage=a.Marionette.Layout.extend({template:Handlebars.templates["leave_message/layout"],regions:{leaveMessageFormRegion:"#content-wrapper",descriptionRegion:"#description-region"},serializeData:function(){return{page:e.Objects.Models.page.toJSON()}}})}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t){e.Layouts.Survey=t.Marionette.Layout.extend({template:Handlebars.templates["survey/layout"],regions:{surveyFormRegion:"#content-wrapper"},serializeData:function(){return{page:e.Objects.Models.page.toJSON()}}})}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
MibewAPIChatInteraction=function(){this.mandatoryArguments=function(){return{"*":{threadId:null,token:null,"return":{},references:{}},result:{errorCode:0}}},this.getReservedFunctionsNames=function(){return["result"]}},MibewAPIChatInteraction.prototype=new MibewAPIInteraction;
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,a,t){e.Views.Avatar=a.Marionette.ItemView.extend({template:t.templates["chat/avatar"],className:"avatar",modelEvents:{change:"render"}})}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,o,t){e.Views.CloseControl=e.Views.Control.extend({template:o.templates["chat/controls/close"],events:t.extend({},e.Views.Control.prototype.events,{click:"closeThread"}),closeThread:function(){var o=e.Localization.get("Are you sure want to leave chat?");(o===!1||confirm(o))&&this.model.closeThread()}})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,o){e.Views.HistoryControl=e.Views.Control.extend({template:t.templates["chat/controls/history"],events:o.extend({},e.Views.Control.prototype.events,{click:"showHistory"}),showHistory:function(){var t=e.Objects.Models.user,o=this.model.get("link");if(t.get("isAgent")&&o){var s=this.model.get("windowParams");o=o.replace("&","&","g");var n=window.open(o,"UserHistory",s);null!==n&&(n.focus(),n.opener=window)}}})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,i){e.Views.RedirectControl=e.Views.Control.extend({template:t.templates["chat/controls/redirect"],events:i.extend({},e.Views.Control.prototype.events,{click:"redirect"}),initialize:function(){e.Objects.Models.user.on("change",this.render,this)},serializeData:function(){var t=this.model.toJSON();return t.user=e.Objects.Models.user.toJSON(),t},redirect:function(){var t=e.Objects.Models.user;if(t.get("isAgent")&&t.get("canPost")){var i=this.model.get("link");if(i){var s=e.Objects.Models.page.get("style"),n="";s&&(n=(-1===i.indexOf("?")?"?":"&")+"style="+s),window.location.href=i.replace(/\&\;/g,"&")+n}}}})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,r){e.Views.RefreshControl=e.Views.Control.extend({template:t.templates["chat/controls/refresh"],events:r.extend({},e.Views.Control.prototype.events,{click:"refresh"}),refresh:function(){this.model.refresh()}})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,o){e.Views.SecureModeControl=e.Views.Control.extend({template:t.templates["chat/controls/secure_mode"],events:o.extend({},e.Views.Control.prototype.events,{click:"secure"}),secure:function(){var t=this.model.get("link");if(t){var o=e.Objects.Models.page.get("style");window.location.href=t.replace(/\&\;/g,"&")+(o?"&style="+o:"")}}})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,n,t){e.Views.SendMailControl=e.Views.Control.extend({template:n.templates["chat/controls/send_mail"],events:t.extend({},e.Views.Control.prototype.events,{click:"sendMail"}),sendMail:function(){var n=this.model.get("link"),t=e.Objects.Models.page;if(n){var l=this.model.get("windowParams"),o=t.get("style"),i="";o&&(i=(-1===n.indexOf("?")?"?":"&")+"style="+o),n=n.replace(/\&\;/g,"&")+i;var a=window.open(n,"ForwardMail",l);null!==a&&(a.focus(),a.opener=window)}}})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,o){e.Views.SoundControl=e.Views.Control.extend({template:t.templates["chat/controls/sound"],events:o.extend({},e.Views.Control.prototype.events,{click:"toggle"}),toggle:function(){this.model.toggle()}})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,n,t){e.Views.UserNameControl=e.Views.Control.extend({template:n.templates["chat/controls/user_name"],events:t.extend({},e.Views.Control.prototype.events,{"click .user-name-control-set":"changeName","click .user-name-control-change":"showNameInput","keydown #user-name-control-input":"inputKeyDown"}),ui:{nameInput:"#user-name-control-input"},initialize:function(){e.Objects.Models.user.on("change:name",this.hideNameInput,this),this.nameInput=e.Objects.Models.user.get("defaultName")},serializeData:function(){var n=this.model.toJSON();return n.user=e.Objects.Models.user.toJSON(),n.nameInput=this.nameInput,n},inputKeyDown:function(e){var n=e.which;(13==n||10==n)&&this.changeName()},hideNameInput:function(){this.nameInput=!1,this.render()},showNameInput:function(){this.nameInput=!0,this.render()},changeName:function(){var e=this.ui.nameInput.val();this.model.changeName(e)}})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,a){e.Views.LeaveMessageDescription=t.Marionette.ItemView.extend({template:a.templates["leave_message/description"],serializeData:function(){return{page:e.Objects.Models.page.toJSON()}}})}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,a){var s=e.Views.BaseSurveyForm;e.Views.LeaveMessageForm=s.extend({template:t.templates["leave_message/form"],events:a.extend({},s.prototype.events,{"click #send-message":"submitForm"}),ui:a.extend({},s.prototype.ui,{captcha:'input[name="captcha"]',captchaImg:"#captcha-img"}),modelEvents:a.extend({},s.prototype.modelEvents,{"submit:error":"hideAjaxLoader showError submitError"}),submitForm:function(){this.showAjaxLoader();var e={};this.model.get("groups")&&(e.groupId=this.ui.groupSelect.val()),e.name=this.ui.name.val()||"",e.email=this.ui.email.val()||"",e.message=this.ui.message.val()||"",this.model.get("showCaptcha")&&(e.captcha=this.ui.captcha.val()||""),this.model.set(e,{validate:!0}),this.model.submit()},submitError:function(e,t){if(t.code==e.ERROR_WRONG_CAPTCHA&&e.get("showCaptcha")){var a=this.ui.captchaImg.attr("src");a=a.replace(/\?d\=[0-9]+/,""),this.ui.captchaImg.attr("src",a+"?d="+(new Date).getTime())}}})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,a){e.Views.LeaveMessageSentDescription=t.Marionette.ItemView.extend({template:a.templates["leave_message/sent_description"],serializeData:function(){return{page:e.Objects.Models.page.toJSON()}}})}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,s){e.Views.Message=e.Views.Message.extend({template:s.templates["chat/message"]})}(Mibew,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,s,t){e.Views.MessageForm=s.Marionette.ItemView.extend({template:t.templates["chat/message_form"],events:{"click #send-message":"postMessage","keydown #message-input":"messageKeyDown","keyup #message-input":"checkUserTyping","change #message-input":"checkUserTyping","change #predefined":"selectPredefinedAnswer","focus #message-input":"setFocus","blur #message-input":"dropFocus"},modelEvents:{change:"render"},ui:{message:"#message-input",send:"#send-message",predefinedAnswer:"#predefined"},initialize:function(){e.Objects.Models.user.on("change:canPost",this.render,this)},serializeData:function(){var s=this.model.toJSON();return s.user=e.Objects.Models.user.toJSON(),s},postMessage:function(){var s=this.ui.message.val();""!=s&&(this.disableInput(),this.model.postMessage(s)),e.Objects.Collections.messages.on("multiple:add",this.postMessageComplete,this)},messageKeyDown:function(e){var s=e.which,t=e.ctrlKey;(13==s&&(t||this.model.get("ignoreCtrl"))||10==s)&&this.postMessage()},enableInput:function(){this.ui.message.removeAttr("disabled")},disableInput:function(){this.ui.message.attr("disabled","disabled")},clearInput:function(){this.ui.message.val("").change()},postMessageComplete:function(){this.clearInput(),this.enableInput(),this.focused&&this.ui.focus(),e.Objects.Collections.messages.off("multiple:add",this.postMessageComplete,this)},selectPredefinedAnswer:function(){var e=this.ui.message,s=this.ui.predefinedAnswer,t=s.get(0).selectedIndex;t&&(e.val(this.model.get("predefinedAnswers")[t-1].full).change(),e.focus(),s.get(0).selectedIndex=0)},checkUserTyping:function(){var s=e.Objects.Models.user,t=""!=this.ui.message.val();t!=s.get("typing")&&s.set({typing:t})},setFocus:function(){this.focused=!0},dropFocus:function(){this.focused=!1}})}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,s){e.Views.Status=t.Marionette.ItemView.extend({template:s.templates["chat/status/base"],className:"status",modelEvents:{change:"render"},onBeforeRender:function(){this.model.get("visible")?this.$el.show():this.$el.hide()}})}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t){e.Views.StatusMessage=e.Views.Status.extend({template:t.templates["chat/status/message"]})}(Mibew,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(t,e){t.Views.StatusTyping=t.Views.Status.extend({template:e.templates["chat/status/typing"]})}(Mibew,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,r){e.Views.BaseSurveyForm=r.Marionette.ItemView.extend({events:{'change select[name="group"]':"changeGroupDescription","submit form":"preventSubmit"},ui:{groupSelect:'select[name="group"]',groupDescription:"#groupDescription",name:'input[name="name"]',email:'input[name="email"]',message:'textarea[name="message"]',errors:".errors",ajaxLoader:"#ajax-loader"},modelEvents:{invalid:"hideAjaxLoader showError","submit:error":"hideAjaxLoader showError"},preventSubmit:function(e){e.preventDefault()},changeGroupDescription:function(){var e=this.ui.groupSelect.prop("selectedIndex"),r=this.model.get("groups")[e].description||"";this.ui.groupDescription.text(r)},showError:function(e,r){var o;o="string"==typeof r?r:r.message,this.ui.errors.html(o)},serializeData:function(){var r=this.model.toJSON();return r.page=e.Objects.Models.page.toJSON(),r},showAjaxLoader:function(){this.ui.ajaxLoader.show()},hideAjaxLoader:function(){this.ui.ajaxLoader.hide()}})}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,s,t){var i=e.Views.BaseSurveyForm;e.Views.SurveyForm=i.extend({template:s.templates["survey/form"],events:t.extend({},i.prototype.events,{"click #submit-survey":"submitForm"}),submitForm:function(){this.showAjaxLoader();var e={};this.model.get("groups")&&(e.groupId=this.ui.groupSelect.val()),this.model.get("canChangeName")&&(e.name=this.ui.name.val()||""),this.model.get("showEmail")&&(e.email=this.ui.email.val()||""),this.model.get("showMessage")&&(e.message=this.ui.message.val()||""),this.model.set(e,{validate:!0}),this.model.submit()}})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(i,e){i.Models.Avatar=i.Models.Base.extend({defaults:{imageLink:!1},initialize:function(){this.registeredFunctions=[],this.registeredFunctions.push(i.Objects.server.registerFunction("setupAvatar",e.bind(this.apiSetupAvatar,this)))},finalize:function(){for(var e=0;e<this.registeredFunctions.length;e++)i.Objects.server.unregisterFunction(this.registeredFunctions[e])},apiSetupAvatar:function(i){i.imageLink&&this.set({imageLink:i.imageLink})}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t){e.Models.ChatUser=e.Models.User.extend({defaults:t.extend({},e.Models.User.prototype.defaults,{canPost:!0,typing:!1,canChangeName:!1,dafaultName:!0})})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Models.CloseControl=e.Models.Control.extend({getModelType:function(){return"CloseControl"},closeThread:function(){var s=e.Objects.Models.thread,t=e.Objects.Models.user;e.Objects.server.callFunctions([{"function":"close",arguments:{references:{},"return":{closed:"closed"},threadId:s.get("id"),token:s.get("token"),lastId:s.get("lastId"),user:!t.get("isAgent")}}],function(s){s.closed?window.close():e.Objects.Models.Status.message.setMessage(s.errorMessage||"Cannot close")},!0)}})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(o,t){o.Models.HistoryControl=o.Models.Control.extend({defaults:t.extend({},o.Models.Control.prototype.defaults,{link:!1,windowParams:""}),getModelType:function(){return"HistoryControl"}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,o){e.Models.RedirectControl=e.Models.Control.extend({defaults:o.extend({},e.Models.Control.prototype.defaults,{link:!1}),getModelType:function(){return"RedirectControl"}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Models.RefreshControl=e.Models.Control.extend({getModelType:function(){return"RefreshControl"},refresh:function(){e.Objects.server.restartUpdater()}})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,o){e.Models.SecureModeControl=e.Models.Control.extend({defaults:o.extend({},e.Models.Control.prototype.defaults,{link:!1}),getModelType:function(){return"SecureModeControl"}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,o){e.Models.SendMailControl=e.Models.Control.extend({defaults:o.extend({},e.Models.Control.prototype.defaults,{link:!1,windowParams:""}),getModelType:function(){return"SendMailControl"}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,o){e.Models.SoundControl=e.Models.Control.extend({defaults:o.extend({},e.Models.Control.prototype.defaults,{enabled:!0}),toggle:function(){var o=!this.get("enabled");e.Objects.Models.soundManager.set({enabled:o}),this.set({enabled:o})},getModelType:function(){return"SoundControl"}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Models.UserNameControl=e.Models.Control.extend({getModelType:function(){return"UserNameControl"},changeName:function(n){var t=e.Objects.Models.user,r=e.Objects.Models.thread,s=t.get("name");n&&s!=n&&(e.Objects.server.callFunctions([{"function":"rename",arguments:{references:{},"return":{},threadId:r.get("id"),token:r.get("token"),name:n}}],function(n){n.errorCode&&(e.Objects.Models.Status.message.setMessage(n.errorMessage||"Cannot rename"),t.set({name:s}))},!0),t.set({name:n}))}})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t){var r=e.Models.BaseSurveyForm;e.Models.LeaveMessageForm=r.extend({defaults:t.extend({},r.prototype.defaults,{showCaptcha:!1,captcha:""}),validate:function(t){var r=e.Localization;if("undefined"!=typeof t.email){if(!t.email)return r.get("leavemessage.error.email.required");if(!e.Utils.checkEmail(t.email))return r.get("leavemessage.error.wrong.email")}return"undefined"==typeof t.name||t.name?"undefined"==typeof t.message||t.message?this.get("showCaptcha")&&"undefined"!=typeof t.captcha&&!t.captcha?r.get("The letters you typed don't match the letters that were shown in the picture."):void 0:r.get("leavemessage.error.message.required"):r.get("leavemessage.error.name.required")},submit:function(){if(!this.validate(this.attributes)){var t=this;e.Objects.server.callFunctions([{"function":"processLeaveMessage",arguments:{references:{},"return":{},groupId:t.get("groupId"),name:t.get("name"),info:t.get("info"),email:t.get("email"),message:t.get("message"),referrer:t.get("referrer"),captcha:t.get("captcha"),threadId:null,token:null}}],function(e){0==e.errorCode?t.trigger("submit:complete",t):t.trigger("submit:error",t,{code:e.errorCode,message:e.errorMessage||""})},!0)}},ERROR_WRONG_CAPTCHA:10})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Models.MessageForm=e.Models.Base.extend({defaults:{predefinedAnswers:[],ignoreCtrl:!1},postMessage:function(t){var s=e.Objects.Models.thread,r=e.Objects.Models.user;if(r.get("canPost")){this.trigger("before:post",this);var n=this;e.Objects.server.callFunctions([{"function":"post",arguments:{references:{},"return":{},message:t,threadId:s.get("id"),token:s.get("token"),user:!r.get("isAgent")}}],function(){n.trigger("after:post",n)},!0)}}})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,n){e.Models.BaseSoundManager=n.Model.extend({defaults:{enabled:!0},play:function(n){this.get("enabled")&&e.Utils.playSound(n)}})}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,s){e.Models.ChatSoundManager=e.Models.BaseSoundManager.extend({defaults:s.extend({},e.Models.BaseSoundManager.prototype.defaults,{skipNextMessageSound:!1}),initialize:function(){var s=e.Objects,t=this;s.Collections.messages.on("multiple:add",this.playNewMessageSound,this),s.Models.messageForm.on("before:post",function(){t.set({skipNextMessageSound:!0})})},playNewMessageSound:function(){if(!this.get("skipNextMessageSound")){var s=e.Objects.Models.page.get("mibewRoot");"undefined"!=typeof s&&(s+="/sounds/new_message",this.play(s))}this.set({skipNextMessageSound:!1})}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(i,e){i.Models.Status=i.Models.Base.extend({defaults:{visible:!0,weight:0,hideTimeout:4e3,title:""},initialize:function(){this.hideTimer=null},autoHide:function(i){var t=i||this.get("hideTimeout");this.hideTimer&&clearTimeout(this.hideTimer),this.hideTimer=setTimeout(e.bind(function(){this.set({visible:!1})},this),t)}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,s){e.Models.StatusMessage=e.Models.Status.extend({defaults:s.extend({},e.Models.Status.prototype.defaults,{message:"",visible:!1}),getModelType:function(){return"StatusMessage"},setMessage:function(e){this.set({message:e,visible:!0}),this.autoHide()}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(t,e){t.Models.StatusTyping=t.Models.Status.extend({defaults:e.extend({},t.Models.Status.prototype.defaults,{visible:!1,hideTimeout:2e3}),getModelType:function(){return"StatusTyping"},show:function(){this.set({visible:!0}),this.autoHide()}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Models.BaseSurveyForm=e.Models.Base.extend({defaults:{name:"",email:"",message:"",info:"",referrer:"",groupId:null,groups:null}})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t){var r=e.Models.BaseSurveyForm;e.Models.SurveyForm=r.extend({defaults:t.extend({},r.prototype.defaults,{showEmail:!1,showMessage:!1,canChangeName:!1}),validate:function(t){return this.get("showEmail")&&"undefined"!=typeof t.email&&!e.Utils.checkEmail(t.email)?e.Localization.get("Wrong email address."):void 0},submit:function(){if(!this.validate(this.attributes)){var t=this;e.Objects.server.callFunctions([{"function":"processSurvey",arguments:{references:{},"return":{next:"next",options:"options"},groupId:t.get("groupId"),name:t.get("name"),info:t.get("info"),email:t.get("email"),message:t.get("message"),referrer:t.get("referrer"),threadId:null,token:null}}],function(r){if(0==r.errorCode)switch(t.trigger("submit:complete",t),e.Application.Survey.stop(),r.next){case"chat":e.Application.Chat.start(r.options);break;case"leaveMessage":e.Application.LeaveMessage.start(r.options);break;default:throw new Error("Do not know how to continue!")}else t.trigger("submit:error",t,{code:r.errorCode,message:r.errorMessage||""})},!0)}}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Objects.Models.Controls={},e.Objects.Models.Status={};var s=[],t=e.Application,o=t.module("Chat",{startWithParent:!1});o.addInitializer(function(o){var n=e.Objects,l=e.Objects.Models,a=e.Objects.Models.Controls,r=e.Objects.Models.Status;o.page&&l.page.set(o.page),l.thread=new e.Models.Thread(o.thread),l.user=new e.Models.ChatUser(o.user);var i=new e.Layouts.Chat;n.chatLayout=i,t.mainRegion.show(i);var d=new e.Collections.Controls;l.user.get("isAgent")||(a.userName=new e.Models.UserNameControl({weight:220}),d.add(a.userName),a.sendMail=new e.Models.SendMailControl({weight:200,link:o.links.mail,windowParams:o.windowsParams.mail}),d.add(a.sendMail)),l.user.get("isAgent")&&(a.redirect=new e.Models.RedirectControl({weight:200,link:o.links.redirect}),d.add(a.redirect),a.history=new e.Models.HistoryControl({weight:180,link:o.links.history,windowParams:o.windowsParams.history}),d.add(a.history)),a.sound=new e.Models.SoundControl({weight:160}),d.add(a.sound),a.refresh=new e.Models.RefreshControl({weight:140}),d.add(a.refresh),o.links.ssl&&(a.secureMode=new e.Models.SecureModeControl({weight:120,link:o.links.ssl}),d.add(a.secureMode)),a.close=new e.Models.CloseControl({weight:100}),d.add(a.close),n.Collections.controls=d,i.controlsRegion.show(new e.Views.ControlsCollection({collection:d})),r.message=new e.Models.StatusMessage({hideTimeout:5e3}),r.typing=new e.Models.StatusTyping({hideTimeout:5e3}),n.Collections.status=new e.Collections.Status([r.message,r.typing]),i.statusRegion.show(new e.Views.StatusCollection({collection:n.Collections.status})),l.user.get("isAgent")||(l.avatar=new e.Models.Avatar,i.avatarRegion.show(new e.Views.Avatar({model:l.avatar}))),n.Collections.messages=new e.Collections.Messages,l.messageForm=new e.Models.MessageForm(o.messageForm),i.messageFormRegion.show(new e.Views.MessageForm({model:l.messageForm})),i.messagesRegion.show(new e.Views.MessagesCollection({collection:n.Collections.messages})),l.soundManager=new e.Models.ChatSoundManager,s.push(n.server.callFunctionsPeriodically(function(){var s=e.Objects.Models.thread,t=e.Objects.Models.user;return[{"function":"update",arguments:{"return":{typing:"typing",canPost:"canPost"},references:{},threadId:s.get("id"),token:s.get("token"),lastId:s.get("lastId"),typed:t.get("typing"),user:!t.get("isAgent")}}]},function(s){return s.errorCode?void e.Objects.Models.Status.message.setMessage(s.errorMessage||"refresh failed"):(s.typing&&e.Objects.Models.Status.typing.show(),void e.Objects.Models.user.set({canPost:s.canPost||!1}))}))}),o.on("start",function(){e.Objects.server.restartUpdater()}),o.addFinalizer(function(){e.Objects.chatLayout.close();for(var t=0;t<s.length;t++)e.Objects.server.stopCallFunctionsPeriodically(s[t]);"undefined"!=typeof e.Objects.Models.avatar&&e.Objects.Models.avatar.finalize(),e.Objects.Collections.messages.finalize(),delete e.Objects.chatLayout,delete e.Objects.Models.thread,delete e.Objects.Models.user,delete e.Objects.Models.page,delete e.Objects.Models.avatar,delete e.Objects.Models.messageForm,delete e.Objects.Models.Controls,delete e.Objects.Models.Status,delete e.Objects.Collections.messages,delete e.Objects.Collections.controls,delete e.Objects.Collections.status})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){var t=[],s=e.Application,n=s.module("Invitation",{startWithParent:!1});n.addInitializer(function(n){var o=e.Objects,i=e.Objects.Models;i.thread=new e.Models.Thread(n.thread),i.user=new e.Models.ChatUser(n.user),o.invitationLayout=new e.Layouts.Invitation,s.mainRegion.show(o.invitationLayout),o.Collections.messages=new e.Collections.Messages,o.invitationLayout.messagesRegion.show(new e.Views.MessagesCollection({collection:o.Collections.messages})),t.push(o.server.callFunctionsPeriodically(function(){var t=e.Objects.Models.thread;return[{"function":"update",arguments:{"return":{},references:{},threadId:t.get("id"),token:t.get("token"),lastId:t.get("lastId"),typed:!1,user:!0}}]},function(){}))}),n.on("start",function(){e.Objects.server.restartUpdater()}),n.addFinalizer(function(){e.Objects.invitationLayout.close();for(var s=0;s<t.length;s++)e.Objects.server.stopCallFunctionsPeriodically(t[s]);e.Objects.Collections.messages.finalize(),delete e.Objects.invitationLayout,delete e.Objects.Models.thread,delete e.Objects.Models.user,delete e.Objects.Collections.messages})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){var s=e.Application,a=s.module("LeaveMessage",{startWithParent:!1});a.addInitializer(function(a){var o=e.Objects,i=e.Objects.Models;a.page&&i.page.set(a.page),o.leaveMessageLayout=new e.Layouts.LeaveMessage,s.mainRegion.show(o.leaveMessageLayout),i.leaveMessageForm=new e.Models.LeaveMessageForm(a.leaveMessageForm),o.leaveMessageLayout.leaveMessageFormRegion.show(new e.Views.LeaveMessageForm({model:i.leaveMessageForm})),o.leaveMessageLayout.descriptionRegion.show(new e.Views.LeaveMessageDescription),i.leaveMessageForm.on("submit:complete",function(){o.leaveMessageLayout.leaveMessageFormRegion.close(),o.leaveMessageLayout.descriptionRegion.close(),o.leaveMessageLayout.descriptionRegion.show(new e.Views.LeaveMessageSentDescription)})}),a.addFinalizer(function(){e.Objects.leaveMessageLayout.close(),delete e.Objects.Models.leaveMessageForm})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){var o=e.Application,r=o.module("Survey",{startWithParent:!1});r.addInitializer(function(r){var s=e.Objects,u=e.Objects.Models;s.surveyLayout=new e.Layouts.Survey,o.mainRegion.show(s.surveyLayout),u.surveyForm=new e.Models.SurveyForm(r.surveyForm),s.surveyLayout.surveyFormRegion.show(new e.Views.SurveyForm({model:u.surveyForm}))}),r.addFinalizer(function(){e.Objects.surveyLayout.close(),delete e.Objects.Models.surveyForm})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(o,t){o.Regions.Messages=t.Marionette.Region.extend({onShow:function(o){o.on("after:item:added",this.scrollToBottom,this)},scrollToBottom:function(){this.$el.scrollTop(this.$el.prop("scrollHeight"))}})}(Mibew,Backbone);
|
@ -1,379 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Regions={},e.Layouts={},e.Application=new Backbone.Marionette.Application}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
MibewAPIChatInteraction=function(){this.mandatoryArguments=function(){return{"*":{threadId:null,token:null,"return":{},references:{}},result:{errorCode:0}}},this.getReservedFunctionsNames=function(){return["result"]}},MibewAPIChatInteraction.prototype=new MibewAPIInteraction,/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.BaseSoundManager=t.Model.extend({defaults:{enabled:!0},play:function(t){this.get("enabled")&&e.Utils.playSound(t)}})}(Mibew,Backbone),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.Status=e.Models.Base.extend({defaults:{visible:!0,weight:0,hideTimeout:4e3,title:""},initialize:function(){this.hideTimer=null},autoHide:function(e){var s=e||this.get("hideTimeout");this.hideTimer&&clearTimeout(this.hideTimer),this.hideTimer=setTimeout(t.bind(function(){this.set({visible:!1})},this),s)}})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Models.BaseSurveyForm=e.Models.Base.extend({defaults:{name:"",email:"",message:"",info:"",referrer:"",groupId:null,groups:null}})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.Avatar=e.Models.Base.extend({defaults:{imageLink:!1},initialize:function(){this.registeredFunctions=[],this.registeredFunctions.push(e.Objects.server.registerFunction("setupAvatar",t.bind(this.apiSetupAvatar,this)))},finalize:function(){for(var t=0;t<this.registeredFunctions.length;t++)e.Objects.server.unregisterFunction(this.registeredFunctions[t])},apiSetupAvatar:function(e){e.imageLink&&this.set({imageLink:e.imageLink})}})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.ChatUser=e.Models.User.extend({defaults:t.extend({},e.Models.User.prototype.defaults,{canPost:!0,typing:!1,canChangeName:!1,dafaultName:!0})})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Models.CloseControl=e.Models.Control.extend({getModelType:function(){return"CloseControl"},closeThread:function(){var t=e.Objects.Models.thread,s=e.Objects.Models.user;e.Objects.server.callFunctions([{"function":"close",arguments:{references:{},"return":{closed:"closed"},threadId:t.get("id"),token:t.get("token"),lastId:t.get("lastId"),user:!s.get("isAgent")}}],function(t){t.closed?window.close():e.Objects.Models.Status.message.setMessage(t.errorMessage||"Cannot close")},!0)}})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.HistoryControl=e.Models.Control.extend({defaults:t.extend({},e.Models.Control.prototype.defaults,{link:!1,windowParams:""}),getModelType:function(){return"HistoryControl"}})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.RedirectControl=e.Models.Control.extend({defaults:t.extend({},e.Models.Control.prototype.defaults,{link:!1}),getModelType:function(){return"RedirectControl"}})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Models.RefreshControl=e.Models.Control.extend({getModelType:function(){return"RefreshControl"},refresh:function(){e.Objects.server.restartUpdater()}})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.SecureModeControl=e.Models.Control.extend({defaults:t.extend({},e.Models.Control.prototype.defaults,{link:!1}),getModelType:function(){return"SecureModeControl"}})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.SendMailControl=e.Models.Control.extend({defaults:t.extend({},e.Models.Control.prototype.defaults,{link:!1,windowParams:""}),getModelType:function(){return"SendMailControl"}})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.SoundControl=e.Models.Control.extend({defaults:t.extend({},e.Models.Control.prototype.defaults,{enabled:!0}),toggle:function(){var t=!this.get("enabled");e.Objects.Models.soundManager.set({enabled:t}),this.set({enabled:t})},getModelType:function(){return"SoundControl"}})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Models.UserNameControl=e.Models.Control.extend({getModelType:function(){return"UserNameControl"},changeName:function(t){var s=e.Objects.Models.user,o=e.Objects.Models.thread,n=s.get("name");t&&n!=t&&(e.Objects.server.callFunctions([{"function":"rename",arguments:{references:{},"return":{},threadId:o.get("id"),token:o.get("token"),name:t}}],function(t){t.errorCode&&(e.Objects.Models.Status.message.setMessage(t.errorMessage||"Cannot rename"),s.set({name:n}))},!0),s.set({name:t}))}})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){var s=e.Models.BaseSurveyForm;e.Models.LeaveMessageForm=s.extend({defaults:t.extend({},s.prototype.defaults,{showCaptcha:!1,captcha:""}),validate:function(t){var s=e.Localization;if("undefined"!=typeof t.email){if(!t.email)return s.get("leavemessage.error.email.required");if(!e.Utils.checkEmail(t.email))return s.get("leavemessage.error.wrong.email")}return"undefined"==typeof t.name||t.name?"undefined"==typeof t.message||t.message?this.get("showCaptcha")&&"undefined"!=typeof t.captcha&&!t.captcha?s.get("The letters you typed don't match the letters that were shown in the picture."):void 0:s.get("leavemessage.error.message.required"):s.get("leavemessage.error.name.required")},submit:function(){if(!this.validate(this.attributes)){var t=this;e.Objects.server.callFunctions([{"function":"processLeaveMessage",arguments:{references:{},"return":{},groupId:t.get("groupId"),name:t.get("name"),info:t.get("info"),email:t.get("email"),message:t.get("message"),referrer:t.get("referrer"),captcha:t.get("captcha"),threadId:null,token:null}}],function(e){0==e.errorCode?t.trigger("submit:complete",t):t.trigger("submit:error",t,{code:e.errorCode,message:e.errorMessage||""})},!0)}},ERROR_WRONG_CAPTCHA:10})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Models.MessageForm=e.Models.Base.extend({defaults:{predefinedAnswers:[],ignoreCtrl:!1},postMessage:function(t){var s=e.Objects.Models.thread,o=e.Objects.Models.user;if(o.get("canPost")){this.trigger("before:post",this);var n=this;e.Objects.server.callFunctions([{"function":"post",arguments:{references:{},"return":{},message:t,threadId:s.get("id"),token:s.get("token"),user:!o.get("isAgent")}}],function(){n.trigger("after:post",n)},!0)}}})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.ChatSoundManager=e.Models.BaseSoundManager.extend({defaults:t.extend({},e.Models.BaseSoundManager.prototype.defaults,{skipNextMessageSound:!1}),initialize:function(){var t=e.Objects,s=this;t.Collections.messages.on("multiple:add",this.playNewMessageSound,this),t.Models.messageForm.on("before:post",function(){s.set({skipNextMessageSound:!0})})},playNewMessageSound:function(){if(!this.get("skipNextMessageSound")){var t=e.Objects.Models.page.get("mibewRoot");"undefined"!=typeof t&&(t+="/sounds/new_message",this.play(t))}this.set({skipNextMessageSound:!1})}})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.StatusMessage=e.Models.Status.extend({defaults:t.extend({},e.Models.Status.prototype.defaults,{message:"",visible:!1}),getModelType:function(){return"StatusMessage"},setMessage:function(e){this.set({message:e,visible:!0}),this.autoHide()}})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.StatusTyping=e.Models.Status.extend({defaults:t.extend({},e.Models.Status.prototype.defaults,{visible:!1,hideTimeout:2e3}),getModelType:function(){return"StatusTyping"},show:function(){this.set({visible:!0}),this.autoHide()}})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){var s=e.Models.BaseSurveyForm;e.Models.SurveyForm=s.extend({defaults:t.extend({},s.prototype.defaults,{showEmail:!1,showMessage:!1,canChangeName:!1}),validate:function(t){return this.get("showEmail")&&"undefined"!=typeof t.email&&!e.Utils.checkEmail(t.email)?e.Localization.get("Wrong email address."):void 0},submit:function(){if(!this.validate(this.attributes)){var t=this;e.Objects.server.callFunctions([{"function":"processSurvey",arguments:{references:{},"return":{next:"next",options:"options"},groupId:t.get("groupId"),name:t.get("name"),info:t.get("info"),email:t.get("email"),message:t.get("message"),referrer:t.get("referrer"),threadId:null,token:null}}],function(s){if(0==s.errorCode)switch(t.trigger("submit:complete",t),e.Application.Survey.stop(),s.next){case"chat":e.Application.Chat.start(s.options);break;case"leaveMessage":e.Application.LeaveMessage.start(s.options);break;default:throw new Error("Do not know how to continue!")}else t.trigger("submit:error",t,{code:s.errorCode,message:s.errorMessage||""})},!0)}}})}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Collections.Messages=t.Collection.extend({model:e.Models.Message,initialize:function(){this.periodicallyCalled=[],this.periodicallyCalled.push(e.Objects.server.callFunctionsPeriodically(s.bind(this.updateMessagesFunctionBuilder,this),s.bind(this.updateMessages,this)))},finalize:function(){for(var t=0;t<this.periodicallyCalled.length;t++)e.Objects.server.stopCallFunctionsPeriodically(this.periodicallyCalled[t])},updateMessages:function(t){t.lastId&&e.Objects.Models.thread.set({lastId:t.lastId});for(var s,o,n,a,i=e.Models.Message.prototype.KIND_PLUGIN,r=[],l=0,d=t.messages.length;d>l;l++)s=t.messages[l],s.kind==i?"object"==typeof s.data&&null!==s.data&&(o=s.plugin||!1,n="process:"+(o!==!1?o+":":"")+"plugin:message",a={messageData:s,model:!1},this.trigger(n,a),a.model&&(a.model.get("id")||a.model.set({id:s.id}),r.push(a.model))):r.push(new e.Models.Message(s));r.length>0&&this.add(r)},updateMessagesFunctionBuilder:function(){var t=e.Objects.Models.thread,s=e.Objects.Models.user;return[{"function":"updateMessages",arguments:{"return":{messages:"messages",lastId:"lastId"},references:{},threadId:t.get("id"),token:t.get("token"),lastId:t.get("lastId"),user:!s.get("isAgent")}}]},add:function(){var e=Array.prototype.slice.apply(arguments),s=t.Collection.prototype.add.apply(this,e);return this.trigger("multiple:add"),s}})}(Mibew,Backbone,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Collections.Status=t.Collection.extend({comparator:function(e){return e.get("weight")}})}(Mibew,Backbone),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.Status=t.Marionette.ItemView.extend({template:s.templates["chat/status/base"],className:"status",modelEvents:{change:"render"},onBeforeRender:function(){this.model.get("visible")?this.$el.show():this.$el.hide()}})}(Mibew,Backbone,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Views.BaseSurveyForm=t.Marionette.ItemView.extend({events:{'change select[name="group"]':"changeGroupDescription","submit form":"preventSubmit"},ui:{groupSelect:'select[name="group"]',groupDescription:"#groupDescription",name:'input[name="name"]',email:'input[name="email"]',message:'textarea[name="message"]',errors:".errors",ajaxLoader:"#ajax-loader"},modelEvents:{invalid:"hideAjaxLoader showError","submit:error":"hideAjaxLoader showError"},preventSubmit:function(e){e.preventDefault()},changeGroupDescription:function(){var e=this.ui.groupSelect.prop("selectedIndex"),t=this.model.get("groups")[e].description||"";this.ui.groupDescription.text(t)},showError:function(e,t){var s;s="string"==typeof t?t:t.message,this.ui.errors.html(s)},serializeData:function(){var t=this.model.toJSON();return t.page=e.Objects.Models.page.toJSON(),t},showAjaxLoader:function(){this.ui.ajaxLoader.show()},hideAjaxLoader:function(){this.ui.ajaxLoader.hide()}})}(Mibew,Backbone),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.Avatar=t.Marionette.ItemView.extend({template:s.templates["chat/avatar"],className:"avatar",modelEvents:{change:"render"}})}(Mibew,Backbone,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.CloseControl=e.Views.Control.extend({template:t.templates["chat/controls/close"],events:s.extend({},e.Views.Control.prototype.events,{click:"closeThread"}),closeThread:function(){var t=e.Localization.get("Are you sure want to leave chat?");(t===!1||confirm(t))&&this.model.closeThread()}})}(Mibew,Handlebars,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.HistoryControl=e.Views.Control.extend({template:t.templates["chat/controls/history"],events:s.extend({},e.Views.Control.prototype.events,{click:"showHistory"}),showHistory:function(){var t=e.Objects.Models.user,s=this.model.get("link");if(t.get("isAgent")&&s){var o=this.model.get("windowParams");s=s.replace("&","&","g");var n=window.open(s,"UserHistory",o);null!==n&&(n.focus(),n.opener=window)}}})}(Mibew,Handlebars,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.RedirectControl=e.Views.Control.extend({template:t.templates["chat/controls/redirect"],events:s.extend({},e.Views.Control.prototype.events,{click:"redirect"}),initialize:function(){e.Objects.Models.user.on("change",this.render,this)},serializeData:function(){var t=this.model.toJSON();return t.user=e.Objects.Models.user.toJSON(),t},redirect:function(){var t=e.Objects.Models.user;if(t.get("isAgent")&&t.get("canPost")){var s=this.model.get("link");if(s){var o=e.Objects.Models.page.get("style"),n="";o&&(n=(-1===s.indexOf("?")?"?":"&")+"style="+o),window.location.href=s.replace(/\&\;/g,"&")+n}}}})}(Mibew,Handlebars,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.RefreshControl=e.Views.Control.extend({template:t.templates["chat/controls/refresh"],events:s.extend({},e.Views.Control.prototype.events,{click:"refresh"}),refresh:function(){this.model.refresh()}})}(Mibew,Handlebars,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.SecureModeControl=e.Views.Control.extend({template:t.templates["chat/controls/secure_mode"],events:s.extend({},e.Views.Control.prototype.events,{click:"secure"}),secure:function(){var t=this.model.get("link");if(t){var s=e.Objects.Models.page.get("style");window.location.href=t.replace(/\&\;/g,"&")+(s?"&style="+s:"")}}})}(Mibew,Handlebars,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.SendMailControl=e.Views.Control.extend({template:t.templates["chat/controls/send_mail"],events:s.extend({},e.Views.Control.prototype.events,{click:"sendMail"}),sendMail:function(){var t=this.model.get("link"),s=e.Objects.Models.page;if(t){var o=this.model.get("windowParams"),n=s.get("style"),a="";n&&(a=(-1===t.indexOf("?")?"?":"&")+"style="+n),t=t.replace(/\&\;/g,"&")+a;var i=window.open(t,"ForwardMail",o);null!==i&&(i.focus(),i.opener=window)}}})}(Mibew,Handlebars,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.SoundControl=e.Views.Control.extend({template:t.templates["chat/controls/sound"],events:s.extend({},e.Views.Control.prototype.events,{click:"toggle"}),toggle:function(){this.model.toggle()}})}(Mibew,Handlebars,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.UserNameControl=e.Views.Control.extend({template:t.templates["chat/controls/user_name"],events:s.extend({},e.Views.Control.prototype.events,{"click .user-name-control-set":"changeName","click .user-name-control-change":"showNameInput","keydown #user-name-control-input":"inputKeyDown"}),ui:{nameInput:"#user-name-control-input"},initialize:function(){e.Objects.Models.user.on("change:name",this.hideNameInput,this),this.nameInput=e.Objects.Models.user.get("defaultName")},serializeData:function(){var t=this.model.toJSON();return t.user=e.Objects.Models.user.toJSON(),t.nameInput=this.nameInput,t},inputKeyDown:function(e){var t=e.which;(13==t||10==t)&&this.changeName()},hideNameInput:function(){this.nameInput=!1,this.render()},showNameInput:function(){this.nameInput=!0,this.render()},changeName:function(){var e=this.ui.nameInput.val();this.model.changeName(e)}})}(Mibew,Handlebars,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.LeaveMessageDescription=t.Marionette.ItemView.extend({template:s.templates["leave_message/description"],serializeData:function(){return{page:e.Objects.Models.page.toJSON()}}})}(Mibew,Backbone,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){var o=e.Views.BaseSurveyForm;e.Views.LeaveMessageForm=o.extend({template:t.templates["leave_message/form"],events:s.extend({},o.prototype.events,{"click #send-message":"submitForm"}),ui:s.extend({},o.prototype.ui,{captcha:'input[name="captcha"]',captchaImg:"#captcha-img"}),modelEvents:s.extend({},o.prototype.modelEvents,{"submit:error":"hideAjaxLoader showError submitError"}),submitForm:function(){this.showAjaxLoader();var e={};this.model.get("groups")&&(e.groupId=this.ui.groupSelect.val()),e.name=this.ui.name.val()||"",e.email=this.ui.email.val()||"",e.message=this.ui.message.val()||"",this.model.get("showCaptcha")&&(e.captcha=this.ui.captcha.val()||""),this.model.set(e,{validate:!0}),this.model.submit()},submitError:function(e,t){if(t.code==e.ERROR_WRONG_CAPTCHA&&e.get("showCaptcha")){var s=this.ui.captchaImg.attr("src");s=s.replace(/\?d\=[0-9]+/,""),this.ui.captchaImg.attr("src",s+"?d="+(new Date).getTime())}}})}(Mibew,Handlebars,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.LeaveMessageSentDescription=t.Marionette.ItemView.extend({template:s.templates["leave_message/sent_description"],serializeData:function(){return{page:e.Objects.Models.page.toJSON()}}})}(Mibew,Backbone,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Views.Message=e.Views.Message.extend({template:t.templates["chat/message"]})}(Mibew,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){e.Views.MessageForm=t.Marionette.ItemView.extend({template:s.templates["chat/message_form"],events:{"click #send-message":"postMessage","keydown #message-input":"messageKeyDown","keyup #message-input":"checkUserTyping","change #message-input":"checkUserTyping","change #predefined":"selectPredefinedAnswer","focus #message-input":"setFocus","blur #message-input":"dropFocus"},modelEvents:{change:"render"},ui:{message:"#message-input",send:"#send-message",predefinedAnswer:"#predefined"},initialize:function(){e.Objects.Models.user.on("change:canPost",this.render,this)},serializeData:function(){var t=this.model.toJSON();return t.user=e.Objects.Models.user.toJSON(),t},postMessage:function(){var t=this.ui.message.val();""!=t&&(this.disableInput(),this.model.postMessage(t)),e.Objects.Collections.messages.on("multiple:add",this.postMessageComplete,this)},messageKeyDown:function(e){var t=e.which,s=e.ctrlKey;(13==t&&(s||this.model.get("ignoreCtrl"))||10==t)&&this.postMessage()},enableInput:function(){this.ui.message.removeAttr("disabled")},disableInput:function(){this.ui.message.attr("disabled","disabled")},clearInput:function(){this.ui.message.val("").change()},postMessageComplete:function(){this.clearInput(),this.enableInput(),this.focused&&this.ui.focus(),e.Objects.Collections.messages.off("multiple:add",this.postMessageComplete,this)},selectPredefinedAnswer:function(){var e=this.ui.message,t=this.ui.predefinedAnswer,s=t.get(0).selectedIndex;s&&(e.val(this.model.get("predefinedAnswers")[s-1].full).change(),e.focus(),t.get(0).selectedIndex=0)},checkUserTyping:function(){var t=e.Objects.Models.user,s=""!=this.ui.message.val();s!=t.get("typing")&&t.set({typing:s})},setFocus:function(){this.focused=!0},dropFocus:function(){this.focused=!1}})}(Mibew,Backbone,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Views.StatusMessage=e.Views.Status.extend({template:t.templates["chat/status/message"]})}(Mibew,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Views.StatusTyping=e.Views.Status.extend({template:t.templates["chat/status/typing"]})}(Mibew,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,s){var o=e.Views.BaseSurveyForm;e.Views.SurveyForm=o.extend({template:t.templates["survey/form"],events:s.extend({},o.prototype.events,{"click #submit-survey":"submitForm"}),submitForm:function(){this.showAjaxLoader();var e={};this.model.get("groups")&&(e.groupId=this.ui.groupSelect.val()),this.model.get("canChangeName")&&(e.name=this.ui.name.val()||""),this.model.get("showEmail")&&(e.email=this.ui.email.val()||""),this.model.get("showMessage")&&(e.message=this.ui.message.val()||""),this.model.set(e,{validate:!0}),this.model.submit()}})}(Mibew,Handlebars,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Views.MessagesCollection=e.Views.CollectionBase.extend({itemView:e.Views.Message,className:"messages-collection"})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Views.StatusCollection=e.Views.CollectionBase.extend({itemView:e.Views.Status,className:"status-collection"})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Regions.Messages=t.Marionette.Region.extend({onShow:function(e){e.on("after:item:added",this.scrollToBottom,this)},scrollToBottom:function(){this.$el.scrollTop(this.$el.prop("scrollHeight"))}})}(Mibew,Backbone),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Layouts.Chat=t.Marionette.Layout.extend({template:Handlebars.templates["chat/layout"],regions:{controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:{selector:"#messages-region",regionType:e.Regions.Messages},statusRegion:"#status-region",messageFormRegion:"#message-form-region"},serializeData:function(){var t=e.Objects.Models;return{page:t.page.toJSON(),user:t.user.toJSON()}}})}(Mibew,Backbone),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Layouts.Invitation=t.Marionette.Layout.extend({template:Handlebars.templates["invitation/layout"],regions:{messagesRegion:{selector:"#invitation-messages-region",regionType:e.Regions.Messages}}})}(Mibew,Backbone),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Layouts.LeaveMessage=t.Marionette.Layout.extend({template:Handlebars.templates["leave_message/layout"],regions:{leaveMessageFormRegion:"#content-wrapper",descriptionRegion:"#description-region"},serializeData:function(){return{page:e.Objects.Models.page.toJSON()}}})}(Mibew,Backbone),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Layouts.Survey=t.Marionette.Layout.extend({template:Handlebars.templates["survey/layout"],regions:{surveyFormRegion:"#content-wrapper"},serializeData:function(){return{page:e.Objects.Models.page.toJSON()}}})}(Mibew,Backbone),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Objects.Models.Controls={},e.Objects.Models.Status={};var t=[],s=e.Application,o=s.module("Chat",{startWithParent:!1});o.addInitializer(function(o){var n=e.Objects,a=e.Objects.Models,i=e.Objects.Models.Controls,r=e.Objects.Models.Status;o.page&&a.page.set(o.page),a.thread=new e.Models.Thread(o.thread),a.user=new e.Models.ChatUser(o.user);var l=new e.Layouts.Chat;n.chatLayout=l,s.mainRegion.show(l);var d=new e.Collections.Controls;a.user.get("isAgent")||(i.userName=new e.Models.UserNameControl({weight:220}),d.add(i.userName),i.sendMail=new e.Models.SendMailControl({weight:200,link:o.links.mail,windowParams:o.windowsParams.mail}),d.add(i.sendMail)),a.user.get("isAgent")&&(i.redirect=new e.Models.RedirectControl({weight:200,link:o.links.redirect}),d.add(i.redirect),i.history=new e.Models.HistoryControl({weight:180,link:o.links.history,windowParams:o.windowsParams.history}),d.add(i.history)),i.sound=new e.Models.SoundControl({weight:160}),d.add(i.sound),i.refresh=new e.Models.RefreshControl({weight:140}),d.add(i.refresh),o.links.ssl&&(i.secureMode=new e.Models.SecureModeControl({weight:120,link:o.links.ssl}),d.add(i.secureMode)),i.close=new e.Models.CloseControl({weight:100}),d.add(i.close),n.Collections.controls=d,l.controlsRegion.show(new e.Views.ControlsCollection({collection:d})),r.message=new e.Models.StatusMessage({hideTimeout:5e3}),r.typing=new e.Models.StatusTyping({hideTimeout:5e3}),n.Collections.status=new e.Collections.Status([r.message,r.typing]),l.statusRegion.show(new e.Views.StatusCollection({collection:n.Collections.status})),a.user.get("isAgent")||(a.avatar=new e.Models.Avatar,l.avatarRegion.show(new e.Views.Avatar({model:a.avatar}))),n.Collections.messages=new e.Collections.Messages,a.messageForm=new e.Models.MessageForm(o.messageForm),l.messageFormRegion.show(new e.Views.MessageForm({model:a.messageForm})),l.messagesRegion.show(new e.Views.MessagesCollection({collection:n.Collections.messages})),a.soundManager=new e.Models.ChatSoundManager,t.push(n.server.callFunctionsPeriodically(function(){var t=e.Objects.Models.thread,s=e.Objects.Models.user;return[{"function":"update",arguments:{"return":{typing:"typing",canPost:"canPost"},references:{},threadId:t.get("id"),token:t.get("token"),lastId:t.get("lastId"),typed:s.get("typing"),user:!s.get("isAgent")}}]},function(t){return t.errorCode?void e.Objects.Models.Status.message.setMessage(t.errorMessage||"refresh failed"):(t.typing&&e.Objects.Models.Status.typing.show(),void e.Objects.Models.user.set({canPost:t.canPost||!1}))}))}),o.on("start",function(){e.Objects.server.restartUpdater()}),o.addFinalizer(function(){e.Objects.chatLayout.close();for(var s=0;s<t.length;s++)e.Objects.server.stopCallFunctionsPeriodically(t[s]);"undefined"!=typeof e.Objects.Models.avatar&&e.Objects.Models.avatar.finalize(),e.Objects.Collections.messages.finalize(),delete e.Objects.chatLayout,delete e.Objects.Models.thread,delete e.Objects.Models.user,delete e.Objects.Models.page,delete e.Objects.Models.avatar,delete e.Objects.Models.messageForm,delete e.Objects.Models.Controls,delete e.Objects.Models.Status,delete e.Objects.Collections.messages,delete e.Objects.Collections.controls,delete e.Objects.Collections.status})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){var t=[],s=e.Application,o=s.module("Invitation",{startWithParent:!1});o.addInitializer(function(o){var n=e.Objects,a=e.Objects.Models;a.thread=new e.Models.Thread(o.thread),a.user=new e.Models.ChatUser(o.user),n.invitationLayout=new e.Layouts.Invitation,s.mainRegion.show(n.invitationLayout),n.Collections.messages=new e.Collections.Messages,n.invitationLayout.messagesRegion.show(new e.Views.MessagesCollection({collection:n.Collections.messages})),t.push(n.server.callFunctionsPeriodically(function(){var t=e.Objects.Models.thread;return[{"function":"update",arguments:{"return":{},references:{},threadId:t.get("id"),token:t.get("token"),lastId:t.get("lastId"),typed:!1,user:!0}}]},function(){}))}),o.on("start",function(){e.Objects.server.restartUpdater()}),o.addFinalizer(function(){e.Objects.invitationLayout.close();for(var s=0;s<t.length;s++)e.Objects.server.stopCallFunctionsPeriodically(t[s]);e.Objects.Collections.messages.finalize(),delete e.Objects.invitationLayout,delete e.Objects.Models.thread,delete e.Objects.Models.user,delete e.Objects.Collections.messages})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){var t=e.Application,s=t.module("LeaveMessage",{startWithParent:!1});s.addInitializer(function(s){var o=e.Objects,n=e.Objects.Models;s.page&&n.page.set(s.page),o.leaveMessageLayout=new e.Layouts.LeaveMessage,t.mainRegion.show(o.leaveMessageLayout),n.leaveMessageForm=new e.Models.LeaveMessageForm(s.leaveMessageForm),o.leaveMessageLayout.leaveMessageFormRegion.show(new e.Views.LeaveMessageForm({model:n.leaveMessageForm})),o.leaveMessageLayout.descriptionRegion.show(new e.Views.LeaveMessageDescription),n.leaveMessageForm.on("submit:complete",function(){o.leaveMessageLayout.leaveMessageFormRegion.close(),o.leaveMessageLayout.descriptionRegion.close(),o.leaveMessageLayout.descriptionRegion.show(new e.Views.LeaveMessageSentDescription)})}),s.addFinalizer(function(){e.Objects.leaveMessageLayout.close(),delete e.Objects.Models.leaveMessageForm})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){var t=e.Application,s=t.module("Survey",{startWithParent:!1});s.addInitializer(function(s){var o=e.Objects,n=e.Objects.Models;o.surveyLayout=new e.Layouts.Survey,t.mainRegion.show(o.surveyLayout),n.surveyForm=new e.Models.SurveyForm(s.surveyForm),o.surveyLayout.surveyFormRegion.show(new e.Views.SurveyForm({model:n.surveyForm}))}),s.addFinalizer(function(){e.Objects.surveyLayout.close(),delete e.Objects.Models.surveyForm})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){var s=e.Application;s.addRegions({mainRegion:"#main-region"}),s.addInitializer(function(o){switch(e.PluginOptions=o.plugins||{},e.Objects.server=new e.Server(t.extend({interactionType:MibewAPIChatInteraction},o.server)),e.Objects.Models.page=new e.Models.Page(o.page),o.startFrom){case"chat":s.Chat.start(o.chatOptions);break;case"survey":s.Survey.start(o.surveyOptions);break;case"leaveMessage":s.LeaveMessage.start(o.leaveMessageOptions);break;case"invitation":s.Invitation.start(o.invitationOptions);break;default:throw new Error("Dont know how to start!")}}),s.on("start",function(){e.Objects.server.runUpdater()})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,i,t){var n=function(i,n,o){var w=t.extend({model:i},o);if("function"!=typeof i.getModelType)return new n(w);var r=i.getModelType();return r&&e.Views[r]?new e.Views[r](w):new n(w)};e.Views.CollectionBase=i.Marionette.CollectionView.extend({itemView:i.Marionette.ItemView,buildItemView:n}),e.Views.CompositeBase=i.Marionette.CompositeView.extend({buildItemView:n})}(Mibew,Backbone,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Views.ControlsCollection=e.Views.CollectionBase.extend({itemView:e.Views.Control,className:"controls-collection"})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(o,n){o.Collections.Controls=n.Collection.extend({comparator:function(o){return o.get("weight")}})}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,r){r.registerHelper("apply",function(e,t){var n=e,i=/^[0-9A-z_]+$/;t=t.split(/\s*,\s*/);for(var s in t)if(t.hasOwnProperty(s)&&i.test(t[s])){if("function"!=typeof r.helpers[t[s]])throw new Error("Unregistered helper '"+t[s]+"'!");n=r.helpers[t[s]](n).toString()}return new r.SafeString(n)}),r.registerHelper("allowTags",function(e){var t=e;return t=t.replace(/<(span|strong)>(.*?)<\/\1>/g,"<$1>$2</$1>"),t=t.replace(/<span class="(.*?)">(.*?)<\/span>/g,'<span class="$1">$2</span>'),new r.SafeString(t)}),r.registerHelper("formatTime",function(e){var r=new Date(1e3*e),t=r.getHours().toString(),n=r.getMinutes().toString(),i=r.getSeconds().toString();return t=10>t?"0"+t:t,n=10>n?"0"+n:n,i=10>i?"0"+i:i,t+":"+n+":"+i}),r.registerHelper("urlReplace",function(e){return new r.SafeString(e.replace(/((?:https?|ftp):\/\/\S*)/g,'<a href="$1" target="_blank">$1</a>'))}),r.registerHelper("nl2br",function(e){return new r.SafeString(e.replace(/\n/g,"<br/>"))}),r.registerHelper("l10n",function(r){return e.Localization.get(r)||""}),r.registerHelper("ifEven",function(e,r){return e%2===0?r.fn(this):r.inverse(this)}),r.registerHelper("ifOdd",function(e,r){return e%2!==0?r.fn(this):r.inverse(this)})}(Mibew,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
var Mibew={};!function(e,t,o){t.Marionette.TemplateCache.prototype.compileTemplate=function(e){return o.compile(e)};for(var a in o.templates)o.templates.hasOwnProperty(a)&&o.registerPartial(a,o.templates[a]);e.Models={},e.Collections={},e.Views={},e.Objects={},e.Objects.Models={},e.Objects.Collections={}}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(n,t){n.Localization={};var i={};n.Localization.get=function(n){return i.hasOwnProperty(n)?i[n]:!1},n.Localization.set=function(n){t.extend(i,n)}}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,s){e.Views.Control=t.Marionette.ItemView.extend({template:s.templates.default_control,modelEvents:{change:"render"},events:{mouseover:"mouseOver",mouseleave:"mouseLeave"},attributes:function(){var e=[];e.push("control"),this.className&&(e.push(this.className),this.className="");var t=this.getDashedControlType();return t&&e.push(t),{"class":e.join(" ")}},mouseOver:function(){var e=this.getDashedControlType();this.$el.addClass("active"+(e?"-"+e:""))},mouseLeave:function(){var e=this.getDashedControlType();this.$el.removeClass("active"+(e?"-"+e:""))},getDashedControlType:function(){return"undefined"==typeof this.dashedControlType&&(this.dashedControlType=e.Utils.toDashFormat(this.model.getModelType())||""),this.dashedControlType}})}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,n){var i={"<":"<",">":">","&":"&",'"':""","'":"'","`":"`"},s=/[&<>'"`]/g;e.Views.Message=t.Marionette.ItemView.extend({template:n.templates.message,className:"message",modelEvents:{change:"render"},serializeData:function(){var e=this.model.toJSON(),t=this.model.get("kind");return e.allowFormatting=t!=this.model.KIND_USER&&t!=this.model.KIND_AGENT,e.kindName=this.kindToString(t),e.message=this.escapeString(e.message),e},kindToString:function(e){return e==this.model.KIND_USER?"user":e==this.model.KIND_AGENT?"agent":e==this.model.KIND_FOR_AGENT?"hidden":e==this.model.KIND_INFO?"inf":e==this.model.KIND_CONN?"conn":e==this.model.KIND_EVENTS?"event":e==this.model.KIND_PLUGIN?"plugin":""},escapeString:function(e){return e.replace(s,function(e){return i[e]||"&"})}})}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,n){e.Models.Base=n.Model.extend({getModelType:function(){return""}})}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Models.Control=e.Models.Base.extend({defaults:{title:"",weight:0}})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Models.Message=e.Models.Base.extend({defaults:{kind:null,created:0,name:"",message:"",plugin:"",data:{}},KIND_USER:1,KIND_AGENT:2,KIND_FOR_AGENT:3,KIND_INFO:4,KIND_CONN:5,KIND_EVENTS:6,KIND_PLUGIN:7})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,n){e.Models.Page=n.Model.extend()}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(T){T.Models.Thread=T.Models.Base.extend({defaults:{id:0,token:0,lastId:0,state:null},STATE_QUEUE:0,STATE_WAITING:1,STATE_CHATTING:2,STATE_CLOSED:3,STATE_LOADING:4,STATE_LEFT:5,STATE_INVITED:6})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Models.User=e.Models.Base.extend({defaults:{isAgent:!1,name:""}})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(t,e,i,n){t.Server=function(t){this.updateTimer=null,this.options=n.extend({url:"",requestsFrequency:2,reconnectPause:1,onTimeout:function(){},onTransportError:function(){},onCallError:function(){},onUpdateError:function(){},onResponseError:function(){}},t),this.callbacks={},this.callPeriodically={},this.callPeriodicallyLastId=0,this.ajaxRequest=null,this.buffer=[],this.functions={},this.functionsLastId=0,this.mibewAPI=new e(new this.options.interactionType)},t.Server.prototype.callFunctions=function(t,e,i){try{if(!(t instanceof Array))throw new Error("The first arguments must be an array");for(var n=0;n<t.length;n++)this.mibewAPI.checkFunction(t[n],!1);var r=this.generateToken();this.callbacks[r]=e,this.buffer.push({token:r,functions:t}),i&&this.update()}catch(s){return this.options.onCallError(s),!1}return!0},t.Server.prototype.callFunctionsPeriodically=function(t,e){return this.callPeriodicallyLastId++,this.callPeriodically[this.callPeriodicallyLastId]={functionsListBuilder:t,callbackFunction:e},this.callPeriodicallyLastId},t.Server.prototype.stopCallFunctionsPeriodically=function(t){t in this.callPeriodically&&delete this.callPeriodically[t]},t.Server.prototype.generateToken=function(){var t;do t="wnd"+(new Date).getTime().toString()+Math.round(50*Math.random()).toString();while(t in this.callbacks);return t},t.Server.prototype.processRequest=function(t){var e=new MibewAPIExecutionContext,i=this.mibewAPI.getResultFunction(t.functions,this.callbacks.hasOwnProperty(t.token));if(null===i)for(var n in t.functions)t.functions.hasOwnProperty(n)&&(this.processFunction(t.functions[n],e),this.buffer.push(this.mibewAPI.buildResult(e.getResults(),t.token)));else this.callbacks.hasOwnProperty(t.token)&&(this.callbacks[t.token](i.arguments),delete this.callbacks[t.token])},t.Server.prototype.processFunction=function(t,e){if(this.functions.hasOwnProperty(t["function"])){var i=e.getArgumentsList(t),r={};for(var s in this.functions[t["function"]])this.functions[t["function"]].hasOwnProperty(s)&&(r=n.extend(r,this.functions[t["function"]][s](i)));e.storeFunctionResults(t,r)}},t.Server.prototype.sendRequests=function(t){var e=this;this.ajaxRequest=i.ajax({url:e.options.url,timeout:5e3,async:!0,cache:!1,type:"POST",dataType:"text",data:{data:this.mibewAPI.encodePackage(t)},success:n.bind(e.receiveResponse,e),error:n.bind(e.onError,e)})},t.Server.prototype.runUpdater=function(){this.update()},t.Server.prototype.updateAfter=function(t){this.updateTimer=setTimeout(n.bind(this.update,this),1e3*t)},t.Server.prototype.restartUpdater=function(){this.updateTimer&&clearTimeout(this.updateTimer),this.ajaxRequest&&this.ajaxRequest.abort(),this.updateAfter(this.options.reconnectPause)},t.Server.prototype.update=function(){this.updateTimer&&clearTimeout(this.updateTimer);for(var t in this.callPeriodically)this.callPeriodically.hasOwnProperty(t)&&this.callFunctions(this.callPeriodically[t].functionsListBuilder(),this.callPeriodically[t].callbackFunction);if(0==this.buffer.length)return void this.updateAfter(this.options.requestsFrequency);try{this.sendRequests(this.buffer),this.buffer=[]}catch(e){this.options.onUpdateError(e)}},t.Server.prototype.receiveResponse=function(t){""==t&&this.updateAfter(this.options.requestsFrequency);try{var e=this.mibewAPI.decodePackage(t);for(var i in e.requests)this.processRequest(e.requests[i])}catch(n){this.options.onResponseError(n)}finally{this.updateAfter(this.options.requestsFrequency)}},t.Server.prototype.registerFunction=function(t,e){return this.functionsLastId++,t in this.functions||(this.functions[t]={}),this.functions[t][this.functionsLastId]=e,this.functionsLastId},t.Server.prototype.unregisterFunction=function(t){for(var e in this.functions)this.functions.hasOwnProperty(e)&&(t in this.functions[e]&&delete this.functions[e][t],n.isEmpty(this.functions[e])&&delete this.functions[e])},t.Server.prototype.onError=function(t,e){"abort"!=e&&(this.restartUpdater(),"timeout"==e?this.options.onTimeout():"error"==e&&this.options.onTransportError())}}(Mibew,MibewAPI,$,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(t,e){t.Utils={},t.Utils.toUpperCaseFirst=function(t){return"string"!=typeof t?!1:""===t?t:t.substring(0,1).toUpperCase()+t.substring(1)},t.Utils.toDashFormat=function(t){if("string"!=typeof t)return!1;for(var e=t.match(/((?:[A-Z]?[a-z]+)|(?:[A-Z][a-z]*))/g),a=0;a<e.length;a++)e[a]=e[a].toLowerCase();return e.join("-")},t.Utils.checkEmail=function(t){return/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t)},t.Utils.playSound=function(t){var a=e('audio[data-file="'+t+'"]');if(a.length>0)a.get(0).play();else{var i=e("<audio>",{autoplay:!0,style:"display: none"}).append('<source src="'+t+'.wav" type="audio/x-wav" /><source src="'+t+'.mp3" type="audio/mpeg" codecs="mp3" /><embed src="'+t+'.wav" type="audio/x-wav" hidden="true" autostart="true" loop="false" />');e("body").append(i),e.isFunction(i.get(0).play)&&i.attr("data-file",t)}}}(Mibew,$);
|
@ -1,113 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
var Mibew={};!function(e,t,n){t.Marionette.TemplateCache.prototype.compileTemplate=function(e){return n.compile(e)};for(var i in n.templates)n.templates.hasOwnProperty(i)&&n.registerPartial(i,n.templates[i]);e.Models={},e.Collections={},e.Views={},e.Objects={},e.Objects.Models={},e.Objects.Collections={}}(Mibew,Backbone,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){t.registerHelper("apply",function(e,n){var i=e,o=/^[0-9A-z_]+$/;n=n.split(/\s*,\s*/);for(var s in n)if(n.hasOwnProperty(s)&&o.test(n[s])){if("function"!=typeof t.helpers[n[s]])throw new Error("Unregistered helper '"+n[s]+"'!");i=t.helpers[n[s]](i).toString()}return new t.SafeString(i)}),t.registerHelper("allowTags",function(e){var n=e;return n=n.replace(/<(span|strong)>(.*?)<\/\1>/g,"<$1>$2</$1>"),n=n.replace(/<span class="(.*?)">(.*?)<\/span>/g,'<span class="$1">$2</span>'),new t.SafeString(n)}),t.registerHelper("formatTime",function(e){var t=new Date(1e3*e),n=t.getHours().toString(),i=t.getMinutes().toString(),o=t.getSeconds().toString();return n=10>n?"0"+n:n,i=10>i?"0"+i:i,o=10>o?"0"+o:o,n+":"+i+":"+o}),t.registerHelper("urlReplace",function(e){return new t.SafeString(e.replace(/((?:https?|ftp):\/\/\S*)/g,'<a href="$1" target="_blank">$1</a>'))}),t.registerHelper("nl2br",function(e){return new t.SafeString(e.replace(/\n/g,"<br/>"))}),t.registerHelper("l10n",function(t){return e.Localization.get(t)||""}),t.registerHelper("ifEven",function(e,t){return e%2===0?t.fn(this):t.inverse(this)}),t.registerHelper("ifOdd",function(e,t){return e%2!==0?t.fn(this):t.inverse(this)})}(Mibew,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Localization={};var n={};e.Localization.get=function(e){return n.hasOwnProperty(e)?n[e]:!1},e.Localization.set=function(e){t.extend(n,e)}}(Mibew,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,n,i){e.Server=function(e){this.updateTimer=null,this.options=i.extend({url:"",requestsFrequency:2,reconnectPause:1,onTimeout:function(){},onTransportError:function(){},onCallError:function(){},onUpdateError:function(){},onResponseError:function(){}},e),this.callbacks={},this.callPeriodically={},this.callPeriodicallyLastId=0,this.ajaxRequest=null,this.buffer=[],this.functions={},this.functionsLastId=0,this.mibewAPI=new t(new this.options.interactionType)},e.Server.prototype.callFunctions=function(e,t,n){try{if(!(e instanceof Array))throw new Error("The first arguments must be an array");for(var i=0;i<e.length;i++)this.mibewAPI.checkFunction(e[i],!1);var o=this.generateToken();this.callbacks[o]=t,this.buffer.push({token:o,functions:e}),n&&this.update()}catch(s){return this.options.onCallError(s),!1}return!0},e.Server.prototype.callFunctionsPeriodically=function(e,t){return this.callPeriodicallyLastId++,this.callPeriodically[this.callPeriodicallyLastId]={functionsListBuilder:e,callbackFunction:t},this.callPeriodicallyLastId},e.Server.prototype.stopCallFunctionsPeriodically=function(e){e in this.callPeriodically&&delete this.callPeriodically[e]},e.Server.prototype.generateToken=function(){var e;do e="wnd"+(new Date).getTime().toString()+Math.round(50*Math.random()).toString();while(e in this.callbacks);return e},e.Server.prototype.processRequest=function(e){var t=new MibewAPIExecutionContext,n=this.mibewAPI.getResultFunction(e.functions,this.callbacks.hasOwnProperty(e.token));if(null===n)for(var i in e.functions)e.functions.hasOwnProperty(i)&&(this.processFunction(e.functions[i],t),this.buffer.push(this.mibewAPI.buildResult(t.getResults(),e.token)));else this.callbacks.hasOwnProperty(e.token)&&(this.callbacks[e.token](n.arguments),delete this.callbacks[e.token])},e.Server.prototype.processFunction=function(e,t){if(this.functions.hasOwnProperty(e["function"])){var n=t.getArgumentsList(e),o={};for(var s in this.functions[e["function"]])this.functions[e["function"]].hasOwnProperty(s)&&(o=i.extend(o,this.functions[e["function"]][s](n)));t.storeFunctionResults(e,o)}},e.Server.prototype.sendRequests=function(e){var t=this;this.ajaxRequest=n.ajax({url:t.options.url,timeout:5e3,async:!0,cache:!1,type:"POST",dataType:"text",data:{data:this.mibewAPI.encodePackage(e)},success:i.bind(t.receiveResponse,t),error:i.bind(t.onError,t)})},e.Server.prototype.runUpdater=function(){this.update()},e.Server.prototype.updateAfter=function(e){this.updateTimer=setTimeout(i.bind(this.update,this),1e3*e)},e.Server.prototype.restartUpdater=function(){this.updateTimer&&clearTimeout(this.updateTimer),this.ajaxRequest&&this.ajaxRequest.abort(),this.updateAfter(this.options.reconnectPause)},e.Server.prototype.update=function(){this.updateTimer&&clearTimeout(this.updateTimer);for(var e in this.callPeriodically)this.callPeriodically.hasOwnProperty(e)&&this.callFunctions(this.callPeriodically[e].functionsListBuilder(),this.callPeriodically[e].callbackFunction);if(0==this.buffer.length)return void this.updateAfter(this.options.requestsFrequency);try{this.sendRequests(this.buffer),this.buffer=[]}catch(t){this.options.onUpdateError(t)}},e.Server.prototype.receiveResponse=function(e){""==e&&this.updateAfter(this.options.requestsFrequency);try{var t=this.mibewAPI.decodePackage(e);for(var n in t.requests)this.processRequest(t.requests[n])}catch(i){this.options.onResponseError(i)}finally{this.updateAfter(this.options.requestsFrequency)}},e.Server.prototype.registerFunction=function(e,t){return this.functionsLastId++,e in this.functions||(this.functions[e]={}),this.functions[e][this.functionsLastId]=t,this.functionsLastId},e.Server.prototype.unregisterFunction=function(e){for(var t in this.functions)this.functions.hasOwnProperty(t)&&(e in this.functions[t]&&delete this.functions[t][e],i.isEmpty(this.functions[t])&&delete this.functions[t])},e.Server.prototype.onError=function(e,t){"abort"!=t&&(this.restartUpdater(),"timeout"==t?this.options.onTimeout():"error"==t&&this.options.onTransportError())}}(Mibew,MibewAPI,$,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Utils={},e.Utils.toUpperCaseFirst=function(e){return"string"!=typeof e?!1:""===e?e:e.substring(0,1).toUpperCase()+e.substring(1)},e.Utils.toDashFormat=function(e){if("string"!=typeof e)return!1;for(var t=e.match(/((?:[A-Z]?[a-z]+)|(?:[A-Z][a-z]*))/g),n=0;n<t.length;n++)t[n]=t[n].toLowerCase();return t.join("-")},e.Utils.checkEmail=function(e){return/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},e.Utils.playSound=function(e){var n=t('audio[data-file="'+e+'"]');if(n.length>0)n.get(0).play();else{var i=t("<audio>",{autoplay:!0,style:"display: none"}).append('<source src="'+e+'.wav" type="audio/x-wav" /><source src="'+e+'.mp3" type="audio/mpeg" codecs="mp3" /><embed src="'+e+'.wav" type="audio/x-wav" hidden="true" autostart="true" loop="false" />');t("body").append(i),t.isFunction(i.get(0).play)&&i.attr("data-file",e)}}}(Mibew,$),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.Base=t.Model.extend({getModelType:function(){return""}})}(Mibew,Backbone),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Models.Control=e.Models.Base.extend({defaults:{title:"",weight:0}})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Models.Message=e.Models.Base.extend({defaults:{kind:null,created:0,name:"",message:"",plugin:"",data:{}},KIND_USER:1,KIND_AGENT:2,KIND_FOR_AGENT:3,KIND_INFO:4,KIND_CONN:5,KIND_EVENTS:6,KIND_PLUGIN:7})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Models.Page=t.Model.extend()}(Mibew,Backbone),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Models.Thread=e.Models.Base.extend({defaults:{id:0,token:0,lastId:0,state:null},STATE_QUEUE:0,STATE_WAITING:1,STATE_CHATTING:2,STATE_CLOSED:3,STATE_LOADING:4,STATE_LEFT:5,STATE_INVITED:6})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Models.User=e.Models.Base.extend({defaults:{isAgent:!1,name:""}})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t){e.Collections.Controls=t.Collection.extend({comparator:function(e){return e.get("weight")}})}(Mibew,Backbone),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,n){e.Views.Control=t.Marionette.ItemView.extend({template:n.templates.default_control,modelEvents:{change:"render"},events:{mouseover:"mouseOver",mouseleave:"mouseLeave"},attributes:function(){var e=[];e.push("control"),this.className&&(e.push(this.className),this.className="");var t=this.getDashedControlType();return t&&e.push(t),{"class":e.join(" ")}},mouseOver:function(){var e=this.getDashedControlType();this.$el.addClass("active"+(e?"-"+e:""))},mouseLeave:function(){var e=this.getDashedControlType();this.$el.removeClass("active"+(e?"-"+e:""))},getDashedControlType:function(){return"undefined"==typeof this.dashedControlType&&(this.dashedControlType=e.Utils.toDashFormat(this.model.getModelType())||""),this.dashedControlType}})}(Mibew,Backbone,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,n){var i={"<":"<",">":">","&":"&",'"':""","'":"'","`":"`"},o=/[&<>'"`]/g;e.Views.Message=t.Marionette.ItemView.extend({template:n.templates.message,className:"message",modelEvents:{change:"render"},serializeData:function(){var e=this.model.toJSON(),t=this.model.get("kind");return e.allowFormatting=t!=this.model.KIND_USER&&t!=this.model.KIND_AGENT,e.kindName=this.kindToString(t),e.message=this.escapeString(e.message),e},kindToString:function(e){return e==this.model.KIND_USER?"user":e==this.model.KIND_AGENT?"agent":e==this.model.KIND_FOR_AGENT?"hidden":e==this.model.KIND_INFO?"inf":e==this.model.KIND_CONN?"conn":e==this.model.KIND_EVENTS?"event":e==this.model.KIND_PLUGIN?"plugin":""},escapeString:function(e){return e.replace(o,function(e){return i[e]||"&"})}})}(Mibew,Backbone,Handlebars),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,t,n){var i=function(t,i,o){var s=n.extend({model:t},o);if("function"!=typeof t.getModelType)return new i(s);var r=t.getModelType();return r&&e.Views[r]?new e.Views[r](s):new i(s)};e.Views.CollectionBase=t.Marionette.CollectionView.extend({itemView:t.Marionette.ItemView,buildItemView:i}),e.Views.CompositeBase=t.Marionette.CompositeView.extend({buildItemView:i})}(Mibew,Backbone,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Views.ControlsCollection=e.Views.CollectionBase.extend({itemView:e.Views.Control,className:"controls-collection"})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function MibewAPI(n){if(this.protocolVersion="1.0","object"!=typeof n||!(n instanceof MibewAPIInteraction))throw new Error("Wrong interaction type");this.interaction=n}function MibewAPIInteraction(){this.mandatoryArguments=function(){return{}},this.getReservedFunctionsNames=function(){return[]}}function MibewAPIExecutionContext(){this.returnValues={},this.functionsResults=[]}MibewAPI.prototype.checkFunction=function(n,t){if(t=t||!1,"undefined"==typeof n["function"]||""==n["function"])throw new Error("Cannot call for function with no name");if(t)for(var e=this.interaction.getReservedFunctionsNames(),r=0;r<e.length;r++)if(n["function"]==e[r])throw new Error("'"+n["function"]+"' is reserved function name");if("object"!=typeof n.arguments)throw new Error("There are no arguments in '"+n["function"]+"' function");var o=0,i=this.interaction.getMandatoryArguments(n["function"]);n:for(var s in n.arguments)for(var r=0;r<i.length;r++)if(s==i[r]){o++;continue n}if(o!=i.length)throw new Error("Not all mandatory arguments are set in '"+n["function"]+"' function")},MibewAPI.prototype.checkRequest=function(n){if("string"!=typeof n.token)throw new Error("undefined"==typeof n.token?"Empty token":"Wrong token type");if(""==n.token)throw new Error("Empty token");if("object"!=typeof n.functions||!(n.functions instanceof Array)||0==n.functions.length)throw new Error("Empty functions set");for(var t=0;t<n.functions.length;t++)this.checkFunction(n.functions[t])},MibewAPI.prototype.checkPackage=function(n){if("undefined"==typeof n.signature)throw new Error("Missed package signature");if("undefined"==typeof n.proto)throw new Error("Missed protocol version");if(n.proto!=this.protocolVersion)throw new Error("Wrong protocol version");if("undefined"==typeof n.async)throw new Error("'async' flag is missed");if("boolean"!=typeof n.async)throw new Error("Wrong 'async' flag value");if("object"!=typeof n.requests||!(n.requests instanceof Array)||0==n.requests.length)throw new Error("Empty requests set");for(var t=0;t<n.requests.length;t++)this.checkRequest(n.requests[t])},MibewAPI.prototype.getResultFunction=function(n,t){"undefined"==typeof t&&(t=null);var e=null;for(var r in n)if(n.hasOwnProperty(r)&&"result"==n[r]["function"]){if(null!==e)throw new Error("Function 'result' already exists in functions list");e=n[r]}if(t===!0&&null===e)throw new Error("There is no 'result' function in functions list");if(t===!1&&null!==e)throw new Error("There is 'result' function in functions list");return e},MibewAPI.prototype.buildResult=function(n,t){var e=n,r=this.interaction.getMandatoryArgumentsDefaults("result");for(var o in r)r.hasOwnProperty(o)&&(e[o]=r[o]);return{token:t,functions:[{"function":"result",arguments:e}]}},MibewAPI.prototype.encodePackage=function(n){var t={};return t.signature="",t.proto=this.protocolVersion,t.async=!0,t.requests=n,encodeURIComponent(JSON.stringify(t)).replace(/\%20/gi,"+")},MibewAPI.prototype.decodePackage=function(n){var t=JSON.parse(decodeURIComponent(n.replace(/\+/gi," ")));return this.checkPackage(t),t},MibewAPIInteraction.prototype.getMandatoryArguments=function(n){var t=this.mandatoryArguments(),e=[];if("object"==typeof t["*"])for(var r in t["*"])t["*"].hasOwnProperty(r)&&e.push(r);if("object"==typeof t[n])for(var r in t[n])t[n].hasOwnProperty(r)&&e.push(r);return e},MibewAPIInteraction.prototype.getMandatoryArgumentsDefaults=function(n){var t=this.mandatoryArguments(),e={};if("object"==typeof t["*"])for(var r in t["*"])t["*"].hasOwnProperty(r)&&(e[r]=t["*"][r]);if("object"==typeof t[n])for(var r in t[n])t[n].hasOwnProperty(r)&&(e[r]=t[n][r]);return e},MibewAPIExecutionContext.prototype.getArgumentsList=function(n){var t,e,r=n.arguments,o=n.arguments.references;for(var i in o)if(o.hasOwnProperty(i)){if(t=null,e=o[i],"undefined"==typeof this.functionsResults[e-1])throw new Error("Wrong reference in '"+n["function"]+"' function. Function #"+e+" does not call yet.");if("undefined"==typeof r[i]||""==r[i])throw new Error("Wrong reference in '"+n["function"]+"' function. Empty '"+i+"' argument.");if(t=r[i],"undefined"==typeof this.functionsResults[e-1][t])throw new Error("Wrong reference in '"+n["function"]+"' function. There is no '"+t+"' argument in #"+e+" function results");r[i]=this.functionsResults[e-1][t]}return r},MibewAPIExecutionContext.prototype.getResults=function(){return this.returnValues},MibewAPIExecutionContext.prototype.storeFunctionResults=function(n,t){var e;if(t.errorCode)this.returnValues.errorCode=t.errorCode,this.returnValues.errorMessage=t.errorMessage||"";else for(var r in n.arguments["return"])if(n.arguments["return"].hasOwnProperty(r)){if(e=n.arguments["return"][r],"undefined"==typeof t[r])throw new Error("Variable with name '"+r+"' is undefined in the results of the '"+n["function"]+"' function");this.returnValues[e]=t[r]}this.functionsResults.push(t)};
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(n,c){c(document).ready(function(){c("#check-nv").click(function(){n.Utils.playSound("../sounds/new_user")}),c("#check-nm").click(function(){n.Utils.playSound("../sounds/new_message")})})}(Mibew,$);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,s){var i=new s.Marionette.Application;i.addRegions({messagesRegion:"#messages-region"}),i.addInitializer(function(s){var n=new e.Collections.Messages;e.Objects.Collections.messages=n,n.updateMessages(s.messages),i.messagesRegion.show(new e.Views.MessagesCollection({collection:n}))}),e.Application=i}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Views.MessagesCollection=e.Views.CollectionBase.extend({itemView:e.Views.Message,className:"messages-collection"})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,s){e.Collections.Messages=s.Collection.extend({model:e.Models.Message,updateMessages:function(e){for(var s=[],n=0;n<e.length;n++)e[n].message&&s.push(e[n]);s.length>0&&this.add(s)}})}(Mibew,Backbone,_);
|
@ -1,22 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,s){e.Collections.Messages=s.Collection.extend({model:e.Models.Message,updateMessages:function(e){for(var s=[],i=0;i<e.length;i++)e[i].message&&s.push(e[i]);s.length>0&&this.add(s)}})}(Mibew,Backbone,_),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e){e.Views.MessagesCollection=e.Views.CollectionBase.extend({itemView:e.Views.Message,className:"messages-collection"})}(Mibew),/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function(e,s){var i=new s.Marionette.Application;i.addRegions({messagesRegion:"#messages-region"}),i.addInitializer(function(s){var n=new e.Collections.Messages;e.Objects.Collections.messages=n,n.updateMessages(s.messages),i.messagesRegion.show(new e.Views.MessagesCollection({collection:n}))}),e.Application=i}(Mibew,Backbone);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
function loadNews(){if("undefined"!=typeof window.mibewNews&&"undefined"!=typeof window.mibewNews.length){for(var e="<div>",w=0;w<window.mibewNews.length;w++)e+='<div class="newstitle"><a href="'+window.mibewNews[w].link+'">'+window.mibewNews[w].title+'</a>, <span class="small">'+window.mibewNews[w].date+"</span></div>",e+='<div class="newstext">'+window.mibewNews[w].message+"</div>";$("#news").html(e+"</div>")}}function loadVersion(){if("undefined"!=typeof window.mibewLatest&&"undefined"!=typeof window.mibewLatest.version){var e=$("#cver").html();e!=window.mibewLatest.version?(e<window.mibewLatest.version&&$("#cver").css("color","red"),$("#lver").html(window.mibewLatest.version+', Download <a href="'+window.mibewLatest.download+'">'+window.mibewLatest.title+"</a>")):($("#cver").css("color","green"),$("#lver").html(window.mibewLatest.version))}}$(function(){loadNews(),loadVersion()});
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,n,t){var s=0,o=function(){s++,10==s&&(alert(e.Localization.get("Network problems detected. Please refresh the page.")),s=0)},i=new n.Marionette.Application;i.addRegions({agentsRegion:"#agents-region",statusPanelRegion:"#status-panel-region",threadsRegion:"#threads-region",visitorsRegion:"#visitors-region"}),i.addInitializer(function(n){e.PluginOptions=n.plugins||{};var s=e.Objects,a=e.Objects.Models,r=e.Objects.Collections;s.server=new e.Server(t.extend({interactionType:MibewAPIUsersInteraction,onTimeout:o,onTransportError:o},n.server)),a.page=new e.Models.Page(n.page),a.agent=new e.Models.Agent(n.agent),r.threads=new e.Collections.Threads,i.threadsRegion.show(new e.Views.ThreadsCollection({collection:r.threads})),n.page.showVisitors&&(r.visitors=new e.Collections.Visitors,i.visitorsRegion.show(new e.Views.VisitorsCollection({collection:r.visitors}))),a.statusPanel=new e.Models.StatusPanel,i.statusPanelRegion.show(new e.Views.StatusPanel({model:a.statusPanel})),n.page.showOnlineOperators&&(r.agents=new e.Collections.Agents,i.agentsRegion.show(new e.Views.AgentsCollection({collection:r.agents}))),s.server.callFunctionsPeriodically(function(){return[{"function":"update",arguments:{"return":{},references:{},agentId:a.agent.id}}]},function(){})}),i.on("start",function(){e.Objects.server.runUpdater()}),e.Application=i}(Mibew,Backbone,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Views.AgentsCollection=e.Views.CollectionBase.extend({itemView:e.Views.Agent,className:"agents-collection",collectionEvents:{"sort add remove reset":"render"},initialize:function(){this.on("itemview:before:render",this.updateIndexes,this)},updateIndexes:function(e){var i=this.collection,t=e.model;t&&(e.isModelFirst=0==i.indexOf(t),e.isModelLast=i.indexOf(t)==i.length-1)}})}(Mibew);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,i){e.Views.ThreadsCollection=e.Views.CompositeBase.extend({template:t.templates.threads_collection,itemView:e.Views.QueuedThread,itemViewContainer:"#threads-container",emptyView:e.Views.NoThreads,className:"threads-collection",collectionEvents:{sort:"render","sort:field":"createSortField",add:"threadAdded"},itemViewOptions:function(t){var i=e.Objects.Models.page;return{tagName:i.get("threadTag"),collection:t.get("controls")}},initialize:function(){window.setInterval(i.bind(this.updateTimers,this),2e3),this.on("itemview:before:render",this.updateStyles,this),this.on("composite:collection:rendered",this.updateTimers,this)},updateStyles:function(e){var t=this.collection,i=e.model,s=this;if(i.id){var n=this.getQueueCode(i),o=!1,a=!1,l=t.filter(function(e){return s.getQueueCode(e)==n});if(l.length>0&&(a=l[0].id==i.id,o=l[l.length-1].id==i.id),e.lastStyles.length>0){for(var r=0,d=e.lastStyles.length;d>r;r++)e.$el.removeClass(e.lastStyles[r]);e.lastStyles=[]}var E=(n!=this.QUEUE_BAN?"in":"")+this.queueCodeToString(n);e.lastStyles.push(E),a&&e.lastStyles.push(E+"-first"),o&&e.lastStyles.push(E+"-last");for(var r=0,d=e.lastStyles.length;d>r;r++)e.$el.addClass(e.lastStyles[r])}},updateTimers:function(){e.Utils.updateTimers(this.$el,".timesince")},createSortField:function(e,t){var i=this.getQueueCode(e)||"Z";t.field=i.toString()+"_"+e.get("waitingTime").toString()},threadAdded:function(){var t=e.Objects.Models.page.get("mibewRoot");"undefined"!=typeof t&&(t+="/sounds/new_user",e.Utils.playSound(t)),e.Objects.Models.page.get("showPopup")&&this.once("render",function(){alert(e.Localization.get("A new visitor is waiting for an answer."))})},getQueueCode:function(e){var t=e.get("state");return 0!=e.get("ban")&&t!=e.STATE_CHATTING?this.QUEUE_BAN:t==e.STATE_QUEUE||t==e.STATE_LOADING?this.QUEUE_WAITING:t==e.STATE_CLOSED||t==e.STATE_LEFT?this.QUEUE_CLOSED:t==e.STATE_WAITING?this.QUEUE_PRIO:t==e.STATE_CHATTING?this.QUEUE_CHATTING:!1},queueCodeToString:function(e){return e==this.QUEUE_PRIO?"prio":e==this.QUEUE_WAITING?"wait":e==this.QUEUE_CHATTING?"chat":e==this.QUEUE_BAN?"ban":e==this.QUEUE_CLOSED?"closed":""},QUEUE_PRIO:1,QUEUE_WAITING:2,QUEUE_CHATTING:3,QUEUE_BAN:4,QUEUE_CLOSED:5})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,i,t){e.Views.VisitorsCollection=e.Views.CompositeBase.extend({template:i.templates.visitors_collection,itemView:e.Views.Visitor,itemViewContainer:"#visitors-container",emptyView:e.Views.NoVisitors,className:"visitors-collection",collectionEvents:{sort:"render"},itemViewOptions:function(i){var t=e.Objects.Models.page;return{tagName:t.get("visitorTag"),collection:i.get("controls")}},initialize:function(){window.setInterval(t.bind(this.updateTimers,this),2e3),this.on("composite:collection:rendered",this.updateTimers,this)},updateTimers:function(){e.Utils.updateTimers(this.$el,".timesince")}})}(Mibew,Handlebars,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,n){e.Collections.Agents=t.Collection.extend({model:e.Models.Agent,comparator:function(e){return e.get("name")},initialize:function(){var t=e.Objects.Models.agent;e.Objects.server.callFunctionsPeriodically(function(){return[{"function":"updateOperators",arguments:{agentId:t.id,"return":{operators:"operators"},references:{}}}]},n.bind(this.updateOperators,this))},updateOperators:function(e){this.set(e.operators)}})}(Mibew,Backbone,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,r){e.Collections.Threads=t.Collection.extend({model:e.Models.QueuedThread,initialize:function(){this.revision=0;var t=this,i=e.Objects.Models.agent;e.Objects.server.callFunctionsPeriodically(function(){return[{"function":"currentTime",arguments:{agentId:i.id,"return":{time:"currentTime"},references:{}}},{"function":"updateThreads",arguments:{agentId:i.id,revision:t.revision,"return":{threads:"threads",lastRevision:"lastRevision"},references:{}}}]},r.bind(this.updateThreads,this))},comparator:function(e){var t={field:e.get("waitingTime").toString()};return this.trigger("sort:field",e,t),t.field},updateThreads:function(t){if(0==t.errorCode){if(t.threads.length>0){var r;r=t.currentTime?Math.round((new Date).getTime()/1e3)-t.currentTime:0;for(var i=0,s=t.threads.length;s>i;i++)t.threads[i].totalTime=parseInt(t.threads[i].totalTime)+r,t.threads[i].waitingTime=parseInt(t.threads[i].waitingTime)+r;this.trigger("before:update:threads",t.threads);var n=e.Models.Thread.prototype.STATE_CLOSED,a=e.Models.Thread.prototype.STATE_LEFT,o=[];this.set(t.threads,{remove:!1,sort:!1}),o=this.filter(function(e){return e.get("state")==n||e.get("state")==a}),o.length>0&&this.remove(o),this.sort(),this.trigger("after:update:threads")}this.revision=t.lastRevision}}})}(Mibew,Backbone,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(i,t,e){i.Collections.Visitors=t.Collection.extend({model:i.Models.Visitor,initialize:function(){var t=i.Objects.Models.agent;i.Objects.server.callFunctionsPeriodically(function(){return[{"function":"currentTime",arguments:{agentId:t.id,"return":{time:"currentTime"},references:{}}},{"function":"updateVisitors",arguments:{agentId:t.id,"return":{visitors:"visitors"},references:{}}}]},e.bind(this.updateVisitors,this))},comparator:function(i){var t={field:i.get("firstTime").toString()};return this.trigger("sort:field",i,t),t.field},updateVisitors:function(i){if(0==i.errorCode){var t;t=i.currentTime?Math.round((new Date).getTime()/1e3)-i.currentTime:0;for(var e=0,r=i.visitors.length;r>e;e++)i.visitors[e].lastTime=parseInt(i.visitors[e].lastTime)+t,i.visitors[e].firstTime=parseInt(i.visitors[e].firstTime)+t;this.trigger("before:update:visitors",i.visitors),this.reset(i.visitors),this.trigger("after:update:visitors")}}})}(Mibew,Backbone,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(o,e){o.Regions={},o.Popup={},o.Popup.open=function(o,e,n){e=e.replace(/[^A-z0-9_]+/g,"");var i=window.open(o,e,n);i.focus(),i.opener=window},o.Utils.updateTimers=function(o,n){o.find(n).each(function(){var o=e(this).data("timestamp");if(o){var n=Math.round((new Date).getTime()/1e3)-o,i=n%60,t=Math.floor(n/60)%60,a=Math.floor(n/3600),p=[];a>0&&p.push(a),p.push(10>t?"0"+t:t),p.push(10>i?"0"+i:i),e(this).html(p.join(":"))}})}}(Mibew,jQuery);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
MibewAPIUsersInteraction=function(){this.mandatoryArguments=function(){return{"*":{agentId:null,"return":{},references:{}},result:{errorCode:0}}},this.getReservedFunctionsNames=function(){return["result"]}},MibewAPIUsersInteraction.prototype=new MibewAPIInteraction;
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,i){e.Views.Agent=t.Marionette.ItemView.extend({template:i.templates.agent,tagName:"span",className:"agent",modelEvents:{change:"render"},initialize:function(){this.isModelFirst=!1,this.isModelLast=!1},serializeData:function(){var e=this.model.toJSON();return e.isFirst=this.isModelFirst,e.isLast=this.isModelLast,e}})}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,a){e.Views.NoThreads=t.Marionette.ItemView.extend({template:a.templates.no_threads,initialize:function(e){this.tagName=e.tagName}})}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,i){e.Views.NoVisitors=t.Marionette.ItemView.extend({template:i.templates.no_visitors,initialize:function(e){this.tagName=e.tagName}})}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t){e.Views.QueuedThread=e.Views.CompositeBase.extend({template:t.templates.queued_thread,itemView:e.Views.Control,itemViewContainer:".thread-controls",className:"thread",modelEvents:{change:"render"},events:{"click .open-dialog":"openDialog","click .view-control":"viewDialog","click .track-control":"showTrack","click .ban-control":"showBan","click .geo-link":"showGeoInfo","click .first-message a":"showFirstMessage"},initialize:function(){this.lastStyles=[]},serializeData:function(){var t=this.model,i=e.Objects.Models.page,o=t.toJSON();return o.stateDesc=this.stateToDesc(t.get("state")),o.chatting=t.get("state")==t.STATE_CHATTING,o.tracked=i.get("showVisitors"),o.firstMessage&&(o.firstMessagePreview=o.firstMessage.length>30?o.firstMessage.substring(0,30)+"...":o.firstMessage),o},stateToDesc:function(t){var i=e.Localization;return t==this.model.STATE_QUEUE?i.get("In queue"):t==this.model.STATE_WAITING?i.get("Waiting for operator"):t==this.model.STATE_CHATTING?i.get("In chat"):t==this.model.STATE_CLOSED?i.get("Closed"):t==this.model.STATE_LOADING?i.get("Loading"):""},showGeoInfo:function(){var t=this.model.get("userIp");if(t){var i=e.Objects.Models.page,o=i.get("geoLink").replace("{ip}",t);e.Popup.open(o,"ip"+t,i.get("geoWindowParams"))}},openDialog:function(){var e=this.model;if(e.get("canOpen")||e.get("canView")){var t=!e.get("canOpen");this.showDialogWindow(t)}},viewDialog:function(){this.showDialogWindow(!0)},showDialogWindow:function(t){var i=this.model,o=i.id,s=e.Objects.Models.page;e.Popup.open(s.get("agentLink")+"/"+o+(t?"?viewonly=true":""),"ImCenter"+o,s.get("chatWindowParams"))},showTrack:function(){var t=this.model.id,i=e.Objects.Models.page;e.Popup.open(i.get("trackedLink")+"?thread="+t,"ImTracked"+t,i.get("trackedUserWindowParams"))},showBan:function(){var t=this.model,i=t.get("ban"),o=e.Objects.Models.page;e.Popup.open(o.get("banLink")+"/"+(i!==!1?i.id+"/edit":"add?thread="+t.id),"ImBan"+i.id,o.get("banWindowParams"))},showFirstMessage:function(){var e=this.model.get("firstMessage");e&&alert(e)}})}(Mibew,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t,n){e.Views.StatusPanel=t.Marionette.ItemView.extend({template:n.templates.status_panel,modelEvents:{change:"render"},ui:{changeStatus:"#change-status"},events:{"click #change-status":"changeAgentStatus"},initialize:function(){e.Objects.Models.agent.on("change",this.render,this)},changeAgentStatus:function(){this.model.changeAgentStatus()},serializeData:function(){var t=this.model.toJSON();return t.agent=e.Objects.Models.agent.toJSON(),t}})}(Mibew,Backbone,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,i){e.Views.Visitor=e.Views.CompositeBase.extend({template:i.templates.visitor,itemView:e.Views.Control,itemViewContainer:".visitor-controls",className:"visitor",modelEvents:{change:"render"},events:{"click .invite-link":"inviteUser","click .geo-link":"showGeoInfo","click .track-control":"showTrack"},inviteUser:function(){if(!this.model.get("invitationInfo")){var i=this.model.id,t=e.Objects.Models.page;e.Popup.open(t.get("inviteLink")+"?visitor="+i,"ImCenter"+i,t.get("inviteWindowParams"))}},showTrack:function(){var i=this.model.id,t=e.Objects.Models.page;e.Popup.open(t.get("trackedLink")+"?visitor="+i,"ImTracked"+i,t.get("trackedVisitorWindowParams"))},showGeoInfo:function(){var i=this.model.get("userIp");if(i){var t=e.Objects.Models.page,o=t.get("geoLink").replace("{ip}",i);e.Popup.open(o,"ip"+i,t.get("geoWindowParams"))}}})}(Mibew,Handlebars);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,t){e.Models.Agent=e.Models.User.extend({defaults:t.extend({},e.Models.User.prototype.defaults,{id:null,isAgent:!0,away:!1}),away:function(){this.setAvailability(!1)},available:function(){this.setAvailability(!0)},setAvailability:function(t){var a=t?"available":"away",i=this;e.Objects.server.callFunctions([{"function":a,arguments:{agentId:this.id,references:{},"return":{}}}],function(e){0==e.errorCode&&i.set({away:!t})},!0)}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e,n){var t=[],o=e.Models.QueuedThread=e.Models.Thread.extend({defaults:n.extend({},e.Models.Thread.prototype.defaults,{controls:null,userName:"",userIp:"",remote:"",userAgent:"",agentName:"",canOpen:!1,canView:!1,canBan:!1,ban:!1,totalTime:0,waitingTime:0,firstMessage:null}),initialize:function(){for(var n=this,t=[],s=o.getControls(),a=0,r=s.length;r>a;a++)t.push(new s[a]({thread:n}));this.set({controls:new e.Collections.Controls(t)})}},{addControl:function(e){t.push(e)},getControls:function(){return t}})}(Mibew,_);
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @preserve Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
!function(e){e.Models.StatusPanel=e.Models.Base.extend({defaults:{message:""},setStatus:function(e){this.set({message:e})},changeAgentStatus:function(){var a=e.Objects.Models.agent;a.get("away")?a.available():a.away()}})}(Mibew);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user