From 0df2a4b021e581c7661968a23e5c8dd5de5273c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 22 Nov 2016 21:31:21 +0100 Subject: Fixed entry shortcuts available in list view --- .../static/themes/material/js/shortcuts/entry.js | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'app/Resources/static/themes/material/js') diff --git a/app/Resources/static/themes/material/js/shortcuts/entry.js b/app/Resources/static/themes/material/js/shortcuts/entry.js index 2dcc93d7..e19800bd 100644 --- a/app/Resources/static/themes/material/js/shortcuts/entry.js +++ b/app/Resources/static/themes/material/js/shortcuts/entry.js @@ -1,22 +1,26 @@ import Mousetrap from 'mousetrap'; import $ from 'jquery'; -/* open original article */ -Mousetrap.bind('o', () => { - $('ul.side-nav a.original i')[0].click(); -}); +$(document).ready(() => { + if ($('#article').length > 0) { + /* open original article */ + Mousetrap.bind('o', () => { + $('ul.side-nav a.original i')[0].click(); + }); -/* mark as favorite */ -Mousetrap.bind('f', () => { - $('ul.side-nav a.favorite i')[0].click(); -}); + /* mark as favorite */ + Mousetrap.bind('f', () => { + $('ul.side-nav a.favorite i')[0].click(); + }); -/* mark as read */ -Mousetrap.bind('a', () => { - $('ul.side-nav a.markasread i')[0].click(); -}); + /* mark as read */ + Mousetrap.bind('a', () => { + $('ul.side-nav a.markasread i')[0].click(); + }); -/* delete */ -Mousetrap.bind('del', () => { - $('ul.side-nav a.delete i')[0].click(); + /* delete */ + Mousetrap.bind('del', () => { + $('ul.side-nav a.delete i')[0].click(); + }); + } }); -- cgit v1.2.3