-
-
Save allegrabottlik/280dbe63aa0a07b788c81f07382981b9 to your computer and use it in GitHub Desktop.
## currently not working ## | |
function moveToWishList() { | |
var query = document.querySelectorAll("#sc-saved-cart input[value='Move to Wish List']") | |
if (query.length) { | |
query[0].click(); | |
} | |
var query2 = document.querySelectorAll("#registry-3O6MPC8BWUEPE a") | |
if (query2.length) { | |
query2[0].click(); | |
} | |
if (query.length > 1) { | |
setTimeout(moveToWishList,10000); | |
} | |
else { | |
console.log('Finished'); | |
} | |
} | |
moveToWishList(); |
This is in JAVASCRIPT.
Edited from: https://gist.github.com/MichaelLawton/ec73c321d62d1b4eaf0f51ca478ccd92#gistcomment-3005931
Should you desire to move your items to a Wish List instead of deleting them for good,
you can do so with a slight extension to the great script already provided by @MichaelLawton here: https://gist.github.com/MichaelLawton/ec73c321d62d1b4eaf0f51ca478ccd92You'll need to view the source of your Shopping Cart page to get the list/registry ID of your
specific list to save them to (should look something like "#registry-XXXXXXXXXXXXX").
wl-list-link-3O6MPC8BWUEPE <- This is my link
wl-list-link-___________________ <- you will need to find the list link (see above)
----- final version that worked -----
function moveToWishList() {
var query = document.querySelectorAll("#sc-saved-cart input[value='Move to Wish List']")
if (query.length) {
query[0].click();
}
var query2 = document.querySelectorAll("#registry-**3O6MPC8BWUEPE** a")
if (query2.length) {
query2[0].click();
}
if (query.length > 1) {
setTimeout(moveToWishList,5000);
}
else {
console.log('Finished');
}
}
moveToWishList();
Paste the above code (remember to put your wish list ID in first) into Console in your browser then press Enter.
If there are no more entries in the saved for later section visible on screen, please scroll down with your mouse. It does not "see" saved for later icons unless you can too.
function moveToWishList() {
var query = document.querySelectorAll("#sc-saved-cart input[value='Move to Wish List']")
if (query.length) {
query[0].click();
}
var query2 = document.querySelectorAll("#registry-3O6MPC8BWUEPE a")
if (query2.length) {
query2[0].click();
}
if (query.length > 1) {
setTimeout(moveToWishList,10000);
}
else {
console.log('Finished');
}
}
moveToWishList();
Amazon has added a checkbox to the left of items in Cart, and so this is broken again.
Michael's original I started with:
function deleteSavedItems() {
var query = document.querySelectorAll("#sc-saved-cart input[value=Delete]")
if (query.length) {
query[0].click();
}
if (query.length > 1) {
setTimeout(deleteSavedItems,100);
}
else {
console.log('Finished');
}
}
deleteSavedItems();
Updates from recent comment on gist I originally forked from: [(https://gist.github.com/MichaelLawton/ec73c321d62d1b4eaf0f51ca478ccd92?permalink_comment_id=4639550#gistcomment-4639550)].
`avagian commented last week •
Thanks @MichaelLawton and @mhujsak
Amazon has changed a little bit, here is the modified "Add to list" instead of "Move to Wish List" Version
you can get XXXXXXXXXXXX from your list URL as well https://www.amazon.com/hz/wishlist/ls/XXXXXXXXXXXX
I'll load it all and will leave it overnight. But if 10000 is very slow for you, modify it to a lower number.
p.s. deleteSavedItems works fine without any mod
function moveToWishList() {
var query = document.querySelectorAll("#sc-saved-cart input[value='Add to list']")
if (query.length) {
query[0].click();
}
var query2 = document.querySelectorAll("#cldd-list-name-XXXXXXXXXXXX")
if (query2.length) {
query2[0].click();
}
if (query.length > 1) {
setTimeout(moveToWishList,10000);
}
else {
console.log('Finished');
}
}
moveToWishList();`
function moveToWishList() {
var query = document.querySelectorAll("#sc-saved-cart input[value='Add to list']")
if (query.length) {
query[0].click();
}
var query2 = document.querySelectorAll("#cldd-list-name-3O6MPC8BWUEPE")
if (query2.length) {
query2[0].click();
}
if (query.length > 1) {
setTimeout(moveToWishList,10000);
}
else {
console.log('Finished');
}
}
moveToWishList();
try using zoom in browser to get more items per page
Turn off any Chrome extensions running on the page to speed up
add the save to wishlist from atom