Link wordCloud entries to correct daterange
diff --git a/webui/js/source/sidebar-stats.js b/webui/js/source/sidebar-stats.js
index a75a4b5..44241b8 100644
--- a/webui/js/source/sidebar-stats.js
+++ b/webui/js/source/sidebar-stats.js
@@ -80,7 +80,12 @@
// word cloud is delayed by 50ms to let the rest render first
// this is a chrome-specific slowdown we're addressing.
window.setTimeout(function() {
- wordCloud(json.cloud, 220, 100, wc);
+ if (G_current_month) {
+ daterange = G_current_year + '-' + G_current_month
+ } else {
+ daterange = G_current_year
+ }
+ wordCloud(json.cloud, 220, 100, wc, daterange);
}, 50);
}
if (G_show_stats_sidebar === false) {
diff --git a/webui/js/wordcloud.js b/webui/js/wordcloud.js
index 8594012..2fed3dd 100644
--- a/webui/js/wordcloud.js
+++ b/webui/js/wordcloud.js
@@ -33,18 +33,18 @@
|| b.bottom+spacing < (a.top+ny));
}
-function makeWord(word, size) {
+function makeWord(word, size, daterange) {
let textBox = document.createElementNS(SVG_NAMESPACE, "text");
textBox.setAttribute("font-size", size + "px")
textBox.setAttribute("x", "0")
textBox.setAttribute("y", "40")
textBox.setAttribute("class", "cloudword")
- textBox.setAttribute("onclick", "search(\"" + word + "\", 'lte=1M')")
+ textBox.setAttribute("onclick", "search(\"" + word + "\", '" + daterange + "')")
textBox.textContent = word
return textBox
}
-async function wordCloud(hash, width, height, obj) {
+async function wordCloud(hash, width, height, obj, daterange) {
let total = 0
let boxes = []
let space = width * height
@@ -85,7 +85,7 @@
// Try with random placement
- textBox = makeWord(word, size)
+ textBox = makeWord(word, size, daterange)
textBox.setAttribute("id", "svg_wc_" + word)
svg.appendChild(textBox)
if (!popped) {