w2v-server: keep url parameters in all links
diff --git a/templates/index.html.ep b/templates/index.html.ep
index 9183278..f97cf8e 100644
--- a/templates/index.html.ep
+++ b/templates/index.html.ep
@@ -46,7 +46,7 @@
a.marked, #first a.marked {
text-decoration: underline;
}
-
+
a.target {
color: red;
fill: red;
@@ -158,7 +158,8 @@
.attr("class", "tsnet");
g.append("a")
- .attr("xlink:href", function(word) {return "/?word="+word;})
+ .attr("xlink:href", function(word) {
+ return (data.urlprefix+word);})
.attr("class", function(d, i) {
var res="";
if(data.marked[i]) {
@@ -352,7 +353,11 @@
% } elsif($mergedEnd!=0 && $r > $mergedEnd) {
% $r -= $mergedEnd;
% }
- <a class="<%= $class %>" title="freq. rank: <%= $r %>" href="/?word=<%= $item->{word} %>"><%= $item->{word} %></a>
+ <a class="<%= $class =%>"
+ title="freq. rank: <%= $r =%>"
+ href="<%= url_with->query([word => $item->{word}]) =%>">
+ <%= $item->{word} =%>
+ </a>
</td>
% } else {
<td colspan="2"/>
@@ -371,7 +376,7 @@
<%= sprintf("%.3e", $c->{sum}) %>
</td>
<td align="left">
- <a href="/?word=<%= $c->{word} %>">
+ <a href="<%= url_with->query([word => $c->{word}]) =%>">
<%= $c->{word} %>
</td>
% } else {
@@ -383,8 +388,9 @@
</table>
<script>
% use Mojo::ByteStream 'b';
+ % my $urlprefix = url_with->query([word=>'']);
$(window).load(function() {
- showMap(<%= b(Mojo::JSON::to_json({target => " $word ", mergedEnd=> $mergedEnd, words => \@words, vecs => \@vecs, ranks => \@ranks, marked => \@marked})); %>);
+ showMap(<%= b(Mojo::JSON::to_json({target => " $word ", mergedEnd=> $mergedEnd, words => \@words, vecs => \@vecs, ranks => \@ranks, marked => \@marked, urlprefix => $urlprefix})); %>);
});
</script>
% }