| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| (async () => { |
| const MAX = 10; |
| const SKIN = false; |
| const sleep = ms => new Promise(r => setTimeout(r, ms)); |
| const $ = (s, r=document) => r.querySelector(s); |
| const $$ = (s, r=document) => [...r.querySelectorAll(s)]; |
|
|
| const products = $$('.product'); |
| if (!products.length) return console.error('No .product tiles — is the grid loaded?'); |
| const n = MAX ? Math.min(MAX, products.length) : products.length; |
| console.log(`Downloading ${n} of ${products.length} animations…`); |
|
|
| const waitFor = async (fn, tries=60, gap=500) => { |
| for (let i=0;i<tries;i++){ const v=fn(); if(v) return v; await sleep(gap); } return null; |
| }; |
|
|
| for (let i = 0; i < n; i++) { |
| const name = (products[i].querySelector('.product-name,.text-center')||{}).textContent?.trim() || `#${i}`; |
| products[i].click(); |
| |
| const dl = await waitFor(() => $$('.btn-block.btn.btn-primary').find(b => /download/i.test(b.textContent))); |
| if (!dl) { console.warn(`[${i}] ${name}: no Download button, skipping`); continue; } |
| dl.click(); |
| |
| const confirm = await waitFor(() => { const b=$$('.modal .btn-primary, .btn.btn-primary'); return b.length>1 ? b[b.length-1] : null; }); |
| if (!confirm) { console.warn(`[${i}] ${name}: no modal, skipping`); continue; } |
| |
| const skinSel = $$('select').find(s => [...s.options].some(o => /skin/i.test(o.textContent))); |
| if (skinSel) { |
| const want = [...skinSel.options].find(o => (SKIN ? /with skin/i : /without/i).test(o.textContent)); |
| if (want && skinSel.value !== want.value) { |
| skinSel.value = want.value; |
| skinSel.dispatchEvent(new Event('change', {bubbles:true})); |
| await sleep(300); |
| } |
| } |
| confirm.click(); |
| console.log(`[${i+1}/${n}] ${name}`); |
| |
| await waitFor(() => $('.progress-bar'), 8, 250); |
| await waitFor(() => !$('.progress-bar'), 60, 500); |
| await sleep(1200); |
| } |
| console.log('DONE. Check your Downloads folder.'); |
| })(); |
|
|