From 097708feddcc6ffd9c729c4ce4c0ab0ec00e46eb Mon Sep 17 00:00:00 2001 From: rlx Date: Mon, 18 Jan 2016 11:15:33 +0530 Subject: [PATCH] main menu: add entries for preview and fullscreen --- static/js/list.js | 2 ++ static/js/mainMenu.js | 32 ++++++++++++++++++++++++++++++++ static/js/previewButton.js | 1 - 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/static/js/list.js b/static/js/list.js index a33059f..cf36558 100644 --- a/static/js/list.js +++ b/static/js/list.js @@ -18,6 +18,7 @@ oml.ui.list = function() { } }, closepreview: function() { + oml.$ui.mainMenu.setItemTitle('preview', Ox._('Show Preview')); oml.$ui.previewButton.options({value: false}); oml.$ui.previewDialog.close(); delete oml.$ui.previewDialog; @@ -112,6 +113,7 @@ oml.ui.list = function() { }, openpreview: function() { if (!oml.$ui.previewDialog) { + oml.$ui.mainMenu.setItemTitle('preview', Ox._('Hide Preview')); oml.$ui.previewButton.options({value: true}); oml.$ui.previewDialog = oml.ui.previewDialog() .open() diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index f8611dd..96630ec 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -227,6 +227,19 @@ oml.ui.mainMenu = function() { title: Ox._((ui.showBrowser ? 'Hide': 'Show') + ' Browser'), keyboard: 'shift b', disabled: !ui.item + }, + {}, + { + id: 'preview', + title: Ox._('Show Preview'), + keyboard: 'space', + disabled: !!ui.item || !ui.listSelection.length + }, + { + id: 'fullscreen', + title: Ox._('Enter Fullscreen'), + keyboard: 'shift alt f', + disabled: !ui.item || ui.itemView == 'info' } ] }, @@ -520,6 +533,18 @@ oml.ui.mainMenu = function() { oml.UI.set({showFilters: !ui.showFilters}); } else if (id == 'showbrowser') { oml.UI.set({showBrowser: !ui.showBrowser}); + } else if (id == 'preview') { + that.setItemTitle( + 'preview', + data.title == Ox._('Show Preview') + ? Ox._('Hide Preview') : Ox._('Show Preview') + ); + oml.$ui.list[ + data.title == Ox._('Show Preview') + ? 'openPreview' : 'closePreview' + ](); + } else if (id == 'fullscreen') { + Ox.Fullscreen.enter(oml.$ui.viewer.find('iframe')[0]); } else if (id == 'debugmode') { if (oml.localStorage('enableDebugMode')) { oml.localStorage['delete']('enableDebugMode'); @@ -562,10 +587,12 @@ oml.ui.mainMenu = function() { }, oml_itemview: function(data) { that.checkItem('viewMenu_itemviewSubmenu_' + data.value); + that[data.value == 'book' ? 'enableItem' : 'disableItem']('fullscreen'); }, oml_listselection: function(data) { that.replaceMenu('listMenu', getListMenu()); that.replaceMenu('editMenu', getEditMenu()); + that[!ui.item && data.value.length ? 'enableItem' : 'disableItem']('preview'); }, oml_listsort: function(data) { that.checkItem('sortMenu_sortitems_' + data.value[0].key); @@ -596,6 +623,11 @@ oml.ui.mainMenu = function() { }, }); Ox.Event.bind({ + key_alt_shift_f: function() { + if (ui.item && ui.itemView == 'book') { + Ox.Fullscreen.enter(oml.$ui.viewer.find('iframe')[0]); + } + }, key_backtick: function() { changeFocus(1); }, diff --git a/static/js/previewButton.js b/static/js/previewButton.js index e934939..20f26cd 100644 --- a/static/js/previewButton.js +++ b/static/js/previewButton.js @@ -30,5 +30,4 @@ oml.ui.previewButton = function() { return that.updateElement(); - }; \ No newline at end of file