-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
63 lines (56 loc) · 2.06 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://elm-in-action.com/styles.css" />
<link
rel="stylesheet"
href="http://elm-in-action.com/range-slider.css"
/>
<script src="http://elm-in-action.com/range-slider.js"></script>
<script>
class RangeSlider extends HTMLElement {
connectedCallback() {
var input = document.createElement("input");
this.appendChild(input);
var jsr = new JSR(input, {
max: this.max,
values: [this.val],
sliders: 1,
grid: false,
});
var rangeSliderNode = this;
jsr.addEventListener("update", function (elem, value) {
var event = new CustomEvent("slide", {
detail: { userSlidTo: value },
});
rangeSliderNode.dispatchEvent(event);
});
}
}
window.customElements.define("range-slider", RangeSlider);
</script>
</head>
<body>
<div id="app"></div>
<script src="http://elm-in-action.com/pasta.js"></script>
<script src="app.js"></script>
<script>
var app = Elm.PhotoGroove.init({
node: document.getElementById("app"),
flags: Pasta.version
});
app.ports.setFilters.subscribe(function (options) {
requestAnimationFrame(function () {
Pasta.apply(
document.getElementById("main-canvas"),
options
);
});
});
Pasta.addActivityListener(function (activity) {
console.log("Got some activity to send to Elm:", activity);
app.ports.activityChanges.send(activity);
});
</script>
</body>
</html>