diff --git a/i18n/_locales/en_US/messages.json b/i18n/_locales/en_US/messages.json index caac753d4..958edd03a 100644 --- a/i18n/_locales/en_US/messages.json +++ b/i18n/_locales/en_US/messages.json @@ -5,7 +5,15 @@ }, "about" : { "message" : "About" - }, + }, + + "add_epub_dialog" : { + "message" : "Add Epub to Library" + }, + + "list_view_thumbnail_view_toggle" : { + "message" : "Toggle List View and Thumbnail View"}, + "preview" : { "message" : "PREVIEW" }, diff --git a/lib/EpubLibrary.js b/lib/EpubLibrary.js index c2b49bda3..c3bac116a 100644 --- a/lib/EpubLibrary.js +++ b/lib/EpubLibrary.js @@ -242,6 +242,19 @@ define(['jquery', 'bootstrap', 'storage/StorageManager', 'storage/Settings', 'Ep } var loadLibraryUI = function(){ + + var listViewThumbnailViewToggle = function (){ + if (document.body.className.indexOf("list-view") > -1) + { + $(document.body).removeClass('list-view'); + setTimeout(function(){ $('.icon-list-view')[0].focus(); }, 50); + } + else + { + $(document.body).addClass('list-view'); + setTimeout(function(){ $('.icon-thumbnails')[0].focus(); }, 50); + } + } Dialogs.reset(); @@ -292,21 +305,23 @@ define(['jquery', 'bootstrap', 'storage/StorageManager', 'storage/Settings', 'Ep $('nav').empty(); $('nav').attr("aria-label", Strings.i18n_toolbar); $('nav').append(LibraryNavbar({strings: Strings, dialogs: Dialogs, keyboard: Keyboard})); - $('.icon-list-view').on('click', function(){ - $(document.body).addClass('list-view'); - setTimeout(function(){ $('.icon-thumbnails')[0].focus(); }, 50); - }); - $('.icon-thumbnails').on('click', function(){ - $(document.body).removeClass('list-view'); - setTimeout(function(){ $('.icon-list-view')[0].focus(); }, 50); - }); + + $('.icon-list-view').on('click', listViewThumbnailViewToggle); + $('.icon-thumbnails').on('click', listViewThumbnailViewToggle); + + Keyboard.on(Keyboard.ListViewThumbnailViewToggle, 'library', listViewThumbnailViewToggle); + findHeightRule(); setItemHeight(); StorageManager.initStorage(function(){ libraryManager.retrieveAvailableEpubs(loadLibraryItems); }, showError); - Keyboard.on(Keyboard.ShowSettingsModal, 'library', function(){$('#settings-dialog').modal("show");}); + Keyboard.on(Keyboard.ShowSettingsModal, 'library', function(){$('#settings-dialog').modal("show");}); + + Keyboard.on(Keyboard.AboutDialog, 'library', function (){$('#about-dialog').modal("show");}); + + Keyboard.on(Keyboard.AddEpubDialog, 'library' ,function (){$('#add-epub-dialog').modal("show");} ); $(window).trigger('libraryUIReady'); $(window).on('resize', setItemHeight); diff --git a/lib/EpubReader.js b/lib/EpubReader.js index b065f024d..53d4b3473 100644 --- a/lib/EpubReader.js +++ b/lib/EpubReader.js @@ -491,6 +491,8 @@ catch (e) $(window).trigger('loadlibrary'); }; + + Keyboard.on(Keyboard.AboutDialog, 'reader', function (){$('#about-dialog').modal("show");}); Keyboard.on(Keyboard.SwitchToLibrary, 'reader', loadlibrary /* function(){setTimeout(, 30);} */ ); diff --git a/lib/Keyboard.js b/lib/Keyboard.js index 6aa7d69fb..af950248d 100644 --- a/lib/Keyboard.js +++ b/lib/Keyboard.js @@ -387,6 +387,12 @@ define(['i18n/Strings', 'keymaster', 'storage/Settings'], function(Strings, key, }, i18n: { + AddEpubDialog: Strings.add_epub_dialog, + + AboutDialog: Strings.about, + + ListViewThumbnailViewToggle: Strings.list_view_thumbnail_view_toggle, + ShowSettingsModal: Strings.settings, SettingsModalSave: Strings.settings + " - " + Strings.i18n_save_changes, @@ -434,6 +440,13 @@ define(['i18n/Strings', 'keymaster', 'storage/Settings'], function(Strings, key, }, defaultOptions: {}, accesskeys: {}, // single key strokes are dynamically populated, based on the full shortcuts below: + + AboutDialog: 'e', //accesskey'ed + + AddEpubDialog: 'p', //accesskey'ed + + ListViewThumbnailViewToggle: 'f', //accesskey'ed + ShowSettingsModal: 'o', //accesskey'ed SettingsModalSave: 's', //accesskey'ed diff --git a/templates/library-navbar.html b/templates/library-navbar.html index 28ffea6f9..c666da95d 100644 --- a/templates/library-navbar.html +++ b/templates/library-navbar.html @@ -1,14 +1,14 @@