Fossil SCM

Use a JS-disabling browser plugin to fix the legacy-form fallback in the forum editor, reply, and attachment-adding pages.

stephan 2026-06-11 09:17 UTC forum-editor-2026
Commit 77c3ce12e94cfb32e61c7a379d03e0f614efebf6569634fec447e239051929bc
+7 -11
--- src/attach.c
+++ src/attach.c
@@ -585,11 +585,12 @@
585585
const char *zTechNote,
586586
const char *zTicket,
587587
const char *zWikiPage,
588588
const char *zComment,
589589
const char *zFrom){
590
- form_begin("enctype='multipart/form-data'", "%R/attachadd");
590
+ form_begin("enctype='multipart/form-data' class='remove-on-load'",
591
+ "%R/attachadd");
591592
@ <div>\
592593
@ File to Attach:
593594
@ <input type="file" name="f" size="60"><br>
594595
@ Description:<br>
595596
@ <textarea name="comment" cols="80" rows="5" wrap="virtual"\
@@ -1087,23 +1088,18 @@
10871088
style_header("Add Attachment");
10881089
if( !goodCaptcha ){
10891090
@ <p class="generalError">Error: Incorrect security code.</p>
10901091
}
10911092
@ <h2>Attachments for %s(zTargetType)</h2>
1092
- if(1){
1093
- /* noscript fallback is completely untested */
1094
- @ <noscript>
1095
- attach_render_legacy_form(noJsArgs[0], noJsArgs[1], noJsArgs[2],
1096
- noJsArgs[3], 0,
1097
- zFrom ? zFrom : mprintf("%R/home"));
1098
- @ </noscript>
1099
- }
11001093
attachment_list(zTarget, NULL,
11011094
ATTACHLIST_SIZE | ATTACHLIST_HIDE_UNAPPROVED);
1095
+ attach_render_legacy_form(noJsArgs[0], noJsArgs[1], noJsArgs[2],
1096
+ noJsArgs[3], 0,
1097
+ zFrom ? zFrom : mprintf("%R/home"));
11021098
@ <div id='attachadd-form-wrapper' class='hidden'>
1103
- /* fossil.attach.js populates this DIV with the attachment widget
1104
- ** and imports these hidden fields. */
1099
+ /* fossil.attach.js populates this DIV with the attachment widget,
1100
+ ** imports these hidden fields, and removes the legacy form. */
11051101
@ <input type="hidden" name="target" value="%h(zTarget)">
11061102
if( zFrom ){
11071103
@ <input type="hidden" name="from" value="%h(zFrom)">
11081104
}
11091105
if( zTo ){
11101106
--- src/attach.c
+++ src/attach.c
@@ -585,11 +585,12 @@
585 const char *zTechNote,
586 const char *zTicket,
587 const char *zWikiPage,
588 const char *zComment,
589 const char *zFrom){
590 form_begin("enctype='multipart/form-data'", "%R/attachadd");
 
591 @ <div>\
592 @ File to Attach:
593 @ <input type="file" name="f" size="60"><br>
594 @ Description:<br>
595 @ <textarea name="comment" cols="80" rows="5" wrap="virtual"\
@@ -1087,23 +1088,18 @@
1087 style_header("Add Attachment");
1088 if( !goodCaptcha ){
1089 @ <p class="generalError">Error: Incorrect security code.</p>
1090 }
1091 @ <h2>Attachments for %s(zTargetType)</h2>
1092 if(1){
1093 /* noscript fallback is completely untested */
1094 @ <noscript>
1095 attach_render_legacy_form(noJsArgs[0], noJsArgs[1], noJsArgs[2],
1096 noJsArgs[3], 0,
1097 zFrom ? zFrom : mprintf("%R/home"));
1098 @ </noscript>
1099 }
1100 attachment_list(zTarget, NULL,
1101 ATTACHLIST_SIZE | ATTACHLIST_HIDE_UNAPPROVED);
 
 
 
1102 @ <div id='attachadd-form-wrapper' class='hidden'>
1103 /* fossil.attach.js populates this DIV with the attachment widget
1104 ** and imports these hidden fields. */
1105 @ <input type="hidden" name="target" value="%h(zTarget)">
1106 if( zFrom ){
1107 @ <input type="hidden" name="from" value="%h(zFrom)">
1108 }
1109 if( zTo ){
1110
--- src/attach.c
+++ src/attach.c
@@ -585,11 +585,12 @@
585 const char *zTechNote,
586 const char *zTicket,
587 const char *zWikiPage,
588 const char *zComment,
589 const char *zFrom){
590 form_begin("enctype='multipart/form-data' class='remove-on-load'",
591 "%R/attachadd");
592 @ <div>\
593 @ File to Attach:
594 @ <input type="file" name="f" size="60"><br>
595 @ Description:<br>
596 @ <textarea name="comment" cols="80" rows="5" wrap="virtual"\
@@ -1087,23 +1088,18 @@
1088 style_header("Add Attachment");
1089 if( !goodCaptcha ){
1090 @ <p class="generalError">Error: Incorrect security code.</p>
1091 }
1092 @ <h2>Attachments for %s(zTargetType)</h2>
 
 
 
 
 
 
 
 
1093 attachment_list(zTarget, NULL,
1094 ATTACHLIST_SIZE | ATTACHLIST_HIDE_UNAPPROVED);
1095 attach_render_legacy_form(noJsArgs[0], noJsArgs[1], noJsArgs[2],
1096 noJsArgs[3], 0,
1097 zFrom ? zFrom : mprintf("%R/home"));
1098 @ <div id='attachadd-form-wrapper' class='hidden'>
1099 /* fossil.attach.js populates this DIV with the attachment widget,
1100 ** imports these hidden fields, and removes the legacy form. */
1101 @ <input type="hidden" name="target" value="%h(zTarget)">
1102 if( zFrom ){
1103 @ <input type="hidden" name="from" value="%h(zFrom)">
1104 }
1105 if( zTo ){
1106
+11 -50
--- src/forum.c
+++ src/forum.c
@@ -2038,11 +2038,10 @@
20382038
*/
20392039
void forumnew_page(void){
20402040
const char *zTitle = PDT("title","");
20412041
const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE);
20422042
const char *zContent = PDT("content","");
2043
- const int bNoJs = PB("nojs"); /* True for legacy HTML form */
20442043
20452044
login_check_credentials();
20462045
if( !g.perm.WrForum ){
20472046
login_needed(g.anon.WrForum);
20482047
return;
@@ -2056,38 +2055,32 @@
20562055
forum_render(zTitle, zMimetype, zContent, "forumEdit", 1);
20572056
}
20582057
style_set_current_feature("forum");
20592058
style_header("New Forum Thread");
20602059
2061
- if( !bNoJs ){
2062
- @ <noscript>
2063
- }
2064
- @ <form action="%R/forume1" method="POST">
2060
+ @ <form action="%R/forume1" method="POST" \
2061
+ @ class="remove-if-replaced">
20652062
@ <h1>New Thread:</h1>
20662063
forum_from_line();
20672064
forum_post_widget(zTitle, zMimetype, zContent);
20682065
@ <input type="submit" name="preview" value="Preview">
2069
- @ <input type="hidden" name="legacy" value="1">
20702066
if( P("preview") && !fossil_all_whitespace(zContent) ){
20712067
@ <input type="submit" name="submit" value="Submit">
20722068
}else{
20732069
@ <input type="submit" name="submit" value="Submit" disabled>
20742070
}
20752071
forum_render_debug_options();
20762072
login_insert_csrf_secret();
20772073
@ </form>
2074
+ /* When JS is disabled the block above will work. When it's
2075
+ enabled, the above will be removed and JS will render the editor
2076
+ form in the next element. */
2077
+ @ <div hidden id='forumnew-placeholder'>
2078
+ @ <input type='hidden' name='title' value='%h(zTitle)'>
2079
+ login_insert_csrf_secret();
2080
+ @ </div>
20782081
forum_render_attachment_notice();
2079
- if( !bNoJs ){
2080
- @ </noscript>
2081
- /* When JS is disabled the block above will work.
2082
- When it's enabled, the above won't do anything and
2083
- JS will render the editor form in the next element. */
2084
- @ <div hidden id='forumnew-placeholder'>
2085
- @ <input type='hidden' name='title' value='%h(zTitle)'>
2086
- login_insert_csrf_secret();
2087
- @ </div>
2088
- }
20892082
forum_emit_js();
20902083
style_finish_page();
20912084
}
20922085
20932086
/*
@@ -2106,11 +2099,10 @@
21062099
const char *zMimetype = 0;
21072100
const char *zContent = 0;
21082101
const char *zTitle = 0;
21092102
char *zDate = 0;
21102103
const char *zFpid = PD("fpid","");
2111
- const int bNoJs = PB("nojs");
21122104
int isCsrfSafe;
21132105
int isDelete = 0;
21142106
int iClosed = 0;
21152107
int bSameUser; /* True if author is also the reader */
21162108
int bPreview; /* True in preview mode. */
@@ -2174,14 +2166,10 @@
21742166
cgi_redirectf("%R/forum");
21752167
}
21762168
return;
21772169
}
21782170
}
2179
- if( !bNoJs ){
2180
- forumedit_page_v2();
2181
- return;
2182
- }
21832171
style_set_current_feature("forum");
21842172
isDelete = P("nullout")!=0;
21852173
if( P("submit")
21862174
&& isCsrfSafe
21872175
&& (zContent = PDT("content",""))!=0
@@ -2208,11 +2196,11 @@
22082196
@ <h1>Original Post:</h1>
22092197
forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki,
22102198
"forumEdit", 1);
22112199
@ <h1>Change Into:</h1>
22122200
forum_render(zTitle, zMimetype, zContent,"forumEdit", 1);
2213
- @ <form action="%R/forume2" method="POST">
2201
+ @ <form action="%R/forume2" method="POST" class="remove-on-load">
22142202
login_insert_csrf_secret();
22152203
@ <input type="hidden" name="fpid" value="%h(P("fpid"))">
22162204
@ <input type="hidden" name="nullout" value="1">
22172205
@ <input type="hidden" name="mimetype" value="%h(zMimetype)">
22182206
@ <input type="hidden" name="content" value="%h(zContent)">
@@ -2236,11 +2224,11 @@
22362224
if( bPreview ){
22372225
@ <h2>Preview of Edited Post:</h2>
22382226
forum_render(zTitle, zMimetype, zContent,"forumEdit", 1);
22392227
}
22402228
@ <h2>Revised Message:</h2>
2241
- @ <form action="%R/forume2" method="POST">
2229
+ @ <form action="%R/forume2" method="POST" class="remove-on-load">
22422230
login_insert_csrf_secret();
22432231
@ <input type="hidden" name="fpid" value="%h(P("fpid"))">
22442232
@ <input type="hidden" name="edit" value="1">
22452233
forum_from_line();
22462234
forum_post_widget(zTitle, zMimetype, zContent);
@@ -2291,37 +2279,10 @@
22912279
forum_render_attachment_list(rid_to_uuid(fpid));
22922280
}
22932281
forum_render_attachment_notice();
22942282
forum_emit_js();
22952283
style_finish_page();
2296
-}
2297
-
2298
-/*
2299
-** WEBPAGE: forume2_v2 hidden
2300
-**
2301
-** A work in progress.
2302
-*/
2303
-void forumedit_page_v2(void){
2304
- const char *zFpid = PD("fpid","");
2305
-
2306
- login_check_credentials();
2307
- if( !g.perm.WrForum ){
2308
- login_needed(g.anon.WrForum);
2309
- return;
2310
- }
2311
- style_set_current_feature("forum");
2312
- style_header("Edit Forum Post");
2313
- (void)zFpid;
2314
- @ <div hidden id='forumedit-placeholder'>
2315
-#if 0
2316
- @ <input type='hidden' name='title' value='%h(zTitle)'>
2317
-#endif
2318
- login_insert_csrf_secret();
2319
- @ </div>
2320
- forum_emit_js();
2321
- style_finish_page();
2322
-
23232284
}
23242285
23252286
/*
23262287
** SETTING: forum-close-policy boolean default=off
23272288
** If true, forum moderators may close/re-open forum posts, and reply
23282289
--- src/forum.c
+++ src/forum.c
@@ -2038,11 +2038,10 @@
2038 */
2039 void forumnew_page(void){
2040 const char *zTitle = PDT("title","");
2041 const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE);
2042 const char *zContent = PDT("content","");
2043 const int bNoJs = PB("nojs"); /* True for legacy HTML form */
2044
2045 login_check_credentials();
2046 if( !g.perm.WrForum ){
2047 login_needed(g.anon.WrForum);
2048 return;
@@ -2056,38 +2055,32 @@
2056 forum_render(zTitle, zMimetype, zContent, "forumEdit", 1);
2057 }
2058 style_set_current_feature("forum");
2059 style_header("New Forum Thread");
2060
2061 if( !bNoJs ){
2062 @ <noscript>
2063 }
2064 @ <form action="%R/forume1" method="POST">
2065 @ <h1>New Thread:</h1>
2066 forum_from_line();
2067 forum_post_widget(zTitle, zMimetype, zContent);
2068 @ <input type="submit" name="preview" value="Preview">
2069 @ <input type="hidden" name="legacy" value="1">
2070 if( P("preview") && !fossil_all_whitespace(zContent) ){
2071 @ <input type="submit" name="submit" value="Submit">
2072 }else{
2073 @ <input type="submit" name="submit" value="Submit" disabled>
2074 }
2075 forum_render_debug_options();
2076 login_insert_csrf_secret();
2077 @ </form>
 
 
 
 
 
 
 
