A free, self-hostable news aggregator…
Merge branch 'dev' into shortcuts
Alexis Degrugillieraa63f9f64fbf
diff --cc p/scripts/main.jsindex e9d6c40da,c4c0db21a..5a4fb5fb8--- a/p/scripts/main.js+++ b/p/scripts/main.js@@@ -313,27 -264,14 +325,32 @@@ function collapse_entry()$(".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();}}