方法如下:
修改範本中的HTML碼,找到下面這個引進側欄的部分
<b:widget id="Label2" locked="false" title="標籤" type="Label">
一直到
</b:widget>
為止
將上述範圍內的內容改為:
一直到
</b:widget>
為止
將上述範圍內的內容改為:
<b:widget id='Label3' locked='false' title='文章分類(v2)' 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/AVvXsEh8Y2akgaKvMmRvcae1l1jM7Jr4As7C30U8iU4JlO5oI1HSLBLp8_u-CQ_fVV_J7COpGUqsJTadJAGhm_xkfwZ1O-cXWExE1XYVt0bZR1c7l1b1p5fDwVxM24Mexv9RoQ-iZpFAatoMK8c/)" } else { ul.style.display="none" li.style.backgroundImage="url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_ra-OONjzR_A5BTogg5Im7Q3hC2wItpna9uxbSW2fxy8h4Ulx1l8Ne37-ZwVpKASqbuCDJXJ2NSpNc34QNWa7gDo5yt3GfLkni_HbOLp_ZQCoohv7d-JswBCppcH0kAqnzIJipThBC4M/)" } } function draw_obj(obj) { document.write("<li style='padding-left: 0px>'"); document.write("<img src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6hV2u_Xw5k_Pi3-CvLkb9yeiEuOaypG19u24izv7RLlMBiv5rr7VuqblC1FFGLv8G9Ccay8Bprj9LZjQ-G5l1Zo9BcWPmsMrYFOdY5WWB8G569oLJNQjR2_VWBDh5g4NiJj1ZznGm9ko/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/AVvXsEh_ra-OONjzR_A5BTogg5Im7Q3hC2wItpna9uxbSW2fxy8h4Ulx1l8Ne37-ZwVpKASqbuCDJXJ2NSpNc34QNWa7gDo5yt3GfLkni_HbOLp_ZQCoohv7d-JswBCppcH0kAqnzIJipThBC4M/) 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>
沒有留言:
張貼留言
出運系統工作室:提供新竹系統櫃/新竹系統家具/新竹室內設計/等服務。
請留下您的意見,我將儘速回覆您~!