Pages:
Author

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

hero member
Activity: 1036
Merit: 932
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: 686
Merit: 332
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: 686
Merit: 301
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: 1722
Merit: 4711
**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: 1722
Merit: 4711
**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: 2646
Merit: 3911
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: 2114
Merit: 2248
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: 1120
Merit: 887
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.
Pages:
Jump to: