diff options
Diffstat (limited to 'classes')
-rwxr-xr-x | classes/feeds.php | 29 | ||||
-rw-r--r-- | classes/pref/prefs.php | 4 | ||||
-rwxr-xr-x | classes/rpc.php | 15 | ||||
-rwxr-xr-x | classes/rssutils.php | 2 |
4 files changed, 34 insertions, 16 deletions
diff --git a/classes/feeds.php b/classes/feeds.php index ed0789788..38819ec77 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -360,14 +360,18 @@ class Feeds extends Handler_Protected { require_once "colors.php"; - if ($fav_color && $fav_color != 'fail') { - if (!isset($rgba_cache[$feed_id])) { - $rgba_cache[$feed_id] = join(",", _color_unpack($fav_color)) . ",0.3"; + if (!isset($rgba_cache[$feed_id])) { + if ($fav_color && $fav_color != 'fail') { + $rgba_cache[$feed_id] = _color_unpack($fav_color); + } else { + $rgba_cache[$feed_id] = _color_unpack($this->color_of($line['feed_title'])); } - - $line['favicon_avg_color_rgba'] = $rgba_cache[$feed_id]; } + if (isset($rgba_cache[$feed_id])) { + $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)'; + } + /* we don't need those */ foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color", @@ -1878,6 +1882,21 @@ class Feeds extends Handler_Protected { } + function color_of($name) { + $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", + "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", + "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; + + $sum = 0; + + for ($i = 0; $i < strlen($name); $i++) { + $sum += ord($name{$i}); + } + + $sum %= count($colormap); + + return $colormap[$sum]; + } } diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index af8f86284..5388bd905 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -992,7 +992,9 @@ class Pref_Prefs extends Handler_Protected { print_hidden("method", "setpref"); print_hidden("key", "USER_STYLESHEET"); - print "<div class='panel' id='user-css-editor'>$value</div>"; + print "<textarea class='panel user-css-editor' dojoType='dijit.form.SimpleTextarea' + style='font-size : 12px;' + name='value'>$value</textarea>"; print "<div class='dlgButtons'>"; print "<button dojoType=\"dijit.form.Button\" diff --git a/classes/rpc.php b/classes/rpc.php index 41325d62a..d40d5ab6a 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -271,17 +271,14 @@ class RPC extends Handler_Protected { } function getAllCounters() { - $last_article_id = (int) clean($_REQUEST["last_article_id"]); + @$seq = (int) $_REQUEST['seq']; - $reply = array(); - - if (!empty($_REQUEST['seq'])) $reply['seq'] = (int) $_REQUEST['seq']; - - if ($last_article_id != Article::getLastArticleId()) { - $reply['counters'] = Counters::getAllCounters(); - } + $reply = [ + 'counters' => Counters::getAllCounters() + ]; - $reply['runtime-info'] = make_runtime_info(); + if ($seq % 2 == 0) + $reply['runtime-info'] = make_runtime_info(); print json_encode($reply); } diff --git a/classes/rssutils.php b/classes/rssutils.php index 8b3c7c0d0..750222c80 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -830,7 +830,7 @@ class RSSUtils { $start = microtime(true); $article = $plugin->hook_article_filter_action($article, $pfaction); - Debug::log(sprintf("=== %.4f (sec)"), Debug::$LOG_VERBOSE); + Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); } else { Debug::log("??? $pfclass: plugin object not found.", Debug::$LOG_VERBOSE); } |