aboutsummaryrefslogtreecommitdiff
path: root/p/scripts
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <github@ainw.org> 2014-02-24 19:51:57 -0500
committerGravatar Alexis Degrugillier <github@ainw.org> 2014-02-24 19:51:57 -0500
commit1e105a64ab12b37f55b605a89e869f7bbb520e95 (patch)
tree24d3161f22e616b40da5e58a6f2cc20fc6533405 /p/scripts
parent166009f3623213249086038f7af72a76507f60dc (diff)
Add a configuration option to get sticky articles
Now the user can choose if an opened article will be repositioned to the top or not See #338
Diffstat (limited to 'p/scripts')
-rw-r--r--p/scripts/main.js34
1 files changed, 18 insertions, 16 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index ec27bd50c..6cc992379 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -238,26 +238,28 @@ function toggleContent(new_active, old_active) {
var new_pos = new_active.position().top,
old_scroll = $(box_to_move).scrollTop();
- if (hide_posts) {
+ if (sticky_post) {
+ if (hide_posts) {
- new_pos = new_active.position().top;
- old_scroll = $(box_to_move).scrollTop();
+ new_pos = new_active.position().top;
+ old_scroll = $(box_to_move).scrollTop();
- if (relative_move) {
- new_pos += old_scroll;
- }
+ if (relative_move) {
+ new_pos += old_scroll;
+ }
- if (old_active[0] !== new_active[0]) {
- new_active.children(".flux_content").first().each(function () {
- $(box_to_move).scrollTop(new_pos).scrollTop();
- });
- }
- } else {
- if (relative_move) {
- new_pos += old_scroll;
- }
+ if (old_active[0] !== new_active[0]) {
+ new_active.children(".flux_content").first().each(function () {
+ $(box_to_move).scrollTop(new_pos).scrollTop();
+ });
+ }
+ } else {
+ if (relative_move) {
+ new_pos += old_scroll;
+ }
- $(box_to_move).scrollTop(new_pos).scrollTop();
+ $(box_to_move).scrollTop(new_pos).scrollTop();
+ }
}
if (auto_mark_article) {