aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/Resources
diff options
context:
space:
mode:
Diffstat (limited to 'app/Resources')
-rw-r--r--app/Resources/static/themes/_global/js/shortcuts/main.js3
-rw-r--r--app/Resources/static/themes/_global/js/tools.js5
-rwxr-xr-xapp/Resources/static/themes/baggy/js/init.js12
-rw-r--r--app/Resources/static/themes/baggy/js/shortcuts/entry.js11
-rwxr-xr-xapp/Resources/static/themes/material/js/init.js13
-rw-r--r--app/Resources/static/themes/material/js/shortcuts/entry.js11
-rw-r--r--app/Resources/static/themes/material/js/shortcuts/main.js74
7 files changed, 105 insertions, 24 deletions
diff --git a/app/Resources/static/themes/_global/js/shortcuts/main.js b/app/Resources/static/themes/_global/js/shortcuts/main.js
index 0bb962d0..1f2c1c52 100644
--- a/app/Resources/static/themes/_global/js/shortcuts/main.js
+++ b/app/Resources/static/themes/_global/js/shortcuts/main.js
@@ -1,3 +1,6 @@
1import Mousetrap from 'mousetrap';
2
3
1/** Shortcuts **/ 4/** Shortcuts **/
2 5
3/* Go to */ 6/* Go to */
diff --git a/app/Resources/static/themes/_global/js/tools.js b/app/Resources/static/themes/_global/js/tools.js
index 77879dcd..568b2dce 100644
--- a/app/Resources/static/themes/_global/js/tools.js
+++ b/app/Resources/static/themes/_global/js/tools.js
@@ -1,7 +1,6 @@
1import $ from 'jquery'; 1import $ from 'jquery';
2import Mousetrap from 'mousetrap'; 2import './shortcuts/main';
3import './shortcuts/main.js'; 3import './shortcuts/entry';
4import './shortcuts/entry.js';
5 4
6/* Allows inline call qr-code call */ 5/* Allows inline call qr-code call */
7import jrQrcode from 'jr-qrcode'; // eslint-disable-line 6import jrQrcode from 'jr-qrcode'; // eslint-disable-line
diff --git a/app/Resources/static/themes/baggy/js/init.js b/app/Resources/static/themes/baggy/js/init.js
index 5a8911ad..05360a28 100755
--- a/app/Resources/static/themes/baggy/js/init.js
+++ b/app/Resources/static/themes/baggy/js/init.js
@@ -1,7 +1,5 @@
1/* jQuery */
1import $ from 'jquery'; 2import $ from 'jquery';
2import { initFilters, initExport } from '../../_global/js/tools';
3import './shortcuts/main.js';
4import './shortcuts/entry.js';
5 3
6/* eslint-disable no-unused-vars */ 4/* eslint-disable no-unused-vars */
7/* jquery has default scope */ 5/* jquery has default scope */
@@ -9,8 +7,16 @@ import cookie from 'jquery.cookie';
9import ui from 'jquery-ui-browserify'; 7import ui from 'jquery-ui-browserify';
10/* eslint-enable no-unused-vars */ 8/* eslint-enable no-unused-vars */
11 9
10/* Annotations */
12import annotator from 'annotator'; 11import annotator from 'annotator';
13 12
13/* Shortcuts */
14import './shortcuts/main';
15import './shortcuts/entry';
16import '../../_global/js/shortcuts/main';
17import '../../_global/js/shortcuts/entry';
18
19/* Tools */
14import { savePercent, retrievePercent } from '../../_global/js/tools'; 20import { savePercent, retrievePercent } from '../../_global/js/tools';
15import toggleSaveLinkForm from './uiTools'; 21import toggleSaveLinkForm from './uiTools';
16 22
diff --git a/app/Resources/static/themes/baggy/js/shortcuts/entry.js b/app/Resources/static/themes/baggy/js/shortcuts/entry.js
index d618f28e..77d267a3 100644
--- a/app/Resources/static/themes/baggy/js/shortcuts/entry.js
+++ b/app/Resources/static/themes/baggy/js/shortcuts/entry.js
@@ -1,19 +1,22 @@
1import Mousetrap from 'mousetrap';
2import $ from 'jquery';
3
1/* Article view */ 4/* Article view */
2Mousetrap.bind('o', () => { 5Mousetrap.bind('o', () => {
3 $('div#article_toolbar ul.links li:nth-child(2) a')[0].click(); 6 $('div#article_toolbar ul.links li:nth-child(2) a')[0].click();
4}); 7});
5 8
6/* mark as favorite */ 9/* mark as favorite */
7Mousetrap.bind('s', () => { 10Mousetrap.bind('s', () => {
8 $('div#article_toolbar ul.links li:nth-child(5) a')[0].click(); 11 $('div#article_toolbar ul.links li:nth-child(5) a')[0].click();
9}); 12});
10 13
11/* mark as read */ 14/* mark as read */
12Mousetrap.bind('a', () => { 15Mousetrap.bind('a', () => {
13 $('div#article_toolbar ul.links li:nth-child(4) a')[0].click(); 16 $('div#article_toolbar ul.links li:nth-child(4) a')[0].click();
14}); 17});
15 18
16/* delete */ 19/* delete */
17Mousetrap.bind('del', () => { 20Mousetrap.bind('del', () => {
18 $('div#article_toolbar ul.links li:nth-child(7) a')[0].click(); 21 $('div#article_toolbar ul.links li:nth-child(7) a')[0].click();
19}); 22});
diff --git a/app/Resources/static/themes/material/js/init.js b/app/Resources/static/themes/material/js/init.js
index 3ff8de0a..9746224b 100755
--- a/app/Resources/static/themes/material/js/init.js
+++ b/app/Resources/static/themes/material/js/init.js
@@ -1,8 +1,17 @@
1/* jQuery */
1import $ from 'jquery'; 2import $ from 'jquery';
3
4/* Annotations */
2import annotator from 'annotator'; 5import annotator from 'annotator';
6
7/* Tools */
3import { savePercent, retrievePercent, initFilters, initExport } from '../../_global/js/tools'; 8import { savePercent, retrievePercent, initFilters, initExport } from '../../_global/js/tools';
4import './shortcuts/main.js'; 9
5import './shortcuts/entry.js'; 10/* Import shortcuts */
11import './shortcuts/main';
12import './shortcuts/entry';
13import '../../_global/js/shortcuts/main';
14import '../../_global/js/shortcuts/entry';
6 15
7require('materialize'); // eslint-disable-line 16require('materialize'); // eslint-disable-line
8 17
diff --git a/app/Resources/static/themes/material/js/shortcuts/entry.js b/app/Resources/static/themes/material/js/shortcuts/entry.js
index 900a8214..674253b5 100644
--- a/app/Resources/static/themes/material/js/shortcuts/entry.js
+++ b/app/Resources/static/themes/material/js/shortcuts/entry.js
@@ -1,19 +1,22 @@
1import Mousetrap from 'mousetrap';
2import $ from 'jquery';
3
1/* open original article */ 4/* open original article */
2Mousetrap.bind('o', () => { 5Mousetrap.bind('o', () => {
3 $('ul.side-nav li:nth-child(2) a i')[0].click(); 6 $('ul.side-nav li:nth-child(2) a i')[0].click();
4}); 7});
5 8
6/* mark as favorite */ 9/* mark as favorite */
7Mousetrap.bind('s', () => { 10Mousetrap.bind('s', () => {
8 $('ul.side-nav li:nth-child(5) a i')[0].click(); 11 $('ul.side-nav li:nth-child(5) a i')[0].click();
9}); 12});
10 13
11/* mark as read */ 14/* mark as read */
12Mousetrap.bind('a', () => { 15Mousetrap.bind('a', () => {
13 $('ul.side-nav li:nth-child(4) a i')[0].click(); 16 $('ul.side-nav li:nth-child(4) a i')[0].click();
14}); 17});
15 18
16/* delete */ 19/* delete */
17Mousetrap.bind('del', () => { 20Mousetrap.bind('del', () => {
18 $('ul.side-nav li:nth-child(6) a i')[0].click(); 21 $('ul.side-nav li:nth-child(6) a i')[0].click();
19}); 22});
diff --git a/app/Resources/static/themes/material/js/shortcuts/main.js b/app/Resources/static/themes/material/js/shortcuts/main.js
index ccd3c92d..62b7ec64 100644
--- a/app/Resources/static/themes/material/js/shortcuts/main.js
+++ b/app/Resources/static/themes/material/js/shortcuts/main.js
@@ -1,13 +1,71 @@
1/* Actions */ 1import Mousetrap from 'mousetrap';
2Mousetrap.bind('g n', () => { 2import $ from 'jquery';
3
4function toggleFocus(cardToToogleFocus) {
5 if (cardToToogleFocus) {
6 $(cardToToogleFocus).toggleClass('z-depth-4');
7 }
8}
9let card;
10let cardIndex;
11let cardNumber;
12let pagination;
13
14$(document).ready(() => {
15 cardIndex = 0;
16 cardNumber = $('#content ul.data > li').length;
17 card = $('#content ul.data > li')[cardIndex];
18 pagination = $('.pagination');
19
20 /* If we come from next page */
21 if (window.location.hash === '#prev') {
22 cardIndex = cardNumber - 1;
23 card = $('ul.data > li')[cardIndex];
24 }
25
26 /* Focus current card */
27 toggleFocus(card);
28
29 /* Actions */
30 Mousetrap.bind('g n', () => {
3 $('#nav-btn-add').trigger('click'); 31 $('#nav-btn-add').trigger('click');
4}); 32 });
5 33
6Mousetrap.bind('esc', () => { 34 Mousetrap.bind('esc', () => {
7 $('.close').trigger('click'); 35 $('.close').trigger('click');
8}); 36 });
37
38 /* Select right card. If there's a next page, go to next page */
39 Mousetrap.bind('right', () => {
40 if (cardIndex >= 0 && cardIndex < cardNumber - 1) {
41 toggleFocus(card);
42 cardIndex += 1;
43 card = $('ul.data > li')[cardIndex];
44 toggleFocus(card);
45 return;
46 }
47 if (pagination != null && pagination.find('li.next') && cardIndex === cardNumber - 1) {
48 window.location.href = window.location.origin + $(pagination).find('li.next a').attr('href');
49 return;
50 }
51 });
52
53 /* Select previous card. If there's a previous page, go to next page */
54 Mousetrap.bind('left', () => {
55 if (cardIndex > 0 && cardIndex < cardNumber) {
56 toggleFocus(card);
57 cardIndex -= 1;
58 card = $('ul.data > li')[cardIndex];
59 toggleFocus(card);
60 return;
61 }
62 if (pagination !== null && $(pagination).find('li.prev') && cardIndex === 0) {
63 window.location.href = `${window.location.origin + $(pagination).find('li.prev a').attr('href')}#prev`;
64 return;
65 }
66 });
9 67
10// Display the first element of the current view 68 Mousetrap.bind('enter', () => {
11Mousetrap.bind('right', () => { 69 window.location.href = window.location.origin + $(card).find('span.card-title a').attr('href');
12 $('ul.data li:first-child span.dot-ellipsis a')[0].click(); 70 });
13}); 71});