()
| 1025 | } |
| 1026 | |
| 1027 | function hideControls() { |
| 1028 | // Set display:none to all the UI elements that are hidden. |
| 1029 | let hiddenProps = state.getHiddenProps(); |
| 1030 | hiddenProps.forEach(prop => { |
| 1031 | let controls = d3.selectAll(`.ui-${prop}`); |
| 1032 | if (controls.size() === 0) { |
| 1033 | console.warn(`0 html elements found with class .ui-${prop}`); |
| 1034 | } |
| 1035 | controls.style("display", "none"); |
| 1036 | }); |
| 1037 | |
| 1038 | // Also add checkbox for each hidable control in the "use it in classrom" |
| 1039 | // section. |
| 1040 | let hideControls = d3.select(".hide-controls"); |
| 1041 | HIDABLE_CONTROLS.forEach(([text, id]) => { |
| 1042 | let label = hideControls.append("label") |
| 1043 | .attr("class", "mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect"); |
| 1044 | let input = label.append("input") |
| 1045 | .attr({ |
| 1046 | type: "checkbox", |
| 1047 | class: "mdl-checkbox__input", |
| 1048 | }); |
| 1049 | if (hiddenProps.indexOf(id) === -1) { |
| 1050 | input.attr("checked", "true"); |
| 1051 | } |
| 1052 | input.on("change", function() { |
| 1053 | state.setHideProperty(id, !this.checked); |
| 1054 | state.serialize(); |
| 1055 | userHasInteracted(); |
| 1056 | d3.select(".hide-controls-link") |
| 1057 | .attr("href", window.location.href); |
| 1058 | }); |
| 1059 | label.append("span") |
| 1060 | .attr("class", "mdl-checkbox__label label") |
| 1061 | .text(text); |
| 1062 | }); |
| 1063 | d3.select(".hide-controls-link") |
| 1064 | .attr("href", window.location.href); |
| 1065 | } |
| 1066 | |
| 1067 | function generateData(firstTime = false) { |
| 1068 | if (!firstTime) { |
no test coverage detected
searching dependent graphs…