Преглед на файлове

Fix #4231 (#4541)

Actually, there are two issues to be fixed:
1. Since `div.flux_content` has been changed to `article.flux_content`
   in HTML, we should address that in JS too. Or, to take one step
   further, select it using `.flux_content` directly.
2. For the article already at the first position, its `prev_article`
   would select `#new-article` whose css attribute `display` is `none`
   in most cases, which breaks the new position calculation.
Aidi Tan преди 3 години
родител
ревизия
ef84343576
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      p/scripts/main.js

+ 2 - 2
p/scripts/main.js

@@ -435,7 +435,7 @@ function toggleContent(new_active, old_active, skipping) {
 
 		let new_pos = new_active.offsetParent.offsetTop + new_active.offsetTop - nav_menu_height;
 
-		if (prev_article && new_active.offsetTop - prev_article.offsetTop <= 150) {
+		if (prev_article && prev_article.offsetParent && new_active.offsetTop - prev_article.offsetTop <= 150) {
 			new_pos = prev_article.offsetParent.offsetTop + prev_article.offsetTop - nav_menu_height;
 			if (relative_move) {
 				new_pos -= box_to_move.offsetTop;
@@ -1103,7 +1103,7 @@ function init_stream(stream) {
 			if (ev.target.closest('.content, .item.website, .item.link, .dropdown')) {
 				return true;
 			}
-			if (!context.sides_close_article && ev.target.matches('div.flux_content')) {
+			if (!context.sides_close_article && ev.target.matches('.flux_content')) {
 				// setting for not-closing after clicking outside article area
 				return false;
 			}