http://licoriceguava.blogspot.tw/2014/01/5blogger.html
安裝過程如下:
1. 點擊 "設計" => "範本" => "編輯HTML" 在底下的原始檔中尋找
<b:widget id="Label1" locked="false" title="標籤" type="Label">…</b:widget>
2. 之後將其改為
<b:widget id='Label3' locked='false' title='文章分類' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div expr:class='"widget-content " + data:display + "-label-widget-content"'>
<script>
var label_tree= new Object();
function tn(tag)
{
return tag.substring(1,tag.length-1);
}
function build_node(tree,idx,cnt)
{
if(!tree[idx[0]]){
tree[idx[0]]=new Object();
tree[idx[0]]['_cnt']=0;
tree[idx[0]]['_item']=new Array();
}
tree[idx[0]]['_cnt'] = parseInt(tree[idx[0]]['_cnt']) + parseInt(cnt);
if(idx.length==1){
return tree[idx[0]];
}
return build_node(tree[idx[0]],idx.slice(1),cnt);
}
function add_label(_name,_cnt,_url,_dir)
{
var e1 = new RegExp("\\[(.+?)\\]","g");
var e = new RegExp("\\[(.+)\\]","g");
var m = _name.match(e);
var tag = _name;
var obj=new Object();
obj['tag']=_name;
obj['cnt']=_cnt;
obj['dir']=_dir;
obj['url']=_url;
if(m){
obj['tag']= _name.substring(m[0].length,_name.length);
var m1 = _name.match(e1);
if(m1){
node=build_node(label_tree,m1,_cnt);
if(node){
node['_item'].push(obj);
}
}
}
else{
if(!label_tree['_item']){
label_tree['_item']=new Array();
}
label_tree['_item'].push(obj);
}
}
function menu_exp(id)
{
var ul=document.getElementById("ul_"+id);
var li=document.getElementById("li_"+id);
if (ul.style.display=="none"){
ul.style.display="block"
li.style.backgroundImage="url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-xT3EO16BE27VXPdqgDcah7FUsmPT7CWGssslGR89PNhso2MWRaiizz9kG7tVgCGjbUOyJrN1fpQipmV9h7sC6F1xx3p6BOUajPLCaO5Rdg7u9d9tjiuIea9jiVHnf7DEVXSVMD0LuI4/)"
}
else {
ul.style.display="none"
li.style.backgroundImage="url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9IejJizNT6j1wlv_Zs05DnfybpUnqcGCTKneEj7OE6wydjyLH6BV9stfYDS1TkkhKSpFOBvOpNufNUe1esBCuWoRIKZj3lE5nd4WqRsoqSJ7ww_f2gf6cuROLj8Sc3nK0yE6rEAaX-ec/)"
}
}
function draw_obj(obj)
{
document.write("<li style='padding-left: 0px>'");
document.write("<img src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW16i3AVF_HNuf9fvaxtVb2HSz84__QmXSp1oRnS0c7j4oA6vF6JEhnlnq6MNhHb9ii5bJ0wipzDCDI5RQ19Dk2qWnmKaulsnCkzsEP6bICh7i9slOhh5hli48I1IX5WrdzlN8gfnvK9Q/s1600/icon-yellow-bullet.png' /><a dir='"+obj['dir']+"' href='"+obj['url']+"'>"+obj['tag']+"</a>");
document.write("<span dir='"+obj['dir']+"'>("+obj['cnt']+")</span>");
document.write("</li>\n");
}
function draw_tree(tree)
{
for(var tag in tree){
if(tag!='_item'&& tag!='_cnt'){
var rid = Math.random();
document.write("<li class=submenu id=li_"+rid+" onclick=menu_exp('"+rid+"'); style='font-weight:bold;padding-left: 20px;background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9IejJizNT6j1wlv_Zs05DnfybpUnqcGCTKneEj7OE6wydjyLH6BV9stfYDS1TkkhKSpFOBvOpNufNUe1esBCuWoRIKZj3lE5nd4WqRsoqSJ7ww_f2gf6cuROLj8Sc3nK0yE6rEAaX-ec/) no-repeat left 0px;cursor: pointer'>");
document.write(tn(tag));
document.write("("+tree[tag]['_cnt']+")");
document.write("</li>");
document.write("<ul id=ul_"+rid+" style='display:none;padding-left: 20px'>");
draw_tree(tree[tag]);
document.write("</ul>\n");
}
}
if(tree['_item']){
for(var i=0;i < tree['_item'].length;i++){
draw_obj(tree['_item'][i]);
}
}
}
</script>
<b:loop values='data:labels' var='label'>
<script>
add_label('<data:label.name/>','<data:label.count/>','<data:label.url/>','<data:blog.languageDirection/>');
</script>
</b:loop>
<ul>
<script>
draw_tree(label_tree);
</script>
</ul>
<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>
3. 使用 [分類名稱1][分類名稱2]標籤名稱 將其分類
沒有留言:
張貼留言