-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fixed for current Google Maps version #2
base: master
Are you sure you want to change the base?
Conversation
Class names changed. Click() no longer works. Use cache of deleted images to avoid repeatedly deleting the same one.
worked with my photos, but not the reviews |
Ah, I didn't use it on reviews. I'll make some and have a look. |
Hi there! True The classes changed, but updating the selectors, make everything work (also for reviews). I notice a language flaw also (for comparing I'm pushing some updates on master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the selectors, they work with reviews and photos, without changing anything else,
however, you are right about removing idx
from the equation, but also your idcache
would not needed then,
if you feel like you could update your code pulling from the current master and find a solution without idx
and idcache
(have a look at other more recent scripts I wrote for cleaning FB).
var evt = document.createEvent('MouseEvent'); | ||
evt.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | ||
a.dispatchEvent(evt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the intention here, but actually if one chose correctly the selector with the element having the "click" event handler set, then the .click()
will work
var confirmDeleteContribution = function(idx) { | ||
[...document.querySelectorAll('button[class~="blue-button-text"]')].forEach( (a) => { | ||
var confirmDeleteContribution = function() { | ||
[...document.querySelectorAll('button[class~="section-dialog-footer-action-button"]')].forEach( (a) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the previous selector blue-button-text
is still working for me.
are there different versions of maps around maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it works for me too, I didn't need to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok so no need to use section-dialog-footer-action-button
then
[...document.querySelectorAll('div[class~="context-menu-entry"] div[class~="context-menu-entry-text"]')].forEach( (a) => { | ||
|
||
var deleteContribution = function() { | ||
[...document.querySelectorAll('div[class~="action-menu-entry"] div[class~="action-menu-entry-text"]')].forEach( (a) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this has to change, correct
var elem; | ||
var found = false; | ||
var z = -1; | ||
do { | ||
z++; | ||
elem = [...document.querySelectorAll('button[aria-label*="actions"]')][z]; | ||
if (elem == null) | ||
return; | ||
found = true; | ||
for (var i = 0; i < idcache.length; i++) | ||
{ | ||
if (idcache[i] == elem.getAttribute("data-photo-id")) | ||
found = false; | ||
} | ||
} while(found == false); | ||
|
||
if (elem) { | ||
idcache.push(elem.getAttribute("data-photo-id")); | ||
console.log(elem.getAttribute("data-photo-id")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmmh I don't understand this part,
photo
makes it valid only for the photos and not reviews,
in general comments on what the loop does are highly appreciated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the selector button[aria-label*="actions"
is not working now,
I updated it on master
with 'button[class*="action-menu"]'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue I had was that when the script runs it deleted a couple of photos and then got stuck. To reproduce you need to have at least 3 photos of one location to delete. The first one would be deleted but then the others wouldn't slide into place and the script would keep trying to delete the first one.
The issue seems to be that they don't remove the deleted photo's elements, just hide them, so it was still item [0] in the list. Unfortunately the behaviour isn't consistent so you can't just iterate, so I created the ID cache to just skip over ones that have already been deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah thanks a lot for explanation, it makes sense then,
now I understand the need of idcache
and why probably I added the idx
thing last year.
let me see if there is a way of not looping but include all the photos in the main list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, actually idx
was meant for that purpose,
have a look at current master
,
thanks a lot again for contributing to this!
var idcache = new Array(); | ||
idcache.push("none"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that idx
is not really needed, but also idcache
then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah it turns out that idx
is needed (have a look at the above comments)
the current updated master works also with reviews, at today |
Thanks for looking at this. I don't really know Javascript, I was just annoyed by Google stealing my Rewards money so I wanted to withdraw all my support. Can confirm it now works but it only deletes the first 10 entries. If you have more than 10 entries you have to manually run it again until they are all gone. My version keeps going until there are none left, I don't know if that was your intended behaviour. Correction: It deletes however many are displayed, which by default is 10 when I switch to that tab. So to be clear after a few have been deleted the site loads more reviews, and they are not deleted. |
yes it deletes the reviews/photos that are rendered in that moment: scroll down until the last review/photo is shown and then start the script |
Okay, well I tested it out with one minor modification, I removed the test for |
Class names changed.
Click() no longer works.
Use cache of deleted images to avoid repeatedly deleting the same one.