diff --git a/src/messenger/webim/js/164/chatinit.js b/src/messenger/webim/js/164/chatinit.js
index ab66cf19..0fa325cc 100644
--- a/src/messenger/webim/js/164/chatinit.js
+++ b/src/messenger/webim/js/164/chatinit.js
@@ -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||{}))});
\ No newline at end of file
+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||{}))})});
\ No newline at end of file
diff --git a/src/messenger/webim/js/source/chatinit.js b/src/messenger/webim/js/source/chatinit.js
index 0d048a53..aadea3e1 100644
--- a/src/messenger/webim/js/source/chatinit.js
+++ b/src/messenger/webim/js/source/chatinit.js
@@ -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 || {})
+ );
+ });
});
\ No newline at end of file
diff --git a/src/messenger/webim/styles/dialogs/default/templates/chat.tpl b/src/messenger/webim/styles/dialogs/default/templates/chat.tpl
index 6b72cb5a..9422697a 100644
--- a/src/messenger/webim/styles/dialogs/default/templates/chat.tpl
+++ b/src/messenger/webim/styles/dialogs/default/templates/chat.tpl
@@ -5,16 +5,13 @@
${page:additional_css}
-${page:additional_js}
-
-
-
-
-
+
+${page:additional_js}
-
-
-