因為不需要開HTML來改,而只是開 -
[設定]→[版面配置]→[新增小工具]→[HTML/JAVASCRIPT]
再貼上以下的CODE :
<style>
.showpageArea {
font: 13px/36px Arial,Times New Roman,Times,serif;
overflow: hidden;
text-align: center;
text-decoration: none;
width: 100%;
}
.showpageArea a,.showpageNum a {
border: 1px solid #CFE0EA;
color: #555;
margin: 2px;
padding: 3px 8px;
text-decoration: none;
}
.showpageArea a:hover,.showpageNum a:hover,.showpageNum a:hover {
background:#54748E;
color: #FFF;
}
.showpagePoint {
background:#FFF;
border: 1px solid #CCC;
color: #454545;
font-weight: bold;
padding: 3px 8px;
margin: 2px;
text-decoration: none;
}
.showpage a:hover {
background:#54748E;
color: #FFF;
}
</style>
<script type='text/javascript'>
var home_page_url = location.href;
var pageCount=5; //首頁顯示的數量,和系統設定要一樣
var displayPageNum=3; //按鈕數量
var upPageWord ='上一頁'; //上一頁按鈕(可以改成PREV)
var downPageWord ='下一頁'; //下一頁按鈕(可以改成NEXT)
function showpageCount(json) {
var thisUrl = home_page_url;
var htmlMap = new Array();
var thisNum = 1;
var postNum=1;
var itemCount = 0;
var fFlag = 0;
var eFlag = 0;
var html= '';
var upPageHtml ='';
var downPageHtml ='';
htmlMap[htmlMap.length]='/';
postNum++;
for(var i=pageCount-1, post; post = json.feed.entry[i]; i=i+pageCount) {
var timestamp1 = post.published.$t.substring(0,19)+post.published.$t.substring(23,29);
timestamp = encodeURIComponent(timestamp1);
var title = post.title.$t;
if(thisUrl.indexOf(timestamp)!=-1 ){
thisNum = postNum;
}
postNum++;
htmlMap[htmlMap.length] = '/search?updated-max='+timestamp+'&max-results='+pageCount;
}
var banyaknomer = htmlMap.length;
if (json.feed.entry.length % pageCount == 0){
var banyaknomer = htmlMap.length -1 ;
postNum=postNum-1;
};
for(var p =0;p< banyaknomer;p++){
if(p>=(thisNum-displayPageNum-1) && p<(thisNum+displayPageNum)){
if(fFlag ==0 && p == thisNum-2){
if(thisNum==2){
upPageHtml = '<span class="showpage"><a href="/">'+ upPageWord +'</a></span>';
}else{
upPageHtml = '<span class="showpage"><a href="'+htmlMap[p]+'">'+ upPageWord +'</a></span>';
}
fFlag++;
}
if(p==(thisNum-1)){
html += '<span class="showpagePoint">'+thisNum+'</span>';
}else{
if(p==0){
html += '<span class="showpageNum"><a href="/">1</a></span>';
}else{
html += '<span class="showpageNum"><a href="'+htmlMap[p]+'">'+ (p+1) +'</a></span>';
}
}
if(eFlag ==0 && p == thisNum){
downPageHtml = '<span class="showpage"> <a href="'+htmlMap[p]+'">'+ downPageWord +'</a></span>';
eFlag++;
}
}
}
if(thisNum>1){
html = ''+upPageHtml+' '+html +' ';
}
html = '<div class="showpageArea"><span style="padding: 3px 8px;margin: 2px 2px 2px 2px;border: 1px solid #333; background-" class="showpage">頁面 '+thisNum+' / '+(postNum-1)+': </span>'+html;
if(thisNum<(postNum-1)){
html += downPageHtml;
}
if(postNum==1) postNum++;
html += '</div>';
var pageArea = document.getElementsByName("pageArea");
var blogPager = document.getElementById("blog-pager");
if(postNum <= 2){
html ='';
}
for(var p =0;p< pageArea.length;p++){
pageArea[p].innerHTML = html;
}
if(pageArea&&pageArea.length>0){
html ='';
}
if(blogPager){
blogPager.innerHTML = html;
}
}
function showpageCount2(json) {
var thisUrl = home_page_url;
var htmlMap = new Array();
var isLablePage = thisUrl.indexOf("/search/label/")!=-1;
var thisLable = isLablePage ? thisUrl.substr(thisUrl.indexOf("/search/label/")+14,thisUrl.length) : "";
thisLable = thisLable.indexOf("?")!=-1 ? thisLable.substr(0,thisLable.indexOf("?")) : thisLable;
var thisNum = 1;
var postNum=1;
var itemCount = 0;
var fFlag = 0;
var eFlag = 0;
var html= '';
var upPageHtml ='';
var downPageHtml ='';
var labelHtml = '<span class="showpageNum"><a href="/search/label/'+thisLable+'?&max-results='+pageCount+'">';
var thisUrl = home_page_url;
htmlMap[htmlMap.length]=labelHtml;
postNum++;
for(var i=pageCount-1, post; post = json.feed.entry[i]; i=i+pageCount) {
var timestamp1 = post.published.$t.substring(0,19)+post.published.$t.substring(23,29);
timestamp = encodeURIComponent(timestamp1);
var title = post.title.$t;
if(thisUrl.indexOf(timestamp)!=-1 ){
thisNum = postNum;
}
if(title!='') postNum++;
htmlMap[htmlMap.length] = '/search/label/'+thisLable+'?updated-max='+timestamp+'&max-results='+pageCount;
itemCount++;
}
var banyaknomer = htmlMap.length;
if (json.feed.entry.length % pageCount == 0){
var banyaknomer = htmlMap.length -1 ;
postNum=postNum-1;
};
for(var p =0;p< banyaknomer;p++){
if(p>=(thisNum-displayPageNum-1) && p<(thisNum+displayPageNum)){
if(fFlag ==0 && p == thisNum-2){
if(thisNum==2){
upPageHtml = labelHtml + upPageWord +'</a></span>';
}else{
upPageHtml = '<span class="showpage"><a href="'+htmlMap[p]+'">'+ upPageWord +'</a></span>';
}
fFlag++;
}
if(p==(thisNum-1)){
html += '<span class="showpagePoint">'+thisNum+'</span>';
}else{
if(p==0){
html = labelHtml+'1</a></span>';
}else{
html += '<span class="showpageNum"><a href="'+htmlMap[p]+'">'+ (p+1) +'</a></span>';
}
}
if(eFlag ==0 && p == thisNum){
downPageHtml = '<span class="showpage"> <a href="'+htmlMap[p]+'">'+ downPageWord +'</a></span>';
eFlag++;
}
}
}
if(thisNum>1){
if(!isLablePage){
html = ''+upPageHtml+' '+html +' ';
}else{
html = ''+upPageHtml+' '+html +' ';
}
}
html = '<div class="showpageArea"><span style="COLOR: #000;" class="showpageOf"> Pages ('+(postNum-1)+')</span>'+html;
if(thisNum<(postNum-1)){
html += downPageHtml;
}
if(postNum==1) postNum++;
html += '</div>';
var pageArea = document.getElementsByName("pageArea");
var blogPager = document.getElementById("blog-pager");
if(postNum <= 2){
html ='';
}
for(var p =0;p< pageArea.length;p++){
pageArea[p].innerHTML = html;
}
if(pageArea&&pageArea.length>0){
html ='';
}
if(blogPager){
blogPager.innerHTML = html;
}
}
</script>
<script type='text/javascript'>
var thisUrl = home_page_url;
if (thisUrl.indexOf("/search/label/")!=-1){
if (thisUrl.indexOf("?updated-max")!=-1){
var lblname1 = thisUrl.substring(thisUrl.indexOf("/search/label/")+14,thisUrl.indexOf("?updated-max"));
}else{
var lblname1 = thisUrl.substring(thisUrl.indexOf("/search/label/")+14,thisUrl.indexOf("?&max"));
}
}
var home_page = "/";
if (thisUrl.indexOf("?q=")==-1 && thisUrl.indexOf(".html")==-1){
if (thisUrl.indexOf("/search/label/")==-1){
document.write('<script src="'+home_page+'feeds/posts/summary?alt=json-in-script&callback=showpageCount&max-results=99999" ><\/script>')
}else{document.write('<script src="'+home_page+'feeds/posts/full/-/'+lblname1+'?alt=json-in-script&callback=showpageCount2&max-results=99999" ><\/script>')
}
}
</script>
接著再按[儲存排列方式]就成了。當然如果你想頁數的顏色和連結時的顏色有變的話,可以改CSS!!!
改三欄簡易的吧!?
你貼好儲存之後,有CLICK開這個加了程序碼的HTML/JAVASCRIPT格仔,在剛才你貼上的的文字中,同時接電腦的KEYBOARD "CTRL+F",搜尋這關鍵字 : - hover
你會見到
1.)
.showpageArea a:hover,.showpageNum a:hover,.showpageNum a:hover {
background:#54748E;
color: #FFF;
這是改變你CLICK下去數字時會變的[字色]和[底色]
改了它就變成你想要的色!!
上面那種下少少會見到這一組
2.)
.showpage a:hover {
background:#54748E;
color: #FFF;
這是控制[上一頁/PREV] 及[下一頁/NEXT] 的[字色]和[底色]
另外,到頁數列外框的位置,在改hover 的1. 上一組就是了;
.showpageArea a,.showpageNum a {
border: 1px solid #CFE0EA;
color: #555;
margin: 2px;
padding: 3px 8px;
text-decoration: none;
這是格線色和字色
想找顏色的HTML碼,可以來這裡 http://html-color-codes.info/ ,記緊只是改動#和;之間的數子。
其實整個頁數列的字體大少、字型都可以改,不過對不懂HTML的人來說,火星文看少一點會比較舒服,所以改這三點,應該足以襯到自己BLOG的色調囉~
試試吧!!!
參巧來自:
http://sofree.cc/blogger-pagebar/ 及
http://01mistery.blogspot.com/2009/02/page-navigation-menu.html
Thanks for this useful sharing~
ReplyDelete可以一試^_^
Delete謝謝分享,之前試過好幾個,每每去到/search/label或 search by date都頁數出錯,這個version有冇此問題?
ReplyDelete暫時都OK!!
Delete外掛的程式就是沒怎麼完美~~~~
可以試試,不用乾脆DELETE那HTML/JAVA BOX就OK,不會影響TEMPLATE的HTML!!
謝謝分享 ^0^ 我用到我的網誌上了. 真的有用. 謝謝 (≧▽≦)(@)
ReplyDelete加左好似真係方便D!! 希望冇咩大問題出現啦~~!!!
Delete你的Blog真的好漂亮啊,謝謝你的教學~~ 我要慢慢消化一下先得!! ^____^
ReplyDeleteohhh!!! 超簡易!!謝謝你!!!!!!!!
DeleteTHANKS!!!!!!!!!!!!!!!!
Delete謝謝, 又學會了!
ReplyDelete易用就好了~^_^
Delete頁碼我已經試左十幾個~希望呢個唔好有咁多ERROR~多謝分享!
ReplyDelete我試第2個感覺良好...但有小問題都可能,因為PLUGIN ^_^
Delete唉~真可惜~~試左~~依然係一個BUG........要放棄T___T
ReplyDelete如果以標籤Click入去後~有d blog文會消失左(我逐頁CLICK逐個blog文去數)...
cancel左頁碼d 文先會走番出黎~~sosad T__T
我開始明白點解GOOGLE唔開放個頁碼...可能google自己都未解決到d error...
我都知呢個問題,但不是食太多文就照用,起碼方便了大部份BLOG文被翻閱到嘛!!!
Delete謝謝分享 真的有用>< 感謝~~
ReplyDelete謝謝分享!!
ReplyDelete超好看~