]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - app/Resources/static/themes/baggy/js/shortcuts/entry.js
Merge remote-tracking branch 'origin/master' into 2.3
[github/wallabag/wallabag.git] / app / Resources / static / themes / baggy / js / shortcuts / entry.js
index d618f28e86bbbf2ca2aa198a16c6fab0b4a02c61..c87408b92a98a4fe764464ebefad7d6919ecd789 100644 (file)
@@ -1,19 +1,26 @@
-/* Article view */
-Mousetrap.bind('o', () => {
-    $('div#article_toolbar ul.links li:nth-child(2) a')[0].click();
-});
+import Mousetrap from 'mousetrap';
+import $ from 'jquery';
 
-/* mark as favorite */
-Mousetrap.bind('s', () => {
-    $('div#article_toolbar ul.links li:nth-child(5) a')[0].click();
-});
+$(document).ready(() => {
+  if ($('#article').length > 0) {
+    /* Article view */
+    Mousetrap.bind('o', () => {
+      $('div#article_toolbar ul.links a.original')[0].click();
+    });
 
-/* mark as read */
-Mousetrap.bind('a', () => {
-    $('div#article_toolbar ul.links li:nth-child(4) a')[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();
+    });
 
-/* delete */
-Mousetrap.bind('del', () => {
-    $('div#article_toolbar ul.links li:nth-child(7) a')[0].click();
+    /* delete */
+    Mousetrap.bind('del', () => {
+      $('div#article_toolbar ul.links a.delete')[0].click();
+    });
+  }
 });