Change the tagcloud generation for better variaous size.

This commit is contained in:
Knah Tsaeb 2013-03-29 15:51:56 +01:00
parent 4c02d06d57
commit 01f59ddf63
3 changed files with 30 additions and 5 deletions

View File

@ -40,12 +40,12 @@ pre code {
position: static;
margin-left: 130px;
}
#linklist {
#linklist, #cloudtag {
max-width: 80%;
margin: 0 auto;
padding: 0.3em;
}
#linklist li {
#linklist li, #linklist li.private {
padding: 0.3em;
margin: 1em 0;
border: 1px solid #cdcdcd;
@ -128,6 +128,29 @@ pre code {
color: #555;
}
#cloudtag {
background-color: #ababab;
border-radius:0.3em;
}
#cloudtag > span {
padding: 0 0.3em;
color:#fff;
font-size:0.9em;
}
#cloudtag a {
font-weight:bold;
color:black;
text-decoration:none
}
#cloudtag a:hover {
font-weight:bold;
color:#ffffc9;
text-decoration:none
}
@media handheld, only screen and (max-width: 560px), only screen and (max-device-width: 854px)
{
#linklist {

View File

@ -1234,11 +1234,13 @@ function renderPage()
// We sort tags alphabetically, then choose a font size according to count.
// First, find max value.
$maxcount=0; foreach($tags as $key=>$value) $maxcount=max($maxcount,$value);
$linkCount = count($LINKSDB);
ksort($tags);
$tagList=array();
foreach($tags as $key=>$value)
{
$tagList[$key] = array('count'=>$value,'size'=>max(40*$value/$maxcount,8));
//$tagList[$key] = array('count'=>$value,'size'=>max(40*$value/$maxcount,8));
$tagList[$key] = array('count'=>$value,'size'=>round(min(max($maxcount*$value/$linkCount,0.8),4.5),2), 'max'=>$maxcount);
}
$PAGE = new pageBuilder;
$PAGE->assign('linkcount',count($LINKSDB));
@ -1936,7 +1938,7 @@ function computeThumbnail($url,$href=false)
if ("/talks/" !== substr($path,0,7)) return array(); // This is not a single video URL.
}
$sign = hash_hmac('sha256', $url, $GLOBALS['salt']); // We use the salt to sign data (it's random, secret, and specific to each installation)
return array('src'=>indexUrl().'?do=genthumbnail&hmac='.htmlspecialchars($sign).'&url='.urlencode($url),
return array('src'=>indexUrl().'?do=genthumbnail&hmac='.htmlspecialchars($sign).'&url='.rawurlencode($url),
'href'=>$href,'width'=>'120','style'=>'height:auto;','alt'=>'thumbnail');
}

View File

@ -6,7 +6,7 @@
<center>
<div id="cloudtag">
{loop="tags"}
<span>{$value.count}</span><a href="?searchtags={$key|htmlspecialchars}" style="font-size:{$value.size}pt;">{$key|htmlspecialchars}</a>
<span>{$value.count}</span><a href="?searchtags={$key|htmlspecialchars}" style="font-size:{$value.size}em;">{$key|htmlspecialchars}</a>
{/loop}
</div>
</center>