Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

force hard refresh after submit

jackmaessenjackmaessen ✭✭✭
edited January 2015 in Vanilla 2.0 - 2.8

I still had problems loading geshi syntax highlighting, mark V plugin ( @hgtonight made this) and signatures after submitting and editing a comment. They all needed a hard refresh. So i was looking for a way to force this refresh.

In the file: applications/vanilla/js/discussion.js there is this function:

// Hijack comment form button clicks.
   var draftSaving = 0;
$('.CommentButton, a.PreviewButton, a.DraftButton').livequery('click', function() {
// rest of code

I seperated the CommentButton from it and created the same function with at the end a window.location.reload();

/* submit buttons need a hard refresh */
    $('.CommentButton').livequery('click', function() {
// rest of the code and at the end
complete: function(XMLHttpRequest, textStatus) {
            // Remove any spinners, and re-enable buttons.
            $(':submit', frm).removeClass('InProgress');
            $('.DraftButton', frm).removeClass('InProgress');
            $(frm).find(':submit').removeAttr("disabled");
            if (draft)
               draftSaving--;
               window.location.reload(); /* force the refresh*/

         }
      });

I know this is not a proper way to do it because i edited one of the core files. Maybe someone knows a way to get the same result with a more proper way?

Comments

Sign In or Register to comment.