|
@@ -118,23 +118,10 @@ function Edit_Form(post,key) {
|
118
|
118
|
//If no edit is already going underway or a previous edit was finished, make the necessary dom changes.
|
119
|
119
|
if (!$('#editbox' + postid).results() || $('#editbox' + postid + '.hidden').results()) {
|
120
|
120
|
$('#reply_box').ghide();
|
121
|
|
- if (location.href.match(/torrents\.php/)
|
122
|
|
- || location.href.match(/artist\.php/)) {
|
123
|
|
- boxWidth = "50";
|
124
|
|
- } else {
|
125
|
|
- boxWidth = "80";
|
126
|
|
- }
|
|
121
|
+ boxWidth = (location.href.match(/torrents\.php/) || location.href.match(/artist\.php/)) ? "50" : "80";
|
127
|
122
|
postuserid = $('#post' + postid + ' strong a').attr('href').split('=')[1];
|
128
|
|
- if (postuserid != userid) {
|
129
|
|
- pmbox = '<span id="pmbox' + postid + '"><label>PM user on edit? <input type="checkbox" name="pm" value="1" /></label></span>';
|
130
|
|
- } else {
|
131
|
|
- pmbox = '';
|
132
|
|
- };
|
133
|
|
- if (location.href.match(/forums\.php/)) {
|
134
|
|
- inputname = "post";
|
135
|
|
- } else {
|
136
|
|
- inputname = "postid";
|
137
|
|
- }
|
|
123
|
+ pmbox = (postuserid != userid) ? '<span id="pmbox' + postid + '"><label>PM user on edit? <input type="checkbox" name="pm" value="1" /></label></span>' : '';
|
|
124
|
+ inputname = (location.href.match(/forums\.php/)) ? "post" : "postid";
|
138
|
125
|
$('#bar' + postid).raw().cancel = $('#content' + postid).raw().innerHTML;
|
139
|
126
|
$('#bar' + postid).raw().oldbar = $('#bar' + postid).raw().innerHTML;
|
140
|
127
|
$('#content' + postid).raw().innerHTML = "<div id=\"preview" + postid + "\"></div><form id=\"form" + postid + "\" method=\"post\" action=\"\">" + pmbox + "<input type=\"hidden\" name=\"auth\" value=\"" + authkey + "\" /><input type=\"hidden\" name=\"key\" value=\"" + key + "\" /><input type=\"hidden\" name=\"" + inputname + "\" value=\"" + postid + "\" /><textarea id=\"editbox" + postid + "\" onkeyup=\"resize('editbox" + postid + "');\" name=\"body\" cols=\"" + boxWidth + "\" rows=\"10\"></textarea></form>";
|
|
@@ -144,17 +131,12 @@ function Edit_Form(post,key) {
|
144
|
131
|
* If editing is already underway and edit is pressed again, reset the post
|
145
|
132
|
* (keeps current functionality, move into brackets to stop from happening).
|
146
|
133
|
*/
|
147
|
|
- if (location.href.match(/forums\.php/)) {
|
148
|
|
- ajax.get("?action=get_post&post=" + postid, function(response) {
|
149
|
|
- $('#editbox' + postid).raw().value = html_entity_decode(response);
|
150
|
|
- resize('editbox' + postid);
|
151
|
|
- });
|
152
|
|
- } else {
|
153
|
|
- ajax.get("comments.php?action=get&postid=" + postid, function(response) {
|
154
|
|
- $('#editbox' + postid).raw().value = html_entity_decode(response);
|
155
|
|
- resize('editbox' + postid);
|
156
|
|
- });
|
157
|
|
- }
|
|
134
|
+ var post_endpoint = (location.href.match(/forums\.php/)) ? '?action=get_post&post=' : 'comments.php?action=get&postid=';
|
|
135
|
+ ajax.get(post_endpoint + postid, function(response) {
|
|
136
|
+ $('#editbox' + postid).raw().value = html_entity_decode(response);
|
|
137
|
+ resize('editbox' + postid);
|
|
138
|
+ BBEditor($('#editbox' + postid).raw());
|
|
139
|
+ });
|
158
|
140
|
}
|
159
|
141
|
|
160
|
142
|
function Cancel_Edit(postid) {
|