-
Notifications
You must be signed in to change notification settings - Fork 1
/
random.html
247 lines (218 loc) · 11.6 KB
/
random.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--<title>What Food?</title>-->
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" href="css/component.css" />
<link rel="stylesheet" href="css/change.css" />
<link rel="stylesheet" href="css/button.css" />
<script src="js/modernizr.custom.js"></script>
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
</head>
<body>
<nav class="menu menu-vertical menu-right" id="menu">
<div id="sideGrid">
<div class="sideNav">
<button id="diasble" type="button" class="diasble">
<svg xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-arrow-narrow-right"
width="44"
height="44"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="#ffffff"
fill="none"
stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" />
<line x1="5" y1="12" x2="19" y2="12" />
<line x1="19" y1="12" x2="14" y2="16" />
<line x1="19" y1="12" x2="14" y2="8" />
</svg>
</button>
<button id="basket" type="button" class="basket">
<svg xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-shopping-cart"
width="44"
height="44"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="#ffffff"
fill="none"
stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" />
<circle cx="9" cy="19" r="2" />
<circle cx="17" cy="19" r="2" />
<path d="M3 3h2l2 12a3 3 0 0 0 3 2h7a3 3 0 0 0 3 -2l1 -7h-15.2" />
</svg>
</button>
</div>
<div id="cart" class="cart">
<!--<button id="cart-item-remove" class="cart-item-remove"></button>
<div class="cart-item">
<img src="../FoodSelectApp/picture/1.jpg" class="cart-image" id="item-image" />
<button id="cart-item-remove" class="cart-item-remove"></button>
</div>-->
<div id="end"><!-- 나중에 확장자 php로 수정해야함-->
<form action="basket.html" id="form_direction_start" method="POST">
<div id="form_direction_end"></div>
</form>
</div>
</div>
</div>
</nav>
<div id="grid">
<div class="nav">
<button id="prev" type="button" class="prev"><!--prev button-->
<svg xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-arrow-narrow-left"
width="44"
height="44"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="#E43B3C"
fill="none"
stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" />
<line x1="5" y1="12" x2="19" y2="12" />
<line x1="5" y1="12" x2="9" y2="16" />
<line x1="5" y1="12" x2="9" y2="8" />
</svg>
</button>
<button id="home" type="button" class="home"><!--menu button-->
<svg xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-menu-2"
width="44"
height="44"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="#E43B3C"
fill="none"
stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" />
<line x1="4" y1="6" x2="20" y2="6" />
<line x1="4" y1="12" x2="20" y2="12" />
<line x1="4" y1="18" x2="20" y2="18" />
</svg>
</button>
</div>
<div class="wrapper">
<img id="img" src="../FoodSelectApp/picture/1.jpg" />
</div>
<div class="foot">
<button id="change" class="btn btn-primary btn-lg outline">Change</button>
<button type="button" class="cart-button">
<img src="../public/picture/cart.PNG"/>
</button>
</div>
</div>
<!--Slide Menu Script-->
<script src="js/classie.js"></script>
<script>
var menu = document.getElementById('menu'),
show = document.getElementById('home'),
disable = document.getElementById('diasble');
show.addEventListener("click", function() {
menu.classList.toggle("menu-open");
})
disable.onclick = function() {
classie.toggle(menu, 'menu-open');
};
</script>
<!--Selected menu-->
<script>
const cartBtn = document.querySelectorAll('.cart-button');
var removeBtnArr = [];
cartBtn.forEach(function(btn) {
btn.addEventListener('click', function(event) {
//console.log(event.target);
if (event.target.parentElement.classList.contains("cart-button")) {
let fullpath = document.getElementById("img").src;
let pos = fullpath.indexOf("picture") + 7;
let partPath = fullpath.slice(pos);
var partNum = partPath.split('.');
console.log(partPath);
let instant=partPath;
const item = {};
item.img = "../FoodSelectApp/picture" + partPath;
console.log(item);
const cartItem = document.createElement('div');
const sendItem = document.createElement('input');
cartItem.classList.add("cart-item");
sendItem.classList.add("send-item");
cartItem.setAttribute('id', 'cart-item' + partNum[0]);
sendItem.setAttribute('name',"send[]");
sendItem.setAttribute('value',instant);
sendItem.setAttribute('type',"hidden");
cartItem.innerHTML = '<img src=' + item.img + ' class="cart-image" id="item-image"/> <button class="cart-item-remove" onClick="remove()"> <img id="cart-item-remove' + partNum[0] + '" src="../public/picture/remove.PNG"/></button>';
//select cart
const cart = document.getElementById("cart");
const end = document.getElementById("end");
cart.insertBefore(cartItem, end);
//select form
const send_point_start=document.getElementById("form_direction_start");
const send_point_end= document.getElementById("form_direction");
send_point_start.insertBefore(sendItem,send_point_end);
//alert("Hi");
}
});
});
function remove() {
var btnID = event.srcElement.id;
var partNum = btnID.split('/');
var cart = document.getElementById("cart-item/" + partNum[1]);
cart.remove(cart)
}
function send(){
go=document.getElementById("form_direction_start");
go.submit();
}
</script>
</body>
<!-- Copyright (c) 2020 by ahmed beheiry (https://codepen.io/ahmedbeheiry/pen/qNPoyJ)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
All our downloadable resources are licenced under the MIT license (if not mentioned otherwise):
Copyright (c) 2020 Codrops (http://tympanus.net/codrops/)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ��Software��), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Our design freebies can be used in personal or commercial projects with the exception of redistribution, republishing or sale of the item itself, parts of the item, or edited versions.
You are free to copy excerpts of our articles but please don��t republish entire articles. If you��d like to translate single articles, please contact us.
-->
</html>
<script>
var chButton = document.getElementById('change');
var prevButton = document.getElementById('prev');
var basketButton = document.getElementById('basket');
var tmp = location.href.split('?');
var codeNum = String(tmp[1]);
function chaneMenu() {
var picCode;
while (true) {
var number = String(Math.floor(Math.random() * 3) + 1);
if (codeNum.indexOf(number) != -1) {
picCode = number + String(Math.floor(Math.random() * 3));
break;
} else continue;
}
document.getElementById('img').src = '../FoodSelectApp/picture/' + picCode + '.png';
}
function prevPage() {
location = 'checkBox.html'
}
function basketPage(){
location = 'basket.html'
send();
}
chButton.addEventListener('click', chaneMenu);
prevButton.addEventListener('click', prevPage);
basketButton.addEventListener('click', basketPage);
</script>