Skip to main content
Topic: Drafts script makes quick reply/footer jumpy. (Read 3563 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Drafts script makes quick reply/footer jumpy.

Start typing post in quick reply.
Drafts script will run.
Bottom of page will jump up and down quickly several times.
Bleh. :P

(FF, W7, SCEditor in source mode)
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Drafts script makes quick reply/footer jumpy.

Reply #1

test
Bugs creator.
Features destroyer.
Template killer.

Re: Drafts script makes quick reply/footer jumpy.

Reply #2

test
Bugs creator.
Features destroyer.
Template killer.

Re: Drafts script makes quick reply/footer jumpy.

Reply #3

test
Bugs creator.
Features destroyer.
Template killer.

Re: Drafts script makes quick reply/footer jumpy.

Reply #4

The only time I can reproduce it is when I directly click "post", in that case "Draft last saved: " part is not added and the bottom jumps down and up. Otherwise, the string is added and then there is not jumping...
At least for me on Linux.
Bugs creator.
Features destroyer.
Template killer.

Re: Drafts script makes quick reply/footer jumpy.

Reply #5

Testing again again stuffz.

Yup. Just did it again. :P
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Drafts script makes quick reply/footer jumpy.

Reply #6

 emanuele leaves that to someone with a windowz machine.
Bugs creator.
Features destroyer.
Template killer.

Re: Drafts script makes quick reply/footer jumpy.

Reply #7

Hey I was just looking at the template code for the first time in ages. This is funny.

Code: [Select]
		if ($context['drafts_save'] && !empty($options['display_quick_reply']))
{
echo '
<input type="submit" name="save_draft" value="', $txt['draft_save'], '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" tabindex="', $context['tabindex']++, '" class="button_submit" />
<input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '" />';

if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled']))
echo '
<div class="clear"><span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon" />&nbsp;</span><span id="draft_lastautosave"></span></div>';
}

Given that's all wrapped in the quick reply template, there's no way it will happen if quick reply is disabled anyway. The conditional is a bit overkill. :D

Code: [Select]
		if ($context['drafts_save'])
{
echo '

That should be enough.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Drafts script makes quick reply/footer jumpy.

Reply #8

Anyway, regarding the jumpy biz. If the div containing the throbber is given a fixed height, that would probably stop stuff jumping.

This would probably do it:

Code: [Select]
#postmodify>.submitbutton>.clear {height: whatever;}

Although given that it's not a terribly efficient selector anyway, it may make more sense to just give that div a class or id of its own for simplicity.
Last Edit: March 31, 2014, 04:43:00 pm by Antechinus
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Drafts script makes quick reply/footer jumpy.

Reply #9

Hmm. This is all a bit messy. The GenericControls.template.php has a specific class for the little drafts message, but the quick reply doesn't. Really it would make sense for them to share the same declarations (as much as possible).

GenericStuffz.template.php has this:

Code: [Select]
.draftautosave {
display: block;
text-align: right;
}
.draftautosave #draft_lastautosave {
display: inline-block;
min-height: 1em;
}

That's pretty messy CSS. Given that spans are inline display by default, I can't see offhand why they would need inline-block declared. The only reason for that is to set a fixed height on the span, but you can just set the height on the surrounding div instead.

Markup seems to be generated here in GenericBatPoo.template.php:

Code: [Select]
	// Create an area to show the draft last saved on
if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled']))
echo '
<span class="draftautosave smalltext">
<span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon" />&nbsp;</span>
<span id="draft_lastautosave" ></span>
</span>';

Ok, so rationalising the whole effing lot.....................

1/ Given that the throbber and message share the same classes and id's in both templates, they should share the same CSS.
2/ Height should be declared on the surrounding div, so the spans can get by without their own CSS.
3/ That means the surrounding div should be a div in both templates, instead of being a div in the quick reply and a span in GenericBatPoo. Consistency FTW.
4/ I'd be inclined to declare font-size there too, and ditch the smalltext class from the markup.

GenericPigsBreakfast.template.php:

Code: [Select]
	// Create an area to show the draft last saved on
if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled']))
echo '
<div class="draftautosave">
<span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon" />&nbsp;</span>
<span id="draft_lastautosave" ></span>
</div>';

Display.template.php:

Code: [Select]
		if ($context['drafts_save'])
{
echo '
<input type="submit" name="save_draft" value="', $txt['draft_save'], '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" tabindex="', $context['tabindex']++, '" class="button_submit" />
<input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '" />';

if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled']))
echo '
<div class="draftautosave"><span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon" />&nbsp;</span><span id="draft_lastautosave"></span></div>';
}

index.css:

Code: [Select]
.draftautosave {
font-size: 0.857em;
text-align: right;
height: 1em; /* may need adjusting */
}




Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Drafts script makes quick reply/footer jumpy.

Reply #10

Added to GitHub (may it burn in a H.e.l.l of its own making forever): https://github.com/elkarte/Elkarte/issues/1516

Ok, I go play with concrete and bricks now. :P
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Drafts script makes quick reply/footer jumpy.

Reply #11

The two should share the same template... IMHO.
Considering there is the idea of dropping the plain textarea in quick reply (yes, I know you Ant would say probably no, but considering the tons of duplicated code needed for it I'm in favour of dropping it), in 1.1 there should just be a common template with the whole "posting area" (i.e. editor and buttons).
Bugs creator.
Features destroyer.
Template killer.

Re: Drafts script makes quick reply/footer jumpy.

Reply #12

Made the PR to clean that up a bit, the location of the text was above the buttons in one area and below them in the other, so I chose to place it below in both areas and then wrapped them in a div with it containing the css

Re: Drafts script makes quick reply/footer jumpy.

Reply #13

Quote from: emanuele – The two should share the same template... I'm right, your wrong..
Considering there is the idea of dropping the plain textarea in quick reply (yes, I know you Wombat would say probably no, but considering the tons of duplicated code needed for it I'm in favour of dropping it), in 1.1 there should just be a common template with the whole "posting area" (i.e. editor and buttons).
You got it plumbers crack backwards. :P I'm in favour of dropping the option for plain textarea. Also, having a common template sounds good (should do QR, Post.template and PM's).

The setting I want to keep is the one in SCEditor itself, to enable source/BBC mode instead of wyswiyg. As long as you're not planning on getting rid of that, I'm happy.

 Antechinus haz been to store to get concrete and is now having toast :P
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Drafts script makes quick reply/footer jumpy.

Reply #14

lol

Good to know. :P

ETA: so that one should be fixed, right Spuds?
Bugs creator.
Features destroyer.
Template killer.