Use Gulp.js instead of Ant for building

This commit is contained in:
Dmitriy Simushev 2014-08-04 13:53:18 +00:00
parent 324f5bf94e
commit bee65e50f7
109 changed files with 1613 additions and 2048 deletions

3
.gitignore vendored
View File

@ -24,3 +24,6 @@ src/composer.lock
# Do not index third-party libraries
src/mibew/vendor
# Do not index node.js modules that are used for building
src/node_modules

View File

@ -1,394 +0,0 @@
<project name="mibew messenger" default="all">
<property name="mibew_path" value="mibew" />
<property name="closure.c" value="/opt/closure/compiler.jar" />
<property name="handlebars" value="handlebars" />
<property name="dialogs_styles_path" value="${mibew_path}/styles/dialogs" />
<property name="pages_styles_path" value="${mibew_path}/styles/pages" />
<property name="js_path" value="${mibew_path}/js" />
<!-- Compile Handlebars templates for dialogs styles -->
<target name="dialogs_handlebars" description="Compile Handlebars templates for dialogs styles">
<echo>Compile templates</echo>
<!-- Compile templates -->
<apply executable="${handlebars}">
<arg value="-f"/>
<targetfile />
<dirset dir=".">
<include name="${dialogs_styles_path}/*/templates_src/client_side" />
</dirset>
<mapper type="glob" from="*/templates_src/client_side" to="*/templates_compiled/client_side/templates_tmp.js" />
</apply>
<!-- Use closule compiler instead of handlebars minifyer (-m flag)
because of handlebars does not insert line breaks.
Very long lines are cutted by ant and this brings problems -->
<apply executable="java">
<arg value="-jar" />
<arg value="${closure.c}" />
<arg value="--js" />
<srcfile />
<arg value="--js_output_file" />
<targetfile />
<fileset dir=".">
<include name="${dialogs_styles_path}/*/templates_compiled/client_side/templates_tmp.js" />
</fileset>
<mapper type="glob" from="*_tmp.js" to="*_tmp.c.js" />
</apply>
<!-- Add license info. Use move because of it is the best way to append
some info to files -->
<move todir="${dialogs_styles_path}" overwrite="true">
<fileset dir="${dialogs_styles_path}"/>
<mapper type="glob" from="*/templates_compiled/client_side/templates_tmp.c.js" to="*/templates_compiled/client_side/templates.js"/>
<filterchain>
<!-- Add header -->
<concatfilter prepend="tools/compiled_templates_header.txt" />
<!-- Skip empty lines -->
<linecontainsregexp negate="true">
<regexp pattern="^\s+$$" />
</linecontainsregexp>
</filterchain>
</move>
<!-- Remove temporary files -->
<echo>Remove temporary files</echo>
<delete>
<fileset dir=".">
<include name="${dialogs_styles_path}/*/templates_compiled/client_side/templates_tmp.js" />
</fileset>
</delete>
<echo>Done</echo>
</target>
<!-- Compile Handlebars templates for pages styles -->
<target name="pages_handlebars" description="Compile Handlebars templates for pages styles">
<!-- Compile applications templates -->
<apply executable="${handlebars}">
<arg value="-f"/>
<targetfile />
<dirset dir=".">
<include name="${pages_styles_path}/*/templates_src/client_side/*" />
</dirset>
<mapper
type="regexp"
from="^(.*)/templates_src/client_side/(.*)$$"
to="\1/templates_compiled/client_side/\2_app_tmp.tpl.js"
/>
</apply>
<!-- Use closule compiler instead of handlebars minifyer (-m flag)
because of handlebars does not insert line breaks.
Very long lines are cutted by ant and this brings problems -->
<apply executable="java">
<arg value="-jar" />
<arg value="${closure.c}" />
<arg value="--js" />
<srcfile />
<arg value="--js_output_file" />
<targetfile />
<fileset dir=".">
<include name="${pages_styles_path}/*/templates_compiled/client_side/*_app_tmp.tpl.js" />
</fileset>
<mapper type="glob" from="*_app_tmp.tpl.js" to="*_app_tmp.c.tpl.js" />
</apply>
<!-- Add license info. Use move because of it is the best way to append
some info to files -->
<move todir="${pages_styles_path}" overwrite="true">
<fileset dir="${pages_styles_path}">
<include name="*/templates_compiled/client_side/*_tmp.c.tpl.js" />
</fileset>
<!--<mapper type="glob" from="*/templates_compiled/client_side/*_tmp.c.tpl.js" to="*.tpl.js"/>-->
<mapper type="glob" from="*_tmp.c.tpl.js" to="*.tpl.js"/>
<filterchain>
<!-- Add header -->
<concatfilter prepend="tools/compiled_templates_header.txt" />
<!-- Skip empty lines -->
<linecontainsregexp negate="true">
<regexp pattern="^\s+$$" />
</linecontainsregexp>
</filterchain>
</move>
<!-- Remove all temporary files. -->
<delete>
<fileset dir="${pages_styles_path}">
<include name="*/templates_compiled/client_side/*_tmp.tpl.js" />
</fileset>
</delete>
<echo>Done</echo>
</target>
<!-- Compile Handlebars templates for all styles (both dialogs and pages) -->
<target name="styles_handlebars" depends="pages_handlebars,dialogs_handlebars" description="Compile Handlebars templates for all styles">
<echo>Handlebars templates from all styles are built.</echo>
</target>
<!-- Compile and concatenate JavaScript files for dialog styles -->
<target name="styles_js" description="Compile JavaScript files for all dialogs styles">
<echo>Compile and concatenate JavaScript files for dialogs styles:</echo>
<!-- Create temporary directories for compiled JavaScript files -->
<echo>Create temporary directories</echo>
<apply executable="mkdir" addsourcefile="false">
<targetfile />
<dirset dir=".">
<include name="${dialogs_styles_path}/*/js/source" />
</dirset>
<mapper type="glob" from="*/source" to="*/tmp" />
</apply>
<!-- Compile JavaScript files -->
<echo>Compile JavaScript files</echo>
<apply executable="java">
<arg value="-jar" />
<arg value="${closure.c}" />
<arg value="--js" />
<srcfile />
<arg value="--js_output_file" />
<targetfile />
<fileset dir=".">
<include name="${dialogs_styles_path}/*/js/source/*.js" />
</fileset>
<mapper type="regexp" from="^(.+)/source/(.+)$$" to="\1/tmp/\2" />
</apply>
<!-- Concatenate all scripts in one file. Use special script for
expanding wildcards. -->
<echo>Concatenate JavaScript files</echo>
<apply executable="tools/cat">
<srcfile suffix="/*.js"/>
<targetfile />
<dirset dir=".">
<include name="${dialogs_styles_path}/*/js/tmp" />
</dirset>
<mapper type="glob" from="*/tmp" to="*/compiled/scripts.js" />
</apply>
<!-- Remove temporary directories -->
<echo>Remove temporary directories</echo>
<apply executable="rm">
<arg value="-r" />
<arg value="-f" />
<dirset dir=".">
<include name="${dialogs_styles_path}/*/js/tmp" />
</dirset>
</apply>
<echo>Done</echo>
</target>
<!-- Build all stuff related to dialogs styles -->
<target name="styles_all" depends="styles_handlebars,styles_js" description="Run styles_handlebars and styles_js targets">
<echo>Styles built.</echo>
</target>
<!-- Compile all JavaScript files of the Mibew Core -->
<target name="core_js">
<echo>Compile JavaScript files of the Mibew Core</echo>
<!-- Copy directory tree from source to compiled -->
<echo>Copy directory tree</echo>
<copy todir="${js_path}/compiled">
<dirset dir="${js_path}/source">
<include name="**" />
</dirset>
</copy>
<!-- Compile JavaScript files -->
<echo>Compile JavaScript files</echo>
<apply executable="java">
<arg value="-jar" />
<arg value="${closure.c}" />
<arg value="--js" />
<srcfile />
<arg value="--js_output_file" />
<targetfile />
<fileset dir=".">
<include name="${js_path}/source/**/*.js" />
</fileset>
<mapper type="regexp" from="^(.+)/source/(.+)$$" to="\1/compiled/\2" />
</apply>
<echo>Done</echo>
</target>
<!-- Build JavaScript application -->
<target name="app_js">
<echo>Build "${app_name}" JavaScript application</echo>
<!-- Remove old application file -->
<delete file="${js_path}/compiled/${app_name}_app.js" />
<!-- Append application files to the result file -->
<concat destfile="${js_path}/compiled/${app_name}_app.js" eol="lf">
<!-- Append application static initialization code -->
<filelist dir="${js_path}/compiled/${app_name}" files="init.js" />
<!-- Include files from ${js_path}/compiled/${app_name}/ -->
<fileset dir="${js_path}/compiled/${app_name}">
<include name="*.js" />
<exclude name="init.js" />
<exclude name="app.js" />
</fileset>
<!-- Include models files -->
<fileset dir="${js_path}/compiled/${app_name}">
<include name="models/**/base*.js" />
</fileset>
<fileset dir="${js_path}/compiled/${app_name}">
<include name="models/**/*.js" />
<!-- Exclude base files -->
<exclude name="models/**/base*.js" />
</fileset>
<!-- Include collections files -->
<fileset dir="${js_path}/compiled/${app_name}">
<include name="collections/**/base*.js" />
</fileset>
<fileset dir="${js_path}/compiled/${app_name}">
<include name="collections/**/*.js" />
<!-- Exclude base files -->
<exclude name="collections/**/base*.js" />
</fileset>
<!-- Include models views files -->
<fileset dir="${js_path}/compiled/${app_name}">
<include name="model_views/**/base*.js" />
</fileset>
<fileset dir="${js_path}/compiled/${app_name}">
<include name="model_views/**/*.js" />
<!-- Exclude base files -->
<exclude name="model_views/**/base*.js" />
</fileset>
<!-- Include collections views files -->
<fileset dir="${js_path}/compiled/${app_name}">
<include name="collection_views/**/base*.js" />
</fileset>
<fileset dir="${js_path}/compiled/${app_name}">
<include name="collection_views/**/*.js" />
<!-- Exclude base files -->
<exclude name="collection_views/**/base*.js" />
</fileset>
<!-- Include regions files -->
<fileset dir="${js_path}/compiled/${app_name}">
<include name="regions/**/base*.js" />
</fileset>
<fileset dir="${js_path}/compiled/${app_name}">
<include name="regions/**/*.js" />
<!-- Exclude base files -->
<exclude name="regions/**/base*.js" />
</fileset>
<!-- Include layouts files -->
<fileset dir="${js_path}/compiled/${app_name}">
<include name="layouts/**/base*.js" />
</fileset>
<fileset dir="${js_path}/compiled/${app_name}">
<include name="layouts/**/*.js" />
<!-- Exclude base files -->
<exclude name="layouts/**/base*.js" />
</fileset>
<!-- Include all other files -->
<fileset dir="${js_path}/compiled/${app_name}">
<include name="**/base*.js" />
<exclude name="models/**/base*.js" />
<exclude name="collections/**/base*.js" />
<exclude name="model_views/**/base*.js" />
<exclude name="collection_views/**/base*.js" />
<exclude name="regions/**/base*.js" />
<exclude name="layouts/**/base*.js" />
</fileset>
<fileset dir="${js_path}/compiled/${app_name}">
<include name="**/*.js" />
<!-- Exclude files from ${js_path}/compiled/${app_name}/ -->
<exclude name="*.js" />
<!-- Exclude models, collections, views, regions and layouts
files -->
<exclude name="models/**/*.js" />
<exclude name="collections/**/*.js" />
<exclude name="model_views/**/*.js" />
<exclude name="collection_views/**/*.js" />
<exclude name="regions/**/*.js" />
<exclude name="layouts/**/*.js" />
<!-- Exclude base files -->
<exclude name="**/base*.js" />
</fileset>
<fileset dir="${js_path}/compiled/${app_name}">
<include name="app.js" />
</fileset>
<!-- Apply filters -->
<filterchain>
<!-- Skip empty lines -->
<linecontainsregexp negate="true">
<regexp pattern="^\s+$$" />
</linecontainsregexp>
</filterchain>
</concat>
<echo>Done</echo>
</target>
<!-- Build JavaScript files related to default application -->
<target name="default_app_js" depends="core_js" description="Build JavaScript files related to default application">
<antcall target="app_js">
<param name="app_name" value="default" />
</antcall>
<echo>Default JavaScript application built.</echo>
</target>
<!-- Compile and concatenate JavaScript files related to chat application -->
<target name="chat_app_js" depends="default_app_js" description="Build JavaScript files related to chat application">
<antcall target="app_js">
<param name="app_name" value="chat" />
</antcall>
<echo>Chat JavaScript application built.</echo>
</target>
<!-- Compile and concatenate JavaScript files related to users application -->
<target name="users_app_js" depends="default_app_js" description="Build JavaScript files related to users application">
<antcall target="app_js">
<param name="app_name" value="users" />
</antcall>
<echo>Users JavaScript application built.</echo>
</target>
<!-- Compile and concatenate JavaScript files related to thread log application -->
<target name="thread_log_app_js" depends="default_app_js" description="Build JavaScript files related to thread log application">
<antcall target="app_js">
<param name="app_name" value="thread_log" />
</antcall>
<echo>Thread log JavaScript application built.</echo>
</target>
<!-- Build all project -->
<target name="all" depends="chat_app_js,thread_log_app_js,users_app_js,styles_all" description="Build everything">
<echo>Mibew Messenger built.</echo>
</target>
</project>

166
src/gulpfile.js Normal file
View File

