-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
52 lines (44 loc) · 1.42 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Wallpaper Group Editor</title>
<link href='https://fonts.googleapis.com/css?family=PT+Mono' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Oswald:700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="style.css">
<!-- <link rel="stylesheet" href="spinner.css"> -->
<script type="text/javascript" src="elm.js"></script>
<script type="text/javascript" src="node_modules/browser-jsonp/lib/jsonp.min.js">
</script>
</head>
<body>
<div class="" id="editor">
</div>
<script type="text/javascript">
var elmDiv = document.getElementById('editor');
var elmApp = Elm.embed(Elm.Editor.App, elmDiv, {
responseColors: []
});
elmApp.ports.request.subscribe(loadColor);
elmApp.ports.svgString.subscribe(setSvgString);
function loadColor(query) {
JSONP({
url: "http://www.colourlovers.com/api/palettes",
data: {
format: 'json',
keywords: query,
numResults: 100
},
callbackName: 'jsonCallback',
success: function(data) {
elmApp.ports.responseColors.send(data);
}
});
}
function setSvgString(){
var s = document.getElementById('patternSvg').innerHTML
document.getElementById('download').href = 'data:image/svg+xml,' + encodeURIComponent(s);
}
</script>
</body>
</html>