From 29137c0b046bfcc610e6c8a152e558fa9c718da4 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 23 Nov 2013 23:18:18 +0100 Subject: Nouvelle fonction icon() pour générer le code HTML des icônes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Centralisation de la génération du code des icônes pour pouvoir plus facilement le changer, en particulier en préparation d'améliorations futures : * ajouter des alternatives lorsque l'image n'est pas affichée ; * améliorer l'accessibilité ; * permettre de changer les icônes selon le thème graphique choisi ; * simplifier les CSS. Contribue à https://github.com/marienfressinaud/FreshRSS/issues/284 --- app/layout/aside_feed.phtml | 4 +-- app/layout/aside_flux.phtml | 12 +++---- app/layout/header.phtml | 12 +++---- app/layout/layout.phtml | 2 +- app/layout/nav_entries.phtml | 6 ++-- app/layout/nav_menu.phtml | 8 ++--- app/views/configure/categorize.phtml | 2 +- app/views/configure/display.phtml | 10 +++--- app/views/configure/feed.phtml | 10 +++--- app/views/helpers/view/global_view.phtml | 2 +- app/views/helpers/view/normal_view.phtml | 16 ++++----- lib/lib_rss.php | 30 +++++++++++++++++ public/install.php | 3 +- public/scripts/main.js | 8 ++--- public/themes/default/freshrss.css | 56 +++----------------------------- public/themes/default/global.css | 12 +++++++ public/themes/flat-design/freshrss.css | 56 +++----------------------------- public/themes/flat-design/global.css | 12 +++++++ 18 files changed, 110 insertions(+), 151 deletions(-) diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index a622ce8a3..56aeee8b9 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -7,7 +7,7 @@ - + diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index 3e057789f..42dc896aa 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -1,12 +1,12 @@
- +
@@ -53,7 +53,7 @@ @@ -73,7 +73,7 @@ if (login_is_conf ($this->conf) && !is_logged ()) { ?>
- +
diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index 633af16f2..eb0f8b484 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -36,7 +36,7 @@ ?>
notification['content']; ?> - +
diff --git a/app/layout/nav_entries.phtml b/app/layout/nav_entries.phtml index 49dd4eae1..306c1536d 100644 --- a/app/layout/nav_entries.phtml +++ b/app/layout/nav_entries.phtml @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index b7fb4a817..affdaaa10 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -1,8 +1,8 @@ diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index 3656dc0a3..8fecec36f 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -29,21 +29,21 @@
- +
- +
@@ -85,7 +85,7 @@
- +
@@ -94,7 +94,7 @@
- +
diff --git a/app/views/helpers/view/global_view.phtml b/app/views/helpers/view/global_view.phtml index e555adb9f..f34d368f9 100644 --- a/app/views/helpers/view/global_view.phtml +++ b/app/views/helpers/view/global_view.phtml @@ -32,5 +32,5 @@
conf->displayPosts () === 'no' ? ' class="hide_posts"' : ''; ?>> - +
\ No newline at end of file diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index fccfd71b4..6a023451f 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -42,13 +42,13 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { if ($this->conf->toplineRead ()) { ?>
  • isRead () ? '☑' : '☐'; ?>isRead () ? 'read' : 'unread'); ?>
  • conf->toplineFavorite ()) { ?>
  • isFavorite () ? '★' : '☆'; ?>isFavorite () ? 'starred' : 'non-starred'); ?>
  • entryPaginator) && !$this->entryPaginator->isEmpty ()) {
  • ✇ name(); ?>
  • title (); ?>
  • conf->toplineDate ()) { ?>
  • date (); ?> 
  • - conf->toplineLink ()) { ?> + conf->toplineLink ()) { ?>
    @@ -79,13 +79,13 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { if ($this->conf->bottomlineRead ()) { ?>
  • isRead () ? '☑' : '☐'; ?>isRead () ? 'read' : 'unread'); ?>
  • conf->bottomlineFavorite ()) { ?>
  • isFavorite () ? '★' : '☆'; ?>isFavorite () ? 'starred' : 'non-starred'); ?>
  • @@ -97,7 +97,7 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { ?> diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 33f8641e1..b968f500f 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -215,3 +215,33 @@ function lazyimg($content) { $content ); } + +function icon($name) { // '✚', + 'all' => '☰', + 'bookmark' => '★', + 'category' => '☷', + 'category-white' => '☷', + 'close' => '❌', + 'configure' => '⚙', + 'down' => '▽', + 'favorite' => '★', + 'help' => 'ⓘ', + 'link' => '↗', + 'login' => '🔒', + 'logout' => '🔓', + 'next' => '⏩', + 'non-starred' => '☆', + 'prev' => '⏪', + 'read' => '☑', + 'unread' => '☐', + 'refresh' => '🔃', //↻ + 'search' => '🔍', + 'share' => '♺', + 'starred' => '★', + 'tag' => '⚐', + 'up' => '△', + ); + return '' . $alts[$name] . ''; +} diff --git a/public/install.php b/public/install.php index 68878a5e9..2e6519bf8 100644 --- a/public/install.php +++ b/public/install.php @@ -1,5 +1,6 @@
    - +
    diff --git a/public/scripts/main.js b/public/scripts/main.js index e9d300694..8f82fc593 100644 --- a/public/scripts/main.js +++ b/public/scripts/main.js @@ -43,11 +43,11 @@ function mark_read(active, only_not_read) { $r = active.find("a.read").attr("href", res.url), inc = 0; if (active.hasClass("not_read")) { - $r.text('☑'); + $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.text('☐'); + $r.find('.icon').removeClass('i_read').addClass('i_unread').text('☐'); active.addClass("not_read"); inc++; } @@ -113,11 +113,11 @@ function mark_favorite(active) { $b = active.find("a.bookmark").attr("href", res.url), inc = 0; if (active.hasClass("favorite")) { - $b.text('☆'); + $b.find('.icon').removeClass('i_starred').addClass('i_non-starred').text('☆'); active.removeClass("favorite"); inc--; } else { - $b.text('★'); + $b.find('.icon').removeClass('i_non-starred').addClass('i_starred').text('★'); active.addClass("favorite").find('.bookmark'); inc++; } diff --git a/public/themes/default/freshrss.css b/public/themes/default/freshrss.css index 7f57cd51b..04b6c2e93 100644 --- a/public/themes/default/freshrss.css +++ b/public/themes/default/freshrss.css @@ -25,9 +25,6 @@ margin: 0; text-shadow: 1px -1px 0 #ccc; } - .header > .item.title a:hover { - text-decoration: none; - } .header > .item.search input { width: 230px; transition: width 200ms linear; @@ -39,6 +36,10 @@ width: 100px; } +.item a:hover { + text-decoration: none; +} + #global { display: table; width: 100%; @@ -70,11 +71,6 @@ right: 33px; } - .aside.aside_flux .i_category { - background-image: url("../icons/category-white.png"); - background-image: url("../icons/category-white.svg"); - } - .nav-login { display: none; } @@ -259,36 +255,6 @@ font-size: 0px; text-align: center; } - .read { - display: inline-block; - width: 40px; - height: 40px; - background: url("../icons/read.png") center center no-repeat; - background: url("../icons/read.svg") center center no-repeat; - vertical-align: middle; - } - .read:hover { - text-decoration: none; - } - .flux.not_read .read { - background: url("../icons/unread.png") center center no-repeat; - background: url("../icons/unread.svg") center center no-repeat; - } - .bookmark { - display: inline-block; - width: 40px; - height: 40px; - background: url("../icons/non-starred.png") center center no-repeat; - background: url("../icons/non-starred.svg") center center no-repeat; - vertical-align: middle; - } - .bookmark:hover { - text-decoration: none; - } - .flux.favorite .bookmark { - background: url("../icons/starred.png") center center no-repeat; - background: url("../icons/starred.svg") center center no-repeat; - } .flux_header .item.website { width: 200px; overflow: hidden; @@ -313,9 +279,6 @@ color: #000; outline: none; } - .flux_header .item.title a:hover { - text-decoration: none - } .flux.not_read .flux_header .item.title { font-weight: bold; } @@ -334,17 +297,6 @@ width: 40px; text-align: center; } - .link a { - display: inline-block; - width: 40px; - height: 40px; - background: url("../icons/link.png") center center no-repeat; - background: url("../icons/link.svg") center center no-repeat; - vertical-align: middle; - } - .link a:hover { - text-decoration: none; - } #stream.reader .flux { padding: 0 0 30px; diff --git a/public/themes/default/global.css b/public/themes/default/global.css index 89668c393..58b4126b0 100644 --- a/public/themes/default/global.css +++ b/public/themes/default/global.css @@ -572,6 +572,10 @@ input, select, textarea { background-image: url("../icons/category.png"); background-image: url("../icons/category.svg"); } + .i_category-white { + background-image: url("../icons/category-white.png"); + background-image: url("../icons/category-white.svg"); + } .i_rss { background-image: url("../icons/rss.png"); background-image: url("../icons/rss.svg"); @@ -580,6 +584,14 @@ input, select, textarea { background-image: url("../icons/share.png"); background-image: url("../icons/share.svg"); } + .i_starred { + background-image: url("../icons/starred.png"); + background-image: url("../icons/starred.svg"); + } + .i_non-starred { + background-image: url("../icons/non-starred.png"); + background-image: url("../icons/non-starred.svg"); + } .i_tag { background-image: url("../icons/tag.png"); background-image: url("../icons/tag.svg"); diff --git a/public/themes/flat-design/freshrss.css b/public/themes/flat-design/freshrss.css index fd0cf5b00..4c15ca138 100644 --- a/public/themes/flat-design/freshrss.css +++ b/public/themes/flat-design/freshrss.css @@ -28,9 +28,6 @@ body { display: inline-block; margin: 0; } - .header > .item.title a:hover { - text-decoration: none; - } .header > .item.search input { width: 230px; transition: width 200ms linear; @@ -42,6 +39,10 @@ body { width: 100px; } +.item a:hover { + text-decoration: none; +} + #global { display: table; width: 100%; @@ -238,36 +239,6 @@ body { font-size: 0px; text-align: center; } - .read { - display: inline-block; - width: 40px; - height: 40px; - background: url("../icons/read.png") center center no-repeat; - background: url("../icons/read.svg") center center no-repeat; - vertical-align: middle; - } - .read:hover { - text-decoration: none; - } - .flux.not_read .read { - background: url("../icons/unread.png") center center no-repeat; - background: url("../icons/unread.svg") center center no-repeat; - } - .bookmark { - display: inline-block; - width: 40px; - height: 40px; - background: url("../icons/non-starred.png") center center no-repeat; - background: url("../icons/non-starred.svg") center center no-repeat; - vertical-align: middle; - } - .bookmark:hover { - text-decoration: none; - } - .flux.favorite .bookmark { - background: url("../icons/starred.png") center center no-repeat; - background: url("../icons/starred.svg") center center no-repeat; - } .flux_header .item.website { width: 200px; overflow: hidden; @@ -278,10 +249,6 @@ body { .flux_header .item.website .favicon { padding: 5px; } - .flux_header .item.website a { - display: block; - height: 40px; - } .flux_header .item.title { overflow: hidden; white-space: nowrap; @@ -292,9 +259,6 @@ body { color: #333; outline: none; } - .flux_header .item.title a:hover { - text-decoration: none - } .flux.not_read .flux_header .item.title { font-weight: bold; } @@ -313,17 +277,6 @@ body { width: 40px; text-align: center; } - .link a { - display: inline-block; - width: 40px; - height: 40px; - background: url("../icons/link.png") center center no-repeat; - background: url("../icons/link.svg") center center no-repeat; - vertical-align: middle; - } - .link a:hover { - text-decoration: none; - } #stream.reader .flux { position: relative; @@ -529,7 +482,6 @@ body { .pagination .item a:hover { color: #ecf0f1; background: #34495e; - text-decoration: none; } #nav_entries { diff --git a/public/themes/flat-design/global.css b/public/themes/flat-design/global.css index 7d930c066..f2957d77a 100644 --- a/public/themes/flat-design/global.css +++ b/public/themes/flat-design/global.css @@ -556,6 +556,10 @@ input, select, textarea { background-image: url("../icons/category-white.png"); background-image: url("../icons/category-white.svg"); } + .i_category-white { + background-image: url("../icons/category-white.png"); + background-image: url("../icons/category-white.svg"); + } .i_rss { background-image: url("../icons/rss.png"); background-image: url("../icons/rss.svg"); @@ -564,6 +568,14 @@ input, select, textarea { background-image: url("../icons/share.png"); background-image: url("../icons/share.svg"); } + .i_starred { + background-image: url("../icons/starred.png"); + background-image: url("../icons/starred.svg"); + } + .i_non-starred { + background-image: url("../icons/non-starred.png"); + background-image: url("../icons/non-starred.svg"); + } .i_tag { background-image: url("../icons/tag.png"); background-image: url("../icons/tag.svg"); -- cgit v1.2.3