@ -0,0 +1,166 @@
var fs = require('fs'),
eventStream = require('event-stream'),
gulp = require('gulp'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
phpcs = require('gulp-phpcs'),
order = require('gulp-order'),
handlebars = require('gulp-handlebars'),
defineModule = require('gulp-define-module'),
header = require('gulp-header');
// Set global configs.
var config = {
mibewPath: 'mibew',
phpVendorPath: 'mibew/vendor',
pluginsPath: 'mibew/plugins',
jsPath: 'mibew/js',
chatStylesPath: 'mibew/styles/dialogs',
pageStylesPath: 'mibew/styles/pages',
compiledTemplatesHeader: fs.readFileSync('tools/compiled_templates_header.txt')
}
// Checks all PHP files with PHP Code Sniffer.
gulp.task('phpcs', function() {
return gulp.src([
config.mibewPath + '/**/*.php',
'!' + config.phpVendorPath + '/**/*.*',
'!' + config.pluginsPath + '/**/*.*'
])
.pipe(phpcs({
bin: config.phpVendorPath + '/bin/phpcs',
standard: 'PSR2',
warningSeverity: 0
}));
});
// Compile all JavaScript files of the Mibew Core
gulp.task('js', function() {
return eventStream.merge(
getClientSideApp('default'),
getClientSideApp('chat'),
getClientSideApp('thread_log'),
getClientSideApp('users'),
gulp.src(config.jsPath + '/source/**/*.js')
)
.pipe(uglify({preserveComments: 'some'}))
.pipe(gulp.dest(config.jsPath + '/compiled'));
});
// Performs all job related with chat styles.
gulp.task('chat-styles', ['chat-styles-handlebars', 'chat-styles-js'], function() {
// This task is just a combination of other tasks. That is why there is no
// real code.
});
// Compile and concatenate handlebars files for all chat styles.
gulp.task('chat-styles-handlebars', function() {
// TODO: Process all available styles, not only the default one.
var stylePath = config.chatStylesPath + '/default';
return gulp.src(stylePath + '/templates_src/client_side/**/*.handlebars')
.pipe(handlebars())
.pipe(wrapHandlebarsTemplate())
.pipe(concat('templates.js'))
.pipe(uglify({preserveComments: 'some'}))
.pipe(header(config.compiledTemplatesHeader))
.pipe(gulp.dest(stylePath + '/templates_compiled/client_side'));
});
// Compile and concatenate js files for all chat styles.
gulp.task('chat-styles-js', function() {
// TODO: Process all available styles, not only the default one.
var stylePath = config.chatStylesPath + '/default';
return gulp.src(stylePath + '/js/source/**/*.js')
.pipe(concat('scripts.js'))
.pipe(uglify({preserveComments: 'some'}))
.pipe(gulp.dest(stylePath + '/js/compiled'));
});
// Performs all job related with pages styles.
gulp.task('page-styles', function() {
// TODO: Process all available styles, not only the default one.
var stylePath = config.pageStylesPath + '/default';
return eventStream.merge(
gulp.src(stylePath + '/templates_src/client_side/default/**/*.handlebars')
.pipe(handlebars())
.pipe(wrapHandlebarsTemplate())
.pipe(concat('default_app.tpl.js')),
gulp.src(stylePath + '/templates_src/client_side/users/**/*.handlebars')
.pipe(handlebars())
.pipe(wrapHandlebarsTemplate())
.pipe(concat('users_app.tpl.js'))
)
.pipe(uglify({preserveComments: 'some'}))
.pipe(header(config.compiledTemplatesHeader))
.pipe(gulp.dest(stylePath + '/templates_compiled/client_side'));
});
// Runs all existing tasks.
gulp.task('default', ['phpcs', 'js', 'chat-styles', 'page-styles'], function() {
// This task is just a combination of other tasks. That is why there is no
// real code.
});
/**
* Loads and prepare js file for a client side application with the specified
* name.
*
* @param {String} name Application name
* @returns A files stream that can be piped to any gulp plugin.
*/
var getClientSideApp = function(name) {
var appSource = config.jsPath + '/source/' + name;
return gulp.src(appSource + '/**/*.js')
.pipe(order(
[
appSource + '/init.js',
// The following line is equivalent to
// gulp.src([appSource + '/*.js', '!' + appSource + '/app.js']);
appSource + '/!(app).js',
appSource + '/models/**/base*.js',
appSource + '/models/**/*.js',
appSource + '/collections/**/base*.js',
appSource + '/collections/**/*.js',
appSource + '/model_views/**/base*.js',
appSource + '/model_views/**/*.js',
appSource + '/collection_views/**/base*.js',
appSource + '/collection_views/**/*.js',
appSource + '/regions/**/base*.js',
appSource + '/regions/**/*.js',
appSource + '/layouts/**/base*.js',
appSource + '/layouts/**/*.js',
appSource + '/**/base*.js',
// The following line is equivalent to
// gulp.src([appSource + '/**/*.js', '!' + appSource + '/app.js']);
'!' + appSource + '/app.js',
appSource + '/app.js'
],
{base: process.cwd()}
))
.pipe(concat(name + '_app.js'));
}
/**
* Wraps a handlebars template with a function and attach it to the
* Handlebars.templates object.
*
* @returns {Function} A function that can be used in pipe() method of a file
* stream right after gulp-handlebars plugin.
*/
var wrapHandlebarsTemplate = function() {
return defineModule('plain', {
wrapper: '(function() {\n'
+ 'var templates = Handlebars.templates = Handlebars.templates || {};\n'
+ 'Handlebars.templates["<%= relative %>"] = <%= handlebars %>;\n'
+ '})()',
context: function(context) {
return {relative: context.file.relative.replace(/\.js$/, '')};
}
});
}

View File

@ -1,8 +1,8 @@
/*
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 myAgent="",myVer=0,myRealAgent="";function detectAgent(){for(var a="opera msie safari firefox netscape mozilla".split(" "),d=navigator.userAgent.toLowerCase(),b=0;b<a.length;b++){var c=a[b];if(-1!=d.indexOf(c)){myAgent=c;if(!window.RegExp)break;null!=RegExp(c+"[ /]?([0-9]+(.[0-9]+)?)").exec(d)&&(myVer=parseFloat(RegExp.$1));break}}myRealAgent=myAgent;"Gecko"==navigator.product&&(myAgent="moz")}detectAgent();function getEl(a){return document.getElementById(a)};
/**
* @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();

View File

@ -1,9 +1,8 @@
/*
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(b,d){var c=b.Application;c.addRegions({mainRegion:"#main-region"});c.addInitializer(function(a){b.PluginOptions=a.plugins||{};b.Objects.server=new b.Server(d.extend({interactionType:MibewAPIChatInteraction},a.server));b.Objects.Models.page=new b.Models.Page(a.page);switch(a.startFrom){case "chat":c.Chat.start(a.chatOptions);break;case "survey":c.Survey.start(a.surveyOptions);break;case "leaveMessage":c.LeaveMessage.start(a.leaveMessageOptions);break;case "invitation":c.Invitation.start(a.invitationOptions);
break;default:throw Error("Dont know how to start!");}});c.on("start",function(){b.Objects.server.runUpdater()})})(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 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,_);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Views.MessagesCollection=a.Views.CollectionBase.extend({itemView:a.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.MessagesCollection=e.Views.CollectionBase.extend({itemView:e.Views.Message,className:"messages-collection"})}(Mibew);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Views.StatusCollection=a.Views.CollectionBase.extend({itemView:a.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){e.Views.StatusCollection=e.Views.CollectionBase.extend({itemView:e.Views.Status,className:"status-collection"})}(Mibew);

View File

@ -1,10 +1,8 @@
/*
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(b,d,j){b.Collections.Messages=d.Collection.extend({model:b.Models.Message,initialize:function(){this.periodicallyCalled=[];this.periodicallyCalled.push(b.Objects.server.callFunctionsPeriodically(j.bind(this.updateMessagesFunctionBuilder,this),j.bind(this.updateMessages,this)))},finalize:function(){for(var a=0;a<this.periodicallyCalled.length;a++)b.Objects.server.stopCallFunctionsPeriodically(this.periodicallyCalled[a])},updateMessages:function(a){a.lastId&&b.Objects.Models.thread.set({lastId:a.lastId});
for(var k=b.Models.Message.prototype.KIND_PLUGIN,g=[],c,f,e,h=0,d=a.messages.length;h<d;h++)c=a.messages[h],c.kind!=k?g.push(new b.Models.Message(c)):"object"!=typeof c.data||null===c.data||(f=c.plugin||!1,f="process:"+(!1!==f?f+":":"")+"plugin:message",e={messageData:c,model:!1},this.trigger(f,e),e.model&&(e.model.get("id")||e.model.set({id:c.id}),g.push(e.model)));0<g.length&&this.add(g)},updateMessagesFunctionBuilder:function(){var a=b.Objects.Models.thread,d=b.Objects.Models.user;return[{"function":"updateMessages",
arguments:{"return":{messages:"messages",lastId:"lastId"},references:{},threadId:a.get("id"),token:a.get("token"),lastId:a.get("lastId"),user:!d.get("isAgent")}}]},add:function(){var a=Array.prototype.slice.apply(arguments),a=d.Collection.prototype.add.apply(this,a);this.trigger("multiple:add");return a}})})(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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Collections.Status=b.Collection.extend({comparator:function(a){return a.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(t,e){t.Collections.Status=e.Collection.extend({comparator:function(t){return t.get("weight")}})}(Mibew,Backbone);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Regions={};a.Layouts={};a.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
*/
!function(i){i.Regions={},i.Layouts={},i.Application=new Backbone.Marionette.Application}(Mibew);

View File

@ -1,8 +1,8 @@
/*
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(a,c){a.Layouts.Chat=c.Marionette.Layout.extend({template:Handlebars.templates["chat/layout"],regions:{controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:{selector:"#messages-region",regionType:a.Regions.Messages},statusRegion:"#status-region",messageFormRegion:"#message-form-region"},serializeData:function(){var b=a.Objects.Models;return{page:b.page.toJSON(),user:b.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,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);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Layouts.Invitation=b.Marionette.Layout.extend({template:Handlebars.templates["invitation/layout"],regions:{messagesRegion:{selector:"#invitation-messages-region",regionType:a.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.Invitation=t.Marionette.Layout.extend({template:Handlebars.templates["invitation/layout"],regions:{messagesRegion:{selector:"#invitation-messages-region",regionType:e.Regions.Messages}}})}(Mibew,Backbone);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Layouts.LeaveMessage=b.Marionette.Layout.extend({template:Handlebars.templates["leave_message/layout"],regions:{leaveMessageFormRegion:"#content-wrapper",descriptionRegion:"#description-region"},serializeData:function(){return{page:a.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,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);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Layouts.Survey=b.Marionette.Layout.extend({template:Handlebars.templates["survey/layout"],regions:{surveyFormRegion:"#content-wrapper"},serializeData:function(){return{page:a.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);

View File

@ -1,8 +1,8 @@
/*
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
*/
MibewAPIChatInteraction=function(){this.mandatoryArguments=function(){return{"*":{threadId:null,token:null,"return":{},references:{}},result:{errorCode:0}}},this.getReservedFunctionsNames=function(){return["result"]}},MibewAPIChatInteraction.prototype=new MibewAPIInteraction;

View File

@ -1,8 +1,8 @@
/*
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(a,b,c){a.Views.Avatar=b.Marionette.ItemView.extend({template:c.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,a,t){e.Views.Avatar=a.Marionette.ItemView.extend({template:t.templates["chat/avatar"],className:"avatar",modelEvents:{change:"render"}})}(Mibew,Backbone,Handlebars);

View File

@ -1,8 +1,8 @@
/*
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(a,c,d){a.Views.CloseControl=a.Views.Control.extend({template:c.templates["chat/controls/close"],events:d.extend({},a.Views.Control.prototype.events,{click:"closeThread"}),closeThread:function(){var b=a.Localization.get("Are you sure want to leave chat?");(!1===b||confirm(b))&&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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(b,d,e){b.Views.HistoryControl=b.Views.Control.extend({template:d.templates["chat/controls/history"],events:e.extend({},b.Views.Control.prototype.events,{click:"showHistory"}),showHistory:function(){var c=b.Objects.Models.user,a=this.model.get("link");c.get("isAgent")&&a&&(c=this.model.get("windowParams"),a=a.replace("&amp;","&","g"),a=window.open(a,"UserHistory",c),null!==a&&(a.focus(),a.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,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("&amp;","&","g");var n=window.open(o,"UserHistory",s);null!==n&&(n.focus(),n.opener=window)}}})}(Mibew,Handlebars,_);

View File

@ -1,9 +1,8 @@
/*
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(b,e,f){b.Views.RedirectControl=b.Views.Control.extend({template:e.templates["chat/controls/redirect"],events:f.extend({},b.Views.Control.prototype.events,{click:"redirect"}),initialize:function(){b.Objects.Models.user.on("change",this.render,this)},serializeData:function(){var a=this.model.toJSON();a.user=b.Objects.Models.user.toJSON();return a},redirect:function(){var a=b.Objects.Models.user;if(a.get("isAgent")&&a.get("canPost")&&(a=this.model.get("link"))){var c=b.Objects.Models.page.get("style"),
d="";c&&(d=(-1===a.indexOf("?")?"?":"&")+"style="+c);window.location.href=a.replace(/\&amp\;/g,"&")+d}}})})(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,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(/\&amp\;/g,"&")+n}}}})}(Mibew,Handlebars,_);

View File

@ -1,8 +1,8 @@
/*
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(a,b,c){a.Views.RefreshControl=a.Views.Control.extend({template:b.templates["chat/controls/refresh"],events:c.extend({},a.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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(a,d,e){a.Views.SecureModeControl=a.Views.Control.extend({template:d.templates["chat/controls/secure_mode"],events:e.extend({},a.Views.Control.prototype.events,{click:"secure"}),secure:function(){var b=this.model.get("link");if(b){var c=a.Objects.Models.page.get("style");window.location.href=b.replace(/\&amp\;/g,"&")+(c?"&style="+c:"")}}})})(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,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(/\&amp\;/g,"&")+(o?"&style="+o:"")}}})}(Mibew,Handlebars,_);

View File

@ -1,8 +1,8 @@
/*
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(b,d,f){b.Views.SendMailControl=b.Views.Control.extend({template:d.templates["chat/controls/send_mail"],events:f.extend({},b.Views.Control.prototype.events,{click:"sendMail"}),sendMail:function(){var a=this.model.get("link"),c=b.Objects.Models.page;if(a){var d=this.model.get("windowParams"),c=c.get("style"),e="";c&&(e=(-1===a.indexOf("?")?"?":"&")+"style="+c);a=a.replace(/\&amp\;/g,"&")+e;a=window.open(a,"ForwardMail",d);null!==a&&(a.focus(),a.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,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(/\&amp\;/g,"&")+i;var a=window.open(n,"ForwardMail",l);null!==a&&(a.focus(),a.opener=window)}}})}(Mibew,Handlebars,_);

View File

@ -1,8 +1,8 @@
/*
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(a,b,c){a.Views.SoundControl=a.Views.Control.extend({template:b.templates["chat/controls/sound"],events:c.extend({},a.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,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,_);

View File

@ -1,9 +1,8 @@
/*
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(b,c,d){b.Views.UserNameControl=b.Views.Control.extend({template:c.templates["chat/controls/user_name"],events:d.extend({},b.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(){b.Objects.Models.user.on("change:name",this.hideNameInput,this);this.nameInput=b.Objects.Models.user.get("defaultName")},serializeData:function(){var a=
this.model.toJSON();a.user=b.Objects.Models.user.toJSON();a.nameInput=this.nameInput;return a},inputKeyDown:function(a){a=a.which;13!=a&&10!=a||this.changeName()},hideNameInput:function(){this.nameInput=!1;this.render()},showNameInput:function(){this.nameInput=!0;this.render()},changeName:function(){var a=this.ui.nameInput.val();this.model.changeName(a)}})})(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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(a,b,c){a.Views.LeaveMessageDescription=b.Marionette.ItemView.extend({template:c.templates["leave_message/description"],serializeData:function(){return{page:a.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,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);

View File

@ -1,9 +1,8 @@
/*
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(d,e,b){var c=d.Views.BaseSurveyForm;d.Views.LeaveMessageForm=c.extend({template:e.templates["leave_message/form"],events:b.extend({},c.prototype.events,{"click #send-message":"submitForm"}),ui:b.extend({},c.prototype.ui,{captcha:'input[name="captcha"]',captchaImg:"#captcha-img"}),modelEvents:b.extend({},c.prototype.modelEvents,{"submit:error":"hideAjaxLoader showError submitError"}),submitForm:function(){this.showAjaxLoader();var a={};this.model.get("groups")&&(a.groupId=this.ui.groupSelect.val());
a.name=this.ui.name.val()||"";a.email=this.ui.email.val()||"";a.message=this.ui.message.val()||"";this.model.get("showCaptcha")&&(a.captcha=this.ui.captcha.val()||"");this.model.set(a,{validate:!0});this.model.submit()},submitError:function(a,c){if(c.code==a.ERROR_WRONG_CAPTCHA&&a.get("showCaptcha")){var b=this.ui.captchaImg.attr("src"),b=b.replace(/\?d\=[0-9]+/,"");this.ui.captchaImg.attr("src",b+"?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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(a,b,c){a.Views.LeaveMessageSentDescription=b.Marionette.ItemView.extend({template:c.templates["leave_message/sent_description"],serializeData:function(){return{page:a.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,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);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Views.Message=a.Views.Message.extend({template:b.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,s){e.Views.Message=e.Views.Message.extend({template:s.templates["chat/message"]})}(Mibew,Handlebars);

View File

@ -1,11 +1,8 @@
/*
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(b,d,e){b.Views.MessageForm=d.Marionette.ItemView.extend({template:e.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(){b.Objects.Models.user.on("change:canPost",this.render,this)},serializeData:function(){var a=this.model.toJSON();a.user=b.Objects.Models.user.toJSON();return a},postMessage:function(){var a=this.ui.message.val();""!=a&&(this.disableInput(),this.model.postMessage(a));b.Objects.Collections.messages.on("multiple:add",this.postMessageComplete,this)},messageKeyDown:function(a){var c=a.which;a=a.ctrlKey;(13==c&&(a||this.model.get("ignoreCtrl"))||10==c)&&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();b.Objects.Collections.messages.off("multiple:add",this.postMessageComplete,this)},selectPredefinedAnswer:function(){var a=this.ui.message,c=this.ui.predefinedAnswer,b=c.get(0).selectedIndex;b&&(a.val(this.model.get("predefinedAnswers")[b-1].full).change(),a.focus(),c.get(0).selectedIndex=
0)},checkUserTyping:function(){var a=b.Objects.Models.user,c=""!=this.ui.message.val();c!=a.get("typing")&&a.set({typing:c})},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,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);

View File

@ -1,8 +1,8 @@
/*
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(a,b,c){a.Views.Status=b.Marionette.ItemView.extend({template:c.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,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);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Views.StatusMessage=a.Views.Status.extend({template:b.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.StatusMessage=e.Views.Status.extend({template:t.templates["chat/status/message"]})}(Mibew,Handlebars);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Views.StatusTyping=a.Views.Status.extend({template:b.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(t,e){t.Views.StatusTyping=t.Views.Status.extend({template:e.templates["chat/status/typing"]})}(Mibew,Handlebars);

View File

@ -1,9 +1,8 @@
/*
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(c,d){c.Views.BaseSurveyForm=d.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(a){a.preventDefault()},
changeGroupDescription:function(){var a=this.ui.groupSelect.prop("selectedIndex"),a=this.model.get("groups")[a].description||"";this.ui.groupDescription.text(a)},showError:function(a,b){this.ui.errors.html("string"==typeof b?b:b.message)},serializeData:function(){var a=this.model.toJSON();a.page=c.Objects.Models.page.toJSON();return a},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,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);

View File

@ -1,9 +1,8 @@
/*
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(b,d,e){var c=b.Views.BaseSurveyForm;b.Views.SurveyForm=c.extend({template:d.templates["survey/form"],events:e.extend({},c.prototype.events,{"click #submit-survey":"submitForm"}),submitForm:function(){this.showAjaxLoader();var a={};this.model.get("groups")&&(a.groupId=this.ui.groupSelect.val());this.model.get("canChangeName")&&(a.name=this.ui.name.val()||"");this.model.get("showEmail")&&(a.email=this.ui.email.val()||"");this.model.get("showMessage")&&(a.message=this.ui.message.val()||"");
this.model.set(a,{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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(b,c){b.Models.Avatar=b.Models.Base.extend({defaults:{imageLink:!1},initialize:function(){this.registeredFunctions=[];this.registeredFunctions.push(b.Objects.server.registerFunction("setupAvatar",c.bind(this.apiSetupAvatar,this)))},finalize:function(){for(var a=0;a<this.registeredFunctions.length;a++)b.Objects.server.unregisterFunction(this.registeredFunctions[a])},apiSetupAvatar:function(a){a.imageLink&&this.set({imageLink:a.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(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,_);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Models.ChatUser=a.Models.User.extend({defaults:b.extend({},a.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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Models.CloseControl=a.Models.Control.extend({getModelType:function(){return"CloseControl"},closeThread:function(){var b=a.Objects.Models.thread,c=a.Objects.Models.user;a.Objects.server.callFunctions([{"function":"close",arguments:{references:{},"return":{closed:"closed"},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),user:!c.get("isAgent")}}],function(b){b.closed?window.close():a.Objects.Models.Status.message.setMessage(b.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){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);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Models.HistoryControl=a.Models.Control.extend({defaults:b.extend({},a.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(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,_);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Models.RedirectControl=a.Models.Control.extend({defaults:b.extend({},a.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,o){e.Models.RedirectControl=e.Models.Control.extend({defaults:o.extend({},e.Models.Control.prototype.defaults,{link:!1}),getModelType:function(){return"RedirectControl"}})}(Mibew,_);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Models.RefreshControl=a.Models.Control.extend({getModelType:function(){return"RefreshControl"},refresh:function(){a.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){e.Models.RefreshControl=e.Models.Control.extend({getModelType:function(){return"RefreshControl"},refresh:function(){e.Objects.server.restartUpdater()}})}(Mibew);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Models.SecureModeControl=a.Models.Control.extend({defaults:b.extend({},a.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,o){e.Models.SecureModeControl=e.Models.Control.extend({defaults:o.extend({},e.Models.Control.prototype.defaults,{link:!1}),getModelType:function(){return"SecureModeControl"}})}(Mibew,_);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Models.SendMailControl=a.Models.Control.extend({defaults:b.extend({},a.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,o){e.Models.SendMailControl=e.Models.Control.extend({defaults:o.extend({},e.Models.Control.prototype.defaults,{link:!1,windowParams:""}),getModelType:function(){return"SendMailControl"}})}(Mibew,_);

View File

@ -1,8 +1,8 @@
/*
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(a,c){a.Models.SoundControl=a.Models.Control.extend({defaults:c.extend({},a.Models.Control.prototype.defaults,{enabled:!0}),toggle:function(){var b=!this.get("enabled");a.Objects.Models.soundManager.set({enabled:b});this.set({enabled:b})},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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(b){b.Models.UserNameControl=b.Models.Control.extend({getModelType:function(){return"UserNameControl"},changeName:function(a){var c=b.Objects.Models.user,d=b.Objects.Models.thread,e=c.get("name");a&&e!=a&&(b.Objects.server.callFunctions([{"function":"rename",arguments:{references:{},"return":{},threadId:d.get("id"),token:d.get("token"),name:a}}],function(a){a.errorCode&&(b.Objects.Models.Status.message.setMessage(a.errorMessage||"Cannot rename"),c.set({name:e}))},!0),c.set({name:a}))}})})(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(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);

View File

@ -1,10 +1,8 @@
/*
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(c,e){var d=c.Models.BaseSurveyForm;c.Models.LeaveMessageForm=d.extend({defaults:e.extend({},d.prototype.defaults,{showCaptcha:!1,captcha:""}),validate:function(a){var b=c.Localization;if("undefined"!=typeof a.email){if(!a.email)return b.get("leavemessage.error.email.required");if(!c.Utils.checkEmail(a.email))return b.get("leavemessage.error.wrong.email")}if("undefined"!=typeof a.name&&!a.name)return b.get("leavemessage.error.name.required");if("undefined"!=typeof a.message&&!a.message)return b.get("leavemessage.error.message.required");
if(this.get("showCaptcha")&&"undefined"!=typeof a.captcha&&!a.captcha)return b.get("The letters you typed don't match the letters that were shown in the picture.")},submit:function(){if(!this.validate(this.attributes)){var a=this;c.Objects.server.callFunctions([{"function":"processLeaveMessage",arguments:{references:{},"return":{},groupId:a.get("groupId"),name:a.get("name"),info:a.get("info"),email:a.get("email"),message:a.get("message"),referrer:a.get("referrer"),captcha:a.get("captcha"),threadId:null,token:null}}],function(b){0==b.errorCode?a.trigger("submit:complete",
a):a.trigger("submit:error",a,{code:b.errorCode,message:b.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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Models.MessageForm=a.Models.Base.extend({defaults:{predefinedAnswers:[],ignoreCtrl:!1},postMessage:function(e){var b=a.Objects.Models.thread,c=a.Objects.Models.user;if(c.get("canPost")){this.trigger("before:post",this);var d=this;a.Objects.server.callFunctions([{"function":"post",arguments:{references:{},"return":{},message:e,threadId:b.get("id"),token:b.get("token"),user:!c.get("isAgent")}}],function(){d.trigger("after:post",d)},!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.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);

View File

@ -1,8 +1,8 @@
/*
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(b,a){b.Models.BaseSoundManager=a.Model.extend({defaults:{enabled:!0},play:function(a){this.get("enabled")&&b.Utils.playSound(a)}})})(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,n){e.Models.BaseSoundManager=n.Model.extend({defaults:{enabled:!0},play:function(n){this.get("enabled")&&e.Utils.playSound(n)}})}(Mibew,Backbone);

View File

@ -1,9 +1,8 @@
/*
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(a,c){a.Models.ChatSoundManager=a.Models.BaseSoundManager.extend({defaults:c.extend({},a.Models.BaseSoundManager.prototype.defaults,{skipNextMessageSound:!1}),initialize:function(){var b=a.Objects,c=this;b.Collections.messages.on("multiple:add",this.playNewMessageSound,this);b.Models.messageForm.on("before:post",function(){c.set({skipNextMessageSound:!0})})},playNewMessageSound:function(){if(!this.get("skipNextMessageSound")){var b=a.Objects.Models.page.get("mibewRoot");"undefined"!==typeof b&&
this.play(b+"/sounds/new_message")}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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(b,c){b.Models.Status=b.Models.Base.extend({defaults:{visible:!0,weight:0,hideTimeout:4E3,title:""},initialize:function(){this.hideTimer=null},autoHide:function(a){a=a||this.get("hideTimeout");this.hideTimer&&clearTimeout(this.hideTimer);this.hideTimer=setTimeout(c.bind(function(){this.set({visible:!1})},this),a)}})})(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(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,_);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Models.StatusMessage=a.Models.Status.extend({defaults:b.extend({},a.Models.Status.prototype.defaults,{message:"",visible:!1}),getModelType:function(){return"StatusMessage"},setMessage:function(a){this.set({message:a,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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Models.StatusTyping=a.Models.Status.extend({defaults:b.extend({},a.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(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,_);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Models.BaseSurveyForm=a.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){e.Models.BaseSurveyForm=e.Models.Base.extend({defaults:{name:"",email:"",message:"",info:"",referrer:"",groupId:null,groups:null}})}(Mibew);

View File

@ -1,10 +1,8 @@
/*
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(b,e){var d=b.Models.BaseSurveyForm;b.Models.SurveyForm=d.extend({defaults:e.extend({},d.prototype.defaults,{showEmail:!1,showMessage:!1,canChangeName:!1}),validate:function(a){if(this.get("showEmail")&&"undefined"!=typeof a.email&&!b.Utils.checkEmail(a.email))return b.Localization.get("Wrong email address.")},submit:function(){if(!this.validate(this.attributes)){var a=this;b.Objects.server.callFunctions([{"function":"processSurvey",arguments:{references:{},"return":{next:"next",options:"options"},
groupId:a.get("groupId"),name:a.get("name"),info:a.get("info"),email:a.get("email"),message:a.get("message"),referrer:a.get("referrer"),threadId:null,token:null}}],function(c){if(0==c.errorCode)switch(a.trigger("submit:complete",a),b.Application.Survey.stop(),c.next){case "chat":b.Application.Chat.start(c.options);break;case "leaveMessage":b.Application.LeaveMessage.start(c.options);break;default:throw Error("Do not know how to continue!");}else a.trigger("submit:error",a,{code:c.errorCode,message:c.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){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,_);

View File

@ -1,14 +1,8 @@
/*
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(a){a.Objects.Models.Controls={};a.Objects.Models.Status={};var j=[],l=a.Application,k=l.module("Chat",{startWithParent:!1});k.addInitializer(function(b){var f=a.Objects,d=a.Objects.Models,c=a.Objects.Models.Controls,h=a.Objects.Models.Status;b.page&&d.page.set(b.page);d.thread=new a.Models.Thread(b.thread);d.user=new a.Models.ChatUser(b.user);var g=new a.Layouts.Chat;f.chatLayout=g;l.mainRegion.show(g);var e=new a.Collections.Controls;d.user.get("isAgent")||(c.userName=new a.Models.UserNameControl({weight:220}),
e.add(c.userName),c.sendMail=new a.Models.SendMailControl({weight:200,link:b.links.mail,windowParams:b.windowsParams.mail}),e.add(c.sendMail));d.user.get("isAgent")&&(c.redirect=new a.Models.RedirectControl({weight:200,link:b.links.redirect}),e.add(c.redirect),c.history=new a.Models.HistoryControl({weight:180,link:b.links.history,windowParams:b.windowsParams.history}),e.add(c.history));c.sound=new a.Models.SoundControl({weight:160});e.add(c.sound);c.refresh=new a.Models.RefreshControl({weight:140});
e.add(c.refresh);b.links.ssl&&(c.secureMode=new a.Models.SecureModeControl({weight:120,link:b.links.ssl}),e.add(c.secureMode));c.close=new a.Models.CloseControl({weight:100});e.add(c.close);f.Collections.controls=e;g.controlsRegion.show(new a.Views.ControlsCollection({collection:e}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});f.Collections.status=new a.Collections.Status([h.message,h.typing]);g.statusRegion.show(new a.Views.StatusCollection({collection:f.Collections.status}));
d.user.get("isAgent")||(d.avatar=new a.Models.Avatar,g.avatarRegion.show(new a.Views.Avatar({model:d.avatar})));f.Collections.messages=new a.Collections.Messages;d.messageForm=new a.Models.MessageForm(b.messageForm);g.messageFormRegion.show(new a.Views.MessageForm({model:d.messageForm}));g.messagesRegion.show(new a.Views.MessagesCollection({collection:f.Collections.messages}));d.soundManager=new a.Models.ChatSoundManager;j.push(f.server.callFunctionsPeriodically(function(){var b=a.Objects.Models.thread,
c=a.Objects.Models.user;return[{"function":"update",arguments:{"return":{typing:"typing",canPost:"canPost"},references:{},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),typed:c.get("typing"),user:!c.get("isAgent")}}]},function(b){b.errorCode?a.Objects.Models.Status.message.setMessage(b.errorMessage||"refresh failed"):(b.typing&&a.Objects.Models.Status.typing.show(),a.Objects.Models.user.set({canPost:b.canPost||!1}))}))});k.on("start",function(){a.Objects.server.restartUpdater()});
k.addFinalizer(function(){a.Objects.chatLayout.close();for(var b=0;b<j.length;b++)a.Objects.server.stopCallFunctionsPeriodically(j[b]);"undefined"!=typeof a.Objects.Models.avatar&&a.Objects.Models.avatar.finalize();a.Objects.Collections.messages.finalize();delete a.Objects.chatLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;delete a.Objects.Models.page;delete a.Objects.Models.avatar;delete a.Objects.Models.messageForm;delete a.Objects.Models.Controls;delete a.Objects.Models.Status;
delete a.Objects.Collections.messages;delete a.Objects.Collections.controls;delete a.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){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);

View File

@ -1,10 +1,8 @@
/*
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(a){var d=[],e=a.Application,b=e.module("Invitation",{startWithParent:!1});b.addInitializer(function(f){var c=a.Objects,b=a.Objects.Models;b.thread=new a.Models.Thread(f.thread);b.user=new a.Models.ChatUser(f.user);c.invitationLayout=new a.Layouts.Invitation;e.mainRegion.show(c.invitationLayout);c.Collections.messages=new a.Collections.Messages;c.invitationLayout.messagesRegion.show(new a.Views.MessagesCollection({collection:c.Collections.messages}));d.push(c.server.callFunctionsPeriodically(function(){var b=
a.Objects.Models.thread;return[{"function":"update",arguments:{"return":{},references:{},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),typed:!1,user:!0}}]},function(){}))});b.on("start",function(){a.Objects.server.restartUpdater()});b.addFinalizer(function(){a.Objects.invitationLayout.close();for(var b=0;b<d.length;b++)a.Objects.server.stopCallFunctionsPeriodically(d[b]);a.Objects.Collections.messages.finalize();delete a.Objects.invitationLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;
delete a.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=[],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);

View File

@ -1,9 +1,8 @@
/*
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(a){var e=a.Application,f=e.module("LeaveMessage",{startWithParent:!1});f.addInitializer(function(d){var b=a.Objects,c=a.Objects.Models;d.page&&c.page.set(d.page);b.leaveMessageLayout=new a.Layouts.LeaveMessage;e.mainRegion.show(b.leaveMessageLayout);c.leaveMessageForm=new a.Models.LeaveMessageForm(d.leaveMessageForm);b.leaveMessageLayout.leaveMessageFormRegion.show(new a.Views.LeaveMessageForm({model:c.leaveMessageForm}));b.leaveMessageLayout.descriptionRegion.show(new a.Views.LeaveMessageDescription);
c.leaveMessageForm.on("submit:complete",function(){b.leaveMessageLayout.leaveMessageFormRegion.close();b.leaveMessageLayout.descriptionRegion.close();b.leaveMessageLayout.descriptionRegion.show(new a.Views.LeaveMessageSentDescription)})});f.addFinalizer(function(){a.Objects.leaveMessageLayout.close();delete a.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 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);

View File

@ -1,8 +1,8 @@
/*
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(a){var d=a.Application,b=d.module("Survey",{startWithParent:!1});b.addInitializer(function(b){var c=a.Objects,e=a.Objects.Models;c.surveyLayout=new a.Layouts.Survey;d.mainRegion.show(c.surveyLayout);e.surveyForm=new a.Models.SurveyForm(b.surveyForm);c.surveyLayout.surveyFormRegion.show(new a.Views.SurveyForm({model:e.surveyForm}))});b.addFinalizer(function(){a.Objects.surveyLayout.close();delete a.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){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);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Regions.Messages=b.Marionette.Region.extend({onShow:function(a){a.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(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);

View File

@ -1,403 +1,379 @@
/*
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(a){a.Regions={};a.Layouts={};a.Application=new Backbone.Marionette.Application})(Mibew);
/*
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;
/*
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(b,a){b.Models.BaseSoundManager=a.Model.extend({defaults:{enabled:!0},play:function(a){this.get("enabled")&&b.Utils.playSound(a)}})})(Mibew,Backbone);
/*
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(b,c){b.Models.Status=b.Models.Base.extend({defaults:{visible:!0,weight:0,hideTimeout:4E3,title:""},initialize:function(){this.hideTimer=null},autoHide:function(a){a=a||this.get("hideTimeout");this.hideTimer&&clearTimeout(this.hideTimer);this.hideTimer=setTimeout(c.bind(function(){this.set({visible:!1})},this),a)}})})(Mibew,_);
/*
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(a){a.Models.BaseSurveyForm=a.Models.Base.extend({defaults:{name:"",email:"",message:"",info:"",referrer:"",groupId:null,groups:null}})})(Mibew);
/*
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(b,c){b.Models.Avatar=b.Models.Base.extend({defaults:{imageLink:!1},initialize:function(){this.registeredFunctions=[];this.registeredFunctions.push(b.Objects.server.registerFunction("setupAvatar",c.bind(this.apiSetupAvatar,this)))},finalize:function(){for(var a=0;a<this.registeredFunctions.length;a++)b.Objects.server.unregisterFunction(this.registeredFunctions[a])},apiSetupAvatar:function(a){a.imageLink&&this.set({imageLink:a.imageLink})}})})(Mibew,_);
/*
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(a,b){a.Models.ChatUser=a.Models.User.extend({defaults:b.extend({},a.Models.User.prototype.defaults,{canPost:!0,typing:!1,canChangeName:!1,dafaultName:!0})})})(Mibew,_);
/*
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(a){a.Models.CloseControl=a.Models.Control.extend({getModelType:function(){return"CloseControl"},closeThread:function(){var b=a.Objects.Models.thread,c=a.Objects.Models.user;a.Objects.server.callFunctions([{"function":"close",arguments:{references:{},"return":{closed:"closed"},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),user:!c.get("isAgent")}}],function(b){b.closed?window.close():a.Objects.Models.Status.message.setMessage(b.errorMessage||"Cannot close")},!0)}})})(Mibew);
/*
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(a,b){a.Models.HistoryControl=a.Models.Control.extend({defaults:b.extend({},a.Models.Control.prototype.defaults,{link:!1,windowParams:""}),getModelType:function(){return"HistoryControl"}})})(Mibew,_);
/*
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(a,b){a.Models.RedirectControl=a.Models.Control.extend({defaults:b.extend({},a.Models.Control.prototype.defaults,{link:!1}),getModelType:function(){return"RedirectControl"}})})(Mibew,_);
/*
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(a){a.Models.RefreshControl=a.Models.Control.extend({getModelType:function(){return"RefreshControl"},refresh:function(){a.Objects.server.restartUpdater()}})})(Mibew);
/*
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(a,b){a.Models.SecureModeControl=a.Models.Control.extend({defaults:b.extend({},a.Models.Control.prototype.defaults,{link:!1}),getModelType:function(){return"SecureModeControl"}})})(Mibew,_);
/*
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(a,b){a.Models.SendMailControl=a.Models.Control.extend({defaults:b.extend({},a.Models.Control.prototype.defaults,{link:!1,windowParams:""}),getModelType:function(){return"SendMailControl"}})})(Mibew,_);
/*
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(a,c){a.Models.SoundControl=a.Models.Control.extend({defaults:c.extend({},a.Models.Control.prototype.defaults,{enabled:!0}),toggle:function(){var b=!this.get("enabled");a.Objects.Models.soundManager.set({enabled:b});this.set({enabled:b})},getModelType:function(){return"SoundControl"}})})(Mibew,_);
/*
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(b){b.Models.UserNameControl=b.Models.Control.extend({getModelType:function(){return"UserNameControl"},changeName:function(a){var c=b.Objects.Models.user,d=b.Objects.Models.thread,e=c.get("name");a&&e!=a&&(b.Objects.server.callFunctions([{"function":"rename",arguments:{references:{},"return":{},threadId:d.get("id"),token:d.get("token"),name:a}}],function(a){a.errorCode&&(b.Objects.Models.Status.message.setMessage(a.errorMessage||"Cannot rename"),c.set({name:e}))},!0),c.set({name:a}))}})})(Mibew);
/*
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(c,e){var d=c.Models.BaseSurveyForm;c.Models.LeaveMessageForm=d.extend({defaults:e.extend({},d.prototype.defaults,{showCaptcha:!1,captcha:""}),validate:function(a){var b=c.Localization;if("undefined"!=typeof a.email){if(!a.email)return b.get("leavemessage.error.email.required");if(!c.Utils.checkEmail(a.email))return b.get("leavemessage.error.wrong.email")}if("undefined"!=typeof a.name&&!a.name)return b.get("leavemessage.error.name.required");if("undefined"!=typeof a.message&&!a.message)return b.get("leavemessage.error.message.required");
if(this.get("showCaptcha")&&"undefined"!=typeof a.captcha&&!a.captcha)return b.get("The letters you typed don't match the letters that were shown in the picture.")},submit:function(){if(!this.validate(this.attributes)){var a=this;c.Objects.server.callFunctions([{"function":"processLeaveMessage",arguments:{references:{},"return":{},groupId:a.get("groupId"),name:a.get("name"),info:a.get("info"),email:a.get("email"),message:a.get("message"),referrer:a.get("referrer"),captcha:a.get("captcha"),threadId:null,token:null}}],function(b){0==b.errorCode?a.trigger("submit:complete",
a):a.trigger("submit:error",a,{code:b.errorCode,message:b.errorMessage||""})},!0)}},ERROR_WRONG_CAPTCHA:10})})(Mibew,_);
/*
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(a){a.Models.MessageForm=a.Models.Base.extend({defaults:{predefinedAnswers:[],ignoreCtrl:!1},postMessage:function(e){var b=a.Objects.Models.thread,c=a.Objects.Models.user;if(c.get("canPost")){this.trigger("before:post",this);var d=this;a.Objects.server.callFunctions([{"function":"post",arguments:{references:{},"return":{},message:e,threadId:b.get("id"),token:b.get("token"),user:!c.get("isAgent")}}],function(){d.trigger("after:post",d)},!0)}}})})(Mibew);
/*
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(a,c){a.Models.ChatSoundManager=a.Models.BaseSoundManager.extend({defaults:c.extend({},a.Models.BaseSoundManager.prototype.defaults,{skipNextMessageSound:!1}),initialize:function(){var b=a.Objects,c=this;b.Collections.messages.on("multiple:add",this.playNewMessageSound,this);b.Models.messageForm.on("before:post",function(){c.set({skipNextMessageSound:!0})})},playNewMessageSound:function(){if(!this.get("skipNextMessageSound")){var b=a.Objects.Models.page.get("mibewRoot");"undefined"!==typeof b&&
this.play(b+"/sounds/new_message")}this.set({skipNextMessageSound:!1})}})})(Mibew,_);
/*
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(a,b){a.Models.StatusMessage=a.Models.Status.extend({defaults:b.extend({},a.Models.Status.prototype.defaults,{message:"",visible:!1}),getModelType:function(){return"StatusMessage"},setMessage:function(a){this.set({message:a,visible:!0});this.autoHide()}})})(Mibew,_);
/*
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(a,b){a.Models.StatusTyping=a.Models.Status.extend({defaults:b.extend({},a.Models.Status.prototype.defaults,{visible:!1,hideTimeout:2E3}),getModelType:function(){return"StatusTyping"},show:function(){this.set({visible:!0});this.autoHide()}})})(Mibew,_);
/*
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(b,e){var d=b.Models.BaseSurveyForm;b.Models.SurveyForm=d.extend({defaults:e.extend({},d.prototype.defaults,{showEmail:!1,showMessage:!1,canChangeName:!1}),validate:function(a){if(this.get("showEmail")&&"undefined"!=typeof a.email&&!b.Utils.checkEmail(a.email))return b.Localization.get("Wrong email address.")},submit:function(){if(!this.validate(this.attributes)){var a=this;b.Objects.server.callFunctions([{"function":"processSurvey",arguments:{references:{},"return":{next:"next",options:"options"},
groupId:a.get("groupId"),name:a.get("name"),info:a.get("info"),email:a.get("email"),message:a.get("message"),referrer:a.get("referrer"),threadId:null,token:null}}],function(c){if(0==c.errorCode)switch(a.trigger("submit:complete",a),b.Application.Survey.stop(),c.next){case "chat":b.Application.Chat.start(c.options);break;case "leaveMessage":b.Application.LeaveMessage.start(c.options);break;default:throw Error("Do not know how to continue!");}else a.trigger("submit:error",a,{code:c.errorCode,message:c.errorMessage||
""})},!0)}}})})(Mibew,_);
/*
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(b,d,j){b.Collections.Messages=d.Collection.extend({model:b.Models.Message,initialize:function(){this.periodicallyCalled=[];this.periodicallyCalled.push(b.Objects.server.callFunctionsPeriodically(j.bind(this.updateMessagesFunctionBuilder,this),j.bind(this.updateMessages,this)))},finalize:function(){for(var a=0;a<this.periodicallyCalled.length;a++)b.Objects.server.stopCallFunctionsPeriodically(this.periodicallyCalled[a])},updateMessages:function(a){a.lastId&&b.Objects.Models.thread.set({lastId:a.lastId});
for(var k=b.Models.Message.prototype.KIND_PLUGIN,g=[],c,f,e,h=0,d=a.messages.length;h<d;h++)c=a.messages[h],c.kind!=k?g.push(new b.Models.Message(c)):"object"!=typeof c.data||null===c.data||(f=c.plugin||!1,f="process:"+(!1!==f?f+":":"")+"plugin:message",e={messageData:c,model:!1},this.trigger(f,e),e.model&&(e.model.get("id")||e.model.set({id:c.id}),g.push(e.model)));0<g.length&&this.add(g)},updateMessagesFunctionBuilder:function(){var a=b.Objects.Models.thread,d=b.Objects.Models.user;return[{"function":"updateMessages",
arguments:{"return":{messages:"messages",lastId:"lastId"},references:{},threadId:a.get("id"),token:a.get("token"),lastId:a.get("lastId"),user:!d.get("isAgent")}}]},add:function(){var a=Array.prototype.slice.apply(arguments),a=d.Collection.prototype.add.apply(this,a);this.trigger("multiple:add");return a}})})(Mibew,Backbone,_);
/*
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(a,b){a.Collections.Status=b.Collection.extend({comparator:function(a){return a.get("weight")}})})(Mibew,Backbone);
/*
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(a,b,c){a.Views.Status=b.Marionette.ItemView.extend({template:c.templates["chat/status/base"],className:"status",modelEvents:{change:"render"},onBeforeRender:function(){this.model.get("visible")?this.$el.show():this.$el.hide()}})})(Mibew,Backbone,Handlebars);
/*
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(c,d){c.Views.BaseSurveyForm=d.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(a){a.preventDefault()},
changeGroupDescription:function(){var a=this.ui.groupSelect.prop("selectedIndex"),a=this.model.get("groups")[a].description||"";this.ui.groupDescription.text(a)},showError:function(a,b){this.ui.errors.html("string"==typeof b?b:b.message)},serializeData:function(){var a=this.model.toJSON();a.page=c.Objects.Models.page.toJSON();return a},showAjaxLoader:function(){this.ui.ajaxLoader.show()},hideAjaxLoader:function(){this.ui.ajaxLoader.hide()}})})(Mibew,Backbone);
/*
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(a,b,c){a.Views.Avatar=b.Marionette.ItemView.extend({template:c.templates["chat/avatar"],className:"avatar",modelEvents:{change:"render"}})})(Mibew,Backbone,Handlebars);
/*
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(a,c,d){a.Views.CloseControl=a.Views.Control.extend({template:c.templates["chat/controls/close"],events:d.extend({},a.Views.Control.prototype.events,{click:"closeThread"}),closeThread:function(){var b=a.Localization.get("Are you sure want to leave chat?");(!1===b||confirm(b))&&this.model.closeThread()}})})(Mibew,Handlebars,_);
/*
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(b,d,e){b.Views.HistoryControl=b.Views.Control.extend({template:d.templates["chat/controls/history"],events:e.extend({},b.Views.Control.prototype.events,{click:"showHistory"}),showHistory:function(){var c=b.Objects.Models.user,a=this.model.get("link");c.get("isAgent")&&a&&(c=this.model.get("windowParams"),a=a.replace("&amp;","&","g"),a=window.open(a,"UserHistory",c),null!==a&&(a.focus(),a.opener=window))}})})(Mibew,Handlebars,_);
/*
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(b,e,f){b.Views.RedirectControl=b.Views.Control.extend({template:e.templates["chat/controls/redirect"],events:f.extend({},b.Views.Control.prototype.events,{click:"redirect"}),initialize:function(){b.Objects.Models.user.on("change",this.render,this)},serializeData:function(){var a=this.model.toJSON();a.user=b.Objects.Models.user.toJSON();return a},redirect:function(){var a=b.Objects.Models.user;if(a.get("isAgent")&&a.get("canPost")&&(a=this.model.get("link"))){var c=b.Objects.Models.page.get("style"),
d="";c&&(d=(-1===a.indexOf("?")?"?":"&")+"style="+c);window.location.href=a.replace(/\&amp\;/g,"&")+d}}})})(Mibew,Handlebars,_);
/*
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(a,b,c){a.Views.RefreshControl=a.Views.Control.extend({template:b.templates["chat/controls/refresh"],events:c.extend({},a.Views.Control.prototype.events,{click:"refresh"}),refresh:function(){this.model.refresh()}})})(Mibew,Handlebars,_);
/*
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(a,d,e){a.Views.SecureModeControl=a.Views.Control.extend({template:d.templates["chat/controls/secure_mode"],events:e.extend({},a.Views.Control.prototype.events,{click:"secure"}),secure:function(){var b=this.model.get("link");if(b){var c=a.Objects.Models.page.get("style");window.location.href=b.replace(/\&amp\;/g,"&")+(c?"&style="+c:"")}}})})(Mibew,Handlebars,_);
/*
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(b,d,f){b.Views.SendMailControl=b.Views.Control.extend({template:d.templates["chat/controls/send_mail"],events:f.extend({},b.Views.Control.prototype.events,{click:"sendMail"}),sendMail:function(){var a=this.model.get("link"),c=b.Objects.Models.page;if(a){var d=this.model.get("windowParams"),c=c.get("style"),e="";c&&(e=(-1===a.indexOf("?")?"?":"&")+"style="+c);a=a.replace(/\&amp\;/g,"&")+e;a=window.open(a,"ForwardMail",d);null!==a&&(a.focus(),a.opener=window)}}})})(Mibew,Handlebars,_);
/*
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(a,b,c){a.Views.SoundControl=a.Views.Control.extend({template:b.templates["chat/controls/sound"],events:c.extend({},a.Views.Control.prototype.events,{click:"toggle"}),toggle:function(){this.model.toggle()}})})(Mibew,Handlebars,_);
/*
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(b,c,d){b.Views.UserNameControl=b.Views.Control.extend({template:c.templates["chat/controls/user_name"],events:d.extend({},b.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(){b.Objects.Models.user.on("change:name",this.hideNameInput,this);this.nameInput=b.Objects.Models.user.get("defaultName")},serializeData:function(){var a=
this.model.toJSON();a.user=b.Objects.Models.user.toJSON();a.nameInput=this.nameInput;return a},inputKeyDown:function(a){a=a.which;13!=a&&10!=a||this.changeName()},hideNameInput:function(){this.nameInput=!1;this.render()},showNameInput:function(){this.nameInput=!0;this.render()},changeName:function(){var a=this.ui.nameInput.val();this.model.changeName(a)}})})(Mibew,Handlebars,_);
/*
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(a,b,c){a.Views.LeaveMessageDescription=b.Marionette.ItemView.extend({template:c.templates["leave_message/description"],serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone,Handlebars);
/*
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(d,e,b){var c=d.Views.BaseSurveyForm;d.Views.LeaveMessageForm=c.extend({template:e.templates["leave_message/form"],events:b.extend({},c.prototype.events,{"click #send-message":"submitForm"}),ui:b.extend({},c.prototype.ui,{captcha:'input[name="captcha"]',captchaImg:"#captcha-img"}),modelEvents:b.extend({},c.prototype.modelEvents,{"submit:error":"hideAjaxLoader showError submitError"}),submitForm:function(){this.showAjaxLoader();var a={};this.model.get("groups")&&(a.groupId=this.ui.groupSelect.val());
a.name=this.ui.name.val()||"";a.email=this.ui.email.val()||"";a.message=this.ui.message.val()||"";this.model.get("showCaptcha")&&(a.captcha=this.ui.captcha.val()||"");this.model.set(a,{validate:!0});this.model.submit()},submitError:function(a,c){if(c.code==a.ERROR_WRONG_CAPTCHA&&a.get("showCaptcha")){var b=this.ui.captchaImg.attr("src"),b=b.replace(/\?d\=[0-9]+/,"");this.ui.captchaImg.attr("src",b+"?d="+(new Date).getTime())}}})})(Mibew,Handlebars,_);
/*
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(a,b,c){a.Views.LeaveMessageSentDescription=b.Marionette.ItemView.extend({template:c.templates["leave_message/sent_description"],serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone,Handlebars);
/*
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(a,b){a.Views.Message=a.Views.Message.extend({template:b.templates["chat/message"]})})(Mibew,Handlebars);
/*
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(b,d,e){b.Views.MessageForm=d.Marionette.ItemView.extend({template:e.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(){b.Objects.Models.user.on("change:canPost",this.render,this)},serializeData:function(){var a=this.model.toJSON();a.user=b.Objects.Models.user.toJSON();return a},postMessage:function(){var a=this.ui.message.val();""!=a&&(this.disableInput(),this.model.postMessage(a));b.Objects.Collections.messages.on("multiple:add",this.postMessageComplete,this)},messageKeyDown:function(a){var c=a.which;a=a.ctrlKey;(13==c&&(a||this.model.get("ignoreCtrl"))||10==c)&&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();b.Objects.Collections.messages.off("multiple:add",this.postMessageComplete,this)},selectPredefinedAnswer:function(){var a=this.ui.message,c=this.ui.predefinedAnswer,b=c.get(0).selectedIndex;b&&(a.val(this.model.get("predefinedAnswers")[b-1].full).change(),a.focus(),c.get(0).selectedIndex=
0)},checkUserTyping:function(){var a=b.Objects.Models.user,c=""!=this.ui.message.val();c!=a.get("typing")&&a.set({typing:c})},setFocus:function(){this.focused=!0},dropFocus:function(){this.focused=!1}})})(Mibew,Backbone,Handlebars);
/*
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(a,b){a.Views.StatusMessage=a.Views.Status.extend({template:b.templates["chat/status/message"]})})(Mibew,Handlebars);
/*
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(a,b){a.Views.StatusTyping=a.Views.Status.extend({template:b.templates["chat/status/typing"]})})(Mibew,Handlebars);
/*
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(b,d,e){var c=b.Views.BaseSurveyForm;b.Views.SurveyForm=c.extend({template:d.templates["survey/form"],events:e.extend({},c.prototype.events,{"click #submit-survey":"submitForm"}),submitForm:function(){this.showAjaxLoader();var a={};this.model.get("groups")&&(a.groupId=this.ui.groupSelect.val());this.model.get("canChangeName")&&(a.name=this.ui.name.val()||"");this.model.get("showEmail")&&(a.email=this.ui.email.val()||"");this.model.get("showMessage")&&(a.message=this.ui.message.val()||"");
this.model.set(a,{validate:!0});this.model.submit()}})})(Mibew,Handlebars,_);
/*
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(a){a.Views.MessagesCollection=a.Views.CollectionBase.extend({itemView:a.Views.Message,className:"messages-collection"})})(Mibew);
/*
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(a){a.Views.StatusCollection=a.Views.CollectionBase.extend({itemView:a.Views.Status,className:"status-collection"})})(Mibew);
/*
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(a,b){a.Regions.Messages=b.Marionette.Region.extend({onShow:function(a){a.on("after:item:added",this.scrollToBottom,this)},scrollToBottom:function(){this.$el.scrollTop(this.$el.prop("scrollHeight"))}})})(Mibew,Backbone);
/*
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(a,c){a.Layouts.Chat=c.Marionette.Layout.extend({template:Handlebars.templates["chat/layout"],regions:{controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:{selector:"#messages-region",regionType:a.Regions.Messages},statusRegion:"#status-region",messageFormRegion:"#message-form-region"},serializeData:function(){var b=a.Objects.Models;return{page:b.page.toJSON(),user:b.user.toJSON()}}})})(Mibew,Backbone);
/*
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(a,b){a.Layouts.Invitation=b.Marionette.Layout.extend({template:Handlebars.templates["invitation/layout"],regions:{messagesRegion:{selector:"#invitation-messages-region",regionType:a.Regions.Messages}}})})(Mibew,Backbone);
/*
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(a,b){a.Layouts.LeaveMessage=b.Marionette.Layout.extend({template:Handlebars.templates["leave_message/layout"],regions:{leaveMessageFormRegion:"#content-wrapper",descriptionRegion:"#description-region"},serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone);
/*
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(a,b){a.Layouts.Survey=b.Marionette.Layout.extend({template:Handlebars.templates["survey/layout"],regions:{surveyFormRegion:"#content-wrapper"},serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone);
/*
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(a){a.Objects.Models.Controls={};a.Objects.Models.Status={};var j=[],l=a.Application,k=l.module("Chat",{startWithParent:!1});k.addInitializer(function(b){var f=a.Objects,d=a.Objects.Models,c=a.Objects.Models.Controls,h=a.Objects.Models.Status;b.page&&d.page.set(b.page);d.thread=new a.Models.Thread(b.thread);d.user=new a.Models.ChatUser(b.user);var g=new a.Layouts.Chat;f.chatLayout=g;l.mainRegion.show(g);var e=new a.Collections.Controls;d.user.get("isAgent")||(c.userName=new a.Models.UserNameControl({weight:220}),
e.add(c.userName),c.sendMail=new a.Models.SendMailControl({weight:200,link:b.links.mail,windowParams:b.windowsParams.mail}),e.add(c.sendMail));d.user.get("isAgent")&&(c.redirect=new a.Models.RedirectControl({weight:200,link:b.links.redirect}),e.add(c.redirect),c.history=new a.Models.HistoryControl({weight:180,link:b.links.history,windowParams:b.windowsParams.history}),e.add(c.history));c.sound=new a.Models.SoundControl({weight:160});e.add(c.sound);c.refresh=new a.Models.RefreshControl({weight:140});
e.add(c.refresh);b.links.ssl&&(c.secureMode=new a.Models.SecureModeControl({weight:120,link:b.links.ssl}),e.add(c.secureMode));c.close=new a.Models.CloseControl({weight:100});e.add(c.close);f.Collections.controls=e;g.controlsRegion.show(new a.Views.ControlsCollection({collection:e}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});f.Collections.status=new a.Collections.Status([h.message,h.typing]);g.statusRegion.show(new a.Views.StatusCollection({collection:f.Collections.status}));
d.user.get("isAgent")||(d.avatar=new a.Models.Avatar,g.avatarRegion.show(new a.Views.Avatar({model:d.avatar})));f.Collections.messages=new a.Collections.Messages;d.messageForm=new a.Models.MessageForm(b.messageForm);g.messageFormRegion.show(new a.Views.MessageForm({model:d.messageForm}));g.messagesRegion.show(new a.Views.MessagesCollection({collection:f.Collections.messages}));d.soundManager=new a.Models.ChatSoundManager;j.push(f.server.callFunctionsPeriodically(function(){var b=a.Objects.Models.thread,
c=a.Objects.Models.user;return[{"function":"update",arguments:{"return":{typing:"typing",canPost:"canPost"},references:{},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),typed:c.get("typing"),user:!c.get("isAgent")}}]},function(b){b.errorCode?a.Objects.Models.Status.message.setMessage(b.errorMessage||"refresh failed"):(b.typing&&a.Objects.Models.Status.typing.show(),a.Objects.Models.user.set({canPost:b.canPost||!1}))}))});k.on("start",function(){a.Objects.server.restartUpdater()});
k.addFinalizer(function(){a.Objects.chatLayout.close();for(var b=0;b<j.length;b++)a.Objects.server.stopCallFunctionsPeriodically(j[b]);"undefined"!=typeof a.Objects.Models.avatar&&a.Objects.Models.avatar.finalize();a.Objects.Collections.messages.finalize();delete a.Objects.chatLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;delete a.Objects.Models.page;delete a.Objects.Models.avatar;delete a.Objects.Models.messageForm;delete a.Objects.Models.Controls;delete a.Objects.Models.Status;
delete a.Objects.Collections.messages;delete a.Objects.Collections.controls;delete a.Objects.Collections.status})})(Mibew);
/*
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(a){var d=[],e=a.Application,b=e.module("Invitation",{startWithParent:!1});b.addInitializer(function(f){var c=a.Objects,b=a.Objects.Models;b.thread=new a.Models.Thread(f.thread);b.user=new a.Models.ChatUser(f.user);c.invitationLayout=new a.Layouts.Invitation;e.mainRegion.show(c.invitationLayout);c.Collections.messages=new a.Collections.Messages;c.invitationLayout.messagesRegion.show(new a.Views.MessagesCollection({collection:c.Collections.messages}));d.push(c.server.callFunctionsPeriodically(function(){var b=
a.Objects.Models.thread;return[{"function":"update",arguments:{"return":{},references:{},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),typed:!1,user:!0}}]},function(){}))});b.on("start",function(){a.Objects.server.restartUpdater()});b.addFinalizer(function(){a.Objects.invitationLayout.close();for(var b=0;b<d.length;b++)a.Objects.server.stopCallFunctionsPeriodically(d[b]);a.Objects.Collections.messages.finalize();delete a.Objects.invitationLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;
delete a.Objects.Collections.messages})})(Mibew);
/*
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(a){var e=a.Application,f=e.module("LeaveMessage",{startWithParent:!1});f.addInitializer(function(d){var b=a.Objects,c=a.Objects.Models;d.page&&c.page.set(d.page);b.leaveMessageLayout=new a.Layouts.LeaveMessage;e.mainRegion.show(b.leaveMessageLayout);c.leaveMessageForm=new a.Models.LeaveMessageForm(d.leaveMessageForm);b.leaveMessageLayout.leaveMessageFormRegion.show(new a.Views.LeaveMessageForm({model:c.leaveMessageForm}));b.leaveMessageLayout.descriptionRegion.show(new a.Views.LeaveMessageDescription);
c.leaveMessageForm.on("submit:complete",function(){b.leaveMessageLayout.leaveMessageFormRegion.close();b.leaveMessageLayout.descriptionRegion.close();b.leaveMessageLayout.descriptionRegion.show(new a.Views.LeaveMessageSentDescription)})});f.addFinalizer(function(){a.Objects.leaveMessageLayout.close();delete a.Objects.Models.leaveMessageForm})})(Mibew);
/*
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(a){var d=a.Application,b=d.module("Survey",{startWithParent:!1});b.addInitializer(function(b){var c=a.Objects,e=a.Objects.Models;c.surveyLayout=new a.Layouts.Survey;d.mainRegion.show(c.surveyLayout);e.surveyForm=new a.Models.SurveyForm(b.surveyForm);c.surveyLayout.surveyFormRegion.show(new a.Views.SurveyForm({model:e.surveyForm}))});b.addFinalizer(function(){a.Objects.surveyLayout.close();delete a.Objects.Models.surveyForm})})(Mibew);
/*
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(b,d){var c=b.Application;c.addRegions({mainRegion:"#main-region"});c.addInitializer(function(a){b.PluginOptions=a.plugins||{};b.Objects.server=new b.Server(d.extend({interactionType:MibewAPIChatInteraction},a.server));b.Objects.Models.page=new b.Models.Page(a.page);switch(a.startFrom){case "chat":c.Chat.start(a.chatOptions);break;case "survey":c.Survey.start(a.surveyOptions);break;case "leaveMessage":c.LeaveMessage.start(a.leaveMessageOptions);break;case "invitation":c.Invitation.start(a.invitationOptions);
break;default:throw Error("Dont know how to start!");}});c.on("start",function(){b.Objects.server.runUpdater()})})(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.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("&amp;","&","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(/\&amp\;/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(/\&amp\;/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(/\&amp\;/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,_);

View File

@ -1,8 +1,8 @@
/*
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(d,a,f){var e=function(b,a,c){c=f.extend({model:b},c);return"function"!=typeof b.getModelType?new a(c):(b=b.getModelType())&&d.Views[b]?new d.Views[b](c):new a(c)};d.Views.CollectionBase=a.Marionette.CollectionView.extend({itemView:a.Marionette.ItemView,buildItemView:e});d.Views.CompositeBase=a.Marionette.CompositeView.extend({buildItemView:e})})(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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Views.ControlsCollection=a.Views.CollectionBase.extend({itemView:a.Views.Control,className:"controls-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.ControlsCollection=e.Views.CollectionBase.extend({itemView:e.Views.Control,className:"controls-collection"})}(Mibew);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Collections.Controls=b.Collection.extend({comparator:function(a){return a.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(o,n){o.Collections.Controls=n.Collection.extend({comparator:function(o){return o.get("weight")}})}(Mibew,Backbone);

View File

@ -1,10 +1,8 @@
/*
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,c){c.registerHelper("apply",function(a,b){var f=a,e=/^[0-9A-z_]+$/;b=b.split(/\s*,\s*/);for(var d in b)if(b.hasOwnProperty(d)&&e.test(b[d])){if("function"!=typeof c.helpers[b[d]])throw Error("Unregistered helper '"+b[d]+"'!");f=c.helpers[b[d]](f).toString()}return new c.SafeString(f)});c.registerHelper("allowTags",function(a){a=a.replace(/&lt;(span|strong)&gt;(.*?)&lt;\/\1&gt;/g,"<$1>$2</$1>");a=a.replace(/&lt;span class=&quot;(.*?)&quot;&gt;(.*?)&lt;\/span&gt;/g,'<span class="$1">$2</span>');
return new c.SafeString(a)});c.registerHelper("formatTime",function(a){var b=new Date(1E3*a);a=b.getHours().toString();var c=b.getMinutes().toString(),b=b.getSeconds().toString();return(10>a?"0"+a:a)+":"+(10>c?"0"+c:c)+":"+(10>b?"0"+b:b)});c.registerHelper("urlReplace",function(a){return new c.SafeString(a.replace(/((?:https?|ftp):\/\/\S*)/g,'<a href="$1" target="_blank">$1</a>'))});c.registerHelper("nl2br",function(a){return new c.SafeString(a.replace(/\n/g,"<br/>"))});c.registerHelper("l10n",function(a){return e.Localization.get(a)||
""});c.registerHelper("ifEven",function(a,b){return 0===a%2?b.fn(this):b.inverse(this)});c.registerHelper("ifOdd",function(a,b){return 0!==a%2?b.fn(this):b.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,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(/&lt;(span|strong)&gt;(.*?)&lt;\/\1&gt;/g,"<$1>$2</$1>"),t=t.replace(/&lt;span class=&quot;(.*?)&quot;&gt;(.*?)&lt;\/span&gt;/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);

View File

@ -1,8 +1,8 @@
/*
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(a,d,b){d.Marionette.TemplateCache.prototype.compileTemplate=function(a){return b.compile(a)};for(var c in b.templates)b.templates.hasOwnProperty(c)&&b.registerPartial(c,b.templates[c]);a.Models={};a.Collections={};a.Views={};a.Objects={};a.Objects.Models={};a.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
*/
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);

View File

@ -1,8 +1,8 @@
/*
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(b,d){b.Localization={};var c={};b.Localization.get=function(a){return!c.hasOwnProperty(a)?!1:c[a]};b.Localization.set=function(a){d.extend(c,a)}})(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(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,_);

View File

@ -1,9 +1,8 @@
/*
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(b,c,d){b.Views.Control=c.Marionette.ItemView.extend({template:d.templates.default_control,modelEvents:{change:"render"},events:{mouseover:"mouseOver",mouseleave:"mouseLeave"},attributes:function(){var a=[];a.push("control");this.className&&(a.push(this.className),this.className="");var b=this.getDashedControlType();b&&a.push(b);return{"class":a.join(" ")}},mouseOver:function(){var a=this.getDashedControlType();this.$el.addClass("active"+(a?"-"+a:""))},mouseLeave:function(){var a=this.getDashedControlType();
this.$el.removeClass("active"+(a?"-"+a:""))},getDashedControlType:function(){"undefined"==typeof this.dashedControlType&&(this.dashedControlType=b.Utils.toDashFormat(this.model.getModelType())||"");return 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,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);

View File

@ -1,9 +1,8 @@
/*
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(c,d,e){var f={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},g=/[&<>'"`]/g;c.Views.Message=d.Marionette.ItemView.extend({template:e.templates.message,className:"message",modelEvents:{change:"render"},serializeData:function(){var a=this.model.toJSON(),b=this.model.get("kind");a.allowFormatting=b!=this.model.KIND_USER&&b!=this.model.KIND_AGENT;a.kindName=this.kindToString(b);a.message=this.escapeString(a.message);return a},kindToString:function(a){return a==this.model.KIND_USER?
"user":a==this.model.KIND_AGENT?"agent":a==this.model.KIND_FOR_AGENT?"hidden":a==this.model.KIND_INFO?"inf":a==this.model.KIND_CONN?"conn":a==this.model.KIND_EVENTS?"event":a==this.model.KIND_PLUGIN?"plugin":""},escapeString:function(a){return a.replace(g,function(a){return f[a]||"&amp;"})}})})(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={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},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]||"&amp;"})}})}(Mibew,Backbone,Handlebars);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Models.Base=b.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,n){e.Models.Base=n.Model.extend({getModelType:function(){return""}})}(Mibew,Backbone);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Models.Control=a.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.Control=e.Models.Base.extend({defaults:{title:"",weight:0}})}(Mibew);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Models.Message=a.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){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);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Models.Page=b.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,n){e.Models.Page=n.Model.extend()}(Mibew,Backbone);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Models.Thread=a.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(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);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Models.User=a.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){e.Models.User=e.Models.Base.extend({defaults:{isAgent:!1,name:""}})}(Mibew);

View File

@ -1,15 +1,8 @@
/*
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(b,f,g,e){b.Server=function(a){this.updateTimer=null;this.options=e.extend({url:"",requestsFrequency:2,reconnectPause:1,onTimeout:function(){},onTransportError:function(){},onCallError:function(){},onUpdateError:function(){},onResponseError:function(){}},a);this.callbacks={};this.callPeriodically={};this.callPeriodicallyLastId=0;this.ajaxRequest=null;this.buffer=[];this.functions={};this.functionsLastId=0;this.mibewAPI=new f(new this.options.interactionType)};b.Server.prototype.callFunctions=
function(a,c,b){try{if(!(a instanceof Array))throw Error("The first arguments must be an array");for(var d=0;d<a.length;d++)this.mibewAPI.checkFunction(a[d],!1);var e=this.generateToken();this.callbacks[e]=c;this.buffer.push({token:e,functions:a});b&&this.update()}catch(f){return this.options.onCallError(f),!1}return!0};b.Server.prototype.callFunctionsPeriodically=function(a,c){this.callPeriodicallyLastId++;this.callPeriodically[this.callPeriodicallyLastId]={functionsListBuilder:a,callbackFunction:c};
return this.callPeriodicallyLastId};b.Server.prototype.stopCallFunctionsPeriodically=function(a){a in this.callPeriodically&&delete this.callPeriodically[a]};b.Server.prototype.generateToken=function(){var a;do a="wnd"+(new Date).getTime().toString()+Math.round(50*Math.random()).toString();while(a in this.callbacks);return a};b.Server.prototype.processRequest=function(a){var c=new MibewAPIExecutionContext,b=this.mibewAPI.getResultFunction(a.functions,this.callbacks.hasOwnProperty(a.token));if(null===
b)for(var d in a.functions)a.functions.hasOwnProperty(d)&&(this.processFunction(a.functions[d],c),this.buffer.push(this.mibewAPI.buildResult(c.getResults(),a.token)));else this.callbacks.hasOwnProperty(a.token)&&(this.callbacks[a.token](b.arguments),delete this.callbacks[a.token])};b.Server.prototype.processFunction=function(a,c){if(this.functions.hasOwnProperty(a["function"])){var b=c.getArgumentsList(a),d={},f;for(f in this.functions[a["function"]])this.functions[a["function"]].hasOwnProperty(f)&&
(d=e.extend(d,this.functions[a["function"]][f](b)));c.storeFunctionResults(a,d)}};b.Server.prototype.sendRequests=function(a){this.ajaxRequest=g.ajax({url:this.options.url,timeout:5E3,async:!0,cache:!1,type:"POST",dataType:"text",data:{data:this.mibewAPI.encodePackage(a)},success:e.bind(this.receiveResponse,this),error:e.bind(this.onError,this)})};b.Server.prototype.runUpdater=function(){this.update()};b.Server.prototype.updateAfter=function(a){this.updateTimer=setTimeout(e.bind(this.update,this),
1E3*a)};b.Server.prototype.restartUpdater=function(){this.updateTimer&&clearTimeout(this.updateTimer);this.ajaxRequest&&this.ajaxRequest.abort();this.updateAfter(this.options.reconnectPause)};b.Server.prototype.update=function(){this.updateTimer&&clearTimeout(this.updateTimer);for(var a in this.callPeriodically)this.callPeriodically.hasOwnProperty(a)&&this.callFunctions(this.callPeriodically[a].functionsListBuilder(),this.callPeriodically[a].callbackFunction);if(0==this.buffer.length)this.updateAfter(this.options.requestsFrequency);
else try{this.sendRequests(this.buffer),this.buffer=[]}catch(c){this.options.onUpdateError(c)}};b.Server.prototype.receiveResponse=function(a){""==a&&this.updateAfter(this.options.requestsFrequency);try{var c=this.mibewAPI.decodePackage(a),b;for(b in c.requests)this.processRequest(c.requests[b])}catch(d){this.options.onResponseError(d)}finally{this.updateAfter(this.options.requestsFrequency)}};b.Server.prototype.registerFunction=function(a,b){this.functionsLastId++;a in this.functions||(this.functions[a]=
{});this.functions[a][this.functionsLastId]=b;return this.functionsLastId};b.Server.prototype.unregisterFunction=function(a){for(var b in this.functions)this.functions.hasOwnProperty(b)&&(a in this.functions[b]&&delete this.functions[b][a],e.isEmpty(this.functions[b])&&delete this.functions[b])};b.Server.prototype.onError=function(a,b){if("abort"!=b)if(this.restartUpdater(),"timeout"==b)this.options.onTimeout();else if("error"==b)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(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,$,_);

View File

@ -1,9 +1,8 @@
/*
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(c,d){c.Utils={};c.Utils.toUpperCaseFirst=function(a){return"string"!=typeof a?!1:""===a?a:a.substring(0,1).toUpperCase()+a.substring(1)};c.Utils.toDashFormat=function(a){if("string"!=typeof a)return!1;a=a.match(/((?:[A-Z]?[a-z]+)|(?:[A-Z][a-z]*))/g);for(var b=0;b<a.length;b++)a[b]=a[b].toLowerCase();return a.join("-")};c.Utils.checkEmail=function(a){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(a)};
c.Utils.playSound=function(a){var b=d('audio[data-file="'+a+'"]');0<b.length?b.get(0).play():(b=d("<audio>",{autoplay:!0,style:"display: none"}).append('<source src="'+a+'.wav" type="audio/x-wav" /><source src="'+a+'.mp3" type="audio/mpeg" codecs="mp3" /><embed src="'+a+'.wav" type="audio/x-wav" hidden="true" autostart="true" loop="false" />'),d("body").append(b),d.isFunction(b.get(0).play)&&b.attr("data-file",a))}})(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(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,$);

View File

@ -1,124 +1,113 @@
/*
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(a,d,b){d.Marionette.TemplateCache.prototype.compileTemplate=function(a){return b.compile(a)};for(var c in b.templates)b.templates.hasOwnProperty(c)&&b.registerPartial(c,b.templates[c]);a.Models={};a.Collections={};a.Views={};a.Objects={};a.Objects.Models={};a.Objects.Collections={}})(Mibew,Backbone,Handlebars);
/*
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,c){c.registerHelper("apply",function(a,b){var f=a,e=/^[0-9A-z_]+$/;b=b.split(/\s*,\s*/);for(var d in b)if(b.hasOwnProperty(d)&&e.test(b[d])){if("function"!=typeof c.helpers[b[d]])throw Error("Unregistered helper '"+b[d]+"'!");f=c.helpers[b[d]](f).toString()}return new c.SafeString(f)});c.registerHelper("allowTags",function(a){a=a.replace(/&lt;(span|strong)&gt;(.*?)&lt;\/\1&gt;/g,"<$1>$2</$1>");a=a.replace(/&lt;span class=&quot;(.*?)&quot;&gt;(.*?)&lt;\/span&gt;/g,'<span class="$1">$2</span>');
return new c.SafeString(a)});c.registerHelper("formatTime",function(a){var b=new Date(1E3*a);a=b.getHours().toString();var c=b.getMinutes().toString(),b=b.getSeconds().toString();return(10>a?"0"+a:a)+":"+(10>c?"0"+c:c)+":"+(10>b?"0"+b:b)});c.registerHelper("urlReplace",function(a){return new c.SafeString(a.replace(/((?:https?|ftp):\/\/\S*)/g,'<a href="$1" target="_blank">$1</a>'))});c.registerHelper("nl2br",function(a){return new c.SafeString(a.replace(/\n/g,"<br/>"))});c.registerHelper("l10n",function(a){return e.Localization.get(a)||
""});c.registerHelper("ifEven",function(a,b){return 0===a%2?b.fn(this):b.inverse(this)});c.registerHelper("ifOdd",function(a,b){return 0!==a%2?b.fn(this):b.inverse(this)})})(Mibew,Handlebars);
/*
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(b,d){b.Localization={};var c={};b.Localization.get=function(a){return!c.hasOwnProperty(a)?!1:c[a]};b.Localization.set=function(a){d.extend(c,a)}})(Mibew,_);
/*
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(b,f,g,e){b.Server=function(a){this.updateTimer=null;this.options=e.extend({url:"",requestsFrequency:2,reconnectPause:1,onTimeout:function(){},onTransportError:function(){},onCallError:function(){},onUpdateError:function(){},onResponseError:function(){}},a);this.callbacks={};this.callPeriodically={};this.callPeriodicallyLastId=0;this.ajaxRequest=null;this.buffer=[];this.functions={};this.functionsLastId=0;this.mibewAPI=new f(new this.options.interactionType)};b.Server.prototype.callFunctions=
function(a,c,b){try{if(!(a instanceof Array))throw Error("The first arguments must be an array");for(var d=0;d<a.length;d++)this.mibewAPI.checkFunction(a[d],!1);var e=this.generateToken();this.callbacks[e]=c;this.buffer.push({token:e,functions:a});b&&this.update()}catch(f){return this.options.onCallError(f),!1}return!0};b.Server.prototype.callFunctionsPeriodically=function(a,c){this.callPeriodicallyLastId++;this.callPeriodically[this.callPeriodicallyLastId]={functionsListBuilder:a,callbackFunction:c};
return this.callPeriodicallyLastId};b.Server.prototype.stopCallFunctionsPeriodically=function(a){a in this.callPeriodically&&delete this.callPeriodically[a]};b.Server.prototype.generateToken=function(){var a;do a="wnd"+(new Date).getTime().toString()+Math.round(50*Math.random()).toString();while(a in this.callbacks);return a};b.Server.prototype.processRequest=function(a){var c=new MibewAPIExecutionContext,b=this.mibewAPI.getResultFunction(a.functions,this.callbacks.hasOwnProperty(a.token));if(null===
b)for(var d in a.functions)a.functions.hasOwnProperty(d)&&(this.processFunction(a.functions[d],c),this.buffer.push(this.mibewAPI.buildResult(c.getResults(),a.token)));else this.callbacks.hasOwnProperty(a.token)&&(this.callbacks[a.token](b.arguments),delete this.callbacks[a.token])};b.Server.prototype.processFunction=function(a,c){if(this.functions.hasOwnProperty(a["function"])){var b=c.getArgumentsList(a),d={},f;for(f in this.functions[a["function"]])this.functions[a["function"]].hasOwnProperty(f)&&
(d=e.extend(d,this.functions[a["function"]][f](b)));c.storeFunctionResults(a,d)}};b.Server.prototype.sendRequests=function(a){this.ajaxRequest=g.ajax({url:this.options.url,timeout:5E3,async:!0,cache:!1,type:"POST",dataType:"text",data:{data:this.mibewAPI.encodePackage(a)},success:e.bind(this.receiveResponse,this),error:e.bind(this.onError,this)})};b.Server.prototype.runUpdater=function(){this.update()};b.Server.prototype.updateAfter=function(a){this.updateTimer=setTimeout(e.bind(this.update,this),
1E3*a)};b.Server.prototype.restartUpdater=function(){this.updateTimer&&clearTimeout(this.updateTimer);this.ajaxRequest&&this.ajaxRequest.abort();this.updateAfter(this.options.reconnectPause)};b.Server.prototype.update=function(){this.updateTimer&&clearTimeout(this.updateTimer);for(var a in this.callPeriodically)this.callPeriodically.hasOwnProperty(a)&&this.callFunctions(this.callPeriodically[a].functionsListBuilder(),this.callPeriodically[a].callbackFunction);if(0==this.buffer.length)this.updateAfter(this.options.requestsFrequency);
else try{this.sendRequests(this.buffer),this.buffer=[]}catch(c){this.options.onUpdateError(c)}};b.Server.prototype.receiveResponse=function(a){""==a&&this.updateAfter(this.options.requestsFrequency);try{var c=this.mibewAPI.decodePackage(a),b;for(b in c.requests)this.processRequest(c.requests[b])}catch(d){this.options.onResponseError(d)}finally{this.updateAfter(this.options.requestsFrequency)}};b.Server.prototype.registerFunction=function(a,b){this.functionsLastId++;a in this.functions||(this.functions[a]=
{});this.functions[a][this.functionsLastId]=b;return this.functionsLastId};b.Server.prototype.unregisterFunction=function(a){for(var b in this.functions)this.functions.hasOwnProperty(b)&&(a in this.functions[b]&&delete this.functions[b][a],e.isEmpty(this.functions[b])&&delete this.functions[b])};b.Server.prototype.onError=function(a,b){if("abort"!=b)if(this.restartUpdater(),"timeout"==b)this.options.onTimeout();else if("error"==b)this.options.onTransportError()}})(Mibew,MibewAPI,$,_);
/*
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(c,d){c.Utils={};c.Utils.toUpperCaseFirst=function(a){return"string"!=typeof a?!1:""===a?a:a.substring(0,1).toUpperCase()+a.substring(1)};c.Utils.toDashFormat=function(a){if("string"!=typeof a)return!1;a=a.match(/((?:[A-Z]?[a-z]+)|(?:[A-Z][a-z]*))/g);for(var b=0;b<a.length;b++)a[b]=a[b].toLowerCase();return a.join("-")};c.Utils.checkEmail=function(a){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(a)};
c.Utils.playSound=function(a){var b=d('audio[data-file="'+a+'"]');0<b.length?b.get(0).play():(b=d("<audio>",{autoplay:!0,style:"display: none"}).append('<source src="'+a+'.wav" type="audio/x-wav" /><source src="'+a+'.mp3" type="audio/mpeg" codecs="mp3" /><embed src="'+a+'.wav" type="audio/x-wav" hidden="true" autostart="true" loop="false" />'),d("body").append(b),d.isFunction(b.get(0).play)&&b.attr("data-file",a))}})(Mibew,$);
/*
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(a,b){a.Models.Base=b.Model.extend({getModelType:function(){return""}})})(Mibew,Backbone);
/*
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(a){a.Models.Control=a.Models.Base.extend({defaults:{title:"",weight:0}})})(Mibew);
/*
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(a){a.Models.Message=a.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);
/*
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(a,b){a.Models.Page=b.Model.extend()})(Mibew,Backbone);
/*
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(a){a.Models.Thread=a.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);
/*
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(a){a.Models.User=a.Models.Base.extend({defaults:{isAgent:!1,name:""}})})(Mibew);
/*
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(a,b){a.Collections.Controls=b.Collection.extend({comparator:function(a){return a.get("weight")}})})(Mibew,Backbone);
/*
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(b,c,d){b.Views.Control=c.Marionette.ItemView.extend({template:d.templates.default_control,modelEvents:{change:"render"},events:{mouseover:"mouseOver",mouseleave:"mouseLeave"},attributes:function(){var a=[];a.push("control");this.className&&(a.push(this.className),this.className="");var b=this.getDashedControlType();b&&a.push(b);return{"class":a.join(" ")}},mouseOver:function(){var a=this.getDashedControlType();this.$el.addClass("active"+(a?"-"+a:""))},mouseLeave:function(){var a=this.getDashedControlType();
this.$el.removeClass("active"+(a?"-"+a:""))},getDashedControlType:function(){"undefined"==typeof this.dashedControlType&&(this.dashedControlType=b.Utils.toDashFormat(this.model.getModelType())||"");return this.dashedControlType}})})(Mibew,Backbone,Handlebars);
/*
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(c,d,e){var f={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},g=/[&<>'"`]/g;c.Views.Message=d.Marionette.ItemView.extend({template:e.templates.message,className:"message",modelEvents:{change:"render"},serializeData:function(){var a=this.model.toJSON(),b=this.model.get("kind");a.allowFormatting=b!=this.model.KIND_USER&&b!=this.model.KIND_AGENT;a.kindName=this.kindToString(b);a.message=this.escapeString(a.message);return a},kindToString:function(a){return a==this.model.KIND_USER?
"user":a==this.model.KIND_AGENT?"agent":a==this.model.KIND_FOR_AGENT?"hidden":a==this.model.KIND_INFO?"inf":a==this.model.KIND_CONN?"conn":a==this.model.KIND_EVENTS?"event":a==this.model.KIND_PLUGIN?"plugin":""},escapeString:function(a){return a.replace(g,function(a){return f[a]||"&amp;"})}})})(Mibew,Backbone,Handlebars);
/*
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(d,a,f){var e=function(b,a,c){c=f.extend({model:b},c);return"function"!=typeof b.getModelType?new a(c):(b=b.getModelType())&&d.Views[b]?new d.Views[b](c):new a(c)};d.Views.CollectionBase=a.Marionette.CollectionView.extend({itemView:a.Marionette.ItemView,buildItemView:e});d.Views.CompositeBase=a.Marionette.CompositeView.extend({buildItemView:e})})(Mibew,Backbone,_);
/*
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(a){a.Views.ControlsCollection=a.Views.CollectionBase.extend({itemView:a.Views.Control,className:"controls-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
*/
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(/&lt;(span|strong)&gt;(.*?)&lt;\/\1&gt;/g,"<$1>$2</$1>"),n=n.replace(/&lt;span class=&quot;(.*?)&quot;&gt;(.*?)&lt;\/span&gt;/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={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},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]||"&amp;"})}})}(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);

