Skip to main content

max / makenotwork

594 B · 22 lines History Blame Raw
1 function exportAll() {
2 var btn = document.getElementById('export-all-btn');
3 var buttons = document.querySelectorAll('.export-card button.secondary');
4 if (buttons.length === 0) return;
5
6 btn.disabled = true;
7 btn.textContent = 'Exporting...';
8 var i = 0;
9
10 function next() {
11 if (i >= buttons.length) {
12 btn.textContent = 'Done';
13 setTimeout(function() { btn.textContent = 'Export All'; btn.disabled = false; }, 3000);
14 return;
15 }
16 buttons[i].click();
17 i++;
18 setTimeout(next, 1500);
19 }
20 next();
21 }
22