Skip to content
Snippets Groups Projects
Verified Commit ac235f47 authored by Owen Graham's avatar Owen Graham
Browse files

Rename template-generated JavaScript constants

parent 8baa9282
Branches
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
*/
function getYears(n) {
const station = selectVal(suffixID('station', n));
const years = recordYears[station];
const years = RECORD_YEARS[station];
appendYears(years, n);
}
......@@ -12,7 +12,7 @@ function getYears(n) {
*/
function boxplotGetYears() {
const station = selectVal('station');
const years = recordYears[station];
const years = RECORD_YEARS[station];
appendYears(years, 1);
appendYears(years, 2);
}
......@@ -48,7 +48,7 @@ function indexVisualize() {
return;
}
setSources(sourceLink(params.station, params.year));
visualize(`${$SCRIPT_ROOT}/plot`, params);
visualize(`${SCRIPT_ROOT}/plot`, params);
}
function overlayVisualize() {
......@@ -64,7 +64,7 @@ function overlayVisualize() {
}
setSources(sourceLink(params.station1, params.year1, 1),
sourceLink(params.station2, params.year2, 2));
visualize(`${$SCRIPT_ROOT}/plot/overlay`, params);
visualize(`${SCRIPT_ROOT}/plot/overlay`, params);
}
function boxplotVisualize() {
......@@ -79,7 +79,7 @@ function boxplotVisualize() {
}
setSources(sourceLink(params.station, params.year1));
// XXX No year 2?
visualize(`${$SCRIPT_ROOT}/plot/boxplot`, params);
visualize(`${SCRIPT_ROOT}/plot/boxplot`, params);
}
/**
......@@ -103,7 +103,7 @@ function sourceLink(station, year, n) {
a.text = `${suffixTitle('Source', n)}: AMRDC Data Repository`;
a.title = 'AMRDC Data Repository';
div.appendChild(a);
fetch(`${$SCRIPT_ROOT}/record/link${paramString({station, year})}`)
fetch(`${SCRIPT_ROOT}/record/link${paramString({station, year})}`)
.then(response => response.json())
.then(response => {
a.href = response;
......
......@@ -11,8 +11,8 @@
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<link rel="stylesheet" href="https://amrdc.ssec.wisc.edu/wp-test/wp-content/themes/amrdc-theme/dist/fonts/uw160/fonts.css?ver=1.0.0">
<script>
const $SCRIPT_ROOT = {{ request.script_root | tojson }};
const recordYears = {{ g.record_years | tojson }};
const SCRIPT_ROOT = {{ request.script_root | tojson }};
const RECORD_YEARS = {{ g.record_years | tojson }};
</script>
<script defer src="{{ url_for('static', filename='script.js') }}"></script>
</head>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment