Author

Topic: [Userscript] Auto-Save your posts to drafts (Read 453 times)

hero member
Activity: 1036
Merit: 933
Find your Digital Services at- cryptolibrary.pro
January 10, 2024, 11:36:17 AM
#30
Great man thanks for the script.
It has happened to me many times that I have to rewrite a large post due to a wrong click or tap in my desktop browser and also in my mobile browser. Anyway I have installed your script on both my mobile and desktop and both are working.
Those who want to use it on mobile can install the script using kiwi, Firefox browser.
sr. member
Activity: 756
Merit: 356
I didn't miss that. It's just very easy to type for 8 minutes on a long post, and those are the ones I care about. I don't care about losing 5 seconds of typing.
Sometimes I have multiple posts open for editing, before posting them. That can take days. Usually I save a local backup, but I also rely on the "Preview" button to save a Draft. It would be bad if typing in one post wipes my other post from Drafts.

It gets frustrating when I write a long post and it gets wiped out because I took too long to post it. It means I have to start from the beginning. It's annoying as hell. I'll only rewrite the post if I got nothing to do at the moment but most times, I just procrastinate and end up not posting it till I get the time to.

I don't care if it's every 5 seconds, 2 minutes, or 8 minutes, I'd really appreciate a feature that'll make sure I don't lose the stuff I've typed anymore.
I usually use the "preview" button to save, but while typing, I don't always remember to do that.
hero member
Activity: 2520
Merit: 952
And sorry to asked does this only work with windows or it can also be used both mobile? don't know if this question already been asked here.

It has been answered twice already, if it were many pages than bolded part would be a valid excuse, here it's not so.

It's a very useful script that you have made TryNinja and it's one of the scripts that I would love to use myself. I'm currently not using any bots or scripts for the forum but this is something that I will most probably consider using. Thank you so much for making up this script for us. But, I don't really use tampermonkey thing and I'm a chrome user.

Can you please make a chrome based extension of the script that may work similarly for users who prefer to have extension rather than going with that tampermonkey? The script seems very good to me but I would love you to release a chrome-based extension of the script thanks.

Sounds unnecessary, why not just use tampermonkey?
sr. member
Activity: 784
Merit: 306
Hire Bitcointalk Camp. Manager @ r7promotions.com
Inspired by libert19's suggestion, I wrote a small script that auto saves your posts to the forum draft every couple of seconds (customizable).

Once upon a time I was writing a middle sized post and missclicked F5, losing the entire thing. This script helps mitigate this dangerous mistake! Tongue

Just too great of you, this happened to me a while ago when I was trying to reply to a post, and I'm glad I came across this post of yours. This is an excellent script, and I will also try it out. This is not the first time I've had problems with accidentally deleting a reply I'd spent time writing after clicking a button I wasn't supposed to have clicked on. Thank you for consistently providing us with tools to make the forum more user friendly and easier to navigate for everyone.
hero member
Activity: 784
Merit: 672
Top Crypto Casino

It's a very useful script that you have made TryNinja and it's one of the scripts that I would love to use myself. I'm currently not using any bots or scripts for the forum but this is something that I will most probably consider using. Thank you so much for making up this script for us. But, I don't really use tampermonkey thing and I'm a chrome user.

Can you please make a chrome based extension of the script that may work similarly for users who prefer to have extension rather than going with that tampermonkey? The script seems very good to me but I would love you to release a chrome-based extension of the script thanks.

legendary
Activity: 2758
Merit: 6830
Why not allow the user to choose the time interval?
It is allowed.

Edit the INTERVAL_SECONDS variable at the top with the number of seconds you want your draft to automatically save (default: 60 seconds).

I just changed the default because a higher interval will probably work better for most users. If you want to save it every 10 seconds, 1 min, or 5 min, you're free to do so. In my case I'm still using 5 seconds because I don't mind my entire draft being overwritten by my latest post. Grin
legendary
Activity: 1862
Merit: 5154
**In BTC since 2013**
I'll change the default to 60 seconds, which is probably enough for most people. I'll also add a warning on the code so everybody knows that they might override their entire draft if the interval is too low.

Why not allow the user to choose the time interval?
For example, as I use the translator a lot to write my posts in English, sometimes it can take me a little longer to post, if I'm writing something with more content.

Anyway, these are just tips on my use of the forum. As I am not a user of this script, I could be mistaken in my reasoning.
legendary
Activity: 2758
Merit: 6830
I didn't miss that. It's just very easy to type for 8 minutes on a long post, and those are the ones I care about. I don't care about losing 5 seconds of typing.
Sometimes I have multiple posts open for editing, before posting them. That can take days. Usually I save a local backup, but I also rely on the "Preview" button to save a Draft. It would be bad if typing in one post wipes my other post from Drafts.
That makes sense. I usually only write one post at a time and they aren't that big, so a few seconds work fine for me. I just won't miss a single written phrase if I ever close my tab by mistake. Grin

