From b03d63d5006a71307d4f04b22170bdeddc8d8746 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Sat, 26 Nov 2011 22:53:13 -0800 Subject: don't show page index if there is only one page --- index.php | 69 +++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/index.php b/index.php index 4a7bdf4..5e93f62 100644 --- a/index.php +++ b/index.php @@ -84,49 +84,52 @@ function myreload(a) { d3.json(url, function(json) { /* update index, show only page +-5 pages max */ - s="page "; n = Math.floor(json[0][0].total/N); + s = ""; - if(a>7) + if(n>1) { - s+=" "; - if(T!="") - s+="/tag/"+T; - s+="/page/1\">1..."; - start = a-5; - } - else - start=1; - - for(i=start;i<=Math.min(n+1,a+5);i++) - { - if(i==a) - s+= " "+i+" "; - else + s="page "; + + if(a>7) { s+=" "; if(T!="") s+="/tag/"+T; - s+="/page/"+i+"\">"+i+""; + s+="/page/1\">1..."; + start = a-5; } - } - - if(a+5"; - if(T!="") - s+="/tag/"+T; - s+="/page/"+(n+1)+"\">"+(n+1)+""; - } - else if(a+5==n) - { - s+=" "; - if(T!="") - s+="/tag/"+T; - s+="/page/"+(n+1)+"\">"+(n+1)+""; - }; + else + start=1; + for(i=start;i<=Math.min(n+1,a+5);i++) + { + if(i==a) + s+= " "+i+" "; + else + { + s+=" "; + if(T!="") + s+="/tag/"+T; + s+="/page/"+i+"\">"+i+""; + } + } + if(a+5"; + if(T!="") + s+="/tag/"+T; + s+="/page/"+(n+1)+"\">"+(n+1)+""; + } + else if(a+5==n) + { + s+=" "; + if(T!="") + s+="/tag/"+T; + s+="/page/"+(n+1)+"\">"+(n+1)+""; + }; + }; d3.select(".index").html(s); /* update pics */ -- cgit v1.2.3-18-g5258