Skip to content
Permalink
Browse files

! Updated thought (comment) editor to use asynchronous loading of com…

…ments with BBCode in them. Previously, it would wait for them to be retrieved, which now triggers a warning in the browser console. (script.js)

! Fixed potential error when prefetching the next page of messages in a topic. I haven't seen it happen at wedge.org, but it happened at lestrades.com, so I'm guessing this is more of a fix for heavily modded forums that play around with a lot of events. (script.js)
  • Loading branch information...
Nao committed Jun 26, 2019
1 parent a51158f commit a0fe1decd5b6c180e53b1e2eb93ebcf38e9d3665
Showing with 20 additions and 15 deletions.
  1. +20 −15 core/javascript/script.js
@@ -542,7 +542,8 @@ $(function ()
{
var that = $(this);
$.each(that.attr('data-eve').split(' '), function () {
that.on(eves[this][0], eves[this][1]);
if (eves[this]) // Prefetching of the next forum page may cause this to be executed by mistake, see topic.js for the working version.
that.on(eves[this][0], eves[this][1]);
});
});

@@ -1150,21 +1151,25 @@ function JumpTo(control)

var
thought = $('#thought' + tid), edited_thought = thought.find('span').first().html(),
edit_handler = function (cur_text)
{
oid = is_new ? 0 : thought.data('oid') || 0;

// Hide current thought, and add tools to write new thought.
thought.toggle(is_new && is_new !== 1).after('<form id="thought_form"><input type="text" maxlength="255" id="ntho"><select id="npriv">'
+ PrivacySelector((thought.data('prv') + '').split(','), privacy_public, privacy_members, privacy_author)
+ '</select><input type="submit" class="save"><input type="button" class="cancel"></form>');
$('#npriv')
.next().val(we_submit).click(function () { return oThought.submit(tid, mid || tid); }) // Save button
.next().val(we_cancel).click(cancel); // Cancel button
$('#ntho').focus().val(cur_text);
$('#npriv').sb();
};

cur_text = is_new ? '' : (edited_thought.indexOf('<') == -1 ?
edited_thought.php_unhtmlspecialchars() : $.ajax(weUrl('action=ajax;sa=thought') + ';in=' + tid, { async: false }).responseText), p, lists;

oid = is_new ? 0 : thought.data('oid') || 0;

// Hide current thought, and add tools to write new thought.
thought.toggle(is_new && is_new !== 1).after('<form id="thought_form"><input type="text" maxlength="255" id="ntho"><select id="npriv">'
+ PrivacySelector((thought.data('prv') + '').split(','), privacy_public, privacy_members, privacy_author)
+ '</select><input type="submit" class="save"><input type="button" class="cancel"></form>');
$('#npriv')
.next().val(we_submit).click(function () { return oThought.submit(tid, mid || tid); }) // Save button
.next().val(we_cancel).click(cancel); // Cancel button
$('#ntho').focus().val(cur_text);
$('#npriv').sb();
if (is_new || edited_thought.indexOf('<') == -1)
edit_handler(is_new ? '' : edited_thought.php_unhtmlspecialchars());
else
$.post(weUrl('action=ajax;sa=thought') + ';in=' + tid, edit_handler);

return false;
};

0 comments on commit a0fe1de

Please sign in to comment.
You can’t perform that action at this time.