Browse Source

Fix some cases where BBCode toolbars would fail to be recreated after page is modified

spaghetti 7 years ago
parent
commit
f39fc7bfd8
2 changed files with 3 additions and 1 deletions
  1. 2
    1
      static/functions/comments.js
  2. 1
    0
      static/functions/upload.js

+ 2
- 1
static/functions/comments.js View File

153
   ajax.post("ajax.php?action=preview","form" + postid, function(response) {
153
   ajax.post("ajax.php?action=preview","form" + postid, function(response) {
154
     $('#preview' + postid).raw().innerHTML = response;
154
     $('#preview' + postid).raw().innerHTML = response;
155
     $('#editbox' + postid).ghide();
155
     $('#editbox' + postid).ghide();
156
-    if ($('#editbox' + postid).raw().previousSibling.className == 'bbcode_bar') $($('#editbox' + postid).raw().previousSibling).ghide();
156
+    if ($('#editbox' + postid).raw().previousSibling.classList.contains('bbcode_bar')) $($('#editbox' + postid).raw().previousSibling).ghide();
157
   });
157
   });
158
 }
158
 }
159
 
159
 
161
   $('#bar' + postid).raw().innerHTML = "<input type=\"button\" value=\"Preview\" onclick=\"Preview_Edit(" + postid + ");\" /><input type=\"button\" value=\"Post\" onclick=\"Save_Edit(" + postid + ")\" /><input type=\"button\" value=\"Cancel\" onclick=\"Cancel_Edit(" + postid + ");\" />";
161
   $('#bar' + postid).raw().innerHTML = "<input type=\"button\" value=\"Preview\" onclick=\"Preview_Edit(" + postid + ");\" /><input type=\"button\" value=\"Post\" onclick=\"Save_Edit(" + postid + ")\" /><input type=\"button\" value=\"Cancel\" onclick=\"Cancel_Edit(" + postid + ");\" />";
162
   $('#preview' + postid).raw().innerHTML = "";
162
   $('#preview' + postid).raw().innerHTML = "";
163
   $('#editbox' + postid).gshow();
163
   $('#editbox' + postid).gshow();
164
+  if ($('#editbox' + postid).raw().previousSibling.classList.contains('bbcode_bar')) $($('#editbox' + postid).raw().previousSibling).gshow();
164
 }
165
 }
165
 
166
 
166
 function Save_Edit(postid) {
167
 function Save_Edit(postid) {

+ 1
- 0
static/functions/upload.js View File

47
     }
47
     }
48
     initAutocomplete()
48
     initAutocomplete()
49
     initAutofill()
49
     initAutofill()
50
+    $('.bbcode_editor').each(function(i, el) { BBEditor(el) })
50
   });
51
   });
51
 }
52
 }
52
 
53
 

Loading…
Cancel
Save