From cd34cc5c6e9f83e3dfbb8c50008aa7870e8d6ee6 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 15 Apr 2015 18:20:07 +0100 Subject: [PATCH] add 'Show All Users' and 'Show No Users' --- source/UI/js/Video/AnnotationPanel.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/source/UI/js/Video/AnnotationPanel.js b/source/UI/js/Video/AnnotationPanel.js index 7f3d8fd1..d02b48d3 100644 --- a/source/UI/js/Video/AnnotationPanel.js +++ b/source/UI/js/Video/AnnotationPanel.js @@ -456,8 +456,10 @@ Ox.AnnotationPanel = function(options, self) { {}, {id: 'languages', title: Ox._('Show Languages'), disabled: true}, {group: 'languages', min: 1, max: -1, items: self.languages.map(function(language) { - return {id: language.code, title: Ox._(language.name), checked: - self.enabledLanguages.indexOf(language.code) > -1 + return { + id: language.code, + title: Ox._(language.name), + checked: Ox.contains(self.enabledLanguages, language.code) }; })} ] : [], @@ -465,10 +467,17 @@ Ox.AnnotationPanel = function(options, self) { {}, {id: 'users', title: Ox._('Show Users'), disabled: true}, {group: 'users', min: 1, max: -1, items: self.users.map(function(user) { - return {id: user, title: Ox.encodeHTMLEntities(user), checked: - self.enabledUsers == 'all' || self.enabledUsers.indexOf(user) > -1 + return { + id: 'user_' + user, + title: Ox.encodeHTMLEntities(user), + checked: self.enabledUsers == 'all' || Ox.contains(self.enabledUsers, user) }; })} + ] : [], + self.options.showUsers && self.users.length > 1 ? [ + {}, + {id: 'allusers', title: Ox._('Show All Users')}, + {id: 'nousers', title: Ox._('Show No Users')} ] : [] ), style: 'square', @@ -489,11 +498,19 @@ Ox.AnnotationPanel = function(options, self) { }); } else if (data.id == 'users') { self.enabledUsers = data.checked.map(function(checked) { - return checked.id; + return checked.id.slice(5); }); self.$folder.forEach(function($folder) { $folder.options({users: self.enabledUsers}); }); + } else if (data.id == 'allusers') { + self.users.forEach(function(user) { + self.$optionsMenuButton.checkItem('user_' + user); + }); + } else if (data.id == 'nousers') { + self.users.forEach(function(user) { + self.$optionsMenuButton.uncheckItem('user_' + user); + }); } else { self.options[data.id] = data.checked[0].id; set[data.id] = self.options[data.id];