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 ++++++++++++---------- .../static/themes/material/js/shortcuts/entry.js | 34 ++++++++++++---------- 2 files changed, 38 insertions(+), 30 deletions(-) (limited to 'app/Resources/static') 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(); + }); + } }); 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