-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlookup.html
141 lines (121 loc) · 5.39 KB
/
lookup.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>
<title>PolyDev - StreamLookup</title>
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
a {
color: #15ebd2;
}
.backer {
background: #15ebd2;
}
.backer-dark {
background: #12d0b9;
}
.card-container {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.card {
width: 11rem;
/* Add other card styling here */
}
.card img {
width: 26%;
height: auto;
}
img{
height: 38px; padding: 12px 0;
}
</style>
</head>
<body>
<header class="z-depth-1">
<nav class="z-depth-0 backer-dark">
<div class="nav-wrapper container">
<ul class="left">
<li><a href="https://rebrand.ly/PolyExtended">Home</a></li>
<li><a href="https://rebrand.ly/polylive">PolyLive</a></li>
<li><a href="https://rebrand.ly/PolyStreamLookup">PolyLookup</a></li>
<li><a href="https://rebrand.ly/polywyr">Poly - WYR?</a></li>
</ul>
</div>
</nav>
</header>
<div class="container mt-4">
<!-- Bootstrap form component -->
<form id="channelLookupForm" class="mb-4">
<div class="mb-3">
<label for="inputField" class="form-label">Enter Channel Name:</label>
<input type="text" class="form-control" id="inputField" name="user_input" required>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<div class="card-container" id="emoteContainer">
<!-- Emotes will be displayed here -->
</div>
</div>
</main>
<footer class="container section grey-text center-align">
© 2016 PolyDev
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
<script>
document.getElementById('channelLookupForm').addEventListener('submit', function(event) {
event.preventDefault();
const channel = document.getElementById('inputField').value;
const api_url = `https://emotes.adamcy.pl/v1/channel/${channel}/emotes/all`;
fetch(api_url)
.then(response => response.json())
.then(data => {
const emoteContainer = document.getElementById('emoteContainer');
emoteContainer.innerHTML = '';
data.forEach(emote => {
const card = document.createElement('div');
card.className = 'card';
const img = document.createElement('img');
img.src = emote.urls[0].url;
img.alt = emote.code;
const cardBody = document.createElement('div');
cardBody.className = 'card-body';
const cardText = document.createElement('p');
cardText.className = 'card-text';
cardText.textContent = emote.code;
cardBody.appendChild(cardText);
// Display provider information based on the value
if (emote.provider === 1) {
const providerText = document.createElement('p');
providerText.className = 'card-text';
providerText.innerHTML = `From: <a href="https://bit.ly/Bacon7TV" target="_blank">SevenTV</a>`;
cardBody.appendChild(providerText);
} else if (emote.provider === 2) {
const providerText = document.createElement('p');
providerText.className = 'card-text';
providerText.innerHTML = `From: <a href="https://bit.ly/BaconBTTV" target="_blank">BetterTwitchTV</a>`;
cardBody.appendChild(providerText);
} else if (emote.provider === 3) {
const providerText = document.createElement('p');
providerText.className = 'card-text';
providerText.innerHTML = `From: <a href="https://bit.ly/BaconFFZ" target="_blank">FrankerFaceZ</a>`;
cardBody.appendChild(providerText);
} else {
const providerText = document.createElement('p');
providerText.className = 'card-text';
providerText.innerHTML = `From: <a href="https://twitch.tv/${channel}" target="_blank">Twitch</a>`;
cardBody.appendChild(providerText);
}
card.appendChild(img);
card.appendChild(cardBody);
emoteContainer.appendChild(card);
});
})
.catch(error => console.error('Error fetching data:', error));
});
</script>
</body>
</html>