summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.php2
-rw-r--r--js/photo-tags.js49
2 files changed, 28 insertions, 23 deletions
diff --git a/index.php b/index.php
index a2de85a..353a848 100644
--- a/index.php
+++ b/index.php
@@ -85,6 +85,7 @@ page <span class="index"></span>
<script src = "<?php echo $webbase.autoversion("/js/photo-tags.js")?>"></script>
<script type="text/javascript" >
+
/*hand parameters over to javascript*/
var page=<?php echo $page ?>;
var N=<?php echo $N ?>;
@@ -94,6 +95,7 @@ var count=0;
var dbprefix="<?php echo $dbprefix ?>".replace(/\//g,"\/");
var webbase = "<?php echo $webbase?>";
+init();
load_content();
update_page_index();
diff --git a/js/photo-tags.js b/js/photo-tags.js
index 7fce2f2..c178fe1 100644
--- a/js/photo-tags.js
+++ b/js/photo-tags.js
@@ -1,30 +1,33 @@
var pics = d3.select(".pics").select("ul");
-/* populate data list with tags*/
-d3.json(webbase+"/getjson.php?S", function(json) {
- d3.select("#MyTags").selectAll("option").data(json)
- .enter().append("option").attr("value",function(d) {return d.name});
+function init()
+{
+ /* populate data list with tags*/
+ d3.json(webbase+"/getjson.php?S", function(json) {
+ d3.select("#MyTags").selectAll("option").data(json)
+ .enter().append("option").attr("value",function(d) {return d.name});
+ });
+
+ /* update form to point to new link */
+ d3.select("input").on("keyup", function(d) {
+ d3.select('form').attr("action",webbase+"/tag/"+document.getElementById('MyTagsInput').value.replace(" ","+"));
});
-/* update form to point to new link */
-d3.select("input").on("keyup", function(d) {
- d3.select('form').attr("action",webbase+"/tag/"+document.getElementById('MyTagsInput').value.replace(" ","+"));
-});
-
-if (T!="")
- {
- var mycurrenttags = T.split(",");
-
- d3.select("#currenttags").select("button").remove();
- d3.select("#currenttags").selectAll("button")
- .data(mycurrenttags).enter()
- .append("button").attr("type","button").text( function(d) {return d;} );
- }
- else
- {
- d3.select("#currenttags").select("button").remove();
- d3.select("#currenttags").append("span").text( ' none');
- };
+ if (T!="")
+ {
+ var mycurrenttags = T.split(",");
+
+ d3.select("#currenttags").select("button").remove();
+ d3.select("#currenttags").selectAll("button")
+ .data(mycurrenttags).enter()
+ .append("button").attr("type","button").text( function(d) {return d;} );
+ }
+ else
+ {
+ d3.select("#currenttags").select("button").remove();
+ d3.select("#currenttags").append("span").text( ' none');
+ };
+}
function load_content() {
// d3.select(".debug").text("T,P,N = *"+T+"* *"+page+"* *"+N+"*");