23

I've made a userscript that allows you to self-destruct comments that you've made.

You can get it at Github.

Get started

How to use

Once installed, next to every comment you write, self destruct will appear next to. Clicking this will prompt you to enter the number of days in which to delete the comment. This will be saved with the ID of the comment and time you want it deleted.

A check runs every hour (every o'clock) which checks all comments' desired deletion times and compares it with the current time - if it has passed, it will delete the comment.

Notes

  • This is completely client-side - it will only work as long as your computer is on and the browser is open on a page - ie. in normal cases it will work, but if you don't use your browser for a few days, it won't work until you use the browser again.
  • This will only work on devices where you have set it up (obviously) that you use on a day-to-day basis.

Bugs/feature-request

Please post any bugs/feature requests here.

17
  • Tried to install, I keep getting a msg box telling me to register for an access token May 11, 2015 at 13:03
  • @WilhelmErasmus It will stop appearing once you get and enter an access token, however I can see how this could be annoying, so I'll think of a less annoying way to inform you about this, and update the script as soon as I get more time :) May 11, 2015 at 16:24
  • How do I get and enter the access token though? May 13, 2015 at 12:44
  • @WilhelmErasmus You go to the link mentioned on the post (this one). After approveing, you will be taken to the SE homepage, but the URL will look something like: http://stackexchange.com/#access_token=7sb79dsfb702332(vXrTAw))&expires=86399. Copy the text in between the first = (from access_token) up to the next & (before expires), including any brackets. Then paste it in the dialog that can be opened from your profile page at the top: click self-destruct access-token May 13, 2015 at 16:08
  • @WilhelmErasmus Everything is also explained here (first link in the post) May 13, 2015 at 16:09
  • @WilhelmErasmus I've just updated the script to also add the link I'm talking about to sites without the new profile - if you install the new version from Github, you'll see the link in your StackApps profile as well (which it seems you couldn't before this update I just pushed) May 13, 2015 at 18:37
  • what is the link that i should click for the code entry? I can't find it. I updated the script using the link in the forum post. May 13, 2015 at 19:42
  • @WilhelmErasmus Go to your profile and look for this link: i.stack.imgur.com/qyiz1.png. Click it, and paste the code May 13, 2015 at 19:44
  • Thanks, I've found it. However, the self-destruct button isn't here? :/ May 13, 2015 at 19:46
  • @WilhelmErasmus refresh. Does it appear?? May 13, 2015 at 19:47
  • 1
    oh :) it only appears after you post. I should probably read the post a bit more thoroughly next time. May 13, 2015 at 19:49
  • lol. You probably should :P May 13, 2015 at 19:50
  • OK, I am a complete dummy ? where do I get the Token ? "You'll need an access token. Get it here. Please enter the token by going to your profile page, and clicking self-destruct access-token at the top." does not result in anything.
    – Ruskes
    May 14, 2015 at 21:12
  • @Buscar웃 I need to do something about this..! Nobody knows how to!! Not your fault - it's a bit complicated; I'll see if I can make it easier. But for now, clicking get it here on that mini-site should take you to an authorization page, clicking approve should take you to SE's homepage - the URL will be a bit different. Then you can just do what I said to do in this comment :) May 15, 2015 at 6:12
  • 1
    This seems like a very creative and useful idea. In terms of transparency and ethics, a cool feature could be providing an option of auto-adding a text in the end of the comment saying something like * this comment will be self-destructed on [date/time] As a plus, it adds some marketing to your plugin!
    – user307493
    Oct 25, 2018 at 22:40

6 Answers 6

8

Ok, not a answer but some visuals how to get it going for dummies like me.

  1. Install Greasemonkey (for Firefox) or Tampermonkey (for Chrome) - I'm using Greasemonkey for this post, but it's the same for Tampermonkey -- you will get a new icon on the top right of your menu bar AFTER restarting Firefox.

  2. Install the Script:

enter image description here monkey

  1. While you are still logged in to Stack Exchange, go to this website: https://stackexchange.com/oauth/dialog?client_id=4376&scope=write_access&redirect_uri=http://stackexchange.com

  2. Now at the top left where the web site address bar is GET your token: Copy the alphanumeric stuff in between the first = (from access_token) up to the next "&"(before expires), including any brackets.

