Просмотр исходного кода

[fix] Finishing touches for next/previous without focus (#2140)

* [fix] Finishing touches for next/previous without focus

Cf. #1767.

* Avoid single quote

Alternative: use `’`

* Minor whitespace

* Minor whitespace

* be explicit about skipping

* add todos

* overshot by one
Frans de Jonge 7 лет назад
Родитель
Сommit
e20c7ef1b0

+ 1 - 0
app/i18n/cz/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => 'Označit jako přečtené',
 		'navigation' => 'Navigace',
 		'navigation_help' => 'Pomocí přepínače "Shift" fungují navigační zkratky v rámci kanálů.<br/>Pomocí přepínače "Alt" fungují v rámci kategorií.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => 'Skočit na další článek',
 		'normal_view' => 'Switch to normal view',	//TODO - Translation
 		'other_action' => 'Ostatní akce',

+ 1 - 0
app/i18n/de/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => 'Als gelesen markieren',
 		'navigation' => 'Navigation',
 		'navigation_help' => 'Mit der "Umschalttaste" finden die Tastenkombination auf Feeds Anwendung.<br/>Mit der "Alt-Taste" finden die Tastenkombination auf Kategorien Anwendung.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => 'Zum nächsten Artikel springen',
 		'normal_view' => 'Wechsle zur normalen Ansicht',
 		'other_action' => 'Andere Aktionen',

+ 1 - 0
app/i18n/en/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => 'Mark as read',
 		'navigation' => 'Navigation',
 		'navigation_help' => 'With the "Shift" modifier, navigation shortcuts apply on feeds.<br/>With the "Alt" modifier, navigation shortcuts apply on categories.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',
 		'next_article' => 'Open the next article',
 		'other_action' => 'Other actions',
 		'previous_article' => 'Open the previous article',

+ 1 - 0
app/i18n/es/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => 'Marcar como leído',
 		'navigation' => 'Navegación',
 		'navigation_help' => 'Con el modificador "Mayúsculas" es posible usar los atajos de teclado en las fuentes.<br/>Con el modificador "Alt" es posible aplicar los atajos de teclado en las categorías.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => 'Saltar al siguiente artículo',
 		'normal_view' => 'Switch to normal view',	//TODO - Translation
 		'other_action' => 'Otras acciones',

+ 1 - 0
app/i18n/fr/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => 'Marquer comme lu',
 		'navigation' => 'Navigation',
 		'navigation_help' => 'Avec le modificateur "Shift", les raccourcis de navigation s’appliquent aux flux.<br/>Avec le modificateur "Alt", les raccourcis de navigation s’appliquent aux catégories.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => 'Passer à l’article suivant',
 		'normal_view' => 'Basculer vers la vue normale',
 		'other_action' => 'Autres actions',

+ 1 - 0
app/i18n/he/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => 'סימון כנקרא',
 		'navigation' => 'ניווט',
 		'navigation_help' => 'בעזרת מקש השיפט קיצורי דרך חלים על הזנות .<br/>עם מקש האלט הם חלים על קטגוריות.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => 'דילוג למאמר הבא',
 		'normal_view' => 'Switch to normal view',	//TODO - Translation
 		'other_action' => 'פעולות אחרות',

+ 1 - 0
app/i18n/it/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => 'Segna come letto',
 		'navigation' => 'Navigazione',
 		'navigation_help' => 'Con il tasto "Shift" i comandi di navigazione verranno applicati ai feeds.<br/>Con il tasto "Alt" i comandi di navigazione verranno applicati alle categorie.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => 'Salta al contenuto successivo',
 		'normal_view' => 'Switch to normal view', // TODO
 		'other_action' => 'Altre azioni',

+ 1 - 0
app/i18n/kr/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => '읽음으로 표시',
 		'navigation' => '탐색',
 		'navigation_help' => '"Shift" 키를 누른 상태에선 탐색 단축키가 피드에 적용됩니다.<br/>"Alt" 키를 누른 상태에선 탐색 단축키가 카테고리에 적용됩니다.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => '다음 글 보기',
 		'normal_view' => '일반 모드로 전환',
 		'other_action' => '다른 동작',

+ 1 - 0
app/i18n/nl/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => 'Markeer als gelezen',
 		'navigation' => 'Navigatie',
 		'navigation_help' => 'Met de "Shift" toets, kunt u navigatie verwijzingen voor feeds gebruiken.<br/>Met de "Alt" toets, kunt u navigatie verwijzingen voor categoriën gebruiken.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => 'Spring naar volgende artikel',
 		'normal_view' => 'Schakel naar gewoon aanzicht',
 		'other_action' => 'Andere acties',

+ 1 - 0
app/i18n/oc/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => 'Marcar coma legit',
 		'navigation' => 'Navigacion',
 		'navigation_help' => 'Amb lo modificador «Shift», los acorchis de navigacion s’aplican als fluxes.<br/>Amb lo modificador «Alt», los acorchis de navigacion s’aplican a las categorias.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => 'Passar a l’article seguent',
 		'normal_view' => 'Passar a la vista normala',
 		'other_action' => 'Autras accions',

+ 1 - 0
app/i18n/pt-br/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => 'Marcar como lido',
 		'navigation' => 'Navegação',
 		'navigation_help' => 'Com o modificador "Shift", atalhos de navegação aplicam aos feeds.<br/>Com o "Alt" modificador, atalhos de navegação aplicam as categorias.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => 'Pule para o próximo artigo',
 		'normal_view' => 'Switch to normal view',	//TODO - Translation
 		'other_action' => 'Outras ações',

+ 1 - 0
app/i18n/ru/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_favorite' => 'Mark as favourite',	//TODO - Translation
 		'navigation' => 'Navigation',	//TODO - Translation
 		'navigation_help' => 'With the "Shift" modifier, navigation shortcuts apply on feeds.<br/>With the "Alt" modifier, navigation shortcuts apply on categories.',	//TODO - Translation
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => 'Skip to the next article',	//TODO - Translation
 		'normal_view' => 'Switch to normal view',	//TODO - Translation
 		'other_action' => 'Other actions',	//TODO - Translation

+ 1 - 0
app/i18n/tr/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => 'Okundu olarak işaretle',
 		'navigation' => 'Genel eylemler',
 		'navigation_help' => '"Shift" tuşu ile kısayollar akışlar için geçerli olur.<br/>"Alt" tuşu ile kısayollar kategoriler için geçerli olur.',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => 'Sonraki makaleye geç',
 		'normal_view' => 'Switch to normal view',	//TODO - Translation
 		'other_action' => 'Diğer eylemler',

+ 1 - 0
app/i18n/zh-cn/conf.php

@@ -162,6 +162,7 @@ return array(
 		'mark_read' => '设为已读',
 		'navigation' => '浏览',
 		'navigation_help' => '搭配 "Shift" 键,浏览快捷键将生效于 RSS 源。<br/>搭配 "Alt" 键,浏览快捷键将生效于分类。',
+		'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.',	//TODO - Translation
 		'next_article' => '跳转到下一篇文章',
 		'normal_view' => '切换到普通视图',
 		'other_action' => '其他操作',

+ 3 - 1
app/views/configure/shortcut.phtml

@@ -64,7 +64,9 @@
 				<input type="text" id="prev_entry" name="shortcuts[prev_entry]" list="keys" value="<?php echo $s['prev_entry']; ?>" data-leave-validation="<?php echo $s['prev_entry']; ?>"/>
 			</div>
 		</div>
-		
+
+		<p class="alert alert-warn"><?php echo _t('conf.shortcut.navigation_no_mod_help');?></p>
+
 		<div class="form-group">
 			<label class="group-name" for="skip_next_entry"><?php echo _t('conf.shortcut.skip_next_article'); ?></label>
 			<div class="group-controls">

+ 9 - 9
p/scripts/main.js

@@ -237,7 +237,7 @@ function mark_favorite(active) {
 	});
 }
 
-function toggleContent(new_active, old_active, skipping = false) {
+function toggleContent(new_active, old_active, skipping) {
 	// If skipping, move current without activating or marking as read
 	if (new_active.length === 0) {
 		return;
@@ -252,7 +252,7 @@ function toggleContent(new_active, old_active, skipping = false) {
 	}
 
 	if (old_active[0] !== new_active[0]) {
-		if (isCollapsed && !skipping) { // BUG?: isCollapsed can only ever be true 
+		if (isCollapsed && !skipping) { // BUG?: isCollapsed can only ever be true
 			new_active.addClass("active");
 		}
 		old_active.removeClass("active current");
@@ -260,7 +260,7 @@ function toggleContent(new_active, old_active, skipping = false) {
 		if (context.auto_remove_article && !old_active.hasClass('not_read') && !skipping) {
 			auto_remove(old_active);
 		}
-	} else { // collapse_entry calls toggleContent(flux_current, flux_current)
+	} else { // collapse_entry calls toggleContent(flux_current, flux_current, false)
 		new_active.toggleClass('active');
 	}
 
@@ -279,9 +279,9 @@ function toggleContent(new_active, old_active, skipping = false) {
 			}
 		}
 
-		if (skipping){
+		if (skipping) {
 			// when skipping, this feels more natural if it's not so near the top
-			new_pos -= $(window).height()/4
+			new_pos -= $(window).height() / 4;
 		}
 		if (context.hide_posts) {
 			if (relative_move) {
@@ -423,7 +423,7 @@ function last_category() {
 
 function collapse_entry() {
 	var flux_current = $(".flux.current");
-	toggleContent(flux_current, flux_current);
+	toggleContent(flux_current, flux_current, false);
 }
 
 function user_filter(key) {
@@ -666,7 +666,7 @@ function init_shortcuts() {
 			first = $(".flux:first");
 
 		if (first.hasClass("flux")) {
-			toggleContent(first, old_active);
+			toggleContent(first, old_active, false);
 		}
 	}, {
 		'disable_in_input': true
@@ -682,7 +682,7 @@ function init_shortcuts() {
 			last = $(".flux:last");
 
 		if (last.hasClass("flux")) {
-			toggleContent(last, old_active);
+			toggleContent(last, old_active, false);
 		}
 	}, {
 		'disable_in_input': true
@@ -795,7 +795,7 @@ function init_stream(divStream) {
 			}
 			return true;
 		}
-		toggleContent(new_active, old_active);
+		toggleContent(new_active, old_active, false);
 	});
 
 	divStream.on('click', '.flux a.read', function () {