Use LAB.js to load JavaScripts to the chat window

This commit is contained in:
Dmitriy Simushev 2012-10-10 10:06:01 +00:00
parent 4cfac7bbef
commit f5a970e50f
6 changed files with 42 additions and 53 deletions

View File

@ -5,7 +5,8 @@
Copyright (c) 2005-2011 Mibew Messenger Community
License: http://mibew.org/license.php
*/
var chatController=null,pluginManager=new PluginManager;
var chatController=null;
Behaviour.register({"#postmessage a":function(a){a.onclick=function(){var a=$("msgwnd");a&&chatController.postMessage(a.value)}},"select#predefined":function(a){a.onchange=function(){chatController.selectPredefinedAnswer(this)}},"div#changename2 a":function(a){a.onclick=function(){chatController.showNameField();return!1}},"div#changename1 a":function(a){a.onclick=function(){chatController.applyName();return!1}},"div#changename1 input#uname":function(a){a.onkeydown=function(a){13==(a||event).keyCode&&
chatController.applyName()}},"a#refresh":function(a){a.onclick=function(){chatController.refresh()}},"a#togglesound":function(a){a.onclick=function(){chatController.toggleSound()}},"a.closethread":function(a){a.onclick=function(){chatController.closeThread()}}});
EventHelper.register(window,"onload",function(){FrameUtils.options.cssfile=chatParams.cssfile;var a=new ChatServer(chatParams.serverParams),b=new Thread(chatParams.threadParams);chatParams.initPlugins(pluginManager,b,a);var c=new ChatView(chatParams.localizedStrings,chatParams.predefinedAnswers||[]);chatController=new ChatController(a,c,b,{ignorectrl:-1}.extend(chatParams.controllerParams||{}))});
EventHelper.register(window,"onload",function(){$LAB.setOptions({BasePath:chatParams.jsBasePath}).script("json2.js").wait().script("mibewapi.js").wait().script("chatserver.js").script("thread.js").script("pluginmanager.js").script("brws.js").wait().script("chatcontroller.js").script("chatview.js").wait(function(){FrameUtils.options.cssfile=chatParams.cssfile;var a=new ChatServer(chatParams.serverParams),c=new Thread(chatParams.threadParams),b=new PluginManager;chatParams.initPlugins(b,c,a);b=new ChatView(chatParams.localizedStrings,
chatParams.predefinedAnswers||[]);chatController=new ChatController(a,b,c,{ignorectrl:-1}.extend(chatParams.controllerParams||{}))})});

View File

