From 2c6d010dbae050d8ba140e69ecff3376b36d039f Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 3 Feb 2014 08:48:16 +0100 Subject: Ne pas boucler à la fin de la navigation dans les articles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrige https://github.com/marienfressinaud/FreshRSS/issues/407 Alternative à https://github.com/marienfressinaud/FreshRSS/pull/409 qui conserve le fait que l'article se ferme, et plus simple. --- p/scripts/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'p/scripts/main.js') diff --git a/p/scripts/main.js b/p/scripts/main.js index f0d2bbf7b..48386b1d6 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -172,12 +172,14 @@ function mark_favorite(active) { } function toggleContent(new_active, old_active) { - old_active.removeClass("active").removeClass("current"); + old_active.removeClass("active"); if (new_active.length === 0) { return; } + old_active.removeClass("current"); + if (does_lazyload) { new_active.find('img[data-original], iframe[data-original]').each(function () { this.setAttribute('src', this.getAttribute('data-original')); -- cgit v1.2.3 From 12247b2ce3e49382524ef67feec0ba7622a47066 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 3 Feb 2014 19:53:43 +0100 Subject: Ne pas déplier l'article lors du clic sur l'icône lien externe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrige http://marienfressinaud.fr/index.php?article141/freshrss-0-7-ca-casse-et-ca-passe#c1391357481-1 --- p/scripts/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'p/scripts/main.js') diff --git a/p/scripts/main.js b/p/scripts/main.js index 48386b1d6..2345bf531 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -443,7 +443,7 @@ function init_shortcuts() { function init_stream(divStream) { divStream.on('click', '.flux_header', function (e) { //flux_header_toggle - if ($(e.target).closest('.item.website > a').length > 0) { + if ($(e.target).closest('.item.website, .item.link').length > 0) { return; } var old_active = $(".flux.current"), @@ -470,7 +470,7 @@ function init_stream(divStream) { return false; }); - divStream.on('click', '.item.title>a', function (e) { + divStream.on('click', '.item.title > a', function (e) { if (e.ctrlKey) { return true; //Allow default control-click behaviour such as open in backround-tab } @@ -483,7 +483,7 @@ function init_stream(divStream) { }); if (auto_mark_site) { - divStream.on('click', '.flux .link a', function () { + divStream.on('click', '.flux .link > a', function () { mark_read($(this).parent().parent().parent(), true); }); } -- cgit v1.2.3 From 797dd21282214c2da6c422d7192dfe8c1de2c824 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 4 Feb 2014 17:47:01 +0100 Subject: Si nécessaire, défile lors du raccourci pour partager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrige http://marienfressinaud.fr/index.php?article141/freshrss-0-7-ca-casse-et-ca-passe#c1391357481-1 --- p/scripts/main.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'p/scripts/main.js') diff --git a/p/scripts/main.js b/p/scripts/main.js index 2345bf531..c4c0db21a 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -20,6 +20,16 @@ function redirect(url, new_tab) { } } +function needsScroll($elem) { + var $win = $(window), + winTop = $win.scrollTop(), + winHeight = $win.height(), + winBottom = winTop + winHeight, + elemTop = $elem.offset().top, + elemBottom = elemTop + $elem.outerHeight(); + return (elemTop < winTop || elemBottom > winBottom) ? elemTop - (winHeight / 2) : 0; +} + function str2int(str) { if (str == '') { return 0; @@ -255,9 +265,13 @@ function collapse_entry() { } function auto_share() { - var share = $(".flux.current.active").find('.dropdown-target[id^="dropdown-share"]'); - if (share.length) { - window.location.hash = share.attr('id'); + var $share = $(".flux.current").find('.dropdown-target[id^="dropdown-share"]'); + if ($share.length) { + window.location.hash = $share.attr('id'); + var scroll = needsScroll($share.closest('.bottom')); + if (scroll != 0) { + $('html,body').scrollTop(scroll); + } } } -- cgit v1.2.3