I'll change the default to 60 seconds, which is probably enough for most people. I'll also add a warning on the code so everybody knows that they might override their entire draft if the interval is too low.

That gives me some other ideas, i.e: Having your own local draft that only keeps like the 10 latest copies of the same post. You can do the control of which post is which by providing a custom name/id. That way you can work on 5 different posts and they won't override eachother's (older) drafts.
legendary
Activity: 1862
Merit: 5154
**In BTC since 2013**
you missed this part:
I didn't miss that. It's just very easy to type for 8 minutes on a long post, and those are the ones I care about. I don't care about losing 5 seconds of typing.
Sometimes I have multiple posts open for editing, before posting them. That can take days. Usually I save a local backup, but I also rely on the "Preview" button to save a Draft. It would be bad if typing in one post wipes my other post from Drafts.


I just happened to ask that.
The forum's draft option can be used as a way to save a new post to continue later. I've done this.

So, if the time interval is very low, in which the script performs automatic recording, there is a risk of deleting drafts that you want to preserve. So, if the time interval is very low, in which the script performs automatic recording, there is a risk of deleting drafts that you want to preserve (for brief hours).

I would suggest, if this is not the case, that the creation of automatic drafts should only be done when the user requests it.

Because, for example, I had no interest in this post in keeping a draft. But if you are doing an OP there is already interest.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
you missed this part:
I didn't miss that. It's just very easy to type for 8 minutes on a long post, and those are the ones I care about. I don't care about losing 5 seconds of typing.
Sometimes I have multiple posts open for editing, before posting them. That can take days. Usually I save a local backup, but I also rely on the "Preview" button to save a Draft. It would be bad if typing in one post wipes my other post from Drafts.
legendary
Activity: 2702
Merit: 4002
I think it takes about 1-2 minutes to write 100 words on average, so adjusting the default INTERVAL_SECONDS to 60 or 30 would be more appropriate.
I suggest contacting @theymos to increase Drafts to 200 and thus


Shouldn't that be like 5 minutes by default? Otherwise it takes only 8 minutes to completely overwrite the 100 drafts stored by Bitcointalk, which is especially annoying if you use multiple tabs to edit longer posts.
you missed this part:

If there are no changes on your post since the last draft (this includes pressing the "preview" button), the process is skipped.

hero member
Activity: 1428
Merit: 653
Leading Crypto Sports Betting & Casino Platform
Thank you TryNinja for the great job
I hardly lost any post while posting although i do take my time to comment as well, i usually used the preview button to have the finished look of what i am posting. I may not install the script currently but if there may be any need then might come back to this thread to continue the whole process. And sorry to asked does this only work with windows or it can also be used both mobile? I don't know if this question already been asked here.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
(default: 5 seconds)
Shouldn't that be like 5 minutes by default? Otherwise it takes only 8 minutes to completely overwrite the 100 drafts stored by Bitcointalk, which is especially annoying if you use multiple tabs to edit longer posts.
legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
What exactly do you mean by using too much space? Text has very small size. I expect average post use 1KB or less of data.
Your localStorage has a limitation of 5 MB. Every time you have a draft you're saving a post, meaning 1 post every 5 seconds (by default). If it's a big post and/or you're taking too long, that won't last a lot. While it's probably better than the forum's limit, it's not a foolproof solution.

I see, that makes sense when we're talking about creating big post/thread. And while we're at it, if your script use localStorage, how hard is it to delete old draft periodically to prevent reaching 5MB limit?
legendary
Activity: 2254
Merit: 2406
Playgram - The Telegram Casino


There isn't much I can do since the script is stateless, meaning that every time you refresh, reload or navigate to another page the script runs from the beginning again. Maybe I could save the last draft to your browser's localStorage so it persists and checks if it's the same post you were writing before, but I feel like this is bit too much.
Thank you for the prompt attention.

I guess I'll just try not to bounce back and forth much. There is no practical situation that needs that so you shouldn't bother much to fix what isn't really a problem.
I just pointed it out incase it was a bug.
legendary
Activity: 2212
Merit: 7064
Inspired by libert19's suggestion, I wrote a small script that auto saves your posts to the forum draft every couple of seconds (customizable).
Simple script but it can be very useful.
Maybe you could also add optional feature to do automatic export text to external file at specific time intervals.
This can help in cases when electricity goes down, or when browser is shut down for whatever reason.
legendary
Activity: 2758
Merit: 6830
What exactly do you mean by using too much space? Text has very small size. I expect average post use 1KB or less of data.
Your localStorage has a limitation of 5 MB. Every time you have a draft you're saving a post, meaning 1 post every 5 seconds (by default). If it's a big post and/or you're taking too long, that won't last a lot. While it's probably better than the forum's limit, it's not a foolproof solution.

