这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/demo/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ function gtag() {
<label>✕</label>
<input class="param inline" type="number" id="height" name="height" alt="Height (px)" placeholder="50" value="50">
</span>

<input type="button" class="btn" value="Reset" onclick="preview.reset();">
</form>
</div>

Expand Down
19 changes: 19 additions & 0 deletions src/demo/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,25 @@ let preview = {
this.update();
return false;
},
reset: function () {
const overrides = {
font: "Fira Code",
pause: "1000",
width: "435",
};
// reset all inputs
const inputs = document.querySelectorAll(".param");
inputs.forEach((input) => {
let value = overrides[input.name] || this.defaults[input.name];
if (value) {
if (["color", "background"].includes(input.name)) {
input.jscolor.fromString(value);
} else {
input.value = value;
}
}
});
},
};

let clipboard = {
Expand Down