diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-11-02 16:44:20 +0100 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2016-11-15 21:54:50 +0100 |
commit | 16ef7607f43ebc3e0134360b7657af191e14fe12 (patch) | |
tree | 81cdc13b1b626e313a51119847c5b7c603ca5fba /app/Resources | |
parent | af61cb80eb600618df95a01a15a08e87fc878c2a (diff) | |
download | wallabag-16ef7607f43ebc3e0134360b7657af191e14fe12.tar.gz wallabag-16ef7607f43ebc3e0134360b7657af191e14fe12.tar.zst wallabag-16ef7607f43ebc3e0134360b7657af191e14fe12.zip |
Reorganized JS folders for shortcuts
Diffstat (limited to 'app/Resources')
9 files changed, 71 insertions, 46 deletions
diff --git a/app/Resources/static/themes/_global/js/shortcuts/entry.js b/app/Resources/static/themes/_global/js/shortcuts/entry.js new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/app/Resources/static/themes/_global/js/shortcuts/entry.js | |||
diff --git a/app/Resources/static/themes/_global/js/shortcuts/main.js b/app/Resources/static/themes/_global/js/shortcuts/main.js new file mode 100644 index 00000000..0bb962d0 --- /dev/null +++ b/app/Resources/static/themes/_global/js/shortcuts/main.js | |||
@@ -0,0 +1,13 @@ | |||
1 | /** Shortcuts **/ | ||
2 | |||
3 | /* Go to */ | ||
4 | Mousetrap.bind('g u', () => { window.location.href = Routing.generate('homepage'); }); | ||
5 | Mousetrap.bind('g s', () => { window.location.href = Routing.generate('starred'); }); | ||
6 | Mousetrap.bind('g r', () => { window.location.href = Routing.generate('archive'); }); | ||
7 | Mousetrap.bind('g a', () => { window.location.href = Routing.generate('all'); }); | ||
8 | Mousetrap.bind('g t', () => { window.location.href = Routing.generate('tag'); }); | ||
9 | Mousetrap.bind('g c', () => { window.location.href = Routing.generate('config'); }); | ||
10 | Mousetrap.bind('g i', () => { window.location.href = Routing.generate('import'); }); | ||
11 | Mousetrap.bind('g d', () => { window.location.href = Routing.generate('developer'); }); | ||
12 | Mousetrap.bind('?', () => { window.location.href = Routing.generate('howto'); }); | ||
13 | Mousetrap.bind('g l', () => { window.location.href = Routing.generate('logout'); }); | ||
diff --git a/app/Resources/static/themes/_global/js/tools.js b/app/Resources/static/themes/_global/js/tools.js index 96d9fcf6..77879dcd 100644 --- a/app/Resources/static/themes/_global/js/tools.js +++ b/app/Resources/static/themes/_global/js/tools.js | |||
@@ -1,5 +1,7 @@ | |||
1 | import $ from 'jquery'; | 1 | import $ from 'jquery'; |
2 | import Mousetrap from 'mousetrap'; | 2 | import Mousetrap from 'mousetrap'; |
3 | import './shortcuts/main.js'; | ||
4 | import './shortcuts/entry.js'; | ||
3 | 5 | ||
4 | /* Allows inline call qr-code call */ | 6 | /* Allows inline call qr-code call */ |
5 | import jrQrcode from 'jr-qrcode'; // eslint-disable-line | 7 | import jrQrcode from 'jr-qrcode'; // eslint-disable-line |
@@ -52,49 +54,3 @@ function initExport() { | |||
52 | } | 54 | } |
53 | 55 | ||
54 | export { savePercent, retrievePercent, initFilters, initExport }; | 56 | export { savePercent, retrievePercent, initFilters, initExport }; |
55 | |||
56 | /** Shortcuts **/ | ||
57 | |||
58 | /* Go to */ | ||
59 | Mousetrap.bind('g u', () => { window.location.href = Routing.generate('homepage'); }); | ||
60 | Mousetrap.bind('g s', () => { window.location.href = Routing.generate('starred'); }); | ||
61 | Mousetrap.bind('g r', () => { window.location.href = Routing.generate('archive'); }); | ||
62 | Mousetrap.bind('g a', () => { window.location.href = Routing.generate('all'); }); | ||
63 | Mousetrap.bind('g t', () => { window.location.href = Routing.generate('tag'); }); | ||
64 | Mousetrap.bind('g c', () => { window.location.href = Routing.generate('config'); }); | ||
65 | Mousetrap.bind('g i', () => { window.location.href = Routing.generate('import'); }); | ||
66 | Mousetrap.bind('g d', () => { window.location.href = Routing.generate('developer'); }); | ||
67 | Mousetrap.bind('g h', () => { window.location.href = Routing.generate('howto'); }); | ||
68 | Mousetrap.bind('g l', () => { window.location.href = Routing.generate('logout'); }); | ||
69 | |||
70 | |||
71 | /* Actions */ | ||
72 | Mousetrap.bind('g n', () => { | ||
73 | $('#nav-btn-add').trigger('click'); | ||
74 | }); | ||
75 | |||
76 | Mousetrap.bind('esc', () => { | ||
77 | $('.close').trigger('click'); | ||
78 | }); | ||
79 | |||
80 | // Display the first element of the current view | ||
81 | Mousetrap.bind('right', () => { | ||
82 | $('ul.data li:first-child span.dot-ellipsis a')[0].click(); | ||
83 | }); | ||
84 | |||
85 | /* Article view */ | ||
86 | Mousetrap.bind('o', () => { | ||
87 | $('ul.side-nav li:nth-child(2) a i')[0].click(); | ||
88 | }); | ||
89 | |||
90 | Mousetrap.bind('s', () => { | ||
91 | $('ul.side-nav li:nth-child(5) a i')[0].click(); | ||
92 | }); | ||
93 | |||
94 | Mousetrap.bind('a', () => { | ||
95 | $('ul.side-nav li:nth-child(4) a i')[0].click(); | ||
96 | }); | ||
97 | |||
98 | Mousetrap.bind('del', () => { | ||
99 | $('ul.side-nav li:nth-child(6) a i')[0].click(); | ||
100 | }); | ||
diff --git a/app/Resources/static/themes/baggy/js/init.js b/app/Resources/static/themes/baggy/js/init.js index b7347f7c..5a8911ad 100755 --- a/app/Resources/static/themes/baggy/js/init.js +++ b/app/Resources/static/themes/baggy/js/init.js | |||
@@ -1,4 +1,7 @@ | |||
1 | import $ from 'jquery'; | 1 | import $ from 'jquery'; |
2 | import { initFilters, initExport } from '../../_global/js/tools'; | ||
3 | import './shortcuts/main.js'; | ||
4 | import './shortcuts/entry.js'; | ||
2 | 5 | ||
3 | /* eslint-disable no-unused-vars */ | 6 | /* eslint-disable no-unused-vars */ |
4 | /* jquery has default scope */ | 7 | /* jquery has default scope */ |
diff --git a/app/Resources/static/themes/baggy/js/shortcuts/entry.js b/app/Resources/static/themes/baggy/js/shortcuts/entry.js new file mode 100644 index 00000000..d618f28e --- /dev/null +++ b/app/Resources/static/themes/baggy/js/shortcuts/entry.js | |||
@@ -0,0 +1,19 @@ | |||
1 | /* Article view */ | ||
2 | Mousetrap.bind('o', () => { | ||
3 | $('div#article_toolbar ul.links li:nth-child(2) a')[0].click(); | ||
4 | }); | ||
5 | |||
6 | /* mark as favorite */ | ||
7 | Mousetrap.bind('s', () => { | ||
8 | $('div#article_toolbar ul.links li:nth-child(5) a')[0].click(); | ||
9 | }); | ||
10 | |||
11 | /* mark as read */ | ||
12 | Mousetrap.bind('a', () => { | ||
13 | $('div#article_toolbar ul.links li:nth-child(4) a')[0].click(); | ||
14 | }); | ||
15 | |||
16 | /* delete */ | ||
17 | Mousetrap.bind('del', () => { | ||
18 | $('div#article_toolbar ul.links li:nth-child(7) a')[0].click(); | ||
19 | }); | ||
diff --git a/app/Resources/static/themes/baggy/js/shortcuts/main.js b/app/Resources/static/themes/baggy/js/shortcuts/main.js new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/app/Resources/static/themes/baggy/js/shortcuts/main.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 @@ | |||
1 | import $ from 'jquery'; | 1 | import $ from 'jquery'; |
2 | import annotator from 'annotator'; | 2 | import annotator from 'annotator'; |
3 | import { savePercent, retrievePercent, initFilters, initExport } from '../../_global/js/tools'; | 3 | import { savePercent, retrievePercent, initFilters, initExport } from '../../_global/js/tools'; |
4 | import './shortcuts/main.js'; | ||
5 | import './shortcuts/entry.js'; | ||
4 | 6 | ||
5 | require('materialize'); // eslint-disable-line | 7 | require('materialize'); // eslint-disable-line |
6 | 8 | ||
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 @@ | |||
1 | /* open original article */ | ||
2 | Mousetrap.bind('o', () => { | ||
3 | $('ul.side-nav li:nth-child(2) a i')[0].click(); | ||
4 | }); | ||
5 | |||
6 | /* mark as favorite */ | ||
7 | Mousetrap.bind('s', () => { | ||
8 | $('ul.side-nav li:nth-child(5) a i')[0].click(); | ||
9 | }); | ||
10 | |||
11 | /* mark as read */ | ||
12 | Mousetrap.bind('a', () => { | ||
13 | $('ul.side-nav li:nth-child(4) a i')[0].click(); | ||
14 | }); | ||
15 | |||
16 | /* delete */ | ||
17 | Mousetrap.bind('del', () => { | ||
18 | $('ul.side-nav li:nth-child(6) a i')[0].click(); | ||
19 | }); | ||
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 @@ | |||
1 | /* Actions */ | ||
2 | Mousetrap.bind('g n', () => { | ||
3 | $('#nav-btn-add').trigger('click'); | ||
4 | }); | ||
5 | |||
6 | Mousetrap.bind('esc', () => { | ||
7 | $('.close').trigger('click'); | ||
8 | }); | ||
9 | |||
10 | // Display the first element of the current view | ||
11 | Mousetrap.bind('right', () => { | ||
12 | $('ul.data li:first-child span.dot-ellipsis a')[0].click(); | ||
13 | }); | ||