-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
380 lines (327 loc) · 20.4 KB
/
index.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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Indonesia Logo Library Search</title>
<meta name="description" content="This repository hosts a collection of logos for use in web and mobile applications, specifically tailored for payment channels, banks, and bill payment services in Indonesia. These logos are available in a centralized format for easier integration into various projects, and are served via CDN.">
<meta name="keywords" content="logo, bank, payment, bill payment, indonesia bank, indonesia bill, indonesia payment">
<meta property="og:type" content="website">
<meta property="og:url" content="https://indonesia-logo-library.vercel.app/">
<meta property="og:title" content="Indonesia Logo Library">
<meta property="og:description" content="This repository hosts a collection of logos for use in web and mobile applications, specifically tailored for payment channels, banks, and bill payment services in Indonesia.">
<meta property="og:image" content="https://raska.id/images/indonesia-logo-library-thumbnail.jpg">
<meta property="og:site_name" content="Indonesia Logo Library">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="https://indonesia-logo-library.vercel.app/">
<meta property="twitter:title" content="Indonesia Logo Library">
<meta property="twitter:description" content="This repository hosts a collection of logos for use in web and mobile applications, specifically tailored for payment channels, banks, and bill payment services in Indonesia.">
<meta property="twitter:image" content="https://raska.id/images/indonesia-logo-library-thumbnail.jpg">
<link rel="canonical" href="https://indonesia-logo-library.vercel.app/">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/flowbite.min.css" rel="stylesheet" />
<script defer data-domain="indonesia-logo-library.vercel.app" src="https://beacon.8labs.id/js/script.js"></script>
<script defer src="https://analytic.8labs.id/script.js" data-website-id="753da775-a393-4b71-9bd6-3f6c076a9c17"></script>
</head>
<body class="bg-gray-900 text-white">
<div class="container mx-auto px-4 py-8">
<nav class="bg-white border-gray-200 dark:bg-gray-900">
<div class="max-w-full flex flex-wrap items-center justify-between mx-auto py-4">
<a href="https://flowbite.com/" class="flex items-center space-x-3 rtl:space-x-reverse">
<span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">🇮🇩 Indonesia Logo Library</span>
</a>
<div class="flex md:order-2 space-x-3 md:space-x-0 rtl:space-x-reverse">
<a href="https://github.com/Adekabang/indonesia-logo-library" target="_blank" type="button" class="flex items-center justify-center text-gray-900 bg-white hover:bg-gray-200 focus:ring-4 focus:outline-none focus:ring-white font-medium rounded-lg text-sm px-2 text-center">
<svg viewBox="0 0 24 24" aria-hidden="true" class="m-2 w-5 h-5 text-white"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 2C6.477 2 2 6.463 2 11.97c0 4.404 2.865 8.14 6.839 9.458.5.092.682-.216.682-.48 0-.236-.008-.864-.013-1.695-2.782.602-3.369-1.337-3.369-1.337-.454-1.151-1.11-1.458-1.11-1.458-.908-.618.069-.606.069-.606 1.003.07 1.531 1.027 1.531 1.027.892 1.524 2.341 1.084 2.91.828.092-.643.35-1.083.636-1.332-2.22-.251-4.555-1.107-4.555-4.927 0-1.088.39-1.979 1.029-2.675-.103-.252-.446-1.266.098-2.638 0 0 .84-.268 2.75 1.022A9.607 9.607 0 0 1 12 6.82c.85.004 1.705.114 2.504.336 1.909-1.29 2.747-1.022 2.747-1.022.546 1.372.202 2.386.1 2.638.64.696 1.028 1.587 1.028 2.675 0 3.83-2.339 4.673-4.566 4.92.359.307.678.915.678 1.846 0 1.332-.012 2.407-.012 2.734 0 .267.18.577.688.48 3.97-1.32 6.833-5.054 6.833-9.458C22 6.463 17.522 2 12 2Z"></path></svg>
Github Repo</a>
<button data-collapse-toggle="navbar-cta" type="button" class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600" aria-controls="navbar-cta" aria-expanded="false">
<span class="sr-only">Open main menu</span>
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 1h15M1 7h15M1 13h15"/>
</svg>
</button>
</div>
<div class="items-center justify-between hidden w-full md:flex md:w-auto md:order-1" id="navbar-cta">
<ul class="flex flex-col font-medium p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:space-x-8 rtl:space-x-reverse md:flex-row md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
<li>
<a href="https://statically.io/" target="_blank" class="flex py-2 px-3 md:p-0 text-gray-900 rounded hover:bg-gray-100 md:hover:bg-transparent md:hover:text-gray-900 md:dark:hover:text-gray-900 dark:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700 hover:underline">
<img class="h-6" src="https://statically.io/icons/icon-48x48.png" alt="Statically" title="Statically logo">
Statically.io</a>
</li>
<li>
<a href="https://www.jsdelivr.com/" target="_blank" class="flex py-2 px-3 md:p-0 text-gray-900 rounded hover:bg-gray-100 md:hover:bg-transparent md:hover:text-gray-900 md:dark:hover:text-gray-900 dark:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700 hover:underline">
<img class="h-6" title="jsDelivr logo" src="https://www.jsdelivr.com/icons/favicon-48x48.png">
JSDelivr.net</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="mb-4 flex justify-between items-center">
<div class="flex md:w-1/2 w-full flex-col sm:flex-row">
<input type="text" id="search" placeholder="Search logos..." class="w-full p-2 border border-gray-600 rounded bg-gray-700 text-white">
<div class="mx-2 flex items-center">
<span class="mr-2">PNG</span>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" id="fileTypeSwitch" class="sr-only peer">
<div class="w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-gray-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-gray-600"></div>
</label>
<span class="ml-2">SVG</span>
</div>
</div>
<button id="reset" class="text-white bg-gray-800 hover:bg-gray-700 focus:ring-4 focus:ring-gray-600 font-medium rounded-lg text-sm px-5 py-2.5 ml-2">Reset</button>
</div>
<div id="categories" class="mb-4 flex flex-wrap">
<!-- Category filters will be populated here -->
</div>
<div id="results" class="space-y-8">
<!-- Results will be populated here -->
</div>
</div>
<style>
.loading-spinner {
border: 5px solid #4B5563;
border-top: 5px solid #E5E7EB;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
<script>
const GITHUB_API_URL = 'https://api.github.com/repos/Adekabang/indonesia-logo-library/contents';
const GITHUB_RAW_URL = 'https://raw.githubusercontent.com/Adekabang/indonesia-logo-library/main';
const JSDELIVR_URL = 'https://cdn.jsdelivr.net/gh/Adekabang/indonesia-logo-library@main';
const STATICALLY_URL = 'https://cdn.statically.io/gh/Adekabang/indonesia-logo-library@main';
const categories = [
"Bank",
"Bill Payment",
"Payment Channel"
];
const subcategories = {
"Bank": ["Bank App", "Bank Logo", "Regulatory", "Remittance", "Switching"],
"Bill Payment": ["Card Payment", "Donation", "E-Wallet", "Entertainment", "Financing", "Game", "Government", "ISP", "Logistic", "Mobile Telco", "Prepaid Card", "Supermarket", "Transportation", "Utilities"],
"Payment Channel": ["Card Payment", "Direct Debit", "E-Wallet", "Financing", "Miscellaneous", "Payment Gateway", "Prepaid Card", "Supermarket"]
};
let allLogos = {};
let currentCategory = 'all';
let currentSearchTerm = '';
async function fetchLogos(path) {
const cachedData = localStorage.getItem(path);
if (cachedData) {
return JSON.parse(cachedData);
}
const response = await fetch(`${GITHUB_API_URL}/${path}`);
const data = await response.json();
localStorage.setItem(path, JSON.stringify(data));
return data;
}
async function getAllLogos() {
const logos = {};
for (const category of categories) {
logos[category] = {};
for (const subcategory of subcategories[category]) {
const path = `${category}/${subcategory}`;
try {
const items = await fetchLogos(path);
logos[category][subcategory] = items.filter(item =>
item.type === 'file' && (item.name.endsWith('.png') || item.name.endsWith('.svg'))
).map(item => ({
name: item.name.split('.')[0],
path: item.path,
type: item.name.split('.').pop()
}));
} catch (error) {
console.error(`Error fetching logos for ${path}:`, error);
}
}
}
return logos;
}
function getImageUrls(path) {
const encodedPath = path.split('/').map(encodeURIComponent).join('/');
return [
`${JSDELIVR_URL}/${encodedPath}`,
`${STATICALLY_URL}/${encodedPath}`,
`${GITHUB_RAW_URL}/${encodedPath}`
];
}
async function loadImage(urls) {
for (const url of urls) {
try {
const response = await fetch(url, { method: 'HEAD' });
if (response.ok) {
return url;
}
} catch (error) {
console.warn(`Failed to load image from ${url}`, error);
}
}
console.error('All image loading attempts failed');
return urls[urls.length - 1]; // Return GitHub URL as a fallback
}
function displayLogos(filteredLogos) {
const resultsDiv = document.getElementById('results');
resultsDiv.innerHTML = '';
const fileType = document.getElementById('fileTypeSwitch').checked ? 'svg' : 'png';
for (const [category, subcats] of Object.entries(filteredLogos)) {
const categoryDiv = document.createElement('div');
categoryDiv.className = 'mb-6';
const categoryTitle = document.createElement('h2');
categoryTitle.textContent = category;
categoryTitle.className = 'text-2xl font-bold mb-4';
categoryDiv.appendChild(categoryTitle);
for (const [subcategory, logos] of Object.entries(subcats)) {
const filteredLogos = logos.filter(logo => logo.type === fileType);
if (filteredLogos.length === 0) continue;
const subcategoryDiv = document.createElement('div');
subcategoryDiv.className = 'mb-4';
const subcategoryTitle = document.createElement('h3');
subcategoryTitle.textContent = subcategory;
subcategoryTitle.className = 'text-xl font-semibold mb-2';
subcategoryDiv.appendChild(subcategoryTitle);
const logosGrid = document.createElement('div');
logosGrid.className = 'grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4';
filteredLogos.forEach(logo => {
const logoDiv = document.createElement('div');
logoDiv.className = 'bg-gray-800 p-4 rounded shadow';
const imgContainer = document.createElement('div');
imgContainer.className = 'w-full h-40 flex items-center justify-center mb-2 overflow-hidden bg-gray-700';
const loadingSpinner = document.createElement('div');
loadingSpinner.className = 'loading-spinner';
imgContainer.appendChild(loadingSpinner);
const img = document.createElement('img');
img.alt = `${logo.name} Logo`;
img.className = 'w-full h-full object-contain hidden';
const imageUrls = getImageUrls(logo.path);
loadImage(imageUrls).then(url => {
img.src = url;
img.onload = () => {
loadingSpinner.remove();
img.classList.remove('hidden');
};
});
imgContainer.appendChild(img);
logoDiv.appendChild(imgContainer);
const name = document.createElement('p');
name.textContent = logo.name;
name.className = 'text-center font-semibold mb-2';
logoDiv.appendChild(name);
const copyButtons = document.createElement('div');
copyButtons.className = 'flex flex-col space-y-2';
['jsDelivr', 'Statically', 'GitHub'].forEach((cdn, index) => {
const button = document.createElement('button');
button.textContent = `Copy ${cdn} Link`;
button.className = 'text-white bg-gray-900 hover:bg-gray-700 focus:ring-4 focus:ring-gray-600 font-medium rounded-lg text-sm px-5 py-2.5';
button.onclick = () => copyToClipboard(imageUrls[index], cdn);
copyButtons.appendChild(button);
});
logoDiv.appendChild(copyButtons);
logosGrid.appendChild(logoDiv);
});
subcategoryDiv.appendChild(logosGrid);
categoryDiv.appendChild(subcategoryDiv);
}
resultsDiv.appendChild(categoryDiv);
}
}
function copyToClipboard(text, cdn) {
navigator.clipboard.writeText(text).then(() => {
alert(`${cdn} link copied to clipboard!`);
}, (err) => {
console.error('Could not copy text: ', err);
});
}
function createCategoryFilters() {
const categoriesDiv = document.getElementById('categories');
categoriesDiv.innerHTML = '<button class="text-gray-900 bg-white hover:bg-gray-200 focus:ring-4 focus:ring-gray-600 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2" data-category="all">All</button>';
categories.forEach(category => {
const button = document.createElement('button');
button.textContent = category;
button.className = 'text-gray-300 bg-gray-800 border border-gray-600 focus:outline-none hover:bg-gray-700 focus:ring-4 focus:ring-gray-600 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2';
button.setAttribute('data-category', category);
categoriesDiv.appendChild(button);
});
categoriesDiv.addEventListener('click', (e) => {
if (e.target.tagName === 'BUTTON') {
const selectedCategory = e.target.getAttribute('data-category');
updateActiveCategory(selectedCategory);
filterLogos();
}
});
}
function updateActiveCategory(selectedCategory) {
currentCategory = selectedCategory;
const buttons = document.querySelectorAll('#categories button');
buttons.forEach(button => {
if (button.getAttribute('data-category') === selectedCategory) {
button.className = 'text-gray-900 bg-white hover:bg-gray-200 focus:ring-4 focus:ring-gray-600 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2';
} else {
button.className = 'text-gray-300 bg-gray-800 border border-gray-600 focus:outline-none hover:bg-gray-700 focus:ring-4 focus:ring-gray-600 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2';
}
});
}
function filterLogos() {
let filteredLogos = JSON.parse(JSON.stringify(allLogos)); // Deep clone allLogos
// Apply category filter
if (currentCategory !== 'all') {
filteredLogos = { [currentCategory]: filteredLogos[currentCategory] };
}
// Apply search filter
if (currentSearchTerm) {
for (const category in filteredLogos) {
for (const subcategory in filteredLogos[category]) {
filteredLogos[category][subcategory] = filteredLogos[category][subcategory].filter(logo =>
logo.name.toLowerCase().includes(currentSearchTerm) ||
logo.path.toLowerCase().includes(currentSearchTerm)
);
}
// Remove empty subcategories
for (const subcategory in filteredLogos[category]) {
if (filteredLogos[category][subcategory].length === 0) {
delete filteredLogos[category][subcategory];
}
}
// Remove empty categories
if (Object.keys(filteredLogos[category]).length === 0) {
delete filteredLogos[category];
}
}
}
displayLogos(filteredLogos);
}
function searchLogos() {
currentSearchTerm = document.getElementById('search').value.toLowerCase();
filterLogos();
}
function resetSearch() {
document.getElementById('search').value = '';
currentSearchTerm = '';
currentCategory = 'all';
updateActiveCategory('all');
filterLogos();
}
async function initializeLogos() {
allLogos = await getAllLogos();
createCategoryFilters();
filterLogos();
}
document.getElementById('search').addEventListener('input', searchLogos);
document.getElementById('fileTypeSwitch').addEventListener('change', filterLogos);
// Add a reset button
// const resetButton = document.createElement('button');
// resetButton.textContent = 'Reset';
// resetButton.className = 'text-white bg-gray-800 hover:bg-gray-700 focus:ring-4 focus:ring-gray-600 font-medium rounded-lg text-sm px-5 py-2.5 ml-2';
// resetButton.onclick = resetSearch;
// document.querySelector('.mb-4.flex').appendChild(resetButton);
const resetButton = document.querySelector('#reset');
resetButton.onclick = resetSearch;
// Initialize the page
initializeLogos();
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/flowbite.min.js"></script>
</body>
</html>