From 7b17c60bb18b122f3d14795780f4642717cfd81b Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 24 Aug 2014 11:34:58 -0400 Subject: Add shortcuts Add a shortcut to open the wiki. Shortcut is F1 and is not modifiable. Add a shortcut to access user filters the same way to access share actions. --- p/scripts/main.js | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index c37f9f6f2..ad6cc8bef 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -378,6 +378,36 @@ function collapse_entry() { } } +function user_filter(key) { + console.log('user filter'); + console.warn(key); + var filter = $('#dropdown-query'); + var filters = filter.siblings('.dropdown-menu').find('.item.query a'); + if (typeof key === "undefined") { + if (!filter.length) { + return; + } + // Display the filter div + window.location.hash = filter.attr('id'); + // Force scrolling to the filter div + var scroll = needsScroll($('.header')); + if (scroll !== 0) { + $('html,body').scrollTop(scroll); + } + // Force the key value if there is only one action, so we can trigger it automatically + if (filters.length === 1) { + key = 1; + } else { + return; + } + } + // Trigger selected share action + key = parseInt(key); + if (key <= filters.length) { + filters[key - 1].click(); + } +} + function auto_share(key) { var share = $(".flux.current.active").find('.dropdown-target[id^="dropdown-share"]'); var shares = share.siblings('.dropdown-menu').find('.item a'); @@ -531,9 +561,19 @@ function init_shortcuts() { }, { 'disable_in_input': true }); + + shortcut.add(shortcuts.user_filter, function () { + user_filter(); + }, { + 'disable_in_input': true + }); for(var i = 1; i < 10; i++){ shortcut.add(i.toString(), function (e) { - auto_share(String.fromCharCode(e.keyCode)); + if ($('#dropdown-query').siblings('.dropdown-menu').is(':visible')) { + user_filter(String.fromCharCode(e.keyCode)); + } else { + auto_share(String.fromCharCode(e.keyCode)); + } }, { 'disable_in_input': true }); @@ -618,6 +658,13 @@ function init_shortcuts() { }, { 'disable_in_input': true }); + + shortcut.add(shortcuts.help, function () { + redirect(help_url, true); + }, { + 'disable_in_input': true + }); + } function init_stream(divStream) { -- cgit v1.2.3 From 5d718b5c3bc183441b7629377367f23f8773045a Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 3 Sep 2014 21:33:29 -0400 Subject: Fix collapse shortcut behavior Before, the collapse shortcut was marking all articles as read when used. No matter what configuration you use. Now, the collapse shortcut marks articles only if the appropriate configuration is used (when article is viewed). --- p/scripts/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index c37f9f6f2..7bd746f75 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -373,7 +373,7 @@ function collapse_entry() { var flux_current = $(".flux.current"); flux_current.toggleClass("active"); - if (isCollapsed) { + if (isCollapsed && auto_mark_article) { mark_read(flux_current, true); } } -- cgit v1.2.3 From 88ec538ef5a444c65d0d34603d108257538b537d Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Thu, 4 Sep 2014 23:45:40 -0400 Subject: Fix navigation on hidden categories and feeds Before, when navigating with the keyboard, hidden categories and feeds where shown. Now, they stay hidden. See #604 --- p/scripts/main.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index c37f9f6f2..ee95a1b98 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -297,7 +297,7 @@ function next_entry() { function prev_feed() { var active_feed = $("#aside_flux .feeds li.active"); if (active_feed.length > 0) { - active_feed.prev().find('a.feed').each(function(){this.click();}); + active_feed.prevAll(':visible:first').find('a.feed').each(function(){this.click();}); } else { last_feed(); } @@ -306,21 +306,21 @@ function prev_feed() { function next_feed() { var active_feed = $("#aside_flux .feeds li.active"); if (active_feed.length > 0) { - active_feed.next().find('a.feed').each(function(){this.click();}); + active_feed.nextAll(':visible:first').find('a.feed').each(function(){this.click();}); } else { first_feed(); } } function first_feed() { - var feed = $("#aside_flux .feeds.active li:first"); + var feed = $("#aside_flux .feeds.active li:visible:first"); if (feed.length > 0) { feed.find('a')[1].click(); } } function last_feed() { - var feed = $("#aside_flux .feeds.active li:last"); + var feed = $("#aside_flux .feeds.active li:visible:last"); if (feed.length > 0) { feed.find('a')[1].click(); } @@ -330,7 +330,7 @@ function prev_category() { var active_cat = $("#aside_flux .category.stick.active"); if (active_cat.length > 0) { - var prev_cat = active_cat.parent('li').prev().find('.category.stick a.btn'); + var prev_cat = active_cat.parent('li').prevAll(':visible:first').find('.category.stick a.btn'); if (prev_cat.length > 0) { prev_cat[0].click(); } @@ -344,7 +344,7 @@ function next_category() { var active_cat = $("#aside_flux .category.stick.active"); if (active_cat.length > 0) { - var next_cat = active_cat.parent('li').next().find('.category.stick a.btn'); + var next_cat = active_cat.parent('li').nextAll(':visible:first').find('.category.stick a.btn'); if (next_cat.length > 0) { next_cat[0].click(); } @@ -355,14 +355,14 @@ function next_category() { } function first_category() { - var cat = $("#aside_flux .category.stick:first"); + var cat = $("#aside_flux .category.stick:visible:first"); if (cat.length > 0) { cat.find('a.btn')[0].click(); } } function last_category() { - var cat = $("#aside_flux .category.stick:last"); + var cat = $("#aside_flux .category.stick:visible:last"); if (cat.length > 0) { cat.find('a.btn')[0].click(); } -- cgit v1.2.3 From 6374f9ec98a132a810efa3e651bd800bcf541340 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 15 Sep 2014 16:19:12 +0200 Subject: Use setTimeout instead of setInterval (JavaScript) See https://github.com/marienfressinaud/FreshRSS/pull/585 --- p/scripts/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index 2108eece2..6eb7fdd72 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -787,7 +787,7 @@ function openNotification(msg, status) { notification.find(".msg").html(msg); notification.fadeIn(300); - notification_interval = window.setInterval(closeNotification, 4000); + notification_interval = window.setTimeout(closeNotification, 4000); } function closeNotification() { @@ -810,7 +810,7 @@ function init_notifications() { if (notification.find(".msg").html().length > 0) { notification_working = true; - notification_interval = window.setInterval(closeNotification, 4000); + notification_interval = window.setTimeout(closeNotification, 4000); } } // @@ -1224,7 +1224,7 @@ function init_all() { faviconNbUnread(); init_print_action(); init_notifs_html5(); - window.setInterval(refreshUnreads, 120000); + window.setTimeout(refreshUnreads, 120000); } else { init_share_observers(); init_remove_observers(); -- cgit v1.2.3 From d67242884dd511c62dc26888f5ba7a2c7b825375 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 16 Sep 2014 10:53:20 +0200 Subject: Revert setTimeout for refreshUnreads See https://github.com/marienfressinaud/FreshRSS/commit/6374f9ec98a132a810efa3e651bd800bcf541340#commitcomment-7790536 --- p/scripts/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index 6eb7fdd72..d68d76e3b 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1224,7 +1224,7 @@ function init_all() { faviconNbUnread(); init_print_action(); init_notifs_html5(); - window.setTimeout(refreshUnreads, 120000); + window.setInterval(refreshUnreads, 120000); } else { init_share_observers(); init_remove_observers(); -- cgit v1.2.3 From 497d3564c8f4638107bfcae6a492bd51e9012b9d Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 16 Sep 2014 14:19:55 +0200 Subject: Fix bug with shortcut "mark all as read" See https://github.com/marienfressinaud/FreshRSS/issues/599 --- p/scripts/main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index d68d76e3b..07af35a5b 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -533,13 +533,13 @@ function init_shortcuts() { }); shortcut.add("shift+" + shortcuts.mark_read, function () { // on marque tout comme lu - var url = $(".nav_menu a.read_all").attr("href"); - if ($(".nav_menu a.read_all").hasClass('confirm')) { + var btn = $(".nav_menu .read_all"); + if (btn.hasClass('confirm')) { if (confirm(str_confirmation)) { - redirect(url, false); + btn.click(); } } else { - redirect(url, false); + btn.click(); } }, { 'disable_in_input': true -- cgit v1.2.3 From 6f8413403b53db7e17a36900bba2b470635b7943 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 16 Sep 2014 14:58:25 +0200 Subject: Change #bigMarkAsRead link in button See https://github.com/marienfressinaud/FreshRSS/issues/599#issuecomment-55735615 --- app/views/helpers/pagination.phtml | 8 ++++++-- p/scripts/main.js | 8 ++++++-- p/themes/base-theme/template.css | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'p/scripts') diff --git a/app/views/helpers/pagination.phtml b/app/views/helpers/pagination.phtml index db5cf25b5..f6fcbc701 100755 --- a/app/views/helpers/pagination.phtml +++ b/app/views/helpers/pagination.phtml @@ -14,11 +14,15 @@ - conf->reading_confirm) { echo ' class="confirm"';} ?>> +
diff --git a/p/scripts/main.js b/p/scripts/main.js index 07af35a5b..69ac01816 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -894,9 +894,13 @@ function load_more_posts() { box_load_more.children('.flux:last').after($('#stream', data).children('.flux, .day')); $('.pagination').replaceWith($('.pagination', data)); if (display_order === 'ASC') { - $('#nav_menu_read_all>a').attr('href', $('#bigMarkAsRead').attr('href')); + $('#nav_menu_read_all > .read_all').attr( + 'formaction', $('#bigMarkAsRead').attr('formaction') + ); } else { - $('#bigMarkAsRead').attr('href', $('#nav_menu_read_all>a').attr('href')); + $('#bigMarkAsRead').attr( + 'formaction', $('#nav_menu_read_all > .read_all').attr('formaction') + ); } $('[id^=day_]').each(function (i) { diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index 9d81b6180..4186000a3 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -516,6 +516,7 @@ a.btn { } #bigMarkAsRead { display: block; + width: 100%; padding: 3em 0; text-align: center; } -- cgit v1.2.3 From 7eb71edecf0b4eb6018bc10bcffc2441996489d3 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 16 Sep 2014 17:23:25 +0200 Subject: Improve align article on previous article Always align view on previous article IF its top is not too far (magic number: 150px). See https://github.com/marienfressinaud/FreshRSS/issues/470 --- p/scripts/main.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index 69ac01816..7c3be3af4 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -251,9 +251,14 @@ function toggleContent(new_active, old_active) { } if (sticky_post) { - var new_pos = new_active.position().top - new_active.children('.flux_header').outerHeight(), + var prev_article = new_active.prevAll('.flux'), + new_pos = new_active.position().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 (hide_posts) { if (relative_move) { new_pos += old_scroll; -- cgit v1.2.3 From c2ca9805fa61d045fa5466a8c3ba88d8a0c5a299 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 16 Sep 2014 17:44:51 +0200 Subject: Same behaviour for middle click on article Middle click was not catched by JavaScript so when opening article in a new page, itwas not marked as read. See https://github.com/marienfressinaud/FreshRSS/issues/454 --- p/scripts/main.js | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index 7c3be3af4..fd49d62ba 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -702,11 +702,25 @@ function init_stream(divStream) { }); divStream.on('click', '.item.title > a', function (e) { + // Allow default control-click behaviour such as open in backround-tab. + return e.ctrlKey; + }); + divStream.on('mouseup', '.item.title > a', function (e) { + // Mouseup enables us to catch middle click. if (e.ctrlKey) { - return true; //Allow default control-click behaviour such as open in backround-tab + // CTRL+click, it will be manage by previous rule. + return; + } + + if (e.which == 2) { + // If middle click, we want same behaviour as CTRL+click. + var e = jQuery.Event("click"); + e.ctrlKey = true; + $(this).trigger(e); + } else if(e.which == 1) { + // Normal click, just toggle article. + $(this).parent().click(); } - $(this).parent().click(); //Will perform toggle flux_content - return false; }); divStream.on('click', '.flux .content a', function () { @@ -714,7 +728,13 @@ function init_stream(divStream) { }); if (auto_mark_site) { - divStream.on('click', '.flux .link > a', function () { + // catch mouseup instead of click so we can have the correct behaviour + // with middle button click (scroll button). + divStream.on('mouseup', '.flux .link > a', function (e) { + if (e.which == 3) { + return; + } + mark_read($(this).parents(".flux"), true); }); } -- cgit v1.2.3 From 4211539c24e36531f2c5440ad454c4e208131047 Mon Sep 17 00:00:00 2001 From: plopoyop Date: Thu, 18 Sep 2014 10:46:34 +0200 Subject: Add timeout option for HTML5 notification --- app/Controllers/configureController.php | 1 + app/Models/Configuration.php | 7 +++++++ app/i18n/de.php | 2 ++ app/i18n/en.php | 2 ++ app/i18n/fr.php | 2 ++ app/views/configure/display.phtml | 7 +++++++ app/views/helpers/javascript_vars.phtml | 2 ++ p/scripts/main.js | 6 ++++++ 8 files changed, 29 insertions(+) (limited to 'p/scripts') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index bb96bfae3..b1cd45014 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -157,6 +157,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $this->view->conf->_bottomline_tags(Minz_Request::param('bottomline_tags', false)); $this->view->conf->_bottomline_date(Minz_Request::param('bottomline_date', false)); $this->view->conf->_bottomline_link(Minz_Request::param('bottomline_link', false)); + $this->view->conf->_html5_notif_timeout(Minz_Request::param('html5_notif_timeout', 0)); $this->view->conf->save(); Minz_Session::_param('language', $this->view->conf->language); diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index e4408df73..830d39f0d 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -60,6 +60,7 @@ class FreshRSS_Configuration { 'bottomline_link' => true, 'sharing' => array(), 'queries' => array(), + 'html5_notif_timeout' => 0, ); private $available_languages = array( @@ -269,6 +270,12 @@ class FreshRSS_Configuration { $this->data['content_width'] = 'thin'; } } + + public function _html5_notif_timeout ($value) { + $value = intval($value); + $this->data['html5_notif_timeout'] = $value >= 0 ? $value : 0; + } + public function _token($value) { $this->data['token'] = $value; } diff --git a/app/i18n/de.php b/app/i18n/de.php index 4301a8b6d..3f7d8ca27 100644 --- a/app/i18n/de.php +++ b/app/i18n/de.php @@ -212,6 +212,8 @@ return array ( 'reading_icons' => 'Lese Symbol', 'top_line' => 'Kopfzeile', 'bottom_line' => 'Fusszeile', + 'html5_notif_timeout' => 'HTML5 notification timeout', + 'seconds_(0_means_no_timeout)' => 'seconds (0 means no timeout)', 'img_with_lazyload' => 'Verwende die "träge laden" Methode zum laden von Bildern', 'auto_read_when' => 'Artikel als gelesen markieren…', 'article_selected' => 'wenn der Artikel ausgewählt ist', diff --git a/app/i18n/en.php b/app/i18n/en.php index 8f39115ad..1e842a1e1 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -280,6 +280,8 @@ return array ( 'article_icons' => 'Article icons', 'top_line' => 'Top line', 'bottom_line' => 'Bottom line', + 'html5_notif_timeout' => 'HTML5 notification timeout', + 'seconds_(0_means_no_timeout)' => 'seconds (0 means no timeout)', 'img_with_lazyload' => 'Use "lazy load" mode to load pictures', 'sticky_post' => 'Stick the article to the top when opened', 'reading_confirm' => 'Display a confirmation dialog on “mark all as read” actions', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 48b4c1732..bbfa71f66 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -280,6 +280,8 @@ return array ( 'article_icons' => 'Icônes d’article', 'top_line' => 'Ligne du haut', 'bottom_line' => 'Ligne du bas', + 'html5_notif_timeout' => 'Temps d\'affichage de la notification HTML5', + 'seconds_(0_means_no_timeout)' => 'secondes (0 signifie aucun timeout ) ', 'img_with_lazyload' => 'Utiliser le mode “chargement différé” pour les images', 'sticky_post' => 'Aligner l’article en haut quand il est ouvert', 'reading_confirm' => 'Afficher une confirmation lors des actions “marquer tout comme lu”', diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 955fc6747..8eb3a156b 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -91,6 +91,13 @@
+ +
+ +
+ +
+
diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 2144f1576..bf0ffdb76 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -54,6 +54,8 @@ echo 'authType="', $authType, '",', echo 'str_confirmation="', Minz_Translate::t('confirm_action'), '"', ",\n"; echo 'str_notif_title_articles="', Minz_Translate::t('notif_title_new_articles'), '"', ",\n"; echo 'str_notif_body_articles="', Minz_Translate::t('notif_body_new_articles'), '"', ",\n"; +echo 'html5_notif_timeout=', $this->conf->html5_notif_timeout,",\n"; + $autoActualise = Minz_Session::param('actualize_feeds', false); echo 'auto_actualize_feeds=', $autoActualise ? 'true' : 'false', ";\n"; diff --git a/p/scripts/main.js b/p/scripts/main.js index fd49d62ba..c568bac35 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -866,6 +866,12 @@ function notifs_html5_show(nb) { notification.onclick = function() { window.location.reload(); } + + if (html5_notif_timeout !== 0){ + setTimeout(function() { + notification.close(); + }, html5_notif_timeout * 1000); + } } function init_notifs_html5() { -- cgit v1.2.3 From f727a1383639d5bdc762f73dfe93b9a5d577cb41 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 18 Sep 2014 14:50:54 +0200 Subject: Improve reset auth system - Add bcrypt.js in resetAuthAction() - Rename init_loginForm() in init_crypto_form() - Load init_crypto_form() everytime (if no #crypto-form, do nothing) --- app/Controllers/indexController.php | 3 +++ app/views/index/formLogin.phtml | 2 +- app/views/index/resetAuth.phtml | 2 +- p/scripts/main.js | 27 +++++++++++++++------------ 4 files changed, 20 insertions(+), 14 deletions(-) (limited to 'p/scripts') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index fccf16ecf..86863cc84 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -423,6 +423,9 @@ class FreshRSS_index_Controller extends Minz_ActionController { public function resetAuthAction() { Minz_View::prependTitle(_t('reset_auth') . ' · '); + Minz_View::appendScript(Minz_Url::display( + '/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js') + )); $this->view->no_form = false; // Enable changement of auth only if Persona! diff --git a/app/views/index/formLogin.phtml b/app/views/index/formLogin.phtml index b79c1b614..34f10de4a 100644 --- a/app/views/index/formLogin.phtml +++ b/app/views/index/formLogin.phtml @@ -3,7 +3,7 @@ switch (Minz_Configuration::authType()) { case 'form': - ?>
+ ?>
diff --git a/app/views/index/resetAuth.phtml b/app/views/index/resetAuth.phtml index 7f3b54bdb..78cc527b3 100644 --- a/app/views/index/resetAuth.phtml +++ b/app/views/index/resetAuth.phtml @@ -9,7 +9,7 @@ no_form) { ?> - +

diff --git a/p/scripts/main.js b/p/scripts/main.js index fd49d62ba..04151c30d 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -977,7 +977,7 @@ function init_load_more(box) { } // -// +// function poormanSalt() { //If crypto.getRandomValues is not available var text = '$2a$04$', base = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789/abcdefghijklmnopqrstuvwxyz'; @@ -987,20 +987,24 @@ function poormanSalt() { //If crypto.getRandomValues is not available return text; } -function init_loginForm() { - var $loginForm = $('#loginForm'); - if ($loginForm.length === 0) { +function init_crypto_form() { + var $crypto_form = $('#crypto-form'); + if ($crypto_form.length === 0) { return; } + if (!(window.dcodeIO)) { if (window.console) { console.log('FreshRSS waiting for bcrypt.js…'); } - window.setTimeout(init_loginForm, 100); + window.setTimeout(init_crypto_form, 100); return; } - $loginForm.on('submit', function() { - $('#loginButton').attr('disabled', ''); + + $crypto_form.on('submit', function() { + var $submit_button = $(this).find('button[type="submit"]'); + $submit_button.attr('disabled', ''); + var success = false; $.ajax({ url: './?c=javascript&a=nonce&user=' + $('#username').val(), @@ -1027,11 +1031,12 @@ function init_loginForm() { }).fail(function() { alert('Communication error!'); }); - $('#loginButton').removeAttr('disabled'); + + $submit_button.removeAttr('disabled'); return success; }); } -// +// // function init_persona() { @@ -1233,14 +1238,12 @@ function init_all() { } init_notifications(); switch (authType) { - case 'form': - init_loginForm(); - break; case 'persona': init_persona(); break; } init_confirm_action(); + init_crypto_form(); $stream = $('#stream'); if ($stream.length > 0) { init_actualize(); -- cgit v1.2.3 From c0d0279b03c4cd9f3b529da0b24db58cfb3520c1 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 18 Sep 2014 14:57:34 +0200 Subject: Use openNotification instead of alert (main.js) --- p/scripts/main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index 04151c30d..01bd0c734 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1012,7 +1012,7 @@ function init_crypto_form() { async: false }).done(function (data) { if (data.salt1 == '' || data.nonce == '') { - alert('Invalid user!'); + openNotification('Invalid user!', 'bad'); } else { try { var strong = window.Uint32Array && window.crypto && (typeof window.crypto.getRandomValues === 'function'), @@ -1020,16 +1020,16 @@ function init_crypto_form() { c = dcodeIO.bcrypt.hashSync(data.nonce + s, strong ? 4 : poormanSalt()); $('#challenge').val(c); if (s == '' || c == '') { - alert('Crypto error!'); + openNotification('Crypto error!', 'bad'); } else { success = true; } } catch (e) { - alert('Crypto exception! ' + e); + openNotification('Crypto exception! ' + e, 'bad'); } } }).fail(function() { - alert('Communication error!'); + openNotification('Communication error!', 'bad'); }); $submit_button.removeAttr('disabled'); -- cgit v1.2.3 From bafe851f9073faedc52b4de1ff4fbe5a680dab2b Mon Sep 17 00:00:00 2001 From: plopoyop Date: Thu, 18 Sep 2014 15:29:16 +0200 Subject: Ajout du tag sur la notification HTML5 --- p/scripts/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index c568bac35..9d2d83a32 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -860,7 +860,8 @@ function notifs_html5_show(nb) { var notification = new window.Notification(str_notif_title_articles, { icon: "../themes/icons/favicon-256.png", - body: str_notif_body_articles.replace("\d", nb) + body: str_notif_body_articles.replace("\d", nb), + tag: "freshRssNewArticles" }); notification.onclick = function() { -- cgit v1.2.3 From 635ea04d52b3078e6a76c64072cf86d60b6c1561 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 19 Sep 2014 18:38:00 +0200 Subject: Move loading of crypto form See https://github.com/marienfressinaud/FreshRSS/commit/f727a1383639d5bdc762f73dfe93b9a5d577cb41#commitcomment-7853832 --- p/scripts/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index b2ca90c5b..2503116ee 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1250,7 +1250,6 @@ function init_all() { break; } init_confirm_action(); - init_crypto_form(); $stream = $('#stream'); if ($stream.length > 0) { init_actualize(); @@ -1265,6 +1264,7 @@ function init_all() { init_notifs_html5(); window.setInterval(refreshUnreads, 120000); } else { + init_crypto_form(); init_share_observers(); init_remove_observers(); init_feed_observers(); -- cgit v1.2.3 From bcb1e3750a9eee51070d602cc77def06f7f071c9 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 24 Sep 2014 13:56:40 +0200 Subject: More explicit message when deleting feeds or cats Introduce "data-str-confirm" to override default message for confirm actions. Fix https://github.com/marienfressinaud/FreshRSS/issues/625 --- app/i18n/en.php | 1 + app/i18n/fr.php | 1 + app/views/configure/categorize.phtml | 5 ++++- app/views/configure/feed.phtml | 7 +++++-- app/views/helpers/javascript_vars.phtml | 2 +- p/scripts/main.js | 5 +++++ 6 files changed, 17 insertions(+), 4 deletions(-) (limited to 'p/scripts') diff --git a/app/i18n/en.php b/app/i18n/en.php index e5def46be..1ceb7b1fa 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -368,6 +368,7 @@ return array ( 'login_required' => 'Login required:', 'confirm_action' => 'Are you sure you want to perform this action? It cannot be cancelled!', + 'confirm_action_feed_cat' => 'Are you sure you want to perform this action? You may lost related favorites and user queries. It cannot be cancelled!', 'notif_title_new_articles' => 'FreshRSS: new articles!', 'notif_body_new_articles' => 'There are \d new articles to read on FreshRSS.', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 4d39f7eb4..b0fbf15ae 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -368,6 +368,7 @@ return array ( 'login_required' => 'Accès protégé par mot de passe :', 'confirm_action' => 'Êtes-vous sûr(e) de vouloir continuer ? Cette action ne peut être annulée !', + 'confirm_action_feed_cat' => 'Êtes-vous sûr(e) de vouloir continuer ? Vous pourriez perdre les favoris et les filtres associés. Cette action ne peut être annulée !', 'notif_title_new_articles' => 'FreshRSS : nouveaux articles !', 'notif_body_new_articles' => 'Il y a \d nouveaux articles à lire sur FreshRSS.', diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index 2f0e554ca..23d1c9fa1 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -21,7 +21,10 @@ - +

(nbFeed ()); ?>) diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index 0959652c2..e96a28739 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -79,8 +79,11 @@
- - + +
diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index bf0ffdb76..1139eb446 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -51,7 +51,7 @@ echo 'authType="', $authType, '",', 'url_login="', _url ('index', 'login'), '",', 'url_logout="', _url ('index', 'logout'), '",'; -echo 'str_confirmation="', Minz_Translate::t('confirm_action'), '"', ",\n"; +echo 'str_confirmation_default="', Minz_Translate::t('confirm_action'), '"', ",\n"; echo 'str_notif_title_articles="', Minz_Translate::t('notif_title_new_articles'), '"', ",\n"; echo 'str_notif_body_articles="', Minz_Translate::t('notif_body_new_articles'), '"', ",\n"; echo 'html5_notif_timeout=', $this->conf->html5_notif_timeout,",\n"; diff --git a/p/scripts/main.js b/p/scripts/main.js index 2503116ee..f6d5d2907 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1109,6 +1109,11 @@ function init_persona() { function init_confirm_action() { $('body').on('click', '.confirm', function () { + var str_confirmation = $(this).attr('data-str-confirm'); + if (!str_confirmation) { + str_confirmation = str_confirmation_default; + } + return confirm(str_confirmation); }); } -- cgit v1.2.3