Token

There you go, you got your Token!

  1. Paste the code in the prompt that you can access from you profile page. So, from here:

0
4

Excellent :)

Bugs:

  1. Clicking show more comments hides the buttons next to your comments.

  2. 0 days? (I'm not sure what you want the behaviour of 0 days to be). It didn't remove the comment. : Make sure you wait until the next o'clock after submitting 0, and make sure your access_token is up-to-date.

Feature Requests:

  1. Hours, rather than days? : Just express the amount of hours as a decimal of the day (eg. 0.5 days == 12 hours).

  2. Blue text not black makes it look linkish? And a link-mouse-pointer-on-hover?

12
  • Bug 1: will fix as soon as I get back. Bug 2: will look into as soon as I get back. FR 1: don't think you should do hours because it might get deleted before the intended user sees the comment - besides, you can express the amount of hours as days - 0.5 days equals 12 hours... FR 2: will add as soon as I get back May 10, 2015 at 16:33
  • @ᔕᖺᘎᕊ as you can do decimals for hours, that's fine :) Is it just 0.5?
    – Tim
    May 10, 2015 at 16:37
  • 1
    No idea. Haven't tried :) I will when I get back though :) May 10, 2015 at 16:45
  • @ᔕᖺᘎᕊ what is the behaviour of 0 atm?
    – Tim
    May 10, 2015 at 20:30
  • I'd expect it would mean instant so it would delete at the next o clock, but I didn't get time to check that. I'll check asap :) May 11, 2015 at 6:15
  • I've checked now :) The behavior of 0 is to delete it instantly, but the reason it didn't delete for you is because the deletion process happens every o'clock - so you probably didn't have the browser open at an o'clock. May 13, 2015 at 18:32
  • 1
    @ᔕᖺᘎᕊ ahh okay. I'll test with this one. Oh, new bug. I have to refresh the page to view the button since you made it work for the "view more comments".
    – Tim
    May 13, 2015 at 18:32
  • 1
    might want to update - I just added a new version to add the link for the access token to sites without the new profile May 13, 2015 at 18:34
  • did anything show up in console? Are you sure your access key is correct? If you went on that link again afterwards, it would have made a new access key! May 13, 2015 at 19:08
  • Hope it works! BTW - to make life easier (and quicker), you can change line 77's if(mins == "00"){ value to the next minute in real life (so right now, that would be 40) May 13, 2015 at 19:38
  • @ᔕᖺᘎᕊ Working :) I get a Object {} a lot - maybe only check once per minute. also dom.spec.whatwg.org/#dom-range-detach? And finally, can I make it every 10 mins with the line 70?
    – Tim
    May 13, 2015 at 19:41
  • the console just, every second, on the o'clock, lists the questions in memory. What is that link supposed to mean?? If you want the check to happen every 10 mins, you could add 5 || (or's) to say mins == "00" || mins == "20"|| mins == "30"...` (you get what I mean!) May 13, 2015 at 19:47
4

Feature request: Moderator accounts can self-destruct any comment

As a mod (on a smaller Stack) it's sometimes useful to let comments be right now, but you know they should be cleaned up soon. But you also know you're not going to be back here tomorrow, so you have to instead decide between no cleanup or instant cleanup. Being able to schedule others’ comments for mod-deletion using this script would be very useful in these uncommon but not rare cases.

Could the self-destruct widget be added to all comments on a site when the script-using account has moderator privileges?

3
  • This sounds like a nice idea, but it will be hard for me to test as I'm not a mod anywhere :( however it might be as simple as just adding the button to all comments if you're a mod and it might just work. I'll try it out and ask you to test it in a few days :) Mar 31, 2017 at 19:22
  • 2
    @ᔕᖺᘎᕊ I think that would do the trick since the permissions are already there, and I'd try to hack it in myself if I had more JS experience. I'd be happy to test anything you come up with! Mar 31, 2017 at 19:34
  • btw, I haven't forgotten about this! It's on my mental to-do list! I just haven't gotten round to it yet :( sorry! Apr 9, 2017 at 19:58
2

Can not make it working on Firefox.

However, the stackexchange (my profile) shows the app installed under the "apps tab"

app installed

However, there is still no " profile page at the top: click self-destruct access-token".

token

When checking the app link:

The SENotifier leads to http://hewgill.com/senotifier and it works.

The Comment Self destruct leads to: https://stackapps.com/ ?? this might be the problem!

UPDATE:

After you fixed it for the Firefox it now works and shows up...Great job.

it works

9
  • It's weird that you can't see the 'self-destruct access-token' link - are you sure you're looking in the right place? On your profile, at the top... And I've edited the URL so clicking Comment self-destruct shouldn't lead to stackapps.com anymore May 17, 2015 at 16:27
  • OK, looks like you're looking in the right place. Does anything show up in the console? May 17, 2015 at 16:33
  • Yes you fixed the link :) but still nothing, let me check the Console log. the link now leads to : shu8.github.io/SE-Comment-Self-Destruct
    – Ruskes
    May 17, 2015 at 16:38
  • OK :) I can't think of a reason for the button not showing up... It works for me... May 17, 2015 at 16:39
  • Can you please instead check your browser's console. Which browser btw? Can you take a screenshot of the message if possible? May 17, 2015 at 16:43
  • It is Firefox browser ver. 3702, as for browser console, in which window do I look at it, (sorry not a web coding expert)
    – Ruskes
    May 17, 2015 at 16:51
  • Let us continue this discussion in chat. May 17, 2015 at 16:52
  • command+option+k May 17, 2015 at 16:53
  • 1
    and after you fixed it for Firefox it now shows up :) congrats...
    – Ruskes
    May 17, 2015 at 17:35
1

Bug: Doesn't work for moderator accounts

Symptom: The self-destruct button doesn't appear.

Investigation:

The problem seems to be that $that.find('.comment-user').text() == … won't match the name (scraped from elsewhere on the page) because the left side of the equals test also contains the diamond and its enclosing span. Compare these two .comment-user objects' structures, one for a normal user and one for a moderator:

Normal user:

<a href="/users/4163/sevensideddie"
                   title="27,705 reputation"
                   class="comment-user">SevenSidedDie</a>

Moderator:

<a href="/users/321/sevensideddie"
                   title="145,704 reputation"
                   class="comment-user">SevenSidedDie<span class="mod-flair" title="moderator">&#9830;</span></a>

Ironically, my many moderation-related comments are exactly the ones that would most benefit from self-destructing! :)

Fix

A find-and-replace for .text() == replaced with .text().replace('♦','') == enables the self-destruct button for moderator messages.

4
  • Thanks for the bug report but I'm currently really busy with school work, so I don't think I'll have much time to look into this. I'll try my best to look at this asap, but if I haven't got back to you within a few weeks, please do ping me to remind me!! Thanks again :) Sep 21, 2016 at 20:25
  • @ᔕᖺᘎᕊ I totally understand! Thanks for the great userscript, in the meantime. Sep 21, 2016 at 20:26
  • 1
    @ᔕᖺᘎᕊ I figured out the fix (wasn't much, but my JS is meh), so I'm enjoying it on my moderator account now. I've provided it above so you can poke it to verify when you have time to mock up some moderator-account-HTML inputs. Thanks! And good luck with your studies! Sep 21, 2016 at 21:10
  • So I finally got some time to look at this and the reason you said it happened was completely right, so I've changed it a bit and you get the new version at: github.com/shu8/SE-Comment-Self-Destruct/blob/master/…! :) Thanks for the bug report and idea for the solution!! Hope it works for you now Oct 1, 2016 at 11:34
0

I think a feature should be added to make comments which have been replied to (@Username) not self-destruct, or at least ask the user if he still wants the comment to self-destruct. Otherwise, people reading the comments on that question/answer wouldn't know what that comment was replying to.

2
  • 2
    Nothing self destructs without you clicking the button self-destruct and saying how many days you want it to self destruct in. I don't understand what you mean...? Aug 21, 2015 at 9:22
  • @ᔕᖺᘎᕊ I mean cancelling the self-destruct if the comment is replied to. Or at least asking the user if they still want the comment to self-destruct.
    – user34662
    Dec 13, 2018 at 8:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .