mirror of
https://github.com/Mibew/java.git
synced 2025-01-23 01:50:34 +03:00
Move creating instance of Chat JS app to init.js
This commit is contained in:
parent
eec1d1a352
commit
2f5998843e
@ -5,9 +5,9 @@
|
|||||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||||
License: http://mibew.org/license.php
|
License: http://mibew.org/license.php
|
||||||
*/
|
*/
|
||||||
(function(a,j,k){var d=new j.Marionette.Application;d.addRegions({controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:a.Regions.Messages,statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"});d.addInitializer(function(e){var g=a.Objects,c=a.Objects.Models,b=a.Objects.Models.Controls,h=a.Objects.Models.Status;g.server=new a.Server(k.extend({interactionType:MibewAPIChatInteraction},e.server));c.thread=new a.Models.Thread(e.thread);
|
(function(a,j){var f=a.Application;f.addRegions({controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:a.Regions.Messages,statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"});f.addInitializer(function(d){var g=a.Objects,c=a.Objects.Models,b=a.Objects.Models.Controls,h=a.Objects.Models.Status;g.server=new a.Server(j.extend({interactionType:MibewAPIChatInteraction},d.server));c.thread=new a.Models.Thread(d.thread);c.user=new a.Models.ChatUser(d.user);
|
||||||
c.user=new a.Models.ChatUser(e.user);c.page=new a.Models.Page(e.page);var f=new a.Collections.Controls;c.user.get("isAgent")||(b.userName=new a.Models.UserNameControl({weight:220}),f.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:e.links.mailLink}),f.add(b.sendMail));c.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:e.links.redirectLink}),f.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:e.links.historyLink}),f.add(b.history));
|
c.page=new a.Models.Page(d.page);var e=new a.Collections.Controls;c.user.get("isAgent")||(b.userName=new a.Models.UserNameControl({weight:220}),e.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:d.links.mailLink}),e.add(b.sendMail));c.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:d.links.redirectLink}),e.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:d.links.historyLink}),e.add(b.history));b.sound=new a.Models.SoundControl({weight:160});
|
||||||
b.sound=new a.Models.SoundControl({weight:160});f.add(b.sound);b.refresh=new a.Models.RefreshControl({weight:140});f.add(b.refresh);e.links.sslLink&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:e.links.sslLink}),f.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});f.add(b.close);g.Collections.controls=f;d.controlsRegion.show(new a.Views.ControlsCollection({collection:f}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});
|
e.add(b.sound);b.refresh=new a.Models.RefreshControl({weight:140});e.add(b.refresh);d.links.sslLink&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:d.links.sslLink}),e.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});e.add(b.close);g.Collections.controls=e;f.controlsRegion.show(new a.Views.ControlsCollection({collection:e}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});g.Collections.status=new a.Collections.Status([h.message,
|
||||||
g.Collections.status=new a.Collections.Status([h.message,h.typing]);d.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));c.user.get("isAgent")||(c.avatar=new a.Models.Avatar,d.avatarRegion.show(new a.Views.Avatar({model:c.avatar})));g.Collections.messages=new a.Collections.Messages;c.messageForm=new a.Models.MessageForm(e.messageForm);d.messageFormRegion.show(new a.Views.MessageForm({model:c.messageForm}));d.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));
|
h.typing]);f.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));c.user.get("isAgent")||(c.avatar=new a.Models.Avatar,f.avatarRegion.show(new a.Views.Avatar({model:c.avatar})));g.Collections.messages=new a.Collections.Messages;c.messageForm=new a.Models.MessageForm(d.messageForm);f.messageFormRegion.show(new a.Views.MessageForm({model:c.messageForm}));f.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));c.sound=new a.Models.Sound;
|
||||||
c.sound=new a.Models.Sound;d.soundRegion.show(new a.Views.Sound({model:c.sound}));g.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&&
|
f.soundRegion.show(new a.Views.Sound({model:c.sound}));g.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.Status.typing.show(),a.Objects.Models.user.set({canPost:b.canPost||!1}))})});d.on("start",function(){a.Objects.server.runUpdater()});a.Application=d})(Mibew,Backbone,_);
|
a.Objects.Models.user.set({canPost:b.canPost||!1}))})});f.on("start",function(){a.Objects.server.runUpdater()})})(Mibew,_);
|
||||||
|
@ -5,4 +5,4 @@
|
|||||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||||
License: http://mibew.org/license.php
|
License: http://mibew.org/license.php
|
||||||
*/
|
*/
|
||||||
(function(a){a.Regions={};a.Objects.Models.Controls={};a.Objects.Models.Status={}})(Mibew);
|
(function(a){a.Regions={};a.Objects.Models.Controls={};a.Objects.Models.Status={};a.Application=new Backbone.Marionette.Application})(Mibew);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||||
License: http://mibew.org/license.php
|
License: http://mibew.org/license.php
|
||||||
*/
|
*/
|
||||||
(function(a){a.Regions={};a.Objects.Models.Controls={};a.Objects.Models.Status={}})(Mibew);
|
(function(a){a.Regions={};a.Objects.Models.Controls={};a.Objects.Models.Status={};a.Application=new Backbone.Marionette.Application})(Mibew);
|
||||||
/*
|
/*
|
||||||
This file is part of Mibew Messenger project.
|
This file is part of Mibew Messenger project.
|
||||||
http://mibew.org
|
http://mibew.org
|
||||||
@ -249,9 +249,9 @@ c=""!=this.ui.message.val();c!=a.get("typing")&&a.set({typing:c})},setFocus:func
|
|||||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||||
License: http://mibew.org/license.php
|
License: http://mibew.org/license.php
|
||||||
*/
|
*/
|
||||||
(function(a,j,k){var d=new j.Marionette.Application;d.addRegions({controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:a.Regions.Messages,statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"});d.addInitializer(function(e){var g=a.Objects,c=a.Objects.Models,b=a.Objects.Models.Controls,h=a.Objects.Models.Status;g.server=new a.Server(k.extend({interactionType:MibewAPIChatInteraction},e.server));c.thread=new a.Models.Thread(e.thread);
|
(function(a,j){var f=a.Application;f.addRegions({controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:a.Regions.Messages,statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"});f.addInitializer(function(d){var g=a.Objects,c=a.Objects.Models,b=a.Objects.Models.Controls,h=a.Objects.Models.Status;g.server=new a.Server(j.extend({interactionType:MibewAPIChatInteraction},d.server));c.thread=new a.Models.Thread(d.thread);c.user=new a.Models.ChatUser(d.user);
|
||||||
c.user=new a.Models.ChatUser(e.user);c.page=new a.Models.Page(e.page);var f=new a.Collections.Controls;c.user.get("isAgent")||(b.userName=new a.Models.UserNameControl({weight:220}),f.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:e.links.mailLink}),f.add(b.sendMail));c.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:e.links.redirectLink}),f.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:e.links.historyLink}),f.add(b.history));
|
c.page=new a.Models.Page(d.page);var e=new a.Collections.Controls;c.user.get("isAgent")||(b.userName=new a.Models.UserNameControl({weight:220}),e.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:d.links.mailLink}),e.add(b.sendMail));c.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:d.links.redirectLink}),e.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:d.links.historyLink}),e.add(b.history));b.sound=new a.Models.SoundControl({weight:160});
|
||||||
b.sound=new a.Models.SoundControl({weight:160});f.add(b.sound);b.refresh=new a.Models.RefreshControl({weight:140});f.add(b.refresh);e.links.sslLink&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:e.links.sslLink}),f.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});f.add(b.close);g.Collections.controls=f;d.controlsRegion.show(new a.Views.ControlsCollection({collection:f}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});
|
e.add(b.sound);b.refresh=new a.Models.RefreshControl({weight:140});e.add(b.refresh);d.links.sslLink&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:d.links.sslLink}),e.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});e.add(b.close);g.Collections.controls=e;f.controlsRegion.show(new a.Views.ControlsCollection({collection:e}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});g.Collections.status=new a.Collections.Status([h.message,
|
||||||
g.Collections.status=new a.Collections.Status([h.message,h.typing]);d.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));c.user.get("isAgent")||(c.avatar=new a.Models.Avatar,d.avatarRegion.show(new a.Views.Avatar({model:c.avatar})));g.Collections.messages=new a.Collections.Messages;c.messageForm=new a.Models.MessageForm(e.messageForm);d.messageFormRegion.show(new a.Views.MessageForm({model:c.messageForm}));d.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));
|
h.typing]);f.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));c.user.get("isAgent")||(c.avatar=new a.Models.Avatar,f.avatarRegion.show(new a.Views.Avatar({model:c.avatar})));g.Collections.messages=new a.Collections.Messages;c.messageForm=new a.Models.MessageForm(d.messageForm);f.messageFormRegion.show(new a.Views.MessageForm({model:c.messageForm}));f.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));c.sound=new a.Models.Sound;
|
||||||
c.sound=new a.Models.Sound;d.soundRegion.show(new a.Views.Sound({model:c.sound}));g.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&&
|
f.soundRegion.show(new a.Views.Sound({model:c.sound}));g.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.Status.typing.show(),a.Objects.Models.user.set({canPost:b.canPost||!1}))})});d.on("start",function(){a.Objects.server.runUpdater()});a.Application=d})(Mibew,Backbone,_);
|
a.Objects.Models.user.set({canPost:b.canPost||!1}))})});f.on("start",function(){a.Objects.server.runUpdater()})})(Mibew,_);
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
* License: http://mibew.org/license.php
|
* License: http://mibew.org/license.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function (Mibew, Backbone, _) {
|
(function (Mibew, _) {
|
||||||
|
|
||||||
// Create application instance
|
// Create shortcut for application
|
||||||
var App = new Backbone.Marionette.Application();
|
var App = Mibew.Application;
|
||||||
|
|
||||||
// Define regions
|
// Define regions
|
||||||
App.addRegions({
|
App.addRegions({
|
||||||
@ -221,5 +221,4 @@
|
|||||||
Mibew.Objects.server.runUpdater();
|
Mibew.Objects.server.runUpdater();
|
||||||
});
|
});
|
||||||
|
|
||||||
Mibew.Application = App;
|
})(Mibew, _);
|
||||||
})(Mibew, Backbone, _);
|
|
@ -23,4 +23,10 @@
|
|||||||
*/
|
*/
|
||||||
Mibew.Objects.Models.Status = {};
|
Mibew.Objects.Models.Status = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create application instance.
|
||||||
|
* @type Backbone.Marionette.Application
|
||||||
|
*/
|
||||||
|
Mibew.Application = new Backbone.Marionette.Application();
|
||||||
|
|
||||||
})(Mibew);
|
})(Mibew);
|
Loading…
Reference in New Issue
Block a user