diff options
author | Arun Persaud <arun@nubati.net> | 2012-11-17 15:28:14 -0800 |
---|---|---|
committer | Arun Persaud <arun@nubati.net> | 2012-11-17 15:28:14 -0800 |
commit | ccbd358803261b138fb5f09cf132543d737a07e7 (patch) | |
tree | cf813cd9e2356df6ccde40329f5832c6b22119c5 /js/photo-tags.js | |
parent | 68246bb37ea3eaba59e3fb6af80d541bfd345f38 (diff) | |
download | photo-tags-ccbd358803261b138fb5f09cf132543d737a07e7.tar.gz photo-tags-ccbd358803261b138fb5f09cf132543d737a07e7.tar.bz2 photo-tags-ccbd358803261b138fb5f09cf132543d737a07e7.zip |
show search tags, current tags, and tags of the current pic in one line
Diffstat (limited to 'js/photo-tags.js')
-rw-r--r-- | js/photo-tags.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/js/photo-tags.js b/js/photo-tags.js index 238575d..b657fbe 100644 --- a/js/photo-tags.js +++ b/js/photo-tags.js @@ -81,17 +81,21 @@ function load_content() { return "Description: "+d.description + "Time: "+date.toUTCString(); }); /* show tags */ - tags=""; d3.json(webbase+"/getjson.php?IDT="+ID, function(jsontag) { - singlepicspace.append("p").selectAll("span").data(jsontag) + tags=0; + d3.select("#pictags").selectAll("span").remove(); + d3.select("#pictags").selectAll("span").data(jsontag) .enter().append("span") .attr("class","btn btn-small") .text( function(t) { + tags=1; return t.name; }) .on("mouseover", function(d){ d3.select(this).classed("btn-success",true)}) - .on("mouseout", function(d){ d3.select(this).classed("btn-success",false)}) - .on("click", function(d) { document.location.href=webbase+'/tag/'+d.name}); + .on("mouseout", function(d){ d3.select(this).classed("btn-success",false)}) + .on("click", function(d){ document.location.href=webbase+'/tag/'+d.name}); + if(tags) + d3.select("#pictags").insert("span",":first-child").text("tags in current picture:"); }); update_thumbnails(); |