-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.js
101 lines (88 loc) · 3.15 KB
/
demo.js
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
// Initialize and add the map
let c = 1;
function changeMap() {
const mapAdd = [
'https://www.google.com.qa/maps/d/u/0/embed?mid=10FZeNZd1o9xyLj7UZE2ZZ6rQcojVVVM7&ehbc=2E312F',
'https://www.google.com.qa/maps/d/u/0/embed?mid=1pdDezt7lGJI8iUREZMIaALFH3vfN4SA8&ehbc=2E312F',
];
let map = document.querySelector('#map');
if (c % 2 == 0) {
map.querySelector('iframe').src = mapAdd[0];
} else {
map.querySelector('iframe').src = mapAdd[1];
}
c++;
}
function initMap() {
// The location of Uluru
console.log('Herer');
const uluru = { lat: 30.735233, lng: 76.740175 };
// The map, centered at Uluru
const map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: uluru,
});
// The marker, positioned at Uluru
const marker = new google.maps.Marker({
position: uluru,
map: map,
});
}
window.initMap = initMap;
const accept = document.getElementsByClassName('acc');
// const accept2 = document.querySelector('.container-fluid');
// console.log(accept2);
const decline = document.getElementsByClassName('dec');
// console.log(decline);
// console.log(map);
let count = 0;
let orderLeft = 4;
let mapArray = [
'https://www.google.com.qa/maps/d/u/0/embed?mid=1z7Pz88ulCtedPUq7zzKtgEUWBAC9zKSi&ehbc=2E312F',
'https://www.google.com.qa/maps/d/u/0/embed?mid=1hwjwMJmEnfHQwCxuejtL9AEe10NjSSpe&ehbc=2E312F',
'https://www.google.com.qa/maps/d/u/0/embed?mid=1SvtlhOYhdtolhsmF_U70JxLQLmmlAflw&ehbc=2E312F',
'https://www.google.com.qa/maps/d/u/0/embed?mid=14swdl2EmnROpMDAgfyDI2mo1q-zCrvUw&ehbc=2E312F',
'https://www.google.com.qa/maps/d/u/0/embed?mid=1TCGgPJBrparS-6_0XhuRIrRWM01DUvaz&ehbc=2E312F',
];
let oLeft = document.querySelector('.oLeft');
// let hideArray = [1, 0, 0, 0, 0];
function accClick() {
let map = document.querySelector('#map');
oLeft.innerHTML = 'Orders Left : ' + orderLeft;
let orderArray = document.querySelectorAll('.orders');
orderArray[count].classList.add('hideIt');
orderArray[count + 1].classList.remove('hideIt');
console.log(orderArray[count]);
console.log(orderArray[count + 1]);
// console.log(orderArray);
// console.log(count);
if (count <= 4) {
map.querySelector('iframe').src = mapArray[count];
console.log(count);
if (count >= 0) {
map.querySelector('iframe').src = mapArray[count];
} else {
alert('All orders done!');
count = 0;
orderLeft = 4;
// return 0;
}
console.log('Order Left ', orderLeft);
console.log('Count ', count);
orderLeft--;
count++;
// console.log(map.querySelector('iframe'));
}
}
function decClick() {
let orderArray = document.querySelectorAll('.orders');
orderArray[count].classList.add('hideIt');
orderArray[count + 1].classList.remove('hideIt');
if (count <= 4) {
oLeft.innerHTML = 'Orders Left : ' + orderLeft;
} else {
alert('All order done.');
}
orderLeft--;
count++;
}