Bläddra i källkod

Add a shortcut to open the share div. The default shortcut is "s".

Alexis Degrugillier 12 år sedan
förälder
incheckning
7db271e95e

+ 1 - 0
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,

+ 1 - 0
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',

+ 1 - 0
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',

+ 7 - 0
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>

+ 2 - 1
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') {

+ 12 - 0
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, {