X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=photo-tags.git;a=blobdiff_plain;f=js%2Fphoto-tags.js;fp=js%2Fphoto-tags.js;h=71dadd41c8150fdf4ca97f316651aebbac16180d;hp=95497bd73ecbb1fbf68d631a3d726625b6b2955c;hb=801ba916b5b5680e10c3b63978034058f7fed840;hpb=2edbbec973793211aa5683ce6f69fba2ff953f03 diff --git a/js/photo-tags.js b/js/photo-tags.js index 95497bd..71dadd4 100644 --- a/js/photo-tags.js +++ b/js/photo-tags.js @@ -1,4 +1,6 @@ var pics = d3.select(".pics").select("ul"); +var page; +var maxpage; function init() { @@ -30,7 +32,7 @@ function init() } function load_content() { - // d3.select(".debug").text("T,P,N = *"+T+"* *"+page+"* *"+N+"*"); + // d3.select(".debug").text("T,P,N = *"+T+"* *"+page+"* *"+N+"*"); if (ID>=0) url = webbase+"/getjson.php?ID="+ID; @@ -76,9 +78,9 @@ function load_content() { return s; }); }; + checkbutton(); + update_permalink() }); - checkbutton(); - update_permalink() } function update_permalink() { @@ -97,13 +99,15 @@ function update_permalink() { } function prev_page() { - if (page>=2) page=page-1; - load_content(); + if (page>1) page=page-1; + load_content(); + update_page_index(); } function next_page() { - page=page+1; - load_content(); + if (page 0) page = nr+1; var mydata = new Array(); // add json data {page: , name: } ; at end reform array into real json and use d3 to parse it @@ -232,7 +238,7 @@ function update_page_index() if(n>0) { mydata.push('{ page:0.1, name:"Prev"}'); - if(page>7) + if(page>4) { mydata.push('{ page:1, name:"1"}'); mydata.push('{ page:1.5, name:"..."}'); @@ -275,5 +281,7 @@ function update_page_index() d3.select(".pagination").select("ul").selectAll("li").classed("active", false); d3.select(".pagination").select("ul").selectAll("li").classed("active", function(d) {return ( d.page == page ); }); + checkbutton(); } ); + }