2078 forum_render_attachment_notice();
2079 if( !bNoJs ){
2080 @ </noscript>
2081 /* When JS is disabled the block above will work.
2082 When it's enabled, the above won't do anything and
2083 JS will render the editor form in the next element. */
2084 @ <div hidden id='forumnew-placeholder'>
2085 @ <input type='hidden' name='title' value='%h(zTitle)'>
2086 login_insert_csrf_secret();
2087 @ </div>
2088 }
2089 forum_emit_js();
2090 style_finish_page();
2091 }
2092
2093 /*
@@ -2106,11 +2099,10 @@
2106 const char *zMimetype = 0;
2107 const char *zContent = 0;
2108 const char *zTitle = 0;
2109 char *zDate = 0;
2110 const char *zFpid = PD("fpid","");
2111 const int bNoJs = PB("nojs");
2112 int isCsrfSafe;
2113 int isDelete = 0;
2114 int iClosed = 0;
2115 int bSameUser; /* True if author is also the reader */
2116 int bPreview; /* True in preview mode. */
@@ -2174,14 +2166,10 @@
2174 cgi_redirectf("%R/forum");
2175 }
2176 return;
2177 }
2178 }
2179 if( !bNoJs ){
2180 forumedit_page_v2();
2181 return;
2182 }
2183 style_set_current_feature("forum");
2184 isDelete = P("nullout")!=0;
2185 if( P("submit")
2186 && isCsrfSafe
2187 && (zContent = PDT("content",""))!=0
@@ -2208,11 +2196,11 @@
2208 @ <h1>Original Post:</h1>
2209 forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki,
2210 "forumEdit", 1);
2211 @ <h1>Change Into:</h1>
2212 forum_render(zTitle, zMimetype, zContent,"forumEdit", 1);
2213 @ <form action="%R/forume2" method="POST">
2214 login_insert_csrf_secret();
2215 @ <input type="hidden" name="fpid" value="%h(P("fpid"))">
2216 @ <input type="hidden" name="nullout" value="1">
2217 @ <input type="hidden" name="mimetype" value="%h(zMimetype)">
2218 @ <input type="hidden" name="content" value="%h(zContent)">
@@ -2236,11 +2224,11 @@
2236 if( bPreview ){
2237 @ <h2>Preview of Edited Post:</h2>
2238 forum_render(zTitle, zMimetype, zContent,"forumEdit", 1);
2239 }
2240 @ <h2>Revised Message:</h2>
2241 @ <form action="%R/forume2" method="POST">
2242 login_insert_csrf_secret();
2243 @ <input type="hidden" name="fpid" value="%h(P("fpid"))">
2244 @ <input type="hidden" name="edit" value="1">
2245 forum_from_line();
2246 forum_post_widget(zTitle, zMimetype, zContent);
@@ -2291,37 +2279,10 @@
2291 forum_render_attachment_list(rid_to_uuid(fpid));
2292 }
2293 forum_render_attachment_notice();
2294 forum_emit_js();
2295 style_finish_page();
2296 }
2297
2298 /*
2299 ** WEBPAGE: forume2_v2 hidden
2300 **
2301 ** A work in progress.
2302 */
2303 void forumedit_page_v2(void){
2304 const char *zFpid = PD("fpid","");
2305
2306 login_check_credentials();
2307 if( !g.perm.WrForum ){
2308 login_needed(g.anon.WrForum);
2309 return;
2310 }
2311 style_set_current_feature("forum");
2312 style_header("Edit Forum Post");
2313 (void)zFpid;
2314 @ <div hidden id='forumedit-placeholder'>
2315 #if 0
2316 @ <input type='hidden' name='title' value='%h(zTitle)'>
2317 #endif
2318 login_insert_csrf_secret();
2319 @ </div>
2320 forum_emit_js();
2321 style_finish_page();
2322
2323 }
2324
2325 /*
2326 ** SETTING: forum-close-policy boolean default=off
2327 ** If true, forum moderators may close/re-open forum posts, and reply
2328
--- src/forum.c
+++ src/forum.c
@@ -2038,11 +2038,10 @@
2038 */
2039 void forumnew_page(void){
2040 const char *zTitle = PDT("title","");
2041 const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE);
2042 const char *zContent = PDT("content","");
 
