-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
91 lines (87 loc) · 4.54 KB
/
index.html
File metadata and controls
91 lines (87 loc) · 4.54 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Zinc API Examples</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="./bootstrap.min.css" rel="stylesheet">
<script src="./bootstrap.bundle.min.js"></script>
<style>
html,
body {
height: 100%;
padding: 0;
margin: 0;
font-size: 16px;
}
</style>
</head>
<body>
<div id="explore" class="container-fluid p-0 d-flex flex-column" style="height: 100%;">
<div class="container-fluid">
<div class="row">
<div class="col-lg-2 col-1 align-items-center d-flex">
<img class="me-4" style="width: 25px; filter: invert(100%);" src="./logo.svg" title="Zinc API Examples">
<h5 class="d-none d-lg-block" style="display: inline-block; margin: 0;">Zinc API Examples</h5>
</div>
<div id="hasCt" class="col-lg-6 col-7 align-items-center d-flex">
<span class="me-1 d-none d-sm-block">Amazon ASIN:</span>
<input id="pidTxt" type="text" class="form-control form-control-sm" value="B07VQ69WP5" aria-label="Product Id">
<button id="pidSubmit" type="button" class="btn btn-primary btn-sm m-1">Refresh</button>
</div>
<div id="noCt" class="col-lg-6 col-7 align-items-center d-flex">
<span class="me-1 d-none d-sm-block">Amazon ASIN:</span>
<select id="pidSelect" class="form-select form-select-sm me-2" aria-label="Default select example">
<option value="B07VQ69WP5" selected>B07VQ69WP5</option>
<option value="B0815Y8J9N">B0815Y8J9N</option>
<option value="B07SVB39J2">B07SVB39J2</option>
<option value="B00IVLIC1O">B00IVLIC1O</option>
<option value="B015CH1PJU">B015CH1PJU</option>
</select>
</div>
<div class="col-4 align-items-center justify-content-end d-flex">
<div class="dropdown" title="select example">
<button class="btn btn-secondary btn-sm dropdown-toggle" type="button" id="demoSelectMenu" data-bs-toggle="dropdown" aria-expanded="false">
Select Demo
</button>
<ul class="dropdown-menu" aria-labelledby="demoSelectMenu">
<li><a class="dropdown-item" type="button" href="#Product_Details">Product Details</a></li>
<li><a class="dropdown-item" type="button" href="#Product_Offers">Product Offers</a></li>
</ul>
</div>
<button id="setClientToken" type="button" class="btn btn-primary btn-sm m-1 d-none d-sm-block">Set Client Token</button>
</div>
</div>
</div>
<iframe id="demoFrame" class="flex-fill" src="./product_details_demo.html"></iframe>
</div>
<script>
let pid = 'B07VQ69WP5'
function refreshIframe() {
if (localStorage.getItem('ct')) document.getElementById('noCt').style.setProperty('display', 'none', 'important');
else document.getElementById('hasCt').style.setProperty('display', 'none', 'important');
const demo = window.location.hash || 'Product_Details'
document.getElementById('demoFrame').src = `./${demo.replace("#","")}.html?pid=${pid}&now=${+new Date()}`
document.getElementById('demoSelectMenu').innerHTML = window.location.hash.replace(/_|#/g," ") || "Product Details"
}
refreshIframe()
document.addEventListener("DOMContentLoaded", () => {
window.addEventListener('hashchange', refreshIframe)
document.getElementById('pidSelect').addEventListener('change', (event) => {
pid = event.target.value
refreshIframe()
});
document.getElementById('setClientToken').addEventListener('click', (event) => {
const ct = prompt("Enter Client Token", "");
localStorage.setItem('ct', ct)
location.reload();
})
document.getElementById('pidSubmit').addEventListener('click', (event) => {
pid = document.getElementById('pidTxt').value
refreshIframe()
})
})
</script>
</body>
</html>