Is there a way to delete all of my posts, comments and +1's on my personal Google+ profile without deleting my Google+ account so I can keep my friends and acquaintances?
3 Answers
- Go to https://plus.google.com/apps/activities/
- Click on Posts, Comments, or the set of activities you want to remove.
- Enter this code into the console:
document.body.style.height = "200%"; // Always allow to scroll to wake the ajax
(function deleteItems() {
// All of the X buttons but from posts being removed
const xButtons = document.querySelectorAll(".kKHdKc:not(.FmKyud) .XVzU0b.J3yWx");
// If reached the end of the list
const reachedEnd = window.getComputedStyle(document.querySelector(".Jb45He.SrWDEb")).getPropertyValue("display") !== "none";
if (reachedEnd) {
// Stop if no more buttons to delete
console.log("No more buttons! Stopping");
clearInterval(deleteInterval);
return;
} else if (xButtons.length === 0 && document.querySelectorAll(".kKHdKc.FmKyud").length === 0) { // No more buttons to press and it's not disposing of old comments
// Scroll to wake up G+, an easier hack than calling G+ or loading all comments on a slow system
window.scrollTo(0, document.body.scrollHeight);
window.setTimeout(function() {
window.scrollTo(0, 0);
}, 10);
}
// Click the X buttons
for (let i = 0; i < xButtons.length; i++) {
xButtons[i].click();
// Click the all the modals' delete buttons
window.setTimeout(function() {
let modalDeleteButtons = document.querySelectorAll(".HvOprf .RveJvd");
for (let i = 0; i < modalDeleteButtons.length; i++) {
modalDeleteButtons[i].click();
}
}, 3);
}
window.setTimeout(function() {deleteItems();}, 100); // Forces at least the syncronous tasks to finish which is why I used this over an interval
})();
- Let it sit for a while.
If it stops after a while, change the three setTimeout delays to something larger. The 10, 3, and 5 ms times respectively were just some okay values for my system. I didn't put thought into them but rather just changed them when I noticed one part lag behind.
Be careful with code you enter into the console and don't enter code into the console unless you understand what the code does (as the self XSS warning in the console explains).
-
Is there any code available to delete posts from Google Plus Profile page? I tried the proposed solution, but If I go to activities, nothing loads under Posts! May 19, 2017 at 14:37
-
@kikeenrique Huh I see my posts under that menu option. I guess the code could be modified to work to click on the the post then the delete option. I don't have any working code for that though. May 19, 2017 at 14:41
I wrote this javascript you can use in the console that will delete all posts and click the confirm box after clicking the x
from the https://plus.google.com/apps/activities/ page.
var t = 500;
document.querySelectorAll('.XVzU0b.J3yWx').forEach(function(el,k) {
setTimeout(function() {
el.click();
setTimeout(function() {
document.querySelectorAll('.CwaK9 > span')[1].click();
}, 200);
}, (t * k));
});
A slightly lower t
(but greater than 200) should work too just a little faster.
The only official method without resorting to running scripts or hacks it to manually delete every post.