diff options
| author | 2014-02-02 10:02:45 -0500 | |
|---|---|---|
| committer | 2014-02-02 10:07:30 -0500 | |
| commit | a201450b5817af23a57e8c68569c24ed5451b7ef (patch) | |
| tree | a0327c01dbb818d332d32ec98f506e76388c8ddd /p/scripts | |
| parent | f8be8eb41b50d0bea6f6c362abc33fb4ac546f3d (diff) | |
Modification des raccourcis de navigation
Modification du raccourci pour naviguer au premier article (Home au lieu de Shift+j)
Modification du raccourci pour naviguer au dernier article (End au lieu de Shift+k)
Ajout de modificateurs pour utiliser les touches de navigation dans d'autres contextes (Shift pour les flux, Ctrl pour les catégories)
Voir issue#256
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 94 |
1 files changed, 91 insertions, 3 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index ee729b9e5..e9d6c40da 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -247,6 +247,67 @@ function next_entry() { } } +function prev_feed() { + if ($('li.active').length > 0) { + var pf = $('li.active').prev().find('a.feed'); + if (pf.length > 0) { + pf[0].click(); + } + } else { + first_feed(); + } +} + +function next_feed() { + if ($('li.active').length > 0) { + var nf = $('li.active').next().find('a.feed'); + if (nf.length > 0) { + nf[0].click(); + } + } else { + last_feed(); + } +} + +function first_feed() { + $('.feeds.active li').first().find('a')[1].click(); +} + +function last_feed() { + $('.feeds.active li').last().find('a')[1].click(); +} + +function prev_category() { + if ($('div.active').length > 0) { + var pc = $('div.active').parent('li').prev().find('div.stick a.btn'); + if (pc.length > 0) { + pc[0].click(); + return; + } + } else { + first_category(); + } +} + +function next_category() { + if ($('div.active').length > 0) { + var nc = $('div.active').parent('li').next().find('div.stick a.btn'); + if (nc.length > 0) { + nc[0].click(); + } + } else { + last_category(); + } +} + +function first_category() { + $('div.category.stick').first().find('a.btn')[0].click(); +} + +function last_category() { + $('div.category.stick').last().find('a.btn')[0].click(); +} + function collapse_entry() { isCollapsed = !isCollapsed; $(".flux.current").toggleClass("active"); @@ -415,11 +476,11 @@ function init_shortcuts() { }); } - // Touches de navigation + // Touches de navigation pour les articles shortcut.add(shortcuts.prev_entry, prev_entry, { 'disable_in_input': true }); - shortcut.add("shift+" + shortcuts.prev_entry, function () { + shortcut.add(shortcuts.first_entry, function () { var old_active = $(".flux.current"), first = $(".flux:first"); @@ -432,7 +493,7 @@ function init_shortcuts() { shortcut.add(shortcuts.next_entry, next_entry, { 'disable_in_input': true }); - shortcut.add("shift+" + shortcuts.next_entry, function () { + shortcut.add(shortcuts.last_entry, function () { var old_active = $(".flux.current"), last = $(".flux:last"); @@ -442,6 +503,33 @@ function init_shortcuts() { }, { 'disable_in_input': true }); + // Touches de navigation pour les flux + shortcut.add("shift+" + shortcuts.prev_entry, prev_feed, { + 'disable_in_input': true + }); + shortcut.add("shift+" + shortcuts.next_entry, next_feed, { + 'disable_in_input': true + }); + shortcut.add("shift+" + shortcuts.first_entry, first_feed, { + 'disable_in_input': true + }); + shortcut.add("shift+" + shortcuts.last_entry, last_feed, { + 'disable_in_input': true + }); + // Touches de navigation pour les categories + shortcut.add("ctrl+" + shortcuts.prev_entry, prev_category, { + 'disable_in_input': true + }); + shortcut.add("ctrl+" + shortcuts.next_entry, next_category, { + 'disable_in_input': true + }); + shortcut.add("ctrl+" + shortcuts.first_entry, first_category, { + 'disable_in_input': true + }); + shortcut.add("ctrl+" + shortcuts.last_entry, last_category, { + 'disable_in_input': true + }); + shortcut.add(shortcuts.go_website, function () { var url_website = $(".flux.active .link a").attr("href"); |
