Skip to content

Instantly share code, notes, and snippets.

@syareez
Created January 6, 2018 11:54
Show Gist options
  • Save syareez/a3ccfd9ce25f60442c8814d6db4f1280 to your computer and use it in GitHub Desktop.
Save syareez/a3ccfd9ce25f60442c8814d6db4f1280 to your computer and use it in GitHub Desktop.
Open up browser console, for Chrome, hit F12 and copy-paste and enter this
$("a").filter(function(index){return $(this).text()==="unsave"}).click();setTimeout(function(){location.reload();},500);
Repeat until all items are unsaved.
@theg00s3
Copy link

theg00s3 commented Sep 21, 2019

If used old.reddit.com use:
$("a").filter(function(index){return $(this).text()==="delete from saved"}).click();setTimeout(function(){location.reload();},500);

@lihuelworks
Copy link

lihuelworks commented Feb 25, 2020

You should change that to "unsave", since that is the word it's used now for deleting saved posts. I pasted the command with the change:
$("a").filter(function(index){return $(this).text()==="unsave"}).click();setTimeout(function(){location.reload();},500);

@WozniakMac
Copy link

Updated:
Run:

var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load

And

$("button").filter(function(index){return $(this).text()==="unsave"}).click();setTimeout(function(){location.reload();},500);

It could be improved to one script but I'm fine with it like this

@rlewkowicz
Copy link

Grease monkey script to do the same on old interface

// ==UserScript==
// @name     Unnamed Script 400702
// @version  1
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @include *reddit*user*
// @grant unsafeWindow
// ==/UserScript==


window.addEventListener('load', function() {
  setInterval ( function () {
    var clickEvent  = document.createEvent ("HTMLEvents");
    clickEvent.initEvent ("click", true, true);

    $("a:contains('unsave')")[0].dispatchEvent (clickEvent);
  }, 40);
  setTimeout(function(){location.reload();},5000);
}, false);

@diddycarter
Copy link

Grease monkey script to do the same on old interface

// ==UserScript==
// @name     Unnamed Script 400702
// @version  1
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @include *reddit*user*
// @grant unsafeWindow
// ==/UserScript==


window.addEventListener('load', function() {
  setInterval ( function () {
    var clickEvent  = document.createEvent ("HTMLEvents");
    clickEvent.initEvent ("click", true, true);

    $("a:contains('unsave')")[0].dispatchEvent (clickEvent);
  }, 40);
  setTimeout(function(){location.reload();},5000);
}, false);

thanks

@LuisMcLovin
Copy link

Is there a way to automate the script without repeat copy/paste?

@Oikio
Copy link

Oikio commented Apr 19, 2022

Array.from(document.querySelectorAll("button")).forEach(
  (el) => {
    if (el.innerText === "unsave") el.click()
  })

Without jquery and reload, just to delete whatever you see on the "saved" page.

@dielfrag13
Copy link

Array.from(document.querySelectorAll("button")).forEach(
  (el) => {
    if (el.innerText === "unsave") el.click()
  })

Without jquery and reload, just to delete whatever you see on the "saved" page.

This still works as of 4/2023; only edit is the button text should be capitalized.

if (el.innerText === "Unsave") el.click()

I just had to refresh the page and rerun the function a couple times since Reddit does dynamic loading as you scroll

@alwei1
Copy link

alwei1 commented Jun 17, 2023

You should change that to "unsave", since that is the word it's used now for deleting saved posts. I pasted the command with the change: $("a").filter(function(index){return $(this).text()==="unsave"}).click();setTimeout(function(){location.reload();},500);

This still works as of 5/2023 on old reddit!

@gitatmax
Copy link

@alwei1 Indeed it does—thanks for confirming!

@brijazz
Copy link

brijazz commented Jun 17, 2024

Would there be any way to omit saves from a particular sub? I'd love to be able to clear out all of my saves except /r/dogpictures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment