diff options
2 files changed, 82 insertions, 83 deletions
| -rw-r--r-- | src/teaching/upp-2025/week02/machine_table.css | 80 | ||||
| -rw-r--r-- | src/teaching/upp-2025/week02/machine_table.js | 85 |
diff --git a/src/teaching/upp-2025/week02/machine_table.css b/src/teaching/upp-2025/week02/machine_table.css new file mode 100644 index 0000000..fee8577 --- /dev/null +++ b/src/teaching/upp-2025/week02/machine_table.css @@ -0,0 +1,80 @@ +/* Reset */ +#worksheet table, +#worksheet tr, +#worksheet th, +#worksheet td { + background-color: initial; + border: initial; + padding: 0.1em; +} + +/* General styling */ +#worksheet th { + font-weight: normal; +} +#worksheet { + color: black; + background-color: white; + margin: 1em auto; + + /* Thanks https://stackoverflow.com/a/4407335/12036073 */ + + -webkit-touch-callout: none; /* iOS Safari */ + -webkit-user-select: none; /* Safari */ + -khtml-user-select: none; /* Konqueror HTML */ + -moz-user-select: none; /* Old versions of Firefox */ + -ms-user-select: none; /* Internet Explorer/Edge */ + user-select: none; +} + +#worksheet button { + border-radius: 0; + border-width: 2px; + width: 100%; +} +#worksheet button:hover, +#worksheet input[type="radio"]:hover, +#worksheet input[type="radio"] ~ label:hover { + cursor: pointer; +} + +/* Borders and colors */ +#worksheet td, #worksheet th { + border: 1px solid #c0c0c0; +} +#worksheet tr:first-of-type th, +#worksheet td:first-child, #worksheet th:first-child +{ + border-color: #6a6a6a; + background-color: #f1f1f1; +} +#worksheet tr:first-of-type th { + border-top: none; +} +#worksheet td:first-child, #worksheet th:first-child { + border-left: none; +} + +/* Spacing */ +#worksheet th:first-child { + min-width: 2.82em; + padding: 0.3em 0; +} +#worksheet td { + min-width: 8em; + padding: 0.3em 0.2em; +} + +#worksheet button { + margin: calc(-0.3em + 4px) 0; + padding: 0.2em; +} + +/* Execution */ +.selected { + background-color: yellow !important; +} +.error { + background-color: red !important; +} + diff --git a/src/teaching/upp-2025/week02/machine_table.js b/src/teaching/upp-2025/week02/machine_table.js index ec67ff8..99a0255 100644 --- a/src/teaching/upp-2025/week02/machine_table.js +++ b/src/teaching/upp-2025/week02/machine_table.js @@ -1,88 +1,7 @@ // Style // -var machineStyles = document.createElement("style"); -machineStyles.textContent = ` - /* Reset */ - #worksheet table, - #worksheet tr, - #worksheet th, - #worksheet td { - background-color: initial; - border: initial; - padding: 0.1em; - } - - /* General styling */ - #worksheet th { - font-weight: normal; - } - #worksheet { - color: black; - background-color: white; - margin: 1em auto; - - /* Thanks https://stackoverflow.com/a/4407335/12036073 */ - - -webkit-touch-callout: none; /* iOS Safari */ - -webkit-user-select: none; /* Safari */ - -khtml-user-select: none; /* Konqueror HTML */ - -moz-user-select: none; /* Old versions of Firefox */ - -ms-user-select: none; /* Internet Explorer/Edge */ - user-select: none; - } - - #worksheet button { - border-radius: 0; - border-width: 2px; - width: 100%; - } - #worksheet button:hover, - #worksheet input[type="radio"]:hover, - #worksheet input[type="radio"] ~ label:hover { - cursor: pointer; - } - - /* Borders and colors */ - #worksheet td, #worksheet th { - border: 1px solid #c0c0c0; - } - #worksheet tr:first-of-type th, - #worksheet td:first-child, #worksheet th:first-child - { - border-color: #6a6a6a; - background-color: #f1f1f1; - } - #worksheet tr:first-of-type th { - border-top: none; - } - #worksheet td:first-child, #worksheet th:first-child { - border-left: none; - } - - /* Spacing */ - #worksheet th:first-child { - min-width: 2.82em; - padding: 0.3em 0; - } - #worksheet td { - min-width: 8em; - padding: 0.3em 0.2em; - } - - #worksheet button { - margin: calc(-0.3em + 4px) 0; - padding: 0.2em; - } - - /* Execution */ - .selected { - background-color: yellow !important; - } - .error { - background-color: red !important; - } -`; -document.head.appendChild(machineStyles); +const machineStyles = document.getElementById("upp2025_w02"); +machineStyles.disabled = false; // Execution // |