aboutsummaryrefslogtreecommitdiff
path: root/p/scripts
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <github@ainw.org> 2014-01-03 00:01:29 -0500
committerGravatar Alexis Degrugillier <github@ainw.org> 2014-01-03 00:01:29 -0500
commit7db271e95ebab52c31c78f51270de71af1d750d2 (patch)
tree6e8a825d6954b401b1cb7a2f7147747f1fcdd90a /p/scripts
parentb4c477ca41a7ecaa6364dd6a97603829b14b11ef (diff)
Add a shortcut to open the share div. The default shortcut is "s".
Diffstat (limited to 'p/scripts')
-rw-r--r--p/scripts/main.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index ef05eb2fb..43b0384e8 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -220,6 +220,13 @@ function collapse_entry() {
$(".flux.current").toggleClass("active");
}
+function auto_share() {
+ var share = $(".flux.current.active").find('.dropdown-target[id^="dropdown-share"]');
+ if (share.length) {
+ window.location.replace('/i/#' + share.attr('id'));
+ }
+}
+
function inMarkViewport(flux, box_to_follow, relative_follow) {
var top = flux.position().top;
if (relative_follow) {
@@ -338,6 +345,11 @@ function init_shortcuts() {
}, {
'disable_in_input': true
});
+ shortcut.add(shortcuts.auto_share, function () {
+ auto_share();
+ }, {
+ 'disable_in_input': true
+ });
// Touches de navigation
shortcut.add(shortcuts.prev_entry, prev_entry, {