Commit | Line | Data |
---|---|---|
17f187e6 D |
1 | (function () { |
2 | var view = Backbone.View.extend({ | |
3 | events: {}, | |
4 | ||
5 | ||
6 | initialize: function (options) { | |
7 | this.showConnectionDialog(); | |
8 | }, | |
9 | ||
10 | ||
11 | showConnectionDialog: function() { | |
12 | var connection_dialog = this.connection_dialog = new _kiwi.model.NewConnection(); | |
13 | connection_dialog.populateDefaultServerSettings(); | |
14 | ||
15 | connection_dialog.view.$el.addClass('initial'); | |
16 | this.$el.append(connection_dialog.view.$el); | |
17 | ||
18 | var $info = $($('#tmpl_new_connection_info').html().trim()); | |
19 | ||
20 | if ($info.html()) { | |
21 | connection_dialog.view.infoBoxSet($info); | |
de6010d6 D |
22 | } else { |
23 | $info = null; | |
17f187e6 D |
24 | } |
25 | ||
26 | this.listenTo(connection_dialog, 'connected', this.newConnectionConnected); | |
27 | ||
28 | _.defer(function(){ | |
de6010d6 D |
29 | if ($info) { |
30 | connection_dialog.view.infoBoxShow(); | |
31 | } | |
32 | ||
4b978ed2 D |
33 | // Only set focus if we're not within an iframe. (firefox auto scrolls to the embedded client on page load - bad) |
34 | if (window == window.top) { | |
35 | connection_dialog.view.$el.find('.nick').select(); | |
36 | } | |
17f187e6 D |
37 | }); |
38 | }, | |
39 | ||
40 | ||
41 | newConnectionConnected: function(network) { | |
42 | // Once connected, reset the connection form to be used again in future | |
43 | this.connection_dialog.view.reset(); | |
44 | } | |
45 | }); | |
46 | ||
47 | ||
48 | ||
49 | var applet = Backbone.Model.extend({ | |
50 | initialize: function () { | |
51 | this.view = new view({model: this}); | |
52 | } | |
53 | }); | |
54 | ||
55 | ||
56 | _kiwi.model.Applet.register('kiwi_startup', applet); | |
63b21ebe | 57 | })(); |