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
jackmaessen
✭✭✭
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?
0
Comments
There are a few more plugins which needs this. This is good. Take your javascript and move it into a plugin which adds a new .js file and then it can be stand alone.
@Anonymoose Yes, i was already thinking about that to make a plugin of this. Good idea! The core files remain the same.
Kudos for getting it to work.
That said, I would rather see the underlying issue get fixed. This is a bit like taking aspirin to get rid of your toothache rather than getting the tooth pulled/filled by the dentist.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
If you want to run some javascript after post submission, bind your handler to the "CommentAdded" event.
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Great @Bleistivt ; i used the DiscussionRefresh plugin from R_J for this and i added at the bottom:
Same result without editing the core files!