View File

@ -1,19 +1,8 @@
/*
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(a){this.protocolVersion="1.0";if("object"!=typeof a||!(a instanceof MibewAPIInteraction))throw Error("Wrong interaction type");this.interaction=a}
MibewAPI.prototype.checkFunction=function(a,b){if("undefined"==typeof a["function"]||""==a["function"])throw Error("Cannot call for function with no name");if(b)for(var d=this.interaction.getReservedFunctionsNames(),c=0;c<d.length;c++)if(a["function"]==d[c])throw Error("'"+a["function"]+"' is reserved function name");if("object"!=typeof a.arguments)throw Error("There are no arguments in '"+a["function"]+"' function");var d=0,f=this.interaction.getMandatoryArguments(a["function"]),e;a:for(e in a.arguments)for(c=
0;c<f.length;c++)if(e==f[c]){d++;continue a}if(d!=f.length)throw Error("Not all mandatory arguments are set in '"+a["function"]+"' function");};MibewAPI.prototype.checkRequest=function(a){if("string"!=typeof a.token){if("undefined"==typeof a.token)throw Error("Empty token");throw Error("Wrong token type");}if(""==a.token)throw Error("Empty token");if("object"!=typeof a.functions||!(a.functions instanceof Array)||0==a.functions.length)throw Error("Empty functions set");for(var b=0;b<a.functions.length;b++)this.checkFunction(a.functions[b])};
MibewAPI.prototype.checkPackage=function(a){if("undefined"==typeof a.signature)throw Error("Missed package signature");if("undefined"==typeof a.proto)throw Error("Missed protocol version");if(a.proto!=this.protocolVersion)throw Error("Wrong protocol version");if("undefined"==typeof a.async)throw Error("'async' flag is missed");if("boolean"!=typeof a.async)throw Error("Wrong 'async' flag value");if("object"!=typeof a.requests||!(a.requests instanceof Array)||0==a.requests.length)throw Error("Empty requests set");
for(var b=0;b<a.requests.length;b++)this.checkRequest(a.requests[b])};MibewAPI.prototype.getResultFunction=function(a,b){"undefined"==typeof b&&(b=null);var d=null,c;for(c in a)if(a.hasOwnProperty(c)&&"result"==a[c]["function"]){if(null!==d)throw Error("Function 'result' already exists in functions list");d=a[c]}if(!0===b&&null===d)throw Error("There is no 'result' function in functions list");if(!1===b&&null!==d)throw Error("There is 'result' function in functions list");return d};
MibewAPI.prototype.buildResult=function(a,b){var d=this.interaction.getMandatoryArgumentsDefaults("result"),c;for(c in d)d.hasOwnProperty(c)&&(a[c]=d[c]);return{token:b,functions:[{"function":"result",arguments:a}]}};MibewAPI.prototype.encodePackage=function(a){var b={signature:""};b.proto=this.protocolVersion;b.async=!0;b.requests=a;return encodeURIComponent(JSON.stringify(b)).replace(/\%20/gi,"+")};
MibewAPI.prototype.decodePackage=function(a){a=JSON.parse(decodeURIComponent(a.replace(/\+/gi," ")));this.checkPackage(a);return a};function MibewAPIInteraction(){this.mandatoryArguments=function(){return{}};this.getReservedFunctionsNames=function(){return[]}}
MibewAPIInteraction.prototype.getMandatoryArguments=function(a){var b=this.mandatoryArguments(),d=[];if("object"==typeof b["*"])for(var c in b["*"])b["*"].hasOwnProperty(c)&&d.push(c);if("object"==typeof b[a])for(c in b[a])b[a].hasOwnProperty(c)&&d.push(c);return d};
MibewAPIInteraction.prototype.getMandatoryArgumentsDefaults=function(a){var b=this.mandatoryArguments(),d={};if("object"==typeof b["*"])for(var c in b["*"])b["*"].hasOwnProperty(c)&&(d[c]=b["*"][c]);if("object"==typeof b[a])for(c in b[a])b[a].hasOwnProperty(c)&&(d[c]=b[a][c]);return d};function MibewAPIExecutionContext(){this.returnValues={};this.functionsResults=[]}
MibewAPIExecutionContext.prototype.getArgumentsList=function(a){var b=a.arguments,d=a.arguments.references,c,f,e;for(e in d)if(d.hasOwnProperty(e)){f=d[e];if("undefined"==typeof this.functionsResults[f-1])throw Error("Wrong reference in '"+a["function"]+"' function. Function #"+f+" does not call yet.");if("undefined"==typeof b[e]||""==b[e])throw Error("Wrong reference in '"+a["function"]+"' function. Empty '"+e+"' argument.");c=b[e];if("undefined"==typeof this.functionsResults[f-1][c])throw Error("Wrong reference in '"+
a["function"]+"' function. There is no '"+c+"' argument in #"+f+" function results");b[e]=this.functionsResults[f-1][c]}return b};MibewAPIExecutionContext.prototype.getResults=function(){return this.returnValues};
MibewAPIExecutionContext.prototype.storeFunctionResults=function(a,b){var d;if(b.errorCode)this.returnValues.errorCode=b.errorCode,this.returnValues.errorMessage=b.errorMessage||"";else for(var c in a.arguments["return"])if(a.arguments["return"].hasOwnProperty(c)){d=a.arguments["return"][c];if("undefined"==typeof b[c])throw Error("Variable with name '"+c+"' is undefined in the results of the '"+a["function"]+"' function");this.returnValues[d]=b[c]}this.functionsResults.push(b)};
/**
* @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)};

View File

@ -1,8 +1,8 @@
/*
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(b,a){a(document).ready(function(){a("#check-nv").click(function(){b.Utils.playSound("../sounds/new_user")});a("#check-nm").click(function(){b.Utils.playSound("../sounds/new_message")})})})(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(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,$);

View File

@ -1,8 +1,8 @@
/*
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(a,c){var b=new c.Marionette.Application;b.addRegions({messagesRegion:"#messages-region"});b.addInitializer(function(c){var d=new a.Collections.Messages;a.Objects.Collections.messages=d;d.updateMessages(c.messages);b.messagesRegion.show(new a.Views.MessagesCollection({collection:d}))});a.Application=b})(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,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);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Views.MessagesCollection=a.Views.CollectionBase.extend({itemView:a.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.MessagesCollection=e.Views.CollectionBase.extend({itemView:e.Views.Message,className:"messages-collection"})}(Mibew);

View File

@ -1,8 +1,8 @@
/*
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(d,e){d.Collections.Messages=e.Collection.extend({model:d.Models.Message,updateMessages:function(b){for(var c=[],a=0;a<b.length;a++)b[a].message&&c.push(b[a]);0<c.length&&this.add(c)}})})(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,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,_);

View File

@ -1,21 +1,22 @@
/*
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(d,e){d.Collections.Messages=e.Collection.extend({model:d.Models.Message,updateMessages:function(b){for(var c=[],a=0;a<b.length;a++)b[a].message&&c.push(b[a]);0<c.length&&this.add(c)}})})(Mibew,Backbone,_);
/*
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(a){a.Views.MessagesCollection=a.Views.CollectionBase.extend({itemView:a.Views.Message,className:"messages-collection"})})(Mibew);
/*
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(a,c){var b=new c.Marionette.Application;b.addRegions({messagesRegion:"#messages-region"});b.addInitializer(function(c){var d=new a.Collections.Messages;a.Objects.Collections.messages=d;d.updateMessages(c.messages);b.messagesRegion.show(new a.Views.MessagesCollection({collection:d}))});a.Application=b})(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,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);

View File

@ -1,10 +1,8 @@
/*
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(a,h,j){var c=0,g=function(){c++;10==c&&(alert(a.Localization.get("Network problems detected. Please refresh the page.")),c=0)},b=new h.Marionette.Application;b.addRegions({agentsRegion:"#agents-region",statusPanelRegion:"#status-panel-region",threadsRegion:"#threads-region",visitorsRegion:"#visitors-region"});b.addInitializer(function(d){a.PluginOptions=d.plugins||{};var c=a.Objects,f=a.Objects.Models,e=a.Objects.Collections;c.server=new a.Server(j.extend({interactionType:MibewAPIUsersInteraction,onTimeout:g,onTransportError:g},
d.server));f.page=new a.Models.Page(d.page);f.agent=new a.Models.Agent(d.agent);e.threads=new a.Collections.Threads;b.threadsRegion.show(new a.Views.ThreadsCollection({collection:e.threads}));d.page.showVisitors&&(e.visitors=new a.Collections.Visitors,b.visitorsRegion.show(new a.Views.VisitorsCollection({collection:e.visitors})));f.statusPanel=new a.Models.StatusPanel;b.statusPanelRegion.show(new a.Views.StatusPanel({model:f.statusPanel}));d.page.showOnlineOperators&&(e.agents=new a.Collections.Agents,
b.agentsRegion.show(new a.Views.AgentsCollection({collection:e.agents})));c.server.callFunctionsPeriodically(function(){return[{"function":"update",arguments:{"return":{},references:{},agentId:f.agent.id}}]},function(){})});b.on("start",function(){a.Objects.server.runUpdater()});a.Application=b})(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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(a){a.Views.AgentsCollection=a.Views.CollectionBase.extend({itemView:a.Views.Agent,className:"agents-collection",collectionEvents:{"sort add remove reset":"render"},initialize:function(){this.on("itemview:before:render",this.updateIndexes,this)},updateIndexes:function(a){var b=this.collection,c=a.model;c&&(a.isModelFirst=0==b.indexOf(c),a.isModelLast=b.indexOf(c)==b.length-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){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);

View File

@ -1,12 +1,8 @@
/*
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(d,h,k){d.Views.ThreadsCollection=d.Views.CompositeBase.extend({template:h.templates.threads_collection,itemView:d.Views.QueuedThread,itemViewContainer:"#threads-container",emptyView:d.Views.NoThreads,className:"threads-collection",collectionEvents:{sort:"render","sort:field":"createSortField",add:"threadAdded"},itemViewOptions:function(a){return{tagName:d.Objects.Models.page.get("threadTag"),collection:a.get("controls")}},initialize:function(){window.setInterval(k.bind(this.updateTimers,
this),2E3);this.on("itemview:before:render",this.updateStyles,this);this.on("composite:collection:rendered",this.updateTimers,this)},updateStyles:function(a){var b=this.collection,c=a.model,d=this;if(c.id){var e=this.getQueueCode(c),f=!1,g=!1,b=b.filter(function(a){return d.getQueueCode(a)==e});0<b.length&&(g=b[0].id==c.id,f=b[b.length-1].id==c.id);if(0<a.lastStyles.length){c=0;for(b=a.lastStyles.length;c<b;c++)a.$el.removeClass(a.lastStyles[c]);a.lastStyles=[]}c=(e!=this.QUEUE_BAN?"in":"")+this.queueCodeToString(e);
a.lastStyles.push(c);g&&a.lastStyles.push(c+"-first");f&&a.lastStyles.push(c+"-last");c=0;for(b=a.lastStyles.length;c<b;c++)a.$el.addClass(a.lastStyles[c])}},updateTimers:function(){d.Utils.updateTimers(this.$el,".timesince")},createSortField:function(a,b){var c=this.getQueueCode(a)||"Z";b.field=c.toString()+"_"+a.get("waitingTime").toString()},threadAdded:function(){var a=d.Objects.Models.page.get("mibewRoot");"undefined"!==typeof a&&d.Utils.playSound(a+"/sounds/new_user");if(d.Objects.Models.page.get("showPopup"))this.once("render",
function(){alert(d.Localization.get("A new visitor is waiting for an answer."))})},getQueueCode:function(a){var b=a.get("state");return!1!=a.get("ban")&&b!=a.STATE_CHATTING?this.QUEUE_BAN:b==a.STATE_QUEUE||b==a.STATE_LOADING?this.QUEUE_WAITING:b==a.STATE_CLOSED||b==a.STATE_LEFT?this.QUEUE_CLOSED:b==a.STATE_WAITING?this.QUEUE_PRIO:b==a.STATE_CHATTING?this.QUEUE_CHATTING:!1},queueCodeToString:function(a){return a==this.QUEUE_PRIO?"prio":a==this.QUEUE_WAITING?"wait":a==this.QUEUE_CHATTING?"chat":a==
this.QUEUE_BAN?"ban":a==this.QUEUE_CLOSED?"closed":""},QUEUE_PRIO:1,QUEUE_WAITING:2,QUEUE_CHATTING:3,QUEUE_BAN:4,QUEUE_CLOSED:5})})(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,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,_);

View File

@ -1,9 +1,8 @@
/*
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(a,b,c){a.Views.VisitorsCollection=a.Views.CompositeBase.extend({template:b.templates.visitors_collection,itemView:a.Views.Visitor,itemViewContainer:"#visitors-container",emptyView:a.Views.NoVisitors,className:"visitors-collection",collectionEvents:{sort:"render"},itemViewOptions:function(b){return{tagName:a.Objects.Models.page.get("visitorTag"),collection:b.get("controls")}},initialize:function(){window.setInterval(c.bind(this.updateTimers,this),2E3);this.on("composite:collection:rendered",
this.updateTimers,this)},updateTimers:function(){a.Utils.updateTimers(this.$el,".timesince")}})})(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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(b,c,d){b.Collections.Agents=c.Collection.extend({model:b.Models.Agent,comparator:function(a){return a.get("name")},initialize:function(){var a=b.Objects.Models.agent;b.Objects.server.callFunctionsPeriodically(function(){return[{"function":"updateOperators",arguments:{agentId:a.id,"return":{operators:"operators"},references:{}}}]},d.bind(this.updateOperators,this))},updateOperators:function(a){this.set(a.operators)}})})(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.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,_);

View File

@ -1,10 +1,8 @@
/*
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(c,e,f){c.Collections.Threads=e.Collection.extend({model:c.Models.QueuedThread,initialize:function(){this.revision=0;var a=this,b=c.Objects.Models.agent;c.Objects.server.callFunctionsPeriodically(function(){return[{"function":"currentTime",arguments:{agentId:b.id,"return":{time:"currentTime"},references:{}}},{"function":"updateThreads",arguments:{agentId:b.id,revision:a.revision,"return":{threads:"threads",lastRevision:"lastRevision"},references:{}}}]},f.bind(this.updateThreads,this))},comparator:function(a){var b=
{field:a.get("waitingTime").toString()};this.trigger("sort:field",a,b);return b.field},updateThreads:function(a){if(0==a.errorCode){if(0<a.threads.length){var b;b=a.currentTime?Math.round((new Date).getTime()/1E3)-a.currentTime:0;for(var d=0,e=a.threads.length;d<e;d++)a.threads[d].totalTime=parseInt(a.threads[d].totalTime)+b,a.threads[d].waitingTime=parseInt(a.threads[d].waitingTime)+b;this.trigger("before:update:threads",a.threads);var f=c.Models.Thread.prototype.STATE_CLOSED,g=c.Models.Thread.prototype.STATE_LEFT;
b=[];this.set(a.threads,{remove:!1,sort:!1});b=this.filter(function(a){return a.get("state")==f||a.get("state")==g});0<b.length&&this.remove(b);this.sort();this.trigger("after:update:threads")}this.revision=a.lastRevision}}})})(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,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,_);

View File

@ -1,9 +1,8 @@
/*
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(b,e,f){b.Collections.Visitors=e.Collection.extend({model:b.Models.Visitor,initialize:function(){var a=b.Objects.Models.agent;b.Objects.server.callFunctionsPeriodically(function(){return[{"function":"currentTime",arguments:{agentId:a.id,"return":{time:"currentTime"},references:{}}},{"function":"updateVisitors",arguments:{agentId:a.id,"return":{visitors:"visitors"},references:{}}}]},f.bind(this.updateVisitors,this))},comparator:function(a){var c={field:a.get("firstTime").toString()};this.trigger("sort:field",
a,c);return c.field},updateVisitors:function(a){if(0==a.errorCode){var c;c=a.currentTime?Math.round((new Date).getTime()/1E3)-a.currentTime:0;for(var d=0,b=a.visitors.length;d<b;d++)a.visitors[d].lastTime=parseInt(a.visitors[d].lastTime)+c,a.visitors[d].firstTime=parseInt(a.visitors[d].firstTime)+c;this.trigger("before:update:visitors",a.visitors);this.reset(a.visitors);this.trigger("after:update:visitors")}}})})(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(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,_);

View File

@ -1,8 +1,8 @@
/*
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(b,e){b.Regions={};b.Popup={};b.Popup.open=function(a,c,d){c=c.replace(/[^A-z0-9_]+/g,"");a=window.open(a,c,d);a.focus();a.opener=window};b.Utils.updateTimers=function(a,c){a.find(c).each(function(){var d=e(this).data("timestamp");if(d){var a=Math.round((new Date).getTime()/1E3)-d,d=a%60,c=Math.floor(a/60)%60,a=Math.floor(a/3600),b=[];0<a&&b.push(a);b.push(10>c?"0"+c:c);b.push(10>d?"0"+d:d);e(this).html(b.join(":"))}})}})(Mibew,jQuery);
/**
* @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);

View File

@ -1,8 +1,8 @@
/*
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;
/**
* @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;

View File

@ -1,8 +1,8 @@
/*
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(b,c,d){b.Views.Agent=c.Marionette.ItemView.extend({template:d.templates.agent,tagName:"span",className:"agent",modelEvents:{change:"render"},initialize:function(){this.isModelLast=this.isModelFirst=!1},serializeData:function(){var a=this.model.toJSON();a.isFirst=this.isModelFirst;a.isLast=this.isModelLast;return a}})})(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,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);

View File

@ -1,8 +1,8 @@
/*
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(a,b,c){a.Views.NoThreads=b.Marionette.ItemView.extend({template:c.templates.no_threads,initialize:function(a){this.tagName=a.tagName}})})(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,a){e.Views.NoThreads=t.Marionette.ItemView.extend({template:a.templates.no_threads,initialize:function(e){this.tagName=e.tagName}})}(Mibew,Backbone,Handlebars);

View File

@ -1,8 +1,8 @@
/*
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(a,b,c){a.Views.NoVisitors=b.Marionette.ItemView.extend({template:c.templates.no_visitors,initialize:function(a){this.tagName=a.tagName}})})(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,i){e.Views.NoVisitors=t.Marionette.ItemView.extend({template:i.templates.no_visitors,initialize:function(e){this.tagName=e.tagName}})}(Mibew,Backbone,Handlebars);

View File

@ -1,12 +1,8 @@
/*
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(d,e){d.Views.QueuedThread=d.Views.CompositeBase.extend({template:e.templates.queued_thread,itemView:d.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 a=
this.model,b=d.Objects.Models.page,c=a.toJSON();c.stateDesc=this.stateToDesc(a.get("state"));c.chatting=a.get("state")==a.STATE_CHATTING;c.tracked=b.get("showVisitors");c.firstMessage&&(c.firstMessagePreview=30<c.firstMessage.length?c.firstMessage.substring(0,30)+"...":c.firstMessage);return c},stateToDesc:function(a){var b=d.Localization;return a==this.model.STATE_QUEUE?b.get("In queue"):a==this.model.STATE_WAITING?b.get("Waiting for operator"):a==this.model.STATE_CHATTING?b.get("In chat"):a==this.model.STATE_CLOSED?
b.get("Closed"):a==this.model.STATE_LOADING?b.get("Loading"):""},showGeoInfo:function(){var a=this.model.get("userIp");if(a){var b=d.Objects.Models.page,c=b.get("geoLink").replace("{ip}",a);d.Popup.open(c,"ip"+a,b.get("geoWindowParams"))}},openDialog:function(){var a=this.model;if(a.get("canOpen")||a.get("canView"))a=!a.get("canOpen"),this.showDialogWindow(a)},viewDialog:function(){this.showDialogWindow(!0)},showDialogWindow:function(a){var b=this.model.id,c=d.Objects.Models.page;d.Popup.open(c.get("agentLink")+
"/"+b+(a?"?viewonly=true":""),"ImCenter"+b,c.get("chatWindowParams"))},showTrack:function(){var a=this.model.id,b=d.Objects.Models.page;d.Popup.open(b.get("trackedLink")+"?thread="+a,"ImTracked"+a,b.get("trackedUserWindowParams"))},showBan:function(){var a=this.model,b=a.get("ban"),c=d.Objects.Models.page;d.Popup.open(c.get("banLink")+"/"+(!1!==b?b.id+"/edit":"add?thread="+a.id),"ImBan"+b.id,c.get("banWindowParams"))},showFirstMessage:function(){var a=this.model.get("firstMessage");a&&alert(a)}})})(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.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);

View File

@ -1,8 +1,8 @@
/*
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(a,c,d){a.Views.StatusPanel=c.Marionette.ItemView.extend({template:d.templates.status_panel,modelEvents:{change:"render"},ui:{changeStatus:"#change-status"},events:{"click #change-status":"changeAgentStatus"},initialize:function(){a.Objects.Models.agent.on("change",this.render,this)},changeAgentStatus:function(){this.model.changeAgentStatus()},serializeData:function(){var b=this.model.toJSON();b.agent=a.Objects.Models.agent.toJSON();return b}})})(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){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);

View File

@ -1,9 +1,8 @@
/*
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(a,d){a.Views.Visitor=a.Views.CompositeBase.extend({template:d.templates.visitor,itemView:a.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 b=this.model.id,c=a.Objects.Models.page;a.Popup.open(c.get("inviteLink")+"?visitor="+b,"ImCenter"+b,c.get("inviteWindowParams"))}},
showTrack:function(){var b=this.model.id,c=a.Objects.Models.page;a.Popup.open(c.get("trackedLink")+"?visitor="+b,"ImTracked"+b,c.get("trackedVisitorWindowParams"))},showGeoInfo:function(){var b=this.model.get("userIp");if(b){var c=a.Objects.Models.page,d=c.get("geoLink").replace("{ip}",b);a.Popup.open(d,"ip"+b,c.get("geoWindowParams"))}}})})(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,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);

View File

@ -1,8 +1,8 @@
/*
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(a,b){a.Models.Agent=a.Models.User.extend({defaults:b.extend({},a.Models.User.prototype.defaults,{id:null,isAgent:!0,away:!1}),away:function(){this.setAvailability(!1)},available:function(){this.setAvailability(!0)},setAvailability:function(c){var b=this;a.Objects.server.callFunctions([{"function":c?"available":"away",arguments:{agentId:this.id,references:{},"return":{}}}],function(a){0==a.errorCode&&b.set({away:!c})},!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.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,_);

View File

@ -1,9 +1,8 @@
/*
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(a,c){var b=[],f=a.Models.QueuedThread=a.Models.Thread.extend({defaults:c.extend({},a.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 e=[],b=f.getControls(),d=0,c=b.length;d<c;d++)e.push(new b[d]({thread:this}));this.set({controls:new a.Collections.Controls(e)})}},{addControl:function(a){b.push(a)},getControls:function(){return b}})})(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,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,_);

View File

@ -1,8 +1,8 @@
/*
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(b){b.Models.StatusPanel=b.Models.Base.extend({defaults:{message:""},setStatus:function(a){this.set({message:a})},changeAgentStatus:function(){var a=b.Objects.Models.agent;a.get("away")?a.available():a.away()}})})(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.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