Posts: 576 Offline
Age: 24
Joined: 06/23/2014
Points: 1214
Post Drafting:
This script appends post drafting options to the posting form for new topics and new posts (no polls yet, because I forgot they exit until literally just now), and can save, load, and organize drafts from the UCP notepad - topic drafts will show up when you're creating a new topic, and post drafts will show up when you're creating a new post. As of recently, it features an auto-saving functionality, and will save a draft after five uninterrupted seconds following any keypress inside the relevant input fields.
The only usage concern is that, in order to have full topic draft functionality (inserting title/description as well as the body), you'll need to disable the file attachment system.
As for the notepad itself, it should preserve any non-draft content, so you needn't worry about purging member notepads. Lemme know if you have any trouble!
JQuery drafting (GitHub) This post has been edited by Dusty: Feb 15 2018, 01:00 PM
Posts: 39878 Offline
Age: 29
Joined: 06/26/2006
Points: 37748
Cool stuff. Nice work.
Posts: 576 Offline
Age: 24
Joined: 06/23/2014
Points: 1214
Thanks! I've already squashed a number of bugs I didn't notice before, funny how that works. Hopefully it's a decent stand in for the time being!
This post has been edited by Dusty: May 15 2017, 05:58 PM
Posts: 35 Offline
Age: N/A
Joined: 08/03/2013
Points: 93
Shoot me a PM. (: Are you also okay with a peer review of the code itself?
Posts: 576 Offline
Age: 24
Joined: 06/23/2014
Points: 1214
I'd absolutely welcome it! I am a far cry away from an experienced programmer, and most of what I write is followed by "I have no idea why that works, but it does?" and that's only a slight exaggeration.
I'll send them off in a bit!
Posts: 35 Offline
Age: N/A
Joined: 08/03/2013
Points: 93
QUOTE (Dusty @ May 16 2017, 12:33 PM) |
I'd absolutely welcome it! I am a far cry away from an experienced programmer, and most of what I write is followed by "I have no idea why that works, but it does?" and that's only a slight exaggeration.
I'll send them off in a bit! |
LOL welcome to programming! That feeling never goes away.
Posts: 576 Offline
Age: 24
Joined: 06/23/2014
Points: 1214
OP updated, figured it should be stable enough c:
Posts: 96 Offline
Age: N/A
Joined: 10/28/2013
Points: 284
Will be trying this out and using it, Dusty! It's an awesome bit of code.

One suggestion I have, on the draft preview could it be possible to put a :before of "Topic Title:" and "Topic Description:" in front of those respective items?
EDIT: How do you disable file attachment settings so that this will load up the saved Title/Description too? >>
This post has been edited by Ekko: Jun 13 2017, 03:55 PM
Posts: 576 Offline
Age: 24
Joined: 06/23/2014
Points: 1214
You can just disable the 'Upload' category in the per-forum's permissions mask! Aaand you can, actually. The divs are .prevtitle and .prevdesc
Posts: 96 Offline
Age: N/A
Joined: 10/28/2013
Points: 284
Awesome, and beautifully customizeable. Thanks,
Dusty! Further question on customizing to fit a skin - how would you go about changing the font color and background of the draft name input box and the draft dropdown? It doesn't seem that Jcink's .textinput and other such CSS is affecting it?
Posts: 576 Offline
Age: 24
Joined: 06/23/2014
Points: 1214
Aw shucks
Ekko, not a problem!

If any of these selectors are wrong, I'm going to look like a
huge(
r) dweeb.
EDIT:
Aaaaaaahaaha shucks, I spotted a bug already that had an extra GET request going for every page load regardless of location. Script is updated, should be all dandy now.
This post has been edited by Dusty: Jun 13 2017, 11:59 PM
Posts: 96 Offline
Age: N/A
Joined: 10/28/2013
Points: 284
The selectors worked for me! I'll continue to mess around (and see how much I can break this thing.. >> ) with it for feedback!
One more thing, I noticed that the area where the .load-preview toggles... Changes from initial load - how it looks when I first open New Topic - and how it looks after I've toggled between a draft and closed it.

Aaand after toggling the drop-down from a saved draft back to the ----

What would need changing to fix it so that it looks like the second image from the start?
Posts: 576 Offline
Age: 24
Joined: 06/23/2014
Points: 1214
Ha, I love it when I review my own stylesheets and go "what in the why did I do that?" Add a 10px height to .load-preview and it should work. That entire preview box is a little hacky and poorly coded, but riiiight this moment I'm not feeling redoing it :X
Posts: 150 Offline
Age: 23
Joined: 05/02/2012
Points: 383
This is so extremely handy!! I think auto-saving would make this even more helpful, but the post drafting as is is already really amazing. Thank you for this!
Posts: 59 Offline
Age: N/A
Joined: 05/01/2013
Points: 171
DustyThis is amazingly awesome because I jump from post to post and then have to stop in the middle. It's working beautifully on my new skin. I just have one question.
How do you purge drafts that you are never going to finish? Like I saved a draft twice accidentally. How to I get rid of the second one?
I am very much in the camp of 'I have no idea what I'm doing' so sorry if the answer is obvious.