From 4de5e6c2756f2a300014b80108cf2bf5e91f69a3 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 12 Jan 2014 20:26:26 +0100 Subject: Corrige problème CSS partage/tags + problème raffraîchissement automatique des articles non-lus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + Léger nettoyage JavaScript --- app/views/helpers/javascript_vars.phtml | 2 -- p/scripts/main.js | 53 +++++++++++++++++---------------- p/themes/default/freshrss.css | 4 ++- p/themes/default_dark/freshrss.css | 4 ++- p/themes/flat-design/freshrss.css | 4 ++- 5 files changed, 36 insertions(+), 31 deletions(-) diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 935294e60..f4f36b4f3 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -36,8 +36,6 @@ 'url_logout="', _url ('index', 'logout'), '",', 'current_user_mail=', $mail, ",\n"; - echo 'load_shortcuts=', Minz_Request::controllerName () === 'index' && Minz_Request::actionName () === 'index' ? 'true' : 'false', ",\n"; - echo 'str_confirmation="', Minz_Translate::t('confirm_action'), '"', ",\n"; $autoActualise = Minz_Session::param('actualize_feeds', false); diff --git a/p/scripts/main.js b/p/scripts/main.js index 0c4c3f1b2..7415d0c24 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -61,7 +61,11 @@ function incUnreadsFeed(article, feed_id, nb) { //Update unread: title document.title = document.title.replace(/((?: \(\d+\))?)( · .*?)((?: \(\d+\))?)$/, function (m, p1, p2, p3) { - return incLabel(p1, nb) + p2 + incLabel(p3, feed_priority > 0 ? nb : 0); + if (article || ($('#' + feed_id).closest('.active').length > 0)) { + return incLabel(p1, nb) + p2 + incLabel(p3, feed_priority > 0 ? nb : 0); + } else { + return p1 + p2 + incLabel(p3, feed_priority > 0 ? nb : 0); + } }); } @@ -312,6 +316,14 @@ function init_column_categories() { $(this).parent().next(".feeds").slideToggle(); return false; }); + $('#aside_flux').on('click', '.feeds .dropdown-toggle', function () { + if ($(this).nextAll('.dropdown-menu').length === 0) { + var feed_id = $(this).closest('li').attr('id').substr(2), + feed_web = $(this).data('fweb'), + template = $('#feed_config_template').html().replace(/!!!!!!/g, feed_id).replace('http://example.net/', feed_web); + $(this).attr('href', '#dropdown-' + feed_id).prev('.dropdown-target').attr('id', 'dropdown-' + feed_id).parent().append(template); + } + }); } function init_shortcuts() { @@ -403,7 +415,7 @@ function init_shortcuts() { }); } -function init_stream_delegates(divStream) { +function init_stream(divStream) { divStream.on('click', '.flux_header', function (e) { //flux_header_toggle if ($(e.target).closest('.item.website > a').length > 0) { return; @@ -475,17 +487,6 @@ function init_nav_entries() { }); } -function init_templates() { - $('#aside_flux').on('click', '.feeds .dropdown-toggle', function () { - if ($(this).nextAll('.dropdown-menu').length === 0) { - var feed_id = $(this).closest('li').attr('id').substr(2), - feed_web = $(this).data('fweb'), - template = $('#feed_config_template').html().replace(/!!!!!!/g, feed_id).replace('http://example.net/', feed_web); - $(this).attr('href', '#dropdown-' + feed_id).prev('.dropdown-target').attr('id', 'dropdown-' + feed_id).parent().append(template); - } - }); -} - function init_actualize() { $("#actualize").click(function () { $.getScript('./?c=javascript&a=actualize').done(function () { @@ -732,18 +733,7 @@ function init_all() { window.setTimeout(init_all, 50); return; } - $stream = $('#stream'); - init_posts(); - init_column_categories(); - if (load_shortcuts) { - init_shortcuts(); - } - init_stream_delegates($stream); - init_nav_entries(); - init_templates(); init_notifications(); - init_actualize(); - init_load_more($stream); switch (authType) { case 'form': init_loginForm(); @@ -753,8 +743,19 @@ function init_all() { break; } init_confirm_action(); - init_print_action(); - window.setInterval(refreshUnreads, 120000); + $stream = $('#stream'); + if ($stream.length > 0) { + init_actualize(); + init_column_categories(); + init_load_more($stream); + init_posts(); + init_stream($stream); + init_nav_entries(); + init_shortcuts(); + init_print_action(); + window.setInterval(refreshUnreads, 120000); + } + if (window.console) { console.log('FreshRSS init done.'); } diff --git a/p/themes/default/freshrss.css b/p/themes/default/freshrss.css index 733807938..593f21d30 100644 --- a/p/themes/default/freshrss.css +++ b/p/themes/default/freshrss.css @@ -259,9 +259,11 @@ } .flux .item { line-height: 40px; + white-space: nowrap; + } + .flux_header > .item { overflow: hidden; text-overflow: ellipsis; - white-space: nowrap; } .flux .item.manage { width: 40px; diff --git a/p/themes/default_dark/freshrss.css b/p/themes/default_dark/freshrss.css index 884e2884d..e9eb2c705 100644 --- a/p/themes/default_dark/freshrss.css +++ b/p/themes/default_dark/freshrss.css @@ -250,9 +250,11 @@ } .flux .item { line-height: 40px; + white-space: nowrap; + } + .flux_header > .item { overflow: hidden; text-overflow: ellipsis; - white-space: nowrap; } .flux .item.manage { width: 40px; diff --git a/p/themes/flat-design/freshrss.css b/p/themes/flat-design/freshrss.css index df1dfdde3..dca1b3f28 100644 --- a/p/themes/flat-design/freshrss.css +++ b/p/themes/flat-design/freshrss.css @@ -245,9 +245,11 @@ body { } .flux .item { line-height: 40px; + white-space: nowrap; + } + .flux_header > .item { overflow: hidden; text-overflow: ellipsis; - white-space: nowrap; } .flux .item.manage { width: 40px; -- cgit v1.2.3