2043
2044 login_check_credentials();
2045 if( !g.perm.WrForum ){
2046 login_needed(g.anon.WrForum);
2047 return;
@@ -2056,38 +2055,32 @@
2055 forum_render(zTitle, zMimetype, zContent, "forumEdit", 1);
2056 }
2057 style_set_current_feature("forum");
2058 style_header("New Forum Thread");
2059
2060 @ <form action="%R/forume1" method="POST" \
2061 @ class="remove-if-replaced">
 
 
2062 @ <h1>New Thread:</h1>
2063 forum_from_line();
2064 forum_post_widget(zTitle, zMimetype, zContent);
2065 @ <input type="submit" name="preview" value="Preview">
 
2066 if( P("preview") && !fossil_all_whitespace(zContent) ){
2067 @ <input type="submit" name="submit" value="Submit">
2068 }else{
2069 @ <input type="submit" name="submit" value="Submit" disabled>
2070 }
2071 forum_render_debug_options();
2072 login_insert_csrf_secret();
2073 @ </form>
2074 /* When JS is disabled the block above will work. When it's
2075 enabled, the above will be removed and JS will render the editor
2076 form in the next element. */
2077 @ <div hidden id='forumnew-placeholder'>
2078 @ <input type='hidden' name='title' value='%h(zTitle)'>
2079 login_insert_csrf_secret();
2080 @ </div>
2081 forum_render_attachment_notice();
 
 
 
 
 
 
 
 
 
 
2082 forum_emit_js();
2083 style_finish_page();
2084 }
2085
2086 /*
@@ -2106,11 +2099,10 @@
2099 const char *zMimetype = 0;
2100 const char *zContent = 0;
2101 const char *zTitle = 0;
2102 char *zDate = 0;
2103 const char *zFpid = PD("fpid","");
 
2104 int isCsrfSafe;
2105 int isDelete = 0;
2106 int iClosed = 0;
2107 int bSameUser; /* True if author is also the reader */
2108 int bPreview; /* True in preview mode. */
@@ -2174,14 +2166,10 @@
2166 cgi_redirectf("%R/forum");
2167 }
2168 return;
2169 }
2170 }
 
 
 
 
2171 style_set_current_feature("forum");
2172 isDelete = P("nullout")!=0;
2173 if( P("submit")
2174 && isCsrfSafe
2175 && (zContent = PDT("content",""))!=0
@@ -2208,11 +2196,11 @@
2196 @ <h1>Original Post:</h1>
2197 forum_render(pPost->zThreadTitle, pPost->zMimetype, pPost->zWiki,
2198 "forumEdit", 1);
2199 @ <h1>Change Into:</h1>
2200 forum_render(zTitle, zMimetype, zContent,"forumEdit", 1);
2201 @ <form action="%R/forume2" method="POST" class="remove-on-load">
2202 login_insert_csrf_secret();
2203 @ <input type="hidden" name="fpid" value="%h(P("fpid"))">
2204 @ <input type="hidden" name="nullout" value="1">
2205 @ <input type="hidden" name="mimetype" value="%h(zMimetype)">
2206 @ <input type="hidden" name="content" value="%h(zContent)">
@@ -2236,11 +2224,11 @@
2224 if( bPreview ){
2225 @ <h2>Preview of Edited Post:</h2>
2226 forum_render(zTitle, zMimetype, zContent,"forumEdit", 1);
2227 }
2228 @ <h2>Revised Message:</h2>
2229 @ <form action="%R/forume2" method="POST" class="remove-on-load">
2230 login_insert_csrf_secret();
2231 @ <input type="hidden" name="fpid" value="%h(P("fpid"))">
2232 @ <input type="hidden" name="edit" value="1">
2233 forum_from_line();
2234 forum_post_widget(zTitle, zMimetype, zContent);
@@ -2291,37 +2279,10 @@
2279 forum_render_attachment_list(rid_to_uuid(fpid));
2280 }
2281 forum_render_attachment_notice();
2282 forum_emit_js();
2283 style_finish_page();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2284 }
2285
2286 /*
2287 ** SETTING: forum-close-policy boolean default=off
2288 ** If true, forum moderators may close/re-open forum posts, and reply
2289
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -9,11 +9,11 @@
99
(function(namespace){
1010
"use strict";
1111
const F = namespace, D = F.dom;
1212
1313
let idCounter = 0;
14
-
14
+ document.body.querySelectorAll('.remove-on-load').forEach(e=>e.remove());
1515
/**
1616
Implements a multi-file selector widget. Intended to be plugged
1717
in to places in Fossil's UI where attachments can be assigned to
1818
an artifact.
1919
*/
2020
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -9,11 +9,11 @@
9 (function(namespace){
10 "use strict";
11 const F = namespace, D = F.dom;
12
13 let idCounter = 0;
14
15 /**
16 Implements a multi-file selector widget. Intended to be plugged
17 in to places in Fossil's UI where attachments can be assigned to
18 an artifact.
19 */
20
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -9,11 +9,11 @@
9 (function(namespace){
10 "use strict";
11 const F = namespace, D = F.dom;
12
13 let idCounter = 0;
14 document.body.querySelectorAll('.remove-on-load').forEach(e=>e.remove());
15 /**
16 Implements a multi-file selector widget. Intended to be plugged
17 in to places in Fossil's UI where attachments can be assigned to
18 an artifact.
19 */
20
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -1014,14 +1014,14 @@
10141014
plugInEditor
10151015
&& (
10161016
document.body.classList.contains('cpage-forumnew')
10171017
|| document.body.classList.contains('cpage-forume1')
10181018
))
1019
- ? document.querySelector('#forumnew-placeholder')
1019
+ ? document.body.querySelector('#forumnew-placeholder')
10201020
: null;
10211021
if( plugInEditor && eForumNew ){
1022
- /* /forumnew and /forume2 */
1022
+ /* /forumnew and /forume1 */
10231023
const fpe = new F.ForumPostEditor({
10241024
draftKey: 'draft-forumnew',
10251025
hiddenFields: eForumNew.querySelectorAll('input[type=hidden]'),
10261026
ondiscard: ()=>{
10271027
window.location = F.repoUrl('forum');
@@ -1344,18 +1344,20 @@
13441344
if( eStatusChange ) eToDisable.push(eStatusChange);
13451345
})/*for-each form*/;
13461346
13471347
}/* /forumpost and /forumthread */
13481348
1349
+ document.body.querySelectorAll('.remove-on-load').forEach(e=>e.remove());
13491350
document.body.querySelectorAll('.initially-hidden').forEach(e=>{
13501351
/* This is a workaround for a span.help-buttonlet which we need
13511352
to start hidden so that it does not show up for no-JS
13521353
clients. */
13531354
e.classList.remove('initially-hidden');
13541355
});
13551356
13561357
if( plugInEditor ){
1358
+ document.body.querySelectorAll('.remove-if-replaced').forEach(e=>e.remove());
13571359
/* Purge old drafts only every now and then. */
13581360
const now = Date.now();
13591361
const lastPurge = +F.storage.get('forum-drafts-last-purge', 0);
13601362
if( now - lastPurge > (24 * 60 * 60 * 1000 /*1 day ms*/) ){
13611363
F.storage.set('forum-drafts-last-purge', now);
13621364
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -1014,14 +1014,14 @@
1014 plugInEditor
1015 && (
1016 document.body.classList.contains('cpage-forumnew')
1017 || document.body.classList.contains('cpage-forume1')
1018 ))
1019 ? document.querySelector('#forumnew-placeholder')
1020 : null;
1021 if( plugInEditor && eForumNew ){
1022 /* /forumnew and /forume2 */
1023 const fpe = new F.ForumPostEditor({
1024 draftKey: 'draft-forumnew',
1025 hiddenFields: eForumNew.querySelectorAll('input[type=hidden]'),
1026 ondiscard: ()=>{
1027 window.location = F.repoUrl('forum');
@@ -1344,18 +1344,20 @@
1344 if( eStatusChange ) eToDisable.push(eStatusChange);
1345 })/*for-each form*/;
1346
1347 }/* /forumpost and /forumthread */
1348
 
1349 document.body.querySelectorAll('.initially-hidden').forEach(e=>{
1350 /* This is a workaround for a span.help-buttonlet which we need
1351 to start hidden so that it does not show up for no-JS
1352 clients. */
1353 e.classList.remove('initially-hidden');
1354 });
1355
1356 if( plugInEditor ){
 
1357 /* Purge old drafts only every now and then. */
1358 const now = Date.now();
1359 const lastPurge = +F.storage.get('forum-drafts-last-purge', 0);
1360 if( now - lastPurge > (24 * 60 * 60 * 1000 /*1 day ms*/) ){
1361 F.storage.set('forum-drafts-last-purge', now);
1362
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -1014,14 +1014,14 @@
1014 plugInEditor
1015 && (
1016 document.body.classList.contains('cpage-forumnew')
1017 || document.body.classList.contains('cpage-forume1')
1018 ))
1019 ? document.body.querySelector('#forumnew-placeholder')
1020 : null;
1021 if( plugInEditor && eForumNew ){
1022 /* /forumnew and /forume1 */
1023 const fpe = new F.ForumPostEditor({
1024 draftKey: 'draft-forumnew',
1025 hiddenFields: eForumNew.querySelectorAll('input[type=hidden]'),
1026 ondiscard: ()=>{
1027 window.location = F.repoUrl('forum');
@@ -1344,18 +1344,20 @@
1344 if( eStatusChange ) eToDisable.push(eStatusChange);
1345 })/*for-each form*/;
1346
1347 }/* /forumpost and /forumthread */
1348
1349 document.body.querySelectorAll('.remove-on-load').forEach(e=>e.remove());
1350 document.body.querySelectorAll('.initially-hidden').forEach(e=>{
1351 /* This is a workaround for a span.help-buttonlet which we need
1352 to start hidden so that it does not show up for no-JS
1353 clients. */
1354 e.classList.remove('initially-hidden');
1355 });
1356
1357 if( plugInEditor ){
1358 document.body.querySelectorAll('.remove-if-replaced').forEach(e=>e.remove());
1359 /* Purge old drafts only every now and then. */
1360 const now = Date.now();
1361 const lastPurge = +F.storage.get('forum-drafts-last-purge', 0);
1362 if( now - lastPurge > (24 * 60 * 60 * 1000 /*1 day ms*/) ){
1363 F.storage.set('forum-drafts-last-purge', now);
1364

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button