Skip to content

Instantly share code, notes, and snippets.

@npanuhin
Last active January 12, 2024 19:53
Show Gist options
  • Save npanuhin/1efd3f06f643401703d098b817661d9b to your computer and use it in GitHub Desktop.
Save npanuhin/1efd3f06f643401703d098b817661d9b to your computer and use it in GitHub Desktop.
Rebrickable: add all parts from set to lost parts
let _to_add = document.querySelectorAll('.js-part-data');
function handle(part_index) {
let _part = _to_add[part_index];
console.log(part_index, _part);
let _quantity = _part.getAttribute('data-quantity');
_part.click();
setTimeout(() => {
document.querySelector('a[href="#tab_lostparts"]').click();
setTimeout(() => {
document.querySelector('form[action="/users/npanuhin/lostparts/add/?page_querystring="] input[name="lost_quantity"]').value = _quantity;
setTimeout(() => {
document.querySelector('#tab_lostparts form[action="/users/npanuhin/lostparts/add/?page_querystring="] button[type="submit"]').click();
setTimeout(() => {
document.querySelector('#part_popup_modal').click();
setTimeout(handle, 500, ++part_index);
}, 2000);
}, 1000);
}, 1000);
}, 2000);
}
handle(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment