Parcourir la source

Fix shortcuts for view switching

I've introduced shortcuts to switch between view in #1755. They have been broken by #1714.
Then I've made an ugly fix in #1758.

This change revert all changes to have something better.

See #1757
Alexis Degrugillier il y a 8 ans
Parent
commit
951eb708e6
2 fichiers modifiés avec 5 ajouts et 5 suppressions
  1. 1 1
      app/layout/nav_menu.phtml
  2. 4 4
      p/scripts/main.js

+ 1 - 1
app/layout/nav_menu.phtml

@@ -155,7 +155,7 @@
 				$url_output['params']['hours'] = FreshRSS_Context::$user_conf->since_hours_posts_per_rss;
 			}
 		?>
-		<a class="view_rss btn" target="_blank" rel="noreferrer" title="<?php echo _t('index.menu.rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
+		<a class="view-rss btn" target="_blank" rel="noreferrer" title="<?php echo _t('index.menu.rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
 			<?php echo _i('rss'); ?>
 		</a>
 	</div>

+ 4 - 4
p/scripts/main.js

@@ -705,25 +705,25 @@ function init_shortcuts() {
 	});
 
 	shortcut.add(shortcuts.normal_view, function () {
-		$('#nav_menu_views a').get(0).click();
+		$('#nav_menu_views .view-normal').get(0).click();
 	}, {
 		'disable_in_input': true
 	});
 
 	shortcut.add(shortcuts.global_view, function () {
-		$('#nav_menu_views a').get(1).click();
+		$('#nav_menu_views .view-global').get(0).click();
 	}, {
 		'disable_in_input': true
 	});
 
 	shortcut.add(shortcuts.reading_view, function () {
-		$('#nav_menu_views a').get(2).click();
+		$('#nav_menu_views .view-reader').get(0).click();
 	}, {
 		'disable_in_input': true
 	});
 
 	shortcut.add(shortcuts.rss_view, function () {
-		$('#nav_menu_views a').get(-1).click();
+		$('#nav_menu_views .view-rss').get(0).click();
 	}, {
 		'disable_in_input': true
 	});