projects
/
photo-tags.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e9dd568
)
fixed tag display and clicking on a tag button now removes the tag
author
Arun Persaud
<arun@nubati.net>
Sat, 10 Nov 2012 21:22:29 +0000
(13:22 -0800)
committer
Arun Persaud
<arun@nubati.net>
Sat, 10 Nov 2012 21:22:29 +0000
(13:22 -0800)
js/photo-tags.js
patch
|
blob
|
history
diff --git
a/js/photo-tags.js
b/js/photo-tags.js
index 49184213b5c0e2c85fa92c99c05f980b62ad91c2..e41272fd57e9bb4a4415a151321a2d8446411aa8 100644
(file)
--- a/
js/photo-tags.js
+++ b/
js/photo-tags.js
@@
-15,17
+15,32
@@
function init()
d3.select('form').attr("action",webbase+"/tag/"+document.getElementById('MyTagsInput').value.replace(" ","+"));
});
d3.select('form').attr("action",webbase+"/tag/"+document.getElementById('MyTagsInput').value.replace(" ","+"));
});
- d3.select("#currenttags").select("
button
").remove();
+ d3.select("#currenttags").select("
a
").remove();
if (T!="")
{
var mycurrenttags = T.split(",");
if (T!="")
{
var mycurrenttags = T.split(",");
- d3.select("#currenttags").selectAll("
button
")
+ d3.select("#currenttags").selectAll("
a
")
.data(mycurrenttags).enter()
.data(mycurrenttags).enter()
- .append("button").attr("class","btn btn-small").text( function(d) {return d;} );
+ .append("a").attr("class","btn btn-small").text( function(d) {return d;} )
+ .on("mouseover", function(d){ d3.select(this).classed("btn-danger",true)})
+ .on("mouseout", function(d){ d3.select(this).classed("btn-danger",false)})
+ .attr("href", function(d) { return removeTag(T.split(","),d) });
};
}
};
}
+function removeTag(alltags,removetag)
+{
+ /* return a link to a page with 'removetag' removed from the array of tags*/
+ var index = alltags.indexOf(removetag);
+ alltags.splice(index, 1);
+ if (alltags.length)
+ return webbase+'/tag/'+alltags.join(",");
+ else
+ return webbase;
+}
+
+
function load_content() {
// d3.select(".debug").text("T,P,N = *"+T+"* *"+page+"* *"+N+"*");
function load_content() {
// d3.select(".debug").text("T,P,N = *"+T+"* *"+page+"* *"+N+"*");