Change the tagcloud generation for better variaous size.
This commit is contained in:
parent
4c02d06d57
commit
01f59ddf63
3 changed files with 30 additions and 5 deletions
27
inc/user.css
27
inc/user.css
|
@ -40,12 +40,12 @@ pre code {
|
||||||
position: static;
|
position: static;
|
||||||
margin-left: 130px;
|
margin-left: 130px;
|
||||||
}
|
}
|
||||||
#linklist {
|
#linklist, #cloudtag {
|
||||||
max-width: 80%;
|
max-width: 80%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 0.3em;
|
padding: 0.3em;
|
||||||
}
|
}
|
||||||
#linklist li {
|
#linklist li, #linklist li.private {
|
||||||
padding: 0.3em;
|
padding: 0.3em;
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
border: 1px solid #cdcdcd;
|
border: 1px solid #cdcdcd;
|
||||||
|
@ -128,6 +128,29 @@ pre code {
|
||||||
color: #555;
|
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)
|
@media handheld, only screen and (max-width: 560px), only screen and (max-device-width: 854px)
|
||||||
{
|
{
|
||||||
#linklist {
|
#linklist {
|
||||||
|
|
|
@ -1234,11 +1234,13 @@ function renderPage()
|
||||||
// We sort tags alphabetically, then choose a font size according to count.
|
// We sort tags alphabetically, then choose a font size according to count.
|
||||||
// First, find max value.
|
// First, find max value.
|
||||||
$maxcount=0; foreach($tags as $key=>$value) $maxcount=max($maxcount,$value);
|
$maxcount=0; foreach($tags as $key=>$value) $maxcount=max($maxcount,$value);
|
||||||
|
$linkCount = count($LINKSDB);
|
||||||
ksort($tags);
|
ksort($tags);
|
||||||
$tagList=array();
|
$tagList=array();
|
||||||
foreach($tags as $key=>$value)
|
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 = new pageBuilder;
|
||||||
$PAGE->assign('linkcount',count($LINKSDB));
|
$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.
|
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)
|
$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');
|
'href'=>$href,'width'=>'120','style'=>'height:auto;','alt'=>'thumbnail');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<center>
|
<center>
|
||||||
<div id="cloudtag">
|
<div id="cloudtag">
|
||||||
{loop="tags"}
|
{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}
|
{/loop}
|
||||||
</div>
|
</div>
|
||||||
</center>
|
</center>
|
||||||
|
|
Loading…
Reference in a new issue