aboutsummaryrefslogtreecommitdiff
path: root/p
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-01-24 13:18:48 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-01-24 13:18:48 +0100
commit362dbad0b8ff0a29241f4e29556910dfaf7d66e5 (patch)
tree8a75e83012716cd9539ac1456c454bf4921513c2 /p
parente664138bd2906942b793d85d4eaa6f8c01459509 (diff)
Several position problems, in particular in the global view
Multiple small bugs in global and reader views. Related to these old issues: https://github.com/FreshRSS/FreshRSS/issues/634 https://github.com/FreshRSS/FreshRSS/issues/275
Diffstat (limited to 'p')
-rw-r--r--p/scripts/main.js30
1 files changed, 11 insertions, 19 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index f64927c14..45a028a7d 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -246,18 +246,18 @@ function toggleContent(new_active, old_active) {
var box_to_move = "html,body",
relative_move = false;
- if (context['current_view'] == 'global') {
+ if (context['current_view'] === 'global') {
box_to_move = "#panel";
relative_move = true;
}
if (context['sticky_post']) {
var prev_article = new_active.prevAll('.flux'),
- new_pos = new_active.position().top,
+ new_pos = new_active.offset().top,
old_scroll = $(box_to_move).scrollTop();
- if (prev_article.length > 0 && new_pos - prev_article.position().top <= 150) {
- new_pos = prev_article.position().top;
+ if (prev_article.length > 0 && new_pos - prev_article.offset().top <= 150) {
+ new_pos = prev_article.offset().top;
}
if (context['hide_posts']) {
@@ -451,11 +451,8 @@ function auto_share(key) {
}
}
-function inMarkViewport(flux, box_to_follow, relative_follow) {
- var top = flux.position().top;
- if (relative_follow) {
- top += box_to_follow.scrollTop();
- }
+function inMarkViewport(flux, box_to_follow) {
+ var top = flux.offset().top;
var height = flux.height(),
begin = top + 3 * height / 4,
bot = Math.min(begin + 75, top + height),
@@ -466,17 +463,15 @@ function inMarkViewport(flux, box_to_follow, relative_follow) {
}
function init_posts() {
- var box_to_follow = $(window),
- relative_follow = false;
- if (context['current_view'] == 'global') {
+ var box_to_follow = $(window);
+ if (context['current_view'] === 'global') {
box_to_follow = $("#panel");
- relative_follow = true;
}
if (context['auto_mark_scroll']) {
box_to_follow.scroll(function () {
$('.not_read:visible').each(function () {
- if ($(this).children(".flux_content").is(':visible') && inMarkViewport($(this), box_to_follow, relative_follow)) {
+ if ($(this).children(".flux_content").is(':visible') && inMarkViewport($(this), box_to_follow)) {
mark_read($(this), true);
}
});
@@ -490,10 +485,7 @@ function init_posts() {
return;
}
var boxBot = box_to_follow.scrollTop() + box_to_follow.height(),
- load_more_top = load_more.position().top;
- if (relative_follow) {
- load_more_top += box_to_follow.scrollTop();
- }
+ load_more_top = load_more.offset().top;
if (boxBot >= load_more_top) {
load_more_posts();
}
@@ -765,7 +757,7 @@ function init_nav_entries() {
$nav_entries.find('.up').click(function () {
var active_item = $(".flux.current"),
windowTop = $(window).scrollTop(),
- item_top = active_item.position().top;
+ item_top = active_item.offset().top;
if (windowTop > item_top) {
$("html,body").scrollTop(item_top);