diff options
| author | 2013-11-23 23:47:20 +0100 | |
|---|---|---|
| committer | 2013-11-23 23:47:20 +0100 | |
| commit | 632423d97ca2ebd30b1214e03592035809217197 (patch) | |
| tree | 31ef0d123e199741bc5b3b08301e50134ec59671 | |
| parent | 29137c0b046bfcc610e6c8a152e558fa9c718da4 (diff) | |
Améliorations suite à icon()
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/284
| -rwxr-xr-x | app/views/entry/bookmark.phtml | 2 | ||||
| -rwxr-xr-x | app/views/entry/read.phtml | 2 | ||||
| -rw-r--r-- | lib/lib_rss.php | 2 | ||||
| -rw-r--r-- | public/scripts/main.js | 6 |
4 files changed, 5 insertions, 7 deletions
diff --git a/app/views/entry/bookmark.phtml b/app/views/entry/bookmark.phtml index 1ff1c220c..8ce39629b 100755 --- a/app/views/entry/bookmark.phtml +++ b/app/views/entry/bookmark.phtml @@ -12,4 +12,4 @@ $url = Url::display (array ( 'params' => Request::params (), )); -echo json_encode (array ('url' => str_ireplace ('&', '&', $url))); +echo json_encode (array ('url' => str_ireplace ('&', '&', $url), 'icon' => icon(Request::param ('is_favorite') ? 'non-starred' : 'starred'))); diff --git a/app/views/entry/read.phtml b/app/views/entry/read.phtml index 6d3313a89..224651e58 100755 --- a/app/views/entry/read.phtml +++ b/app/views/entry/read.phtml @@ -12,4 +12,4 @@ $url = Url::display (array ( 'params' => Request::params (), )); -echo json_encode (array ('url' => str_ireplace ('&', '&', $url))); +echo json_encode (array ('url' => str_ireplace ('&', '&', $url), 'icon' => icon(Request::param ('is_read') ? 'unread' : 'read'))); diff --git a/lib/lib_rss.php b/lib/lib_rss.php index b968f500f..1d9d5c7e0 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -216,7 +216,7 @@ function lazyimg($content) { ); } -function icon($name) { //<?php echo icon('share'); +function icon($name) { static $alts = array( 'add' => '✚', 'all' => '☰', diff --git a/public/scripts/main.js b/public/scripts/main.js index 8f82fc593..e21483f28 100644 --- a/public/scripts/main.js +++ b/public/scripts/main.js @@ -43,14 +43,13 @@ function mark_read(active, only_not_read) { $r = active.find("a.read").attr("href", res.url), inc = 0; if (active.hasClass("not_read")) { - $r.find('.icon').removeClass('i_unread').addClass('i_read').text('☑'); active.removeClass("not_read"); inc--; } else if (only_not_read !== true || active.hasClass("not_read")) { - $r.find('.icon').removeClass('i_read').addClass('i_unread').text('☐'); active.addClass("not_read"); inc++; } + $r.find('.icon').replaceWith(res.icon); //Update unread: feed var feed_url = active.find(".website>a").attr("href"), @@ -113,14 +112,13 @@ function mark_favorite(active) { $b = active.find("a.bookmark").attr("href", res.url), inc = 0; if (active.hasClass("favorite")) { - $b.find('.icon').removeClass('i_starred').addClass('i_non-starred').text('☆'); active.removeClass("favorite"); inc--; } else { - $b.find('.icon').removeClass('i_non-starred').addClass('i_starred').text('★'); active.addClass("favorite").find('.bookmark'); inc++; } + $b.find('.icon').replaceWith(res.icon); var favourites = $('.favorites>a').contents().last().get(0); if (favourites && favourites.textContent) { |
