/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ !function(e){e.Regions={},e.Layouts={},e.Application=new Backbone.Marionette.Application}(Mibew),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ MibewAPIChatInteraction=function(){this.mandatoryArguments=function(){return{"*":{threadId:null,token:null,"return":{},references:{}},result:{errorCode:0}}},this.getReservedFunctionsNames=function(){return["result"]}},MibewAPIChatInteraction.prototype=new MibewAPIInteraction,/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e){e.Utils=e.Utils||{},e.Utils.closeChatPopup=function(){window.parent&&window.parent!==window&&window.parent.postMessage?window.parent.postMessage("mibew-chat-closed:"+window.name,"*"):window.close()}}(Mibew),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t){e.Models.BaseSoundManager=t.Model.extend({defaults:{enabled:!0},play:function(t){this.get("enabled")&&e.Utils.playSound(t)}})}(Mibew,Backbone),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e){e.Models.BaseSurveyForm=e.Models.Base.extend({defaults:{name:"",email:"",message:"",info:"",referrer:"",groupId:null,groups:null}})}(Mibew),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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))),e.Objects.Models.thread.on("change:agentId",this.setFromThread,this)},finalize:function(){for(var t=0;tl;l++)s=t.messages[l],s.kind==i?"object"==typeof s.data&&null!==s.data&&(n=s.plugin||!1,o="process:"+(n!==!1?n+":":"")+"plugin:message",a={messageData:s,model:!1},this.trigger(o,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,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t){e.Collections.Status=t.Collection.extend({comparator:function(e){return e.get("weight")}})}(Mibew,Backbone),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t,s){e.Views.Avatar=t.Marionette.ItemView.extend({template:s.templates["chat/avatar"],className:"avatar",modelEvents:{change:"render"}})}(Mibew,Backbone,Handlebars),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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.trans("Are you sure want to leave chat?"),s=this;t!==!1&&e.Utils.confirm(t,function(e){e&&s.model.closeThread()})}})}(Mibew,Handlebars,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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 n=e.Utils.buildWindowParams(this.model.get("windowParams"));s=s.replace("&","&","g");var o=window.open(s,"UserHistory",n);null!==o&&(o.focus(),o.opener=window)}}})}(Mibew,Handlebars,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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 n=e.Objects.Models.page.get("style"),o="";n&&(o=(-1===s.indexOf("?")?"?":"&")+"style="+n),window.location.href=s.replace(/\&\;/g,"&")+o}}}})}(Mibew,Handlebars,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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 n=e.Utils.buildWindowParams(this.model.get("windowParams")),o=s.get("style"),a="";o&&(a=(-1===t.indexOf("?")?"?":"&")+"style="+o),t=t.replace(/\&\;/g,"&")+a;var i=window.open(t,"ForwardMail",n);null!==i&&(i.focus(),i.opener=window)}}})}(Mibew,Handlebars,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t,s){var n=e.Views.BaseSurveyForm;e.Views.LeaveMessageForm=n.extend({template:t.templates["leave_message/form"],events:s.extend({},n.prototype.events,{"click #send-message":"submitForm"}),ui:s.extend({},n.prototype.ui,{captcha:'input[name="captcha"]',captchaImg:"#captcha-img"}),modelEvents:s.extend({},n.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,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t){e.Views.Message=e.Views.Message.extend({template:t.templates["chat/message"]})}(Mibew,Handlebars),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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"},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.sendShortcut=this.getSendShortcut(),t},postMessage:function(){var t=this.ui.message.val();""!=t&&(this.disableInput(),this.model.postMessage(t),e.Objects.Collections.messages.once("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.ui.message.focus()},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})},getSendShortcut:function(){return this.model.get("ignoreCtrl")?"Enter":-1!==navigator.userAgent.indexOf("mac")?"⌘-Enter":"Ctrl-Enter"}})}(Mibew,Backbone,Handlebars),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t){e.Views.StatusMessage=e.Views.Status.extend({template:t.templates["chat/status/message"]})}(Mibew,Handlebars),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t){e.Views.StatusTyping=e.Views.Status.extend({template:t.templates["chat/status/typing"]})}(Mibew,Handlebars),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t,s){var n=e.Views.BaseSurveyForm;e.Views.SurveyForm=n.extend({template:t.templates["survey/form"],events:s.extend({},n.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,_),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e){e.Views.MessagesCollection=e.Views.CollectionBase.extend({className:"messages-collection",getChildView:function(t){return e.Views.Message}})}(Mibew),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e){e.Views.StatusCollection=e.Views.CollectionBase.extend({className:"status-collection",getChildView:function(t){return e.Views.Status}})}(Mibew),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t){e.Regions.Messages=t.Marionette.Region.extend({onShow:function(e){e.on("add:child",this.scrollToBottom,this)},scrollToBottom:function(){this.$el.scrollTop(this.$el.prop("scrollHeight"))}})}(Mibew,Backbone),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t){e.Layouts.Chat=t.Marionette.LayoutView.extend({template:Handlebars.templates["chat/layout"],regions:{controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:{selector:"#messages-region",regionClass: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),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t){e.Layouts.Invitation=t.Marionette.LayoutView.extend({template:Handlebars.templates["invitation/layout"],regions:{messagesRegion:{selector:"#invitation-messages-region",regionClass:e.Regions.Messages}}})}(Mibew,Backbone),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t){e.Layouts.LeaveMessage=t.Marionette.LayoutView.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),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e,t){e.Layouts.Survey=t.Marionette.LayoutView.extend({template:Handlebars.templates["survey/layout"],regions:{surveyFormRegion:"#content-wrapper"},serializeData:function(){return{page:e.Objects.Models.page.toJSON()}}})}(Mibew,Backbone),/*! * This file is a part of Mibew Messenger. * * Copyright 2005-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function(e){e.Objects.Models.Controls={},e.Objects.Models.Status={};var t=[],s=e.Application,n=s.module("Chat",{startWithParent:!1});n.addInitializer(function(n){var o=e.Objects,a=e.Objects.Models,i=e.Objects.Models.Controls,r=e.Objects.Models.Status;n.page&&a.page.set(n.page),a.thread=new e.Models.Thread(n.thread),a.user=new e.Models.ChatUser(n.user);var l=new e.Layouts.Chat;o.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:n.links.mail,windowParams:n.windowsParams.mail}),d.add(i.sendMail)),a.user.get("isAgent")&&(i.redirect=new e.Models.RedirectControl({weight:200,link:n.links.redirect}),d.add(i.redirect),i.history=new e.Models.HistoryControl({weight:180,link:n.links.history,windowParams:n.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),n.links.ssl&&(i.secureMode=new e.Models.SecureModeControl({weight:120,link:n.links.ssl}),d.add(i.secureMode)),i.close=new e.Models.CloseControl({weight:100}),d.add(i.close),o.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}),o.Collections.status=new e.Collections.Status([r.message,r.typing]),l.statusRegion.show(new e.Views.StatusCollection({collection:o.Collections.status})),a.user.get("isAgent")||(a.avatar=new e.Models.Avatar({imageLink:n.avatar||!1}),l.avatarRegion.show(new e.Views.Avatar({model:a.avatar}))),o.Collections.messages=new e.Collections.Messages,a.messageForm=new e.Models.MessageForm(n.messageForm),l.messageFormRegion.show(new e.Views.MessageForm({model:a.messageForm})),l.messagesRegion.show(new e.Views.MessagesCollection({collection:o.Collections.messages})),a.soundManager=new e.Models.ChatSoundManager,!a.user.get("isAgent")&&n.links.chat&&window.parent&&window.parent.postMessage&&window.parent!==window&&window.parent.postMessage("mibew-chat-started:"+window.name+":"+n.links.chat,"*"),t.push(o.server.callFunctionsPeriodically(function(){var t=e.Objects.Models.thread,s=e.Objects.Models.user;return[{"function":"update",arguments:{"return":{threadState:"threadState",threadAgentId:"threadAgentId",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(),e.Objects.Models.user.set({canPost:t.canPost||!1}),void e.Objects.Models.thread.set({agentId:t.threadAgentId,state:t.threadState}))}))}),n.on("start",function(){e.Objects.server.restartUpdater()}),n.addFinalizer(function(){e.Objects.chatLayout.destroy();for(var s=0;s