xmpp.chapril.org-conversejs/src/converse-fullscreen.js

73 lines
2.3 KiB
JavaScript
Raw Normal View History

2017-06-13 21:07:42 +02:00
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
//
// Copyright (c) JC Brand <jc@opkode.com>
2017-06-13 21:07:42 +02:00
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define */
2017-06-13 21:07:42 +02:00
(function (root, factory) {
define(["converse-core",
"tpl!inverse_brand_heading",
2017-06-13 21:07:42 +02:00
"converse-chatview",
"converse-controlbox",
"converse-muc",
"converse-singleton"
], factory);
}(this, function (converse, tpl_brand_heading) {
2017-06-13 21:07:42 +02:00
"use strict";
2017-07-10 21:14:48 +02:00
const { Strophe, _ } = converse.env;
2017-06-13 21:07:42 +02:00
converse.plugins.add('converse-fullscreen', {
enabled (_converse) {
return _.includes(['mobile', 'fullscreen', 'embedded'], _converse.view_mode);
},
2017-06-13 21:07:42 +02:00
overrides: {
// overrides mentioned here will be picked up by converse.js's
// plugin architecture they will replace existing methods on the
// relevant objects or classes.
//
// new functions which don't exist yet can also be added.
ControlBoxView: {
createBrandHeadingHTML() {
return tpl_brand_heading();
},
insertBrandHeading () {
const { _converse } = this.__super__;
const el = _converse.root.getElementById('converse-login-panel');
el.parentNode.insertAdjacentHTML(
'afterbegin',
this.createBrandHeadingHTML()
);
2017-06-13 21:07:42 +02:00
}
},
ChatRoomView: {
afterShown (focus) {
2017-06-13 21:07:42 +02:00
/* Make sure chat rooms are scrolled down when opened
*/
this.scrollDown();
if (focus) {
this.focus();
}
return this.__super__.afterShown.apply(this, arguments);
}
}
},
initialize () {
this._converse.api.settings.update({
2018-02-19 22:36:37 +01:00
chatview_avatar_height: 50,
chatview_avatar_width: 50,
hide_open_bookmarks: true,
show_controlbox_by_default: true,
sticky_controlbox: true
2017-06-13 21:07:42 +02:00
});
}
});
}));