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/baggy/js/shortcuts/entry.js | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'app/Resources/static/themes/baggy') diff --git a/app/Resources/static/themes/baggy/js/shortcuts/entry.js b/app/Resources/static/themes/baggy/js/shortcuts/entry.js index 22aa0caf..c87408b9 100644 --- a/app/Resources/static/themes/baggy/js/shortcuts/entry.js +++ b/app/Resources/static/themes/baggy/js/shortcuts/entry.js @@ -1,22 +1,26 @@ import Mousetrap from 'mousetrap'; import $ from 'jquery'; -/* Article view */ -Mousetrap.bind('o', () => { - $('div#article_toolbar ul.links a.original')[0].click(); -}); +$(document).ready(() => { + if ($('#article').length > 0) { + /* Article view */ + Mousetrap.bind('o', () => { + $('div#article_toolbar ul.links a.original')[0].click(); + }); -/* mark as favorite */ -Mousetrap.bind('f', () => { - $('div#article_toolbar ul.links a.favorite')[0].click(); -}); + /* mark as favorite */ + Mousetrap.bind('f', () => { + $('div#article_toolbar ul.links a.favorite')[0].click(); + }); -/* mark as read */ -Mousetrap.bind('a', () => { - $('div#article_toolbar ul.links a.markasread')[0].click(); -}); + /* mark as read */ + Mousetrap.bind('a', () => { + $('div#article_toolbar ul.links a.markasread')[0].click(); + }); -/* delete */ -Mousetrap.bind('del', () => { - $('div#article_toolbar ul.links a.delete')[0].click(); + /* delete */ + Mousetrap.bind('del', () => { + $('div#article_toolbar ul.links a.delete')[0].click(); + }); + } }); -- cgit v1.2.3