diff options
author | Arthur <arthur@hoa.ro> | 2016-04-09 16:35:14 +0200 |
---|---|---|
committer | Arthur <arthur@hoa.ro> | 2016-04-09 16:35:14 +0200 |
commit | a1703c44c63852cf54d979a50921dc3a09508a82 (patch) | |
tree | 588a42a5e6c5a32c52e33eb86bfc284009e0bcc7 | |
parent | 11609d9fd8ba53f049e6c913d8e3affab6cfc9ce (diff) | |
parent | b0128609f4b29c55d86152f3d0ff4b4e07bbcbf8 (diff) | |
download | Shaarli-a1703c44c63852cf54d979a50921dc3a09508a82.tar.gz Shaarli-a1703c44c63852cf54d979a50921dc3a09508a82.tar.zst Shaarli-a1703c44c63852cf54d979a50921dc3a09508a82.zip |
Merge pull request #527 from ArthurHoaro/hotfix/tagcloud-size
Fixes #526: bad font size separator in tagcloud with some locale
-rw-r--r-- | index.php | 15 | ||||
-rw-r--r-- | tpl/tagcloud.html | 4 |
2 files changed, 12 insertions, 7 deletions
@@ -1015,11 +1015,16 @@ function renderPage() | |||
1015 | return strcasecmp($a, $b); | 1015 | return strcasecmp($a, $b); |
1016 | }); | 1016 | }); |
1017 | 1017 | ||
1018 | $tagList=array(); | 1018 | $tagList = array(); |
1019 | foreach($tags as $key=>$value) | 1019 | foreach($tags as $key => $value) { |
1020 | // Tag font size scaling: default 15 and 30 logarithm bases affect scaling, 22 and 6 are arbitrary font sizes for max and min sizes. | 1020 | // Tag font size scaling: |
1021 | { | 1021 | // default 15 and 30 logarithm bases affect scaling, |
1022 | $tagList[$key] = array('count'=>$value,'size'=>log($value, 15) / log($maxcount, 30) * (22-6) + 6); | 1022 | // 22 and 6 are arbitrary font sizes for max and min sizes. |
1023 | $size = log($value, 15) / log($maxcount, 30) * 2.2 + 0.8; | ||
1024 | $tagList[$key] = array( | ||
1025 | 'count' => $value, | ||
1026 | 'size' => number_format($size, 2, '.', ''), | ||
1027 | ); | ||
1023 | } | 1028 | } |
1024 | 1029 | ||
1025 | $data = array( | 1030 | $data = array( |
diff --git a/tpl/tagcloud.html b/tpl/tagcloud.html index 5891cd25..e449f293 100644 --- a/tpl/tagcloud.html +++ b/tpl/tagcloud.html | |||
@@ -12,8 +12,8 @@ | |||
12 | 12 | ||
13 | <div id="cloudtag"> | 13 | <div id="cloudtag"> |
14 | {loop="tags"} | 14 | {loop="tags"} |
15 | <span class="count">{$value.count}</span> | 15 | <span class="count">{$value.count}</span><a |
16 | <a href="?searchtags={$key|urlencode}" style="font-size:{$value.size}pt;">{$key}</a> | 16 | href="?searchtags={$key|urlencode}" style="font-size:{$value.size}em;">{$key}</a> |
17 | {loop="$value.tag_plugin"} | 17 | {loop="$value.tag_plugin"} |
18 | {$value} | 18 | {$value} |
19 | {/loop} | 19 | {/loop} |