|
|
@@ -259,19 +259,98 @@ 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");
|
|
|
}
|
|
|
|
|
|
-function auto_share() {
|
|
|
- var $share = $(".flux.current").find('.dropdown-target[id^="dropdown-share"]');
|
|
|
- if ($share.length) {
|
|
|
- window.location.hash = $share.attr('id');
|
|
|
- var scroll = needsScroll($share.closest('.bottom'));
|
|
|
- if (scroll != 0) {
|
|
|
+function auto_share(key) {
|
|
|
+ var share = $(".flux.current.active").find('.dropdown-target[id^="dropdown-share"]');
|
|
|
+ var shares = share.siblings('.dropdown-menu').find('.item a');
|
|
|
+ if (typeof key === "undefined") {
|
|
|
+ if (!share.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // Display the share div
|
|
|
+ window.location.hash = share.attr('id');
|
|
|
+ // Force scrolling to the share div
|
|
|
+ var scroll = needsScroll(share.closest('.bottom'));
|
|
|
+ if (scroll !== 0) {
|
|
|
$('html,body').scrollTop(scroll);
|
|
|
}
|
|
|
+ // Force the key value if there is only one action, so we can trigger it automatically
|
|
|
+ if (shares.length === 1) {
|
|
|
+ key = 1;
|
|
|
+ } else {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // Trigger selected share action and hide the share div
|
|
|
+ key = parseInt(key);
|
|
|
+ if (key <= shares.length) {
|
|
|
+ shares[key - 1].click();
|
|
|
+ share.siblings('.dropdown-menu').find('.dropdown-close a')[0].click();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -406,12 +485,19 @@ function init_shortcuts() {
|
|
|
}, {
|
|
|
'disable_in_input': true
|
|
|
});
|
|
|
+ for(var i = 1; i < 10; i++){
|
|
|
+ shortcut.add(i.toString(), function (e) {
|
|
|
+ auto_share(String.fromCharCode(e.keyCode));
|
|
|
+ }, {
|
|
|
+ 'disable_in_input': true
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- // 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");
|
|
|
|
|
|
@@ -424,7 +510,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");
|
|
|
|
|
|
@@ -434,8 +520,35 @@ 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");
|
|
|
+ var url_website = $(".flux.current .link a").attr("href");
|
|
|
|
|
|
if (auto_mark_site) {
|
|
|
$(".flux.current").each(function () {
|