X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=photo-tags.git;a=blobdiff_plain;f=index.php;h=822df79c0bc8333c3cb55183baf14b181477df92;hp=78f77e18f6bdd5608d40a97dc23dffce4ca14284;hb=197867206e97f0b8d85cff0ef7f1bf88a33fd7aa;hpb=fe9797bd60e0027fac4bb989619eec1e428aabd0;ds=sidebyside diff --git a/index.php b/index.php index 78f77e1..822df79 100644 --- a/index.php +++ b/index.php @@ -83,16 +83,50 @@ function myreload(a) { d3.json(url, function(json) { - /* update index */ + /* update index, show only page +-5 pages max */ s="page "; - n = json[0][0].total/N; - for(i=1;i<=n+1;i++) + n = Math.floor(json[0][0].total/N); + + if(a>7) { s+=" "; if(T!="") s+="/tag/"+T; - s+="/page/"+i+"\">"+i+""; + 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+=" "; + 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 */