所以我們只需要把原有的Tag List製做成Tag Cloud即可。
首先,先改CSS的設計部分:
/* Style for Label Cloud */
#labelCloud {
text-align: center;
}
#labelCloud .label-cloud li{
display: inline;
background-image: none !important;
padding: 0 5px;
margin: 0;
vertical-align: baseline !important;
border: 0 !important;
}
#labelCloud ul{
list-style-type: none;
margin: 0 auto;
padding: 0;
}
#labelCloud .label-count {
padding-left: 0.2em;
font-size: 9px;
color: #777;
}
接下來,加入製做Tag Cloud的js code
紅色部分是自訂的地方,諸如blog網址、大小字型、顏色…等。
<!-- User defined inline javascript -->
<script language='javascript' type='text/javascript'>
<!-- Functions used for Label Cloud: adjustLabel(), generateLabels()-->
var labels = new Object;
function adjustLabel(min, max, weight, total) {
if (min > max)
var temp=(min-max)/Math.log(total), result=min-Math.floor(Math.log(weight)*temp);
else
var temp=(max-min)/Math.log(total), result=Math.floor(Math.log(weight)*temp+min);
return result;
}
function generateLabels(){
var blogURL = 'http://abinlee.blogspot.com';
var maxFontSize = 18;
var minFontSize = 11;
var maxColor = [204,204,204];
var minColor = [119,119,119];
var showCount = true;
var labelColor= [];
var labelSize = 0;
var labelCount = new Array();
for (var i in labels)
if (!labelCount[labels[i]])
labelCount[labels[i]] = new Array(labels[i])
total = labelCount.length-1;
section = document.getElementById('labelCloud');
ul = document.createElement('ul');
ul.className = 'label-cloud';
for(var tag in labels) {
for (var i=0; i < 3; i++)
labelColor[i]=adjustLabel(minColor[i], maxColor[i], labels[tag], total);
labelSize = adjustLabel(minFontSize, maxFontSize, labels[tag], total);
li = document.createElement('li');
li.style.fontSize = labelSize+'px';
a = document.createElement('a');
a.title = labels[tag]+' articles with Label: '+tag;
a.style.color = 'rgb('+labelColor[0]+','+labelColor[1]+','+labelColor[2]+')';
a.href = blogURL+'/search/label/'+encodeURIComponent(tag);
if (showCount) {
span = document.createElement('span');
span.innerHTML = '('+labels[tag]+') ';
span.className = 'label-count';
a.appendChild(document.createTextNode(tag));
li.appendChild(a);
li.appendChild(span);
}
else {
a.appendChild(document.createTextNode(tag));
li.appendChild(a);
}
ul.appendChild(li);
ul.appendChild(document.createTextNode(' '));
}
section.appendChild(ul);
}
</script>
最後把widget code展開,找到id='Label1'的widget,將這整個widget以下面的code取代掉。
<b:widget id='Label1' locked='false' title='Labels' type='Label'>
<b:includable id='main'> <!-- Add Label Cloud -->
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<div id='labelCloud'/>
<script type='text/javascript'>
<b:loop values='data:labels' var='label'>
labels["<data:label.name/>"] = <data:label.count/>;
</b:loop>
generateLabels();
</script>
<noscript>
<ul>
<b:loop values='data:labels' var='label'>
<li>
<b:if cond='data:blog.url == data:label.url'>
<data:label.name/>
<b:else/>
<a expr:href='data:label.url'><data:label.name/></a>
</b:if>
(<data:label.count/>)
</li>
</b:loop>
</ul>
</noscript>
<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>
ps. 因為這樣子做出的Tag Cloud是以Blogger給定的Tag list製做的,所以排序就是以Blogger的設定為主,以次數或是字母排序。當然,改成了Tag Cloud之後,還使用次數排序,就看不出效果啦~
1 則留言:
[url=http://www.hi5.com/friend/group/4441177--natrol+tonalin+cla--front-html]natrol tonalin cla[/url]
[url=http://www.hi5.com/friend/group/4440535--soft+hackle--front-html]soft hackle[/url]
[url=http://www.hi5.com/friend/group/4441347--nail+salon+software--front-html]nail salon software[/url]
[url=http://www.hi5.com/friend/group/4440490--murad+acne+complex+kit--front-html]murad acne complex kit[/url]
[url=http://www.hi5.com/friend/group/4441743--codeine+cough+syrup--front-html]codeine cough syrup[/url]
[url=http://www.hi5.com/friend/group/4442403--kirkland+vitamin+c--front-html]kirkland vitamin c[/url]
[url=http://www.hi5.com/friend/group/4440594--metoprolol+tartrate--front-html]metoprolol tartrate[/url]
[url=http://www.hi5.com/friend/group/4442319--ageless+skin+care--front-html]ageless skin care[/url]
[url=http://www.hi5.com/friend/group/4440486--ginseng+powder--front-html]ginseng powder[/url]
[url=http://www.hi5.com/friend/group/4442036--edms+software--front-html]edms software[/url]
[url=http://www.hi5.com/friend/group/4441025--edms+software--front-html]edms software[/url]
[url=http://www.hi5.com/friend/group/4440527--natrol+tonalin+cla--front-html]natrol tonalin cla[/url]
[url=http://www.hi5.com/friend/group/4441785--pc+miler+software--front-html]pc miler software[/url]
[url=http://www.hi5.com/friend/group/4442120--maker--front-html]maker[/url]
[url=http://www.hi5.com/friend/group/4442285--ab+initio+software--front-html]ab initio software[/url]
[url=http://www.hi5.com/friend/group/4440501--soft+sole+infant+shoes--front-html]soft sole infant shoes[/url]
[url=http://www.hi5.com/friend/group/4440788--spironolactone+hair+loss--front-html]spironolactone hair loss[/url]
[url=http://www.hi5.com/friend/group/4442210--edms+software--front-html]edms software[/url]
[url=http://www.hi5.com/friend/group/4440845--mortgage+loan+origination+software--front-html]mortgage loan origination software[/url]
[url=http://www.hi5.com/friend/group/4441678--oxycontin+addiction+treatment--front-html]oxycontin addiction treatment[/url]
What we call the secret of happiness is no more a secret than our willingness to choose life.
wadon9981k
張貼留言