-
Notifications
You must be signed in to change notification settings - Fork 4
/
gui.html
141 lines (130 loc) · 4.16 KB
/
gui.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
@media screen and (max-width: 700px) {
.image, .left {
display: none;
}
.message {
display: block !important;
height: 100vh;
width: 100vw;
margin-top: 12.5%;
text-align: center;
font-size: 36px;
font-weight: 900;
}
}
body {
padding: 0;
margin: 0;
font-family: 'Fira Sans', sans-serif;
}
.message {
display: none;
}
.left {
width: 230px;
border-right: 1px solid #fff;
height: 100vh;
float: left;
padding: 10px 0 0 10px;
background: #222;
color: #fafafa;
box-shadow: 0 0 11px rgba(10,10,10,0.5);
z-index: 1;
}
* {
box-sizing: border-box;
}
label {
display: block;
width: 100%;
padding-bottom: 3px;
margin-top: 13px;
text-transform: uppercase;
font-size: 13px;
font-family: 'Fira Sans';
font-weight: 900;
}
.image {
position: absolute;
height: 100vh;
text-align: center;
width: 100vw;
padding-top: 30px;
z-index: -9001;
}
input {
width: 90%;
height: 20px;
}
input[type="color"] {
height: 40px;
}
</style>
</head>
<body>
<div class="message">Use desktop, fagg3t m9<br>cuz 3deep5me!</div>
<div class="left">
<div class="ranger">
<label for="width">Width</label><input type="range" id="width" min="10" max="1500" step="1" value="200">
</div>
<div class="ranger">
<label for="height">Height</label><input type="range" id="height" min="10" max="1500" step="1" value="200">
</div>
<div class="ranger">
<label for="color">Color</label>
<input type="color" id="color" value="#ffcc00">
</div>
</div>
<div class="image">
<img src="200x200/ffcc00">
</div>
<script>
Array.prototype.list = function() {
var limit = this.length,
orphans = arguments.length - limit,
scope = orphans > 0 && typeof(arguments[arguments.length-1]) != "string" ? arguments[arguments.length-1] : window;
while(limit--) scope[arguments[limit]] = this[limit];
if (scope != window) orphans--;
if (orphans > 0) {
orphans += this.length;
while(orphans-- > this.length) scope[arguments[orphans]] = null;
}
}
document.querySelector('#width').addEventListener('input', changeImg);
document.querySelector('#height').addEventListener('input', changeImg);
document.querySelector('#color').addEventListener('change', changeImg);
function getImageSrc() {
var img = document.querySelector('img').getAttribute('src');
img.split('/').list('size', 'color');
size.split('x').list('width', 'height');
return [width, height, color];
}
function setImageSrc(w,h,c) {
var current = getImageSrc();
if (w != false) { current[0] = w; }
if (h != false) { current[1] = h; }
if (c != false) { current[2] = c; }
var src = current[0] + "x" + current[1] + "/" + current[2].replace('#', '');
var img = document.querySelector('img').setAttribute('src', src);
}
function changeImg() {
if (this.id == "width") {
setImageSrc(this.value, false, false);
}
if (this.id == "height") {
setImageSrc(false, this.value, false);
}
if (this.id == "color") {
// console.log(this.value);
setImageSrc(false, false, this.value);
}
}
</script>
</body>
</html>