From af61cb80eb600618df95a01a15a08e87fc878c2a Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 27 Oct 2016 01:57:27 +0200 Subject: es6 imports Signed-off-by: Thomas Citharel --- .../static/themes/baggy/js/autoCompleteTags.js | 2 +- app/Resources/static/themes/baggy/js/init.js | 18 ++++++++++++------ app/Resources/static/themes/baggy/js/uiTools.js | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'app/Resources/static/themes/baggy') diff --git a/app/Resources/static/themes/baggy/js/autoCompleteTags.js b/app/Resources/static/themes/baggy/js/autoCompleteTags.js index f287ebfa..64fdaa92 100755 --- a/app/Resources/static/themes/baggy/js/autoCompleteTags.js +++ b/app/Resources/static/themes/baggy/js/autoCompleteTags.js @@ -5,4 +5,4 @@ function extractLast(term) { return split(term).pop(); } -export { split, extractLast }; +export default { split, extractLast }; diff --git a/app/Resources/static/themes/baggy/js/init.js b/app/Resources/static/themes/baggy/js/init.js index dc11043a..b7347f7c 100755 --- a/app/Resources/static/themes/baggy/js/init.js +++ b/app/Resources/static/themes/baggy/js/init.js @@ -1,11 +1,17 @@ -import { savePercent, retrievePercent } from '../../_global/js/tools'; -import { toggleSaveLinkForm } from './uiTools'; +import $ from 'jquery'; + +/* eslint-disable no-unused-vars */ +/* jquery has default scope */ +import cookie from 'jquery.cookie'; +import ui from 'jquery-ui-browserify'; +/* eslint-enable no-unused-vars */ -const $ = global.jquery = require('jquery'); -require('jquery.cookie'); -require('jquery-ui-browserify'); -const annotator = require('annotator'); +import annotator from 'annotator'; + +import { savePercent, retrievePercent } from '../../_global/js/tools'; +import toggleSaveLinkForm from './uiTools'; +global.jquery = $; $.fn.ready(() => { const $listmode = $('#listmode'); diff --git a/app/Resources/static/themes/baggy/js/uiTools.js b/app/Resources/static/themes/baggy/js/uiTools.js index 900b2707..713c53f7 100644 --- a/app/Resources/static/themes/baggy/js/uiTools.js +++ b/app/Resources/static/themes/baggy/js/uiTools.js @@ -1,4 +1,4 @@ -const $ = require('jquery'); +import $ from 'jquery'; function toggleSaveLinkForm(url, event) { $('#add-link-result').empty(); @@ -32,4 +32,4 @@ function toggleSaveLinkForm(url, event) { plainUrl.focus(); } -export { toggleSaveLinkForm }; +export default toggleSaveLinkForm; -- cgit v1.2.3 From 16ef7607f43ebc3e0134360b7657af191e14fe12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 2 Nov 2016 16:44:20 +0100 Subject: Reorganized JS folders for shortcuts --- app/Resources/static/themes/baggy/js/init.js | 3 +++ .../static/themes/baggy/js/shortcuts/entry.js | 19 +++++++++++++++++++ .../static/themes/baggy/js/shortcuts/main.js | 0 3 files changed, 22 insertions(+) create mode 100644 app/Resources/static/themes/baggy/js/shortcuts/entry.js create mode 100644 app/Resources/static/themes/baggy/js/shortcuts/main.js (limited to 'app/Resources/static/themes/baggy') 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 @@ import $ from 'jquery'; +import { initFilters, initExport } from '../../_global/js/tools'; +import './shortcuts/main.js'; +import './shortcuts/entry.js'; /* eslint-disable no-unused-vars */ /* 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 @@ +/* Article view */ +Mousetrap.bind('o', () => { + $('div#article_toolbar ul.links li:nth-child(2) a')[0].click(); +}); + +/* mark as favorite */ +Mousetrap.bind('s', () => { + $('div#article_toolbar ul.links li:nth-child(5) a')[0].click(); +}); + +/* mark as read */ +Mousetrap.bind('a', () => { + $('div#article_toolbar ul.links li:nth-child(4) a')[0].click(); +}); + +/* delete */ +Mousetrap.bind('del', () => { + $('div#article_toolbar ul.links li:nth-child(7) a')[0].click(); +}); 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 -- cgit v1.2.3 From 5637a26e9af98a05c76823c85611315cd1a986e0 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 3 Nov 2016 10:02:16 +0100 Subject: Bring navigation (with right, left and enter) on material entries page. Supports going to next and previous page ! Also better indentation for js files (changed editorconfig for them). Signed-off-by: Thomas Citharel --- app/Resources/static/themes/baggy/js/init.js | 12 +++++++++--- app/Resources/static/themes/baggy/js/shortcuts/entry.js | 11 +++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'app/Resources/static/themes/baggy') 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 @@ +/* jQuery */ import $ from 'jquery'; -import { initFilters, initExport } from '../../_global/js/tools'; -import './shortcuts/main.js'; -import './shortcuts/entry.js'; /* eslint-disable no-unused-vars */ /* jquery has default scope */ @@ -9,8 +7,16 @@ import cookie from 'jquery.cookie'; import ui from 'jquery-ui-browserify'; /* eslint-enable no-unused-vars */ +/* Annotations */ import annotator from 'annotator'; +/* Shortcuts */ +import './shortcuts/main'; +import './shortcuts/entry'; +import '../../_global/js/shortcuts/main'; +import '../../_global/js/shortcuts/entry'; + +/* Tools */ import { savePercent, retrievePercent } from '../../_global/js/tools'; import toggleSaveLinkForm from './uiTools'; 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 @@ +import Mousetrap from 'mousetrap'; +import $ from 'jquery'; + /* Article view */ Mousetrap.bind('o', () => { - $('div#article_toolbar ul.links li:nth-child(2) a')[0].click(); + $('div#article_toolbar ul.links li:nth-child(2) a')[0].click(); }); /* mark as favorite */ Mousetrap.bind('s', () => { - $('div#article_toolbar ul.links li:nth-child(5) a')[0].click(); + $('div#article_toolbar ul.links li:nth-child(5) a')[0].click(); }); /* mark as read */ Mousetrap.bind('a', () => { - $('div#article_toolbar ul.links li:nth-child(4) a')[0].click(); + $('div#article_toolbar ul.links li:nth-child(4) a')[0].click(); }); /* delete */ Mousetrap.bind('del', () => { - $('div#article_toolbar ul.links li:nth-child(7) a')[0].click(); + $('div#article_toolbar ul.links li:nth-child(7) a')[0].click(); }); -- cgit v1.2.3 From 94f2057ffefdb164ae388a6971b4ed052082a434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 16 Nov 2016 09:17:12 +0100 Subject: Added CSS class on links --- app/Resources/static/themes/baggy/js/shortcuts/entry.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 77d267a3..728df8bd 100644 --- a/app/Resources/static/themes/baggy/js/shortcuts/entry.js +++ b/app/Resources/static/themes/baggy/js/shortcuts/entry.js @@ -3,20 +3,20 @@ import $ from 'jquery'; /* Article view */ Mousetrap.bind('o', () => { - $('div#article_toolbar ul.links li:nth-child(2) a')[0].click(); + $('div#article_toolbar ul.links a.original')[0].click(); }); /* mark as favorite */ Mousetrap.bind('s', () => { - $('div#article_toolbar ul.links li:nth-child(5) a')[0].click(); + $('div#article_toolbar ul.links a.favorite')[0].click(); }); /* mark as read */ Mousetrap.bind('a', () => { - $('div#article_toolbar ul.links li:nth-child(4) a')[0].click(); + $('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(); + $('div#article_toolbar ul.links a.delete')[0].click(); }); -- cgit v1.2.3