|
@@ -20,6 +20,21 @@
|
|
const { Backbone, Promise, b64_sha1, sizzle, _ } = converse.env;
|
|
const { Backbone, Promise, b64_sha1, sizzle, _ } = converse.env;
|
|
|
|
|
|
converse.plugins.add('converse-roomslist', {
|
|
converse.plugins.add('converse-roomslist', {
|
|
|
|
+
|
|
|
|
+ /* Optional dependencies are other plugins which might be
|
|
|
|
+ * overridden or relied upon, and therefore need to be loaded before
|
|
|
|
+ * this plugin. They are called "optional" because they might not be
|
|
|
|
+ * available, in which case any overrides applicable to them will be
|
|
|
|
+ * ignored.
|
|
|
|
+ *
|
|
|
|
+ * It's possible however to make optional dependencies non-optional.
|
|
|
|
+ * If the setting "strict_plugin_dependencies" is set to true,
|
|
|
|
+ * an error will be raised if the plugin is not found.
|
|
|
|
+ *
|
|
|
|
+ * NB: These plugins need to have already been loaded via require.js.
|
|
|
|
+ */
|
|
|
|
+ optional_dependencies: ["converse-bookmarks"],
|
|
|
|
+
|
|
initialize () {
|
|
initialize () {
|
|
/* The initialize function gets called as soon as the plugin is
|
|
/* The initialize function gets called as soon as the plugin is
|
|
* loaded by converse.js's plugin machinery.
|
|
* loaded by converse.js's plugin machinery.
|
|
@@ -37,8 +52,10 @@
|
|
tagName: 'div',
|
|
tagName: 'div',
|
|
className: 'open-rooms-list rooms-list-container',
|
|
className: 'open-rooms-list rooms-list-container',
|
|
events: {
|
|
events: {
|
|
|
|
+ 'click .add-bookmark': 'addBookmark',
|
|
'click .close-room': 'closeRoom',
|
|
'click .close-room': 'closeRoom',
|
|
- 'click .open-rooms-toggle': 'toggleRoomsList'
|
|
|
|
|
|
+ 'click .open-rooms-toggle': 'toggleRoomsList',
|
|
|
|
+ 'click .remove-bookmark': 'removeBookmark',
|
|
},
|
|
},
|
|
|
|
|
|
initialize () {
|
|
initialize () {
|
|
@@ -120,6 +137,7 @@
|
|
'allow_bookmarks': _converse.allow_bookmarks,
|
|
'allow_bookmarks': _converse.allow_bookmarks,
|
|
'info_leave_room': __('Leave this room'),
|
|
'info_leave_room': __('Leave this room'),
|
|
'info_remove_bookmark': __('Unbookmark this room'),
|
|
'info_remove_bookmark': __('Unbookmark this room'),
|
|
|
|
+ 'info_add_bookmark': __('Bookmark this room'),
|
|
'info_title': __('Show more information on this room'),
|
|
'info_title': __('Show more information on this room'),
|
|
'name': name,
|
|
'name': name,
|
|
'open_title': __('Click to open this room')
|
|
'open_title': __('Click to open this room')
|
|
@@ -128,6 +146,9 @@
|
|
this.show();
|
|
this.show();
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ removeBookmark: _converse.removeBookmarkViaEvent,
|
|
|
|
+ addBookmark: _converse.addBookmarkViaEvent,
|
|
|
|
+
|
|
removeRoomsListElement (item) {
|
|
removeRoomsListElement (item) {
|
|
const list_el = this.el.querySelector('.open-rooms-list');
|
|
const list_el = this.el.querySelector('.open-rooms-list');
|
|
const el = _.head(sizzle(`.available-chatroom[data-room-jid="${item.get('jid')}"]`, list_el));
|
|
const el = _.head(sizzle(`.available-chatroom[data-room-jid="${item.get('jid')}"]`, list_el));
|