Could you guide me on how to provide a rating? I want express my appreciation through ratings, but unfortunately, the option doesn't seem to be editable on the https://greasyfork.org/en/scripts/484095-auto-save-draft-for-bitcointalk-org website.
No idea, but I think you need a Greasyfork account then go to Feedback and write a review? There is no need, though.



^ I simulated how much space this post would have taken and I'm already using 60 KB of space.
hero member
Activity: 1190
Merit: 901
Livecasino.io
Great job TryNinja. I always knew we need something like this but never knew how it would have been done. I am happy you thought of it too and wrote this beautiful code which I do not understand but works perfecto.

Could you guide me on how to provide a rating? I want express my appreciation through ratings, but unfortunately, the option doesn't seem to be editable on the https://greasyfork.org/en/scripts/484095-auto-save-draft-for-bitcointalk-org website.
hero member
Activity: 2520
Merit: 952
Does it work on the phone right now? I've done the installation on my computer but I'm not really using my computer that much since I'm mostly at work so hopefully this is available on the phone. The phone browsers are the most notorious when it comes to that mistake that you've said and it's a frustrating feeling when you get your sentences already done halfway and your replies finished but then someone messages you or there's a notification that you need to answer then you come back only to see the webpage refreshed. I wish I could do programming like you, the stuff that I can do if only I know how to program and write code.

Yes, it does work on mobile phones with extension supported browsers, I'm not sure about IOS since I don't have IOS device, but on android there are several extension supported browsers (Kiwi/Mask/Lemur/Mises), you can search respective names on play store.

Then install Tampermonkey extension from extension store, then either paste the script manually, or just click 'install the script' in op's case.

..and you are right about reload thing, it is annoying especially on mobiles, even if mobile is capable, browsers somehow like to refresh page needlessly, this scripts saved me just minutes ago  Tongue
legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
Thanks for creating this script. I just tried it with Violentmonkey extension and it works without any problem.

--snip--
I could create my own draft implementation where posts would be saved on my server, but I can't see enough demand for that and there may be some downsides like having to trust my server (even though the data isn't too sensitive) and privacy issues (sending requests to my server).

Or I could make it save every post on your local browser. Cons: browser limitations, using too much space, etc...
--snip--

What exactly do you mean by using too much space? Text has very small size. I expect average post use 1KB or less of data.
sr. member
Activity: 1666
Merit: 426
Does it work on the phone right now? I've done the installation on my computer but I'm not really using my computer that much since I'm mostly at work so hopefully this is available on the phone. The phone browsers are the most notorious when it comes to that mistake that you've said and it's a frustrating feeling when you get your sentences already done halfway and your replies finished but then someone messages you or there's a notification that you need to answer then you come back only to see the webpage refreshed. I wish I could do programming like you, the stuff that I can do if only I know how to program and write code.
legendary
Activity: 2758
Merit: 6830
January 07, 2024, 08:04:37 PM
#9
I noted some pros and cons of forum draft page.
Draft page - Pros & Cons

Some of cons are
Quote
  • Limited to only last 100 posts and drafts will be automatically deleted after 7 days
  • Unable to recover your deleted posts to where it initially posted
  • Almost unable to see where you post it (post ordinal number). Exception: You can only get which thread you post it, when you quote posts of others when reply them
  • Unable to know when you post it

Could your userscript add something to reduce those cons?
I could create my own draft implementation where posts would be saved on my server, but I can't see enough demand for that and there may be some downsides like having to trust my server (even though the data isn't too sensitive) and privacy issues (sending requests to my server).

Or I could make it save every post on your local browser. Cons: browser limitations, using too much space, etc...

At this time I don't see the point. If i'm writing a post I only care about its latest version (i.e before I missclicked F5 and refreshed the page) and if you're looking for a deleted post, using the ninjastic.space archive is usually enough.
hero member
Activity: 2366
Merit: 838
January 07, 2024, 07:53:12 PM
#8
It's a helpful userscript, thanks for coding it.

I noted some pros and cons of forum draft page.
Draft page - Pros & Cons

Some of cons are
Quote
  • Limited to only last 100 posts and drafts will be automatically deleted after 7 days
  • Unable to recover your deleted posts to where it initially posted
  • Almost unable to see where you post it (post ordinal number). Exception: You can only get which thread you post it, when you quote posts of others when reply them
  • Unable to know when you post it

