Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working: Contribution action menu not selected #4

Open
erikw opened this issue Oct 20, 2020 · 1 comment
Open

Not working: Contribution action menu not selected #4

erikw opened this issue Oct 20, 2020 · 1 comment

Comments

@erikw
Copy link

erikw commented Oct 20, 2020

I tried out the script. It works somewhat: it iterates though all entries putting a red rectangle around the action button, but it never manages to find the "Delete .. (photo|review)" action inside. Thus nothing is deleted.

erikw added a commit to erikw/google-maps-cleaning-utilities that referenced this issue Oct 20, 2020
The query selection on the master branch does not work on the current
Google Maps version. Instead of looking for a
<div role="menuitem" class="action-menu-entry" ...>
it works for me to look for a
<div class="action-menu-entry-text-container" ...>

With this change, I could delete all my contributed photos and reviews.
erikw added a commit to erikw/google-maps-cleaning-utilities that referenced this issue Oct 20, 2020
The query selection on the master branch does not work on the current
Google Maps version. Instead of looking for a
<div role="menuitem" class="action-menu-entry" ...>
it works for me to look for a
<div class="action-menu-entry-text-container" ...>

With this change, I could delete all my contributed photos and reviews.
@forgetfulprogrammer
Copy link

forgetfulprogrammer commented Jan 1, 2021

Fix and faster deletion:
`// Google Maps - Delete All Contributions
// 1. Go to Google Maps, on your desktop
// 2. Open the left tab menu
// 3. Click on "Your contributions"
// 4. Select the tab "Photos" or "Reviews"
// 5. Scroll down until all or most of all pictures (or reviews) are shown in list
// 6. Open the Developer tools (F12, on Firefox or Chrome)
// 7. Open the Console tab
// 8. Copy Paste this script
// 9. Type pleaseDeleteContributionsPlease(), wait for it to be done.

var pleaseDeleteContributionsPlease = function () {

var confirmDeleteContribution = function() {
    [...document.querySelectorAll('button[class~="blue-button-text"]')].forEach( (a) => { 
        a.style.border = "thick solid green";
        a.click(); 
    });
    setTimeout(removeMe, 2000);
}
    
var deleteContribution = function() {
    [...document.querySelectorAll('div[class="action-menu-entry-text"]')].forEach( (a) => { 
        if (a.innerHTML.includes("Delete")
            || a.innerHTML.includes("Elimina")) {
            a.parentElement.style.border = "thick solid red";
            a.parentElement.click(); 
        }
		
    });
    setTimeout(confirmDeleteContribution, 600);
}

var removeMe = function() {
    
    var elem = items[currentIndex];
    if (currentIndex < numberOfItems && elem) {
        
        elem.style.border = "thick solid orange"; 
        elem.click();

        // goes to the next item
        currentIndex = currentIndex + 1;
        console.log('task:', currentIndex, 'of', numberOfItems);
        // set to delete the item
        setTimeout(deleteContribution, 600);
    
    } else {
        clearTimeout();
        console.log('DONE. You did a favor to your past and present self. Now, go print one of your favorite pictures and hang it on a wall, please.');
    }  
};

// these are used inside the above functions
var currentIndex = 0; 
var items = [...document.querySelectorAll('button[class*="action-menu"]')];
var numberOfItems = [...document.querySelectorAll('button[class*="action-menu"]')].length;
// start iterating through `items`
removeMe();

};
pleaseDeleteContributionsPlease();`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants