projects
/
photo-tags.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2d429b7
)
don't show page index if there is only one page
author
Arun Persaud
<arun@nubati.net>
Sun, 27 Nov 2011 06:53:13 +0000
(22:53 -0800)
committer
Arun Persaud
<apersaud@lbl.gov>
Sun, 27 Nov 2011 06:53:13 +0000
(22:53 -0800)
index.php
patch
|
blob
|
history
diff --git
a/index.php
b/index.php
index 4a7bdf48720a6b629bb03ca0b29d027bf0112ea3..5e93f62d94cfb146d5e46f1ab23009913e44e584 100644
(file)
--- 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 */
d3.json(url, function(json) {
/* update index, show only page +-5 pages max */
- s="page ";
n = Math.floor(json[0][0].total/N);
n = Math.floor(json[0][0].total/N);
+ s = "";
- if(
a>7
)
+ if(
n>1
)
{
{
- s+=" <a href=\"<?php echo $webbase?>";
- if(T!="")
- s+="/tag/"+T;
- s+="/page/1\">1</a>...";
- 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+=" <a href=\"<?php echo $webbase?>";
if(T!="")
s+="/tag/"+T;
{
s+=" <a href=\"<?php echo $webbase?>";
if(T!="")
s+="/tag/"+T;
- s+="/page/"+i+"\">"+i+"</a>";
+ s+="/page/1\">1</a>...";
+ start = a-5;
}
}
- }
-
- if(a+5<n)
- {
- s+="... <a href=\"<?php echo $webbase?>";
- if(T!="")
- s+="/tag/"+T;
- s+="/page/"+(n+1)+"\">"+(n+1)+"</a>";
- }
- else if(a+5==n)
- {
- s+=" <a href=\"<?php echo $webbase?>";
- if(T!="")
- s+="/tag/"+T;
- s+="/page/"+(n+1)+"\">"+(n+1)+"</a>";
- };
+ else
+ start=1;
+ for(i=start;i<=Math.min(n+1,a+5);i++)
+ {
+ if(i==a)
+ s+= " "+i+" ";
+ else
+ {
+ s+=" <a href=\"<?php echo $webbase?>";
+ if(T!="")
+ s+="/tag/"+T;
+ s+="/page/"+i+"\">"+i+"</a>";
+ }
+ }
+ if(a+5<n)
+ {
+ s+="... <a href=\"<?php echo $webbase?>";
+ if(T!="")
+ s+="/tag/"+T;
+ s+="/page/"+(n+1)+"\">"+(n+1)+"</a>";
+ }
+ else if(a+5==n)
+ {
+ s+=" <a href=\"<?php echo $webbase?>";
+ if(T!="")
+ s+="/tag/"+T;
+ s+="/page/"+(n+1)+"\">"+(n+1)+"</a>";
+ };
+ };
d3.select(".index").html(s);
/* update pics */
d3.select(".index").html(s);
/* update pics */