Could your userscript add something to reduce those cons?

From the screenshot, it seems to save the time (when), but how about other points above?
legendary
Activity: 2758
Merit: 6830
January 07, 2024, 04:59:35 PM
#7
Could be just me, but the message icon beneath the text box is a bit of an eye full. Might be easier on the eyes if only the time of the last update is shown and not the date.
Right. Changed the code so it only shows the time (i.e "17:56:17 UTC"). Smiley

Also, when I go to drafts and return to the post the "Auto-Save draft is activated!" message pops up again and again, as I bounce back and forth.
There isn't much I can do since the script is stateless, meaning that every time you refresh, reload or navigate to another page the script runs from the beginning again. Maybe I could save the last draft to your browser's localStorage so it persists and checks if it's the same post you were writing before, but I feel like this is a bit too much.
legendary
Activity: 1862
Merit: 5154
**In BTC since 2013**
January 07, 2024, 03:57:05 PM
#6
Another good script. Congratulations.

Although I've never felt the need for this type of script, I appreciate its value.
I hope it is useful, for anyone who feels the need for this script.

legendary
Activity: 2254
Merit: 2406
Playgram - The Telegram Casino
January 07, 2024, 08:06:32 AM
#5
Great work TryNinja. I don't write long texts regularly, but it helps to have a back up for the situation where you risk losing a message you took a lot of effort to write.

Could be just me, but the message icon beneath the text box is a bit of an eye full. Might be easier on the eyes if only the time of the last update is shown and not the date.
Also, when I go to drafts and return to the post the "Auto-Save draft is activated!" message pops up again and again, as I bounce back and forth.
sr. member
Activity: 448
Merit: 560
Crypto Casino and Sportsbook
January 07, 2024, 04:02:47 AM
#4
Once upon a time I was writing a middle sized post and missclicked F5, losing the entire thing. This script helps mitigate this dangerous mistake! Tongue
I must admit it you have done a great job TryNinja.
Losing a post after making a very long write up is a big nightmare and can be very frustrating sometimes. One time I mistakenly reloaded a page and boom my long compiled post was lost  Cry. Since then I had to switch to using my html text editor to put together my posts before previewing and posting it here on bitcointalk. But with this script I can now do everything here Grin.
This will definitely come in handy especially for higher rank members who create very long and detailed posts.
+1 for the effort  Wink
hero member
Activity: 2520
Merit: 952
January 06, 2024, 10:45:59 PM
#3
A small question here: Will this script will be helpful too for mobile browser such as Kiwi and Mises or it is just for PC. I haven't checked script and will review after using.

It works, I just tried it.



@TryNinja Great work! This words don't justify how handy your scripts are.



hero member
Activity: 812
Merit: 619
January 06, 2024, 10:43:02 PM
#2
Inspired by libert19's suggestion, I wrote a small script that auto saves your posts to the forum draft every couple of seconds (customizable).

Once in time I was writing a middle sized post and missclicked F5, losing the entire thing. This script helps mitigate this dangerous mistake! Tongue  

That's is much needed script , Big thanks for script you created. Your effort in developing a tool whuch automatically saves forum posts to the draft is incredibly helpful because losing whole content just by small mistake is common here. It's a time-saver and enhances the user experience. Honestly I was writing large post in notepad and when I wrote fully then I copy pasted here and I hope now This script will save my time.


: https://greasyfork.org/en/scripts/484095-auto-save-draft-for-bitcointalk-org

Edit the INTERVAL_SECONDS variable at the top with the number of seconds you want your draft to automatically save (default: 5 seconds). If there are no changes on your post since the last draft (this includes pressing the "preview" button), the process is skipped.


A small question here: Will this script will be helpful too for mobile browser such as Kiwi and Mises or it is just for PC. I haven't checked script and will review after using.
legendary
Activity: 2758
Merit: 6830
January 06, 2024, 10:34:05 PM
#1
Inspired by libert19's suggestion, I wrote a small script that auto saves your posts to the forum draft every couple of seconds (customizable).

Once upon a time I was writing a middle sized post and missclicked F5, losing the entire thing. This script helps mitigate this dangerous mistake! Tongue

Installation: https://greasyfork.org/en/scripts/484095-auto-save-draft-for-bitcointalk-org

Edit the INTERVAL_SECONDS variable at the top with the number of seconds you want your draft to automatically save (default: 60 seconds). If there are no changes on your post since the last draft (this includes pressing the "preview" button), the process is skipped.

Quote

P.S: "Drafts are saved whenever you preview or post a topic, post, or PM. Up to 100 drafts are kept. Drafts are deleted after 7 days."
Jump to: