summaryrefslogtreecommitdiff
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
parentb4c477ca41a7ecaa6364dd6a97603829b14b11ef (diff)
Add a shortcut to open the share div. The default shortcut is "s".
-rw-r--r--app/Models/Configuration.php1
-rw-r--r--app/i18n/en.php1
-rw-r--r--app/i18n/fr.php1
-rw-r--r--app/views/configure/shortcut.phtml7
-rw-r--r--app/views/helpers/javascript_vars.phtml3
-rw-r--r--p/scripts/main.js12
6 files changed, 24 insertions, 1 deletions
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
index d44420f56..c29e74603 100644
--- a/app/Models/Configuration.php
+++ b/app/Models/Configuration.php
@@ -33,6 +33,7 @@ class FreshRSS_Configuration {
'prev_entry' => 'k',
'collapse_entry' => 'c',
'load_more' => 'm',
+ 'auto_share' => 's',
),
'topline_read' => true,
'topline_favorite' => true,
diff --git a/app/i18n/en.php b/app/i18n/en.php
index 28aa1296a..06bbf48e6 100644
--- a/app/i18n/en.php
+++ b/app/i18n/en.php
@@ -123,6 +123,7 @@ return array (
'next_page' => 'Skip to the next page',
'previous_page' => 'Skip to the previous page',
'collapse_article' => 'Collapse current article',
+ 'auto_share' => 'Share current article',
'file_to_import' => 'File to import',
'import' => 'Import',
diff --git a/app/i18n/fr.php b/app/i18n/fr.php
index 39aeaf29a..cb689610b 100644
--- a/app/i18n/fr.php
+++ b/app/i18n/fr.php
@@ -123,6 +123,7 @@ return array (
'next_page' => 'Passer à la page suivante',
'previous_page' => 'Passer à la page précédente',
'collapse_article' => 'Refermer l’article courant',
+ 'auto_share' => 'Partager l’article courant',
'file_to_import' => 'Fichier à importer',
'import' => 'Importer',
diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml
index 2e564a7b6..b0867f711 100644
--- a/app/views/configure/shortcut.phtml
+++ b/app/views/configure/shortcut.phtml
@@ -68,6 +68,13 @@
</div>
</div>
+ <div class="form-group">
+ <label class="group-name" for="auto_share_shortcut"><?php echo Minz_Translate::t ('auto_share'); ?></label>
+ <div class="group-controls">
+ <input type="text" id="auto_share_shortcut" name="shortcuts[auto_share]" list="keys" value="<?php echo $s['auto_share']; ?>" />
+ </div>
+ </div>
+
<div class="form-group form-actions">
<div class="group-controls">
<button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml
index 8419b9391..92c068f7e 100644
--- a/app/views/helpers/javascript_vars.phtml
+++ b/app/views/helpers/javascript_vars.phtml
@@ -18,7 +18,8 @@
'prev_entry:"', $s['prev_entry'], '",',
'next_entry:"', $s['next_entry'], '",',
'collapse_entry:"', $s['collapse_entry'], '",',
- 'load_more:"', $s['load_more'], '"',
+ 'load_more:"', $s['load_more'], '",',
+ 'auto_share:"', $s['auto_share'], '"',
"},\n";
if (Minz_Request::param ('output') === 'global') {
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, {