hide peers

This commit is contained in:
j 2019-02-09 20:55:23 +05:30
commit dad9b53b54
4 changed files with 114 additions and 5 deletions

View file

@ -20,6 +20,9 @@ oml.ui.folders = function() {
oml_showfolder: function() {
oml.resizeListFolders();
},
oml_showpeers: function() {
that.updateElement();
},
oml_showinfo: function() {
oml.resizeListFolders();
}
@ -48,9 +51,15 @@ oml.ui.folders = function() {
function getUsersAndLists(callback) {
oml.getUsers(function(users_) {
users = users_.filter(function(user) {
return user.id == oml.user.id || user.peered;
});
if (ui.showPeers) {
users = users_.filter(function(user) {
return user.id == oml.user.id || user.peered;
});
} else {
users = users_.filter(function(user) {
return user.id == oml.user.id;
});
}
oml.getLists(function(lists) {
callback(users, lists);
});

View file

@ -214,6 +214,12 @@ oml.ui.mainMenu = function() {
title: Ox._((ui.showSidebar ? 'Hide' : 'Show') + ' Sidebar'),
keyboard: 'shift s'
},
{
id: 'showpeers',
title: Ox._((ui.showPeers ? 'Hide' : 'Show') + ' Peers'),
keyboard: 'shift p',
disabled: !ui.showSidebar
},
{
id: 'showinfo',
title: Ox._((ui.showInfo ? 'Hide' : 'Show') + ' Info'),
@ -539,6 +545,8 @@ oml.ui.mainMenu = function() {
oml.history.clear();
} else if (id == 'showsidebar') {
oml.UI.set({showSidebar: !ui.showSidebar});
} else if (id == 'showpeers') {
oml.UI.set({showPeers: !ui.showPeers});
} else if (id == 'showinfo') {
oml.UI.set({showInfo: !ui.showInfo});
} else if (id == 'showfilters') {
@ -636,12 +644,16 @@ oml.ui.mainMenu = function() {
that[action]('viewMenu_iconsSubmenu_extension');
that[action]('viewMenu_iconsSubmenu_size');
},
oml_showpeers: function(data) {
that.setItemTitle('showpeers', Ox._((data.value ? 'Hide' : 'Show') + ' Peers'));
},
oml_showinfo: function(data) {
that.setItemTitle('showinfo', Ox._((data.value ? 'Hide' : 'Show') + ' Info'));
},
oml_showsidebar: function(data) {
that.setItemTitle('showsidebar', Ox._((data.value ? 'Hide' : 'Show') + ' Sidebar'));
that[data.value ? 'enableItem' : 'disableItem']('showinfo');
that[data.value ? 'enableItem' : 'disableItem']('showpeers');
},
});
Ox.Event.bind({
@ -726,8 +738,17 @@ oml.ui.mainMenu = function() {
key_shift_f: function() {
!ui.item && oml.UI.set({showFilters: !ui.showFilters});
},
key_shift_i: function() {
ui.showSidebar && oml.UI.set({showInfo: !ui.showInfo});
key_shift_p: function(event, name, target) {
// FIXME: event triggers twice
if (target.hasClass('OxFocus')) {
ui.showSidebar && oml.UI.set({showPeers: !ui.showPeers});
}
},
key_shift_i: function(event, name, target) {
// FIXME: event triggers twice
if (target.hasClass('OxFocus')) {
ui.showSidebar && oml.UI.set({showInfo: !ui.showInfo});
}
},
key_shift_s: function() {
oml.UI.set({showSidebar: !ui.showSidebar});