diff --git a/src/UI/Config.js b/src/UI/Config.js
index 7a0b03862..7c83f527f 100644
--- a/src/UI/Config.js
+++ b/src/UI/Config.js
@@ -7,6 +7,7 @@ define(
Events: {
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
},
+
Keys : {
DefaultProfileId : 'DefaultProfileId',
DefaultRootFolderId : 'DefaultRootFolderId',
diff --git a/src/UI/Content/theme.less b/src/UI/Content/theme.less
index 6c13b071b..7a45d851a 100644
--- a/src/UI/Content/theme.less
+++ b/src/UI/Content/theme.less
@@ -16,6 +16,7 @@
@import "../Rename/rename";
@import "typeahead";
@import "utilities";
+@import "../Hotkeys/hotkeys";
.main-region {
@media (min-width: @screen-lg-min) {
@@ -239,3 +240,10 @@ body {
padding-top: 10px;
}
}
+
+.modal-header {
+ h3 {
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+}
diff --git a/src/UI/Hotkeys/Hotkeys.js b/src/UI/Hotkeys/Hotkeys.js
new file mode 100644
index 000000000..272307ee0
--- /dev/null
+++ b/src/UI/Hotkeys/Hotkeys.js
@@ -0,0 +1,37 @@
+'use strict';
+
+define(
+ [
+ 'jquery',
+ 'vent',
+ 'Hotkeys/HotkeysView'
+ ], function ($, vent, HotkeysView) {
+ $(document).on('keydown', function (e) {
+ if (e.ctrlKey && e.keyCode === 83) {
+ vent.trigger(vent.Hotkeys.SaveSettings);
+ e.preventDefault();
+ return;
+ }
+
+ if (e.shiftKey && e.keyCode === 191) {
+ vent.trigger(vent.Commands.OpenModalCommand, new HotkeysView());
+// vent.trigger(vent.Hotkeys.ShowHotkeys);
+ e.preventDefault();
+ return;
+ }
+
+ if ($(e.target).is('input') || $(e.target).is('textarea')) {
+ return;
+ }
+
+ if (e.ctrlKey || e.metaKey || e.altKey) {
+ return;
+ }
+
+ if (e.keyCode === 84) {
+ vent.trigger(vent.Hotkeys.NavbarSearch);
+ e.preventDefault();
+ }
+ });
+
+ });
diff --git a/src/UI/Hotkeys/HotkeysView.js b/src/UI/Hotkeys/HotkeysView.js
new file mode 100644
index 000000000..affbc9f60
--- /dev/null
+++ b/src/UI/Hotkeys/HotkeysView.js
@@ -0,0 +1,11 @@
+'use strict';
+define(
+ [
+ 'vent',
+ 'marionette'
+ ], function (vent, Marionette) {
+
+ return Marionette.ItemView.extend({
+ template: 'Hotkeys/HotkeysViewTemplate'
+ });
+ });
diff --git a/src/UI/Hotkeys/HotkeysViewTemplate.html b/src/UI/Hotkeys/HotkeysViewTemplate.html
new file mode 100644
index 000000000..aeae692b1
--- /dev/null
+++ b/src/UI/Hotkeys/HotkeysViewTemplate.html
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
Focus Search Box
+
+
+ t
+
+
+
+
+ Pressing 't' puts the cursor in the search box below the navigation links
+
+
+
+
+
+
+
+
+
Save Settings
+
+
+ ctrl + s
+
+
+
+
+ Pressing ctrl + 's' saves your settings (only in settings)
+
+
+
+
+
+
+
+
diff --git a/src/UI/Hotkeys/hotkeys.less b/src/UI/Hotkeys/hotkeys.less
new file mode 100644
index 000000000..b3213825d
--- /dev/null
+++ b/src/UI/Hotkeys/hotkeys.less
@@ -0,0 +1,23 @@
+.hotkeys-modal {
+ h3 {
+ margin-top : 0px;
+ margin-botton : 0px;
+ }
+
+ .hotkey-group {
+ &:first-of-type {
+ margin-top : 0px;
+ }
+
+ &:last-of-type {
+ margin-bottom : 0px;
+ }
+
+ margin-top : 25px;
+ margin-bottom : 25px;
+
+ .hotkey {
+ font-size : 22px;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/UI/Navbar/Search.js b/src/UI/Navbar/Search.js
index d92bbfcad..ea8b04d7e 100644
--- a/src/UI/Navbar/Search.js
+++ b/src/UI/Navbar/Search.js
@@ -3,23 +3,14 @@ define(
[
'underscore',
'jquery',
+ 'vent',
'backbone',
'Series/SeriesCollection',
'typeahead'
- ], function (_, $, Backbone, SeriesCollection) {
- $(document).on('keydown', function (e) {
- if ($(e.target).is('input') || $(e.target).is('textarea')) {
- return;
- }
+ ], function (_, $, vent, Backbone, SeriesCollection) {
- if (e.ctrlKey || e.metaKey || e.altKey) {
- return;
- }
-
- if (e.keyCode === 84) {
- $('.x-series-search').focus();
- e.preventDefault();
- }
+ vent.on(vent.Hotkeys.NavbarSearch, function () {
+ $('.x-series-search').focus();
});
$.fn.bindSearch = function () {
diff --git a/src/UI/Settings/SettingsLayout.js b/src/UI/Settings/SettingsLayout.js
index acd7fbc33..a346e915a 100644
--- a/src/UI/Settings/SettingsLayout.js
+++ b/src/UI/Settings/SettingsLayout.js
@@ -89,6 +89,8 @@ define(
if (options.action) {
this.action = options.action.toLowerCase();
}
+
+ this.listenTo(vent, vent.Hotkeys.SaveSettings, this._save);
},
onRender: function () {
diff --git a/src/UI/app.js b/src/UI/app.js
index 016761351..a0878855c 100644
--- a/src/UI/app.js
+++ b/src/UI/app.js
@@ -245,7 +245,8 @@ define(
'System/StatusModel',
'Shared/Tooltip',
'Instrumentation/StringFormat',
- 'LifeCycle'
+ 'LifeCycle',
+ 'Hotkeys/Hotkeys'
], function ($, Backbone, Marionette, RouteBinder, SignalRBroadcaster, NavbarView, AppLayout, SeriesController, Router, ModalController, ControlPanelController, serverStatusModel, Tooltip) {
new SeriesController();
diff --git a/src/UI/vent.js b/src/UI/vent.js
index c50fc358d..7292a3742 100644
--- a/src/UI/vent.js
+++ b/src/UI/vent.js
@@ -30,5 +30,11 @@ define(
CloseControlPanelCommand : 'CloseControlPanelCommand'
};
+ vent.Hotkeys = {
+ NavbarSearch : 'navbar:search',
+ SaveSettings : 'settings:save',
+ ShowHotkeys : 'hotkeys:show'
+ };
+
return vent;
});