@ -7,7 +7,6 @@
*/
var chatController = null;
var pluginManager = new PluginManager();
Behaviour.register({
'#postmessage a' : function(el) {
@ -68,18 +67,31 @@ Behaviour.register({
});
EventHelper.register(window, 'onload', function(){
FrameUtils.options.cssfile = chatParams.cssfile;
var chatServer = new ChatServer(chatParams.serverParams);
var thread = new Thread(chatParams.threadParams);
chatParams.initPlugins(pluginManager, thread, chatServer);
var chatView = new ChatView(
chatParams.localizedStrings,
chatParams.predefinedAnswers || []
);
chatController = new ChatController(
chatServer,
chatView,
thread,
{ignorectrl: -1}.extend(chatParams.controllerParams || {})
);
$LAB
.setOptions({BasePath: chatParams.jsBasePath})
.script('json2.js').wait()
.script('mibewapi.js').wait()
.script('chatserver.js')
.script('thread.js')
.script('pluginmanager.js')
.script('brws.js').wait()
.script('chatcontroller.js')
.script('chatview.js')
.wait(function() {
FrameUtils.options.cssfile = chatParams.cssfile;
var chatServer = new ChatServer(chatParams.serverParams);
var thread = new Thread(chatParams.threadParams);
var pluginManager = new PluginManager();
chatParams.initPlugins(pluginManager, thread, chatServer);
var chatView = new ChatView(
chatParams.localizedStrings,
chatParams.predefinedAnswers || []
);
chatController = new ChatController(
chatServer,
chatView,
thread,
{ignorectrl: -1}.extend(chatParams.controllerParams || {})
);
});
});

View File

@ -5,16 +5,13 @@
<link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="${tplroot}/chat.css">
${page:additional_css}
${page:additional_js}
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/common.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/thread.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/mibewapi.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/pluginmanager.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/json2.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/brws.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/LAB.js"></script>
${page:additional_js}
<script type="text/javascript" language="javascript"><!--
var chatParams = {
cssfile: "${tplroot}/chat.css",
jsBasePath: "${webimroot}/js/${jsver}/",
localizedStrings: {closeConfirmation:"${page:chat.close.confirmation}"},
${if:agent}${if:canpost}
predefinedAnswers: ${page:fullPredefinedAnswers},
@ -38,9 +35,6 @@ var chatParams = {
}
//-->
</script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatserver.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatview.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatcontroller.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatinit.js"></script>
<style type="text/css">
#header{

View File

@ -5,16 +5,13 @@
<link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="${tplroot}/chat.css">
${page:additional_css}
${page:additional_js}
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/common.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/thread.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/mibewapi.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/pluginmanager.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/json2.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/brws.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/LAB.js"></script>
${page:additional_js}
<script type="text/javascript" language="javascript"><!--
var chatParams = {
cssfile: "${tplroot}/chat.css",
jsBasePath: "${webimroot}/js/${jsver}/",
localizedStrings: {closeConfirmation:"${page:chat.close.confirmation}"},
${if:agent}${if:canpost}
predefinedAnswers: ${page:fullPredefinedAnswers},
@ -38,9 +35,6 @@ var chatParams = {
}
//-->
</script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatserver.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatview.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatcontroller.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatinit.js"></script>
<style type="text/css">
.tplimage {

View File

@ -6,17 +6,14 @@
<link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="${tplroot}/chat.css" media="all" />
${page:additional_css}
${page:additional_js}
<script type="text/javascript" src="${webimroot}/js/${jsver}/common.js"></script>
<script type="text/javascript" src="${webimroot}/js/${jsver}/thread.js"></script>
<script type="text/javascript" src="${webimroot}/js/${jsver}/mibewapi.js"></script>
<script type="text/javascript" src="${webimroot}/js/${jsver}/pluginmanager.js"></script>
<script type="text/javascript" src="${webimroot}/js/${jsver}/json2.js"></script>
<script type="text/javascript" src="${webimroot}/js/${jsver}/brws.js"></script>
<script type="text/javascript" src="${webimroot}/js/${jsver}/LAB.js"></script>
${page:additional_js}
<script type="text/javascript">
<!--
var chatParams = {
cssfile: "${tplroot}/chat.css",
jsBasePath: "${webimroot}/js/${jsver}/",
localizedStrings: {closeConfirmation:"${page:chat.close.confirmation}"},
${if:agent}${if:canpost}
predefinedAnswers: ${page:fullPredefinedAnswers},
@ -79,9 +76,6 @@
window.onresize = setTrueHeight;
//-->
</script>
<script type="text/javascript" src="${webimroot}/js/${jsver}/chatserver.js"></script>
<script type="text/javascript" src="${webimroot}/js/${jsver}/chatview.js"></script>
<script type="text/javascript" src="${webimroot}/js/${jsver}/chatcontroller.js"></script>
<script type="text/javascript" src="${webimroot}/js/${jsver}/chatinit.js"></script>
</head>
<body class="body">

View File

@ -5,16 +5,13 @@
<link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="${tplroot}/chat.css">
${page:additional_css}
${page:additional_js}
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/common.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/thread.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/mibewapi.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/pluginmanager.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/json2.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/brws.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/LAB.js"></script>
${page:additional_js}
<script type="text/javascript" language="javascript"><!--
var chatParams = {
cssfile: "${tplroot}/chat.css",
jsBasePath: "${webimroot}/js/${jsver}/",
localizedStrings: {closeConfirmation:"${page:chat.close.confirmation}"},
${if:agent}${if:canpost}
predefinedAnswers: ${page:fullPredefinedAnswers},
@ -38,9 +35,6 @@ var chatParams = {
}
//-->
</script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatserver.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatview.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatcontroller.js"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/chatinit.js"></script>
<style type="text/css">
.isound { background: url(${tplroot}/images/buttons/sound.gif) no-repeat; width: 19px; height: 19px; }