From 16ef7607f43ebc3e0134360b7657af191e14fe12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 2 Nov 2016 16:44:20 +0100 Subject: Reorganized JS folders for shortcuts --- app/Resources/static/themes/material/js/init.js | 2 ++ .../static/themes/material/js/shortcuts/entry.js | 19 +++++++++++++++++++ .../static/themes/material/js/shortcuts/main.js | 13 +++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 app/Resources/static/themes/material/js/shortcuts/entry.js create mode 100644 app/Resources/static/themes/material/js/shortcuts/main.js (limited to 'app/Resources/static/themes/material/js') diff --git a/app/Resources/static/themes/material/js/init.js b/app/Resources/static/themes/material/js/init.js index d8edeed1..3ff8de0a 100755 --- a/app/Resources/static/themes/material/js/init.js +++ b/app/Resources/static/themes/material/js/init.js @@ -1,6 +1,8 @@ import $ from 'jquery'; import annotator from 'annotator'; import { savePercent, retrievePercent, initFilters, initExport } from '../../_global/js/tools'; +import './shortcuts/main.js'; +import './shortcuts/entry.js'; require('materialize'); // eslint-disable-line diff --git a/app/Resources/static/themes/material/js/shortcuts/entry.js b/app/Resources/static/themes/material/js/shortcuts/entry.js new file mode 100644 index 00000000..900a8214 --- /dev/null +++ b/app/Resources/static/themes/material/js/shortcuts/entry.js @@ -0,0 +1,19 @@ +/* open original article */ +Mousetrap.bind('o', () => { + $('ul.side-nav li:nth-child(2) a i')[0].click(); +}); + +/* mark as favorite */ +Mousetrap.bind('s', () => { + $('ul.side-nav li:nth-child(5) a i')[0].click(); +}); + +/* mark as read */ +Mousetrap.bind('a', () => { + $('ul.side-nav li:nth-child(4) a i')[0].click(); +}); + +/* delete */ +Mousetrap.bind('del', () => { + $('ul.side-nav li:nth-child(6) a i')[0].click(); +}); diff --git a/app/Resources/static/themes/material/js/shortcuts/main.js b/app/Resources/static/themes/material/js/shortcuts/main.js new file mode 100644 index 00000000..ccd3c92d --- /dev/null +++ b/app/Resources/static/themes/material/js/shortcuts/main.js @@ -0,0 +1,13 @@ +/* Actions */ +Mousetrap.bind('g n', () => { + $('#nav-btn-add').trigger('click'); +}); + +Mousetrap.bind('esc', () => { + $('.close').trigger('click'); +}); + +// Display the first element of the current view +Mousetrap.bind('right', () => { + $('ul.data li:first-child span.dot-ellipsis a')[0].click(); +}); -- cgit v1.2.3