Fossil SCM

Extended /builtin/filename to support /builtin/:filename for packing up cacheable bundles of page-specific code. /wikiedit, /fileedit, and /forumpost now serve their JS that way.

stephan 2020-07-31 16:14 ajax-wiki-editor
Commit 18da05b9033c73254623cc51d9712dfda06a251a9e5da5ad5fe0dc9a521416c9
+5 -9
--- src/fileedit.c
+++ src/fileedit.c
@@ -1482,18 +1482,15 @@
14821482
blob_reset(&manifest);
14831483
CheckinMiniInfo_cleanup(&cimi);
14841484
}
14851485
14861486
/*
1487
-** Emits all of the "core" static JS needed by /fileedit into a single
1488
-** SCRIPT tag.
1489
-**
1490
-** TODO: a common mechanism which will let us bundle this type of
1491
-** blob into a single cacheable request.
1487
+** Emits all of the "core" static JS needed by /wikiedit into a single
1488
+** SCRIPT tag. Intended to be mapped to style.c:BundleEmitters with
1489
+** the name "fileedit.js".
14921490
*/
1493
-static void fileedit_emit_js(void){
1494
- style_emit_script_tag(0,0);
1491
+void fileedit_emit_js_bundle(void){
14951492
style_emit_script_fossil_bootstrap(1);
14961493
style_emit_script_builtin(1,0,"sbsdiff.js");
14971494
style_emit_script_fetch(1,0);
14981495
style_emit_script_tabs(1,0)/*also emits fossil.dom*/;
14991496
style_emit_script_confirmer(1,0);
@@ -1503,11 +1500,10 @@
15031500
** used for dynamically toggling certain UI components on and off.
15041501
** Must come before fossil.page.fileedit.js.
15051502
*/
15061503
ajax_emit_js_preview_modes(0);
15071504
style_emit_script_builtin(1, 0, "fossil.page.fileedit.js");
1508
- style_emit_script_tag(1,0);
15091505
}
15101506
15111507
/*
15121508
** WEBPAGE: fileedit
15131509
**
@@ -1974,11 +1970,11 @@
19741970
blob_appendf(&endScript,");\n");
19751971
}
19761972
19771973
blob_reset(&err);
19781974
CheckinMiniInfo_cleanup(&cimi);
1979
- fileedit_emit_js();
1975
+ style_emit_script_builtin(0, 0, ":fileedit.js");
19801976
if(blob_size(&endScript)>0){
19811977
style_emit_script_tag(0,0);
19821978
CX("\n(function(){\n");
19831979
CX("try{\n%b}\n"
19841980
"catch(e){"
19851981
--- src/fileedit.c
+++ src/fileedit.c
@@ -1482,18 +1482,15 @@
1482 blob_reset(&manifest);
1483 CheckinMiniInfo_cleanup(&cimi);
1484 }
1485
1486 /*
1487 ** Emits all of the "core" static JS needed by /fileedit into a single
1488 ** SCRIPT tag.
1489 **
1490 ** TODO: a common mechanism which will let us bundle this type of
1491 ** blob into a single cacheable request.
1492 */
1493 static void fileedit_emit_js(void){
1494 style_emit_script_tag(0,0);
1495 style_emit_script_fossil_bootstrap(1);
1496 style_emit_script_builtin(1,0,"sbsdiff.js");
1497 style_emit_script_fetch(1,0);
1498 style_emit_script_tabs(1,0)/*also emits fossil.dom*/;
1499 style_emit_script_confirmer(1,0);
@@ -1503,11 +1500,10 @@
1503 ** used for dynamically toggling certain UI components on and off.
1504 ** Must come before fossil.page.fileedit.js.
1505 */
1506 ajax_emit_js_preview_modes(0);
1507 style_emit_script_builtin(1, 0, "fossil.page.fileedit.js");
1508 style_emit_script_tag(1,0);
1509 }
1510
1511 /*
1512 ** WEBPAGE: fileedit
1513 **
@@ -1974,11 +1970,11 @@
1974 blob_appendf(&endScript,");\n");
1975 }
1976
1977 blob_reset(&err);
1978 CheckinMiniInfo_cleanup(&cimi);
1979 fileedit_emit_js();
1980 if(blob_size(&endScript)>0){
1981 style_emit_script_tag(0,0);
1982 CX("\n(function(){\n");
1983 CX("try{\n%b}\n"
1984 "catch(e){"
1985
--- src/fileedit.c
+++ src/fileedit.c
@@ -1482,18 +1482,15 @@
1482 blob_reset(&manifest);
1483 CheckinMiniInfo_cleanup(&cimi);
1484 }
1485
1486 /*
1487 ** Emits all of the "core" static JS needed by /wikiedit into a single
1488 ** SCRIPT tag. Intended to be mapped to style.c:BundleEmitters with
1489 ** the name "fileedit.js".
 
 
1490 */
1491 void fileedit_emit_js_bundle(void){
 
1492 style_emit_script_fossil_bootstrap(1);
1493 style_emit_script_builtin(1,0,"sbsdiff.js");
1494 style_emit_script_fetch(1,0);
1495 style_emit_script_tabs(1,0)/*also emits fossil.dom*/;
1496 style_emit_script_confirmer(1,0);
@@ -1503,11 +1500,10 @@
1500 ** used for dynamically toggling certain UI components on and off.
1501 ** Must come before fossil.page.fileedit.js.
1502 */
1503 ajax_emit_js_preview_modes(0);
1504 style_emit_script_builtin(1, 0, "fossil.page.fileedit.js");
 
1505 }
1506
1507 /*
1508 ** WEBPAGE: fileedit
1509 **
@@ -1974,11 +1970,11 @@
1970 blob_appendf(&endScript,");\n");
1971 }
1972
1973 blob_reset(&err);
1974 CheckinMiniInfo_cleanup(&cimi);
1975 style_emit_script_builtin(0, 0, ":fileedit.js");
1976 if(blob_size(&endScript)>0){
1977 style_emit_script_tag(0,0);
1978 CX("\n(function(){\n");
1979 CX("try{\n%b}\n"
1980 "catch(e){"
1981
+8 -15
--- src/forum.c
+++ src/forum.c
@@ -749,25 +749,18 @@
749749
forumthread_delete(pThread);
750750
return target;
751751
}
752752
753753
/*
754
-** The first time this is called, it emits SCRIPT tags to load various
755
-** forum-related JavaScript. Ideally it should be called near the end
756
-** of the page, immediately before the call to style_footer() (which
757
-** closes the document's <BODY> and <HTML> tags). Calls after the first
758
-** are a no-op.
754
+** Callback for use with style.c:BundleEmitters. Emits all JS code
755
+** required by this page.
759756
*/
760
-static void forum_emit_page_js(){
761
- static int once = 0;
762
- if(0==once){
763
- once = 1;
764
- style_load_js("forum.js");
765
- style_emit_script_fossil_bootstrap(0);
766
- style_emit_script_dom(0, 1);
767
- style_emit_script_builtin(0, 1, "fossil.page.forumpost.js");
768
- }
757
+void forum_emit_js_bundle(void){
758
+ style_emit_script_builtin(1, 0, "forum.js");
759
+ style_emit_script_fossil_bootstrap(1);
760
+ style_emit_script_dom(1, 0);
761
+ style_emit_script_builtin(1, 0, "fossil.page.forumpost.js");
769762
}
770763
771764
/*
772765
** WEBPAGE: forumpost
773766
**
@@ -894,11 +887,11 @@
894887
}else{
895888
style_submenu_element("Chronological", "%R/%s/%s?t=c", g.zPath, zName);
896889
style_submenu_element("Unformatted", "%R/%s/%s?t=r", g.zPath, zName);
897890
forum_display_hierarchical(froot, fpid);
898891
}
899
- forum_emit_page_js();
892
+ style_emit_script_builtin(0, 0, ":forum.js");
900893
style_footer();
901894
}
902895
903896
/*
904897
** Return true if a forum post should be moderated.
905898
--- src/forum.c
+++ src/forum.c
@@ -749,25 +749,18 @@
749 forumthread_delete(pThread);
750 return target;
751 }
752
753 /*
754 ** The first time this is called, it emits SCRIPT tags to load various
755 ** forum-related JavaScript. Ideally it should be called near the end
756 ** of the page, immediately before the call to style_footer() (which
757 ** closes the document's <BODY> and <HTML> tags). Calls after the first
758 ** are a no-op.
759 */
760 static void forum_emit_page_js(){
761 static int once = 0;
762 if(0==once){
763 once = 1;
764 style_load_js("forum.js");
765 style_emit_script_fossil_bootstrap(0);
766 style_emit_script_dom(0, 1);
767 style_emit_script_builtin(0, 1, "fossil.page.forumpost.js");
768 }
769 }
770
771 /*
772 ** WEBPAGE: forumpost
773 **
@@ -894,11 +887,11 @@
894 }else{
895 style_submenu_element("Chronological", "%R/%s/%s?t=c", g.zPath, zName);
896 style_submenu_element("Unformatted", "%R/%s/%s?t=r", g.zPath, zName);
897 forum_display_hierarchical(froot, fpid);
898 }
899 forum_emit_page_js();
900 style_footer();
901 }
902
903 /*
904 ** Return true if a forum post should be moderated.
905
--- src/forum.c
+++ src/forum.c
@@ -749,25 +749,18 @@
749 forumthread_delete(pThread);
750 return target;
751 }
752
753 /*
754 ** Callback for use with style.c:BundleEmitters. Emits all JS code
755 ** required by this page.
 
 
 
756 */
757 void forum_emit_js_bundle(void){
758 style_emit_script_builtin(1, 0, "forum.js");
759 style_emit_script_fossil_bootstrap(1);
760 style_emit_script_dom(1, 0);
761 style_emit_script_builtin(1, 0, "fossil.page.forumpost.js");
 
 
 
 
762 }
763
764 /*
765 ** WEBPAGE: forumpost
766 **
@@ -894,11 +887,11 @@
887 }else{
888 style_submenu_element("Chronological", "%R/%s/%s?t=c", g.zPath, zName);
889 style_submenu_element("Unformatted", "%R/%s/%s?t=r", g.zPath, zName);
890 forum_display_hierarchical(froot, fpid);
891 }
892 style_emit_script_builtin(0, 0, ":forum.js");
893 style_footer();
894 }
895
896 /*
897 ** Return true if a forum post should be moderated.
898
+1 -1
--- src/forum.js
+++ src/forum.js
@@ -14,6 +14,6 @@
1414
var h = x[0].scrollHeight;
1515
var y = absoluteY(x[0]);
1616
if( w>h ) y = y + (h-w)/2;
1717
if( y>0 ) window.scrollTo(0, y);
1818
}
19
-})()
19
+})();
2020
--- src/forum.js
+++ src/forum.js
@@ -14,6 +14,6 @@
14 var h = x[0].scrollHeight;
15 var y = absoluteY(x[0]);
16 if( w>h ) y = y + (h-w)/2;
17 if( y>0 ) window.scrollTo(0, y);
18 }
19 })()
20
--- src/forum.js
+++ src/forum.js
@@ -14,6 +14,6 @@
14 var h = x[0].scrollHeight;
15 var y = absoluteY(x[0]);
16 if( w>h ) y = y + (h-w)/2;
17 if( y>0 ) window.scrollTo(0, y);
18 }
19 })();
20
+76 -6
--- src/style.c
+++ src/style.c
@@ -1126,28 +1126,90 @@
11261126
Th_Render(blob_str(&css));
11271127
11281128
/* Tell CGI that the content returned by this page is considered cacheable */
11291129
g.isConst = 1;
11301130
}
1131
+
1132
+/*
1133
+** Maps a "bundle" name to a callback which emits the text of that
1134
+** bundle. For use in consolidating scripts for certain pages into a
1135
+** single cacheable request.
1136
+*/
1137
+typedef struct {
1138
+ const char * zName; /* Name of the bundle (maps to /builtin/:NAME) */
1139
+ void (*xEmit)(void); /* Emits amalgamated text output for this
1140
+ bundle */
1141
+} BundleEmitter;
1142
+/*
1143
+** Map each required bundle here...
1144
+*/
1145
+static const BundleEmitter BundleEmitters[] = {
1146
+/* Keep these sorted for bsearch() */
1147
+{"fileedit.js", fileedit_emit_js_bundle},
1148
+{"forum.js", forum_emit_js_bundle},
1149
+{"wikiedit.js", wikiedit_emit_js_bundle}
1150
+};
1151
+
1152
+/*
1153
+** Comparison function for bsearch() for searching a BundleEmitter
1154
+** list for a matching name.
1155
+*/
1156
+static int cmp_builtin_bundle_name(const void *a, const void *b){
1157
+ const BundleEmitter * rA = (const BundleEmitter*)a;
1158
+ const BundleEmitter * rB = (const BundleEmitter*)b;
1159
+ return fossil_strcmp(rA->zName, rB->zName);
1160
+}
1161
+
1162
+/*
1163
+** Internal helper for /builtin/FILENAME for dispatching "bundles"
1164
+** of amalgamated text (primarily JS) code.
1165
+**
1166
+** Returns true if it finds a bundle matcing the given name, else
1167
+** false. On success it outputs the amalgamated bundle without any
1168
+** sort of wrapper, e.g. SCRIPT tag
1169
+*/
1170
+static int page_builtin_text_bundle(const char * zFilename){
1171
+ const BundleEmitter * pBH;
1172
+ BundleEmitter needle = {zFilename, 0};
1173
+
1174
+ pBH = (const BundleEmitter *)bsearch(&needle, BundleEmitters,
1175
+ count(BundleEmitters),
1176
+ sizeof BundleEmitters[0],
1177
+ cmp_builtin_bundle_name);
1178
+ if(pBH!=0){
1179
+ pBH->xEmit();
1180
+ }
1181
+ return pBH!=0;
1182
+}
11311183
11321184
/*
11331185
** WEBPAGE: builtin
11341186
** URL: builtin/FILENAME
11351187
**
11361188
** Return the built-in text given by FILENAME. This is used internally
11371189
** by many Fossil web pages to load built-in javascript files.
11381190
**
1139
-** If the id= query parameter is present, then Fossil assumes that the
1140
-** result is immutable and sets a very large cache retention time (1 year).
1191
+** If the id= or cache= query parameter is present, then Fossil
1192
+** assumes that the result is immutable and sets a very large cache
1193
+** retention time (1 year).
11411194
*/
11421195
void page_builtin_text(void){
11431196
Blob out;
11441197
const char *zName = P("name");
11451198
const char *zTxt = 0;
1146
- const char *zId = P("id");
1199
+ const char *zId = PD("id",P("cache"));
11471200
int nId;
1148
- if( zName ) zTxt = builtin_text(zName);
1201
+ int isBundle = 0;
1202
+
1203
+ if( zName ){
1204
+ if(':'==zName[0]){
1205
+ isBundle = 1;
1206
+ zTxt = page_builtin_text_bundle(zName+1) ? "" : NULL;
1207
+ }else{
1208
+ zTxt = builtin_text(zName);
1209
+ }
1210
+ }
11491211
if( zTxt==0 ){
11501212
cgi_set_status(404, "Not Found");
11511213
@ File "%h(zName)" not found
11521214
return;
11531215
}
@@ -1159,12 +1221,14 @@
11591221
if( zId && (nId = (int)strlen(zId))>=8 && strncmp(zId,MANIFEST_UUID,nId)==0 ){
11601222
g.isConst = 1;
11611223
}else{
11621224
etag_check(0,0);
11631225
}
1164
- blob_init(&out, zTxt, -1);
1165
- cgi_set_content(&out);
1226
+ if(isBundle==0){
1227
+ blob_init(&out, zTxt, -1);
1228
+ cgi_set_content(&out);
1229
+ }
11661230
}
11671231
11681232
/*
11691233
** All possible capabilities
11701234
*/
@@ -1640,11 +1704,17 @@
16401704
** build-time-dependent cache-buster value.
16411705
*/
16421706
void style_emit_script_builtin(int asInline, int addScripTag,
16431707
char const * zName){
16441708
if(asInline){
1709
+ if(addScripTag){
1710
+ style_emit_script_tag(0,0);
1711
+ }
16451712
CX("%s", builtin_text(zName));
1713
+ if(addScripTag){
1714
+ style_emit_script_tag(1,0);
1715
+ }
16461716
}else{
16471717
char * zFullName = mprintf("builtin/%s",zName);
16481718
const char * zHash = fossil_exe_id();
16491719
CX("<script src='%R/%T?cache=%.8s'></script>\n",
16501720
zFullName, zHash);
16511721
--- src/style.c
+++ src/style.c
@@ -1126,28 +1126,90 @@
1126 Th_Render(blob_str(&css));
1127
1128 /* Tell CGI that the content returned by this page is considered cacheable */
1129 g.isConst = 1;
1130 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1131
1132 /*
1133 ** WEBPAGE: builtin
1134 ** URL: builtin/FILENAME
1135 **
1136 ** Return the built-in text given by FILENAME. This is used internally
1137 ** by many Fossil web pages to load built-in javascript files.
1138 **
1139 ** If the id= query parameter is present, then Fossil assumes that the
1140 ** result is immutable and sets a very large cache retention time (1 year).
 
1141 */
1142 void page_builtin_text(void){
1143 Blob out;
1144 const char *zName = P("name");
1145 const char *zTxt = 0;
1146 const char *zId = P("id");
1147 int nId;
1148 if( zName ) zTxt = builtin_text(zName);
 
 
 
 
 
 
 
 
 
1149 if( zTxt==0 ){
1150 cgi_set_status(404, "Not Found");
1151 @ File "%h(zName)" not found
1152 return;
1153 }
@@ -1159,12 +1221,14 @@
1159 if( zId && (nId = (int)strlen(zId))>=8 && strncmp(zId,MANIFEST_UUID,nId)==0 ){
1160 g.isConst = 1;
1161 }else{
1162 etag_check(0,0);
1163 }
1164 blob_init(&out, zTxt, -1);
1165 cgi_set_content(&out);
 
 
1166 }
1167
1168 /*
1169 ** All possible capabilities
1170 */
@@ -1640,11 +1704,17 @@
1640 ** build-time-dependent cache-buster value.
1641 */
1642 void style_emit_script_builtin(int asInline, int addScripTag,
1643 char const * zName){
1644 if(asInline){
 
 
 
1645 CX("%s", builtin_text(zName));
 
 
 
1646 }else{
1647 char * zFullName = mprintf("builtin/%s",zName);
1648 const char * zHash = fossil_exe_id();
1649 CX("<script src='%R/%T?cache=%.8s'></script>\n",
1650 zFullName, zHash);
1651
--- src/style.c
+++ src/style.c
@@ -1126,28 +1126,90 @@
1126 Th_Render(blob_str(&css));
1127
1128 /* Tell CGI that the content returned by this page is considered cacheable */
1129 g.isConst = 1;
1130 }
1131
1132 /*
1133 ** Maps a "bundle" name to a callback which emits the text of that
1134 ** bundle. For use in consolidating scripts for certain pages into a
1135 ** single cacheable request.
1136 */
1137 typedef struct {
1138 const char * zName; /* Name of the bundle (maps to /builtin/:NAME) */
1139 void (*xEmit)(void); /* Emits amalgamated text output for this
1140 bundle */
1141 } BundleEmitter;
1142 /*
1143 ** Map each required bundle here...
1144 */
1145 static const BundleEmitter BundleEmitters[] = {
1146 /* Keep these sorted for bsearch() */
1147 {"fileedit.js", fileedit_emit_js_bundle},
1148 {"forum.js", forum_emit_js_bundle},
1149 {"wikiedit.js", wikiedit_emit_js_bundle}
1150 };
1151
1152 /*
1153 ** Comparison function for bsearch() for searching a BundleEmitter
1154 ** list for a matching name.
1155 */
1156 static int cmp_builtin_bundle_name(const void *a, const void *b){
1157 const BundleEmitter * rA = (const BundleEmitter*)a;
1158 const BundleEmitter * rB = (const BundleEmitter*)b;
1159 return fossil_strcmp(rA->zName, rB->zName);
1160 }
1161
1162 /*
1163 ** Internal helper for /builtin/FILENAME for dispatching "bundles"
1164 ** of amalgamated text (primarily JS) code.
1165 **
1166 ** Returns true if it finds a bundle matcing the given name, else
1167 ** false. On success it outputs the amalgamated bundle without any
1168 ** sort of wrapper, e.g. SCRIPT tag
1169 */
1170 static int page_builtin_text_bundle(const char * zFilename){
1171 const BundleEmitter * pBH;
1172 BundleEmitter needle = {zFilename, 0};
1173
1174 pBH = (const BundleEmitter *)bsearch(&needle, BundleEmitters,
1175 count(BundleEmitters),
1176 sizeof BundleEmitters[0],
1177 cmp_builtin_bundle_name);
1178 if(pBH!=0){
1179 pBH->xEmit();
1180 }
1181 return pBH!=0;
1182 }
1183
1184 /*
1185 ** WEBPAGE: builtin
1186 ** URL: builtin/FILENAME
1187 **
1188 ** Return the built-in text given by FILENAME. This is used internally
1189 ** by many Fossil web pages to load built-in javascript files.
1190 **
1191 ** If the id= or cache= query parameter is present, then Fossil
1192 ** assumes that the result is immutable and sets a very large cache
1193 ** retention time (1 year).
1194 */
1195 void page_builtin_text(void){
1196 Blob out;
1197 const char *zName = P("name");
1198 const char *zTxt = 0;
1199 const char *zId = PD("id",P("cache"));
1200 int nId;
1201 int isBundle = 0;
1202
1203 if( zName ){
1204 if(':'==zName[0]){
1205 isBundle = 1;
1206 zTxt = page_builtin_text_bundle(zName+1) ? "" : NULL;
1207 }else{
1208 zTxt = builtin_text(zName);
1209 }
1210 }
1211 if( zTxt==0 ){
1212 cgi_set_status(404, "Not Found");
1213 @ File "%h(zName)" not found
1214 return;
1215 }
@@ -1159,12 +1221,14 @@
1221 if( zId && (nId = (int)strlen(zId))>=8 && strncmp(zId,MANIFEST_UUID,nId)==0 ){
1222 g.isConst = 1;
1223 }else{
1224 etag_check(0,0);
1225 }
1226 if(isBundle==0){
1227 blob_init(&out, zTxt, -1);
1228 cgi_set_content(&out);
1229 }
1230 }
1231
1232 /*
1233 ** All possible capabilities
1234 */
@@ -1640,11 +1704,17 @@
1704 ** build-time-dependent cache-buster value.
1705 */
1706 void style_emit_script_builtin(int asInline, int addScripTag,
1707 char const * zName){
1708 if(asInline){
1709 if(addScripTag){
1710 style_emit_script_tag(0,0);
1711 }
1712 CX("%s", builtin_text(zName));
1713 if(addScripTag){
1714 style_emit_script_tag(1,0);
1715 }
1716 }else{
1717 char * zFullName = mprintf("builtin/%s",zName);
1718 const char * zHash = fossil_exe_id();
1719 CX("<script src='%R/%T?cache=%.8s'></script>\n",
1720 zFullName, zHash);
1721
+4 -8
--- src/wiki.c
+++ src/wiki.c
@@ -1061,25 +1061,21 @@
10611061
pRoute->xCallback();
10621062
}
10631063
10641064
/*
10651065
** Emits all of the "core" static JS needed by /wikiedit into a single
1066
-** SCRIPT tag.
1067
-**
1068
-** TODO: a common mechanism which will let us bundle this type of
1069
-** blob into a single cacheable request.
1066
+** SCRIPT tag. Intended to be mapped to style.c:BundleEmitters with
1067
+** the name "wikiedit.js".
10701068
*/
1071
-static void wikiedit_emit_js(void){
1072
- style_emit_script_tag(0,0);
1069
+void wikiedit_emit_js_bundle(void){
10731070
style_emit_script_fossil_bootstrap(1);
10741071
style_emit_script_builtin(1,0,"sbsdiff.js");
10751072
style_emit_script_fetch(1, 0);
10761073
style_emit_script_tabs(1,0)/*also emits fossil.dom*/;
10771074
style_emit_script_confirmer(1,0);
10781075
style_emit_script_builtin(1, 0, "fossil.storage.js");
10791076
style_emit_script_builtin(1, 0, "fossil.page.wikiedit.js");
1080
- style_emit_script_tag(1,0);
10811077
}
10821078
10831079
/*
10841080
** WEBPAGE: wikiedit
10851081
** URL: /wikedit?name=PAGENAME
@@ -1263,11 +1259,11 @@
12631259
CX("<hr><h3>Wiki Name Rules</h3>");
12641260
well_formed_wiki_name_rules();
12651261
CX("</div>"/*#wikiedit-tab-save*/);
12661262
}
12671263
1268
- wikiedit_emit_js();
1264
+ style_emit_script_builtin(0, 0, ":wikiedit.js");
12691265
12701266
/* Dynamically populate the editor... */
12711267
style_emit_script_tag(0,0);
12721268
CX("\nfossil.onPageLoad(function(){\n");
12731269
CX("const P = fossil.page;\n"
12741270
--- src/wiki.c
+++ src/wiki.c
@@ -1061,25 +1061,21 @@
1061 pRoute->xCallback();
1062 }
1063
1064 /*
1065 ** Emits all of the "core" static JS needed by /wikiedit into a single
1066 ** SCRIPT tag.
1067 **
1068 ** TODO: a common mechanism which will let us bundle this type of
1069 ** blob into a single cacheable request.
1070 */
1071 static void wikiedit_emit_js(void){
1072 style_emit_script_tag(0,0);
1073 style_emit_script_fossil_bootstrap(1);
1074 style_emit_script_builtin(1,0,"sbsdiff.js");
1075 style_emit_script_fetch(1, 0);
1076 style_emit_script_tabs(1,0)/*also emits fossil.dom*/;
1077 style_emit_script_confirmer(1,0);
1078 style_emit_script_builtin(1, 0, "fossil.storage.js");
1079 style_emit_script_builtin(1, 0, "fossil.page.wikiedit.js");
1080 style_emit_script_tag(1,0);
1081 }
1082
1083 /*
1084 ** WEBPAGE: wikiedit
1085 ** URL: /wikedit?name=PAGENAME
@@ -1263,11 +1259,11 @@
1263 CX("<hr><h3>Wiki Name Rules</h3>");
1264 well_formed_wiki_name_rules();
1265 CX("</div>"/*#wikiedit-tab-save*/);
1266 }
1267
1268 wikiedit_emit_js();
1269
1270 /* Dynamically populate the editor... */
1271 style_emit_script_tag(0,0);
1272 CX("\nfossil.onPageLoad(function(){\n");
1273 CX("const P = fossil.page;\n"
1274
--- src/wiki.c
+++ src/wiki.c
@@ -1061,25 +1061,21 @@
1061 pRoute->xCallback();
1062 }
1063
1064 /*
1065 ** Emits all of the "core" static JS needed by /wikiedit into a single
1066 ** SCRIPT tag. Intended to be mapped to style.c:BundleEmitters with
1067 ** the name "wikiedit.js".
 
 
1068 */
1069 void wikiedit_emit_js_bundle(void){
 
1070 style_emit_script_fossil_bootstrap(1);
1071 style_emit_script_builtin(1,0,"sbsdiff.js");
1072 style_emit_script_fetch(1, 0);
1073 style_emit_script_tabs(1,0)/*also emits fossil.dom*/;
1074 style_emit_script_confirmer(1,0);
1075 style_emit_script_builtin(1, 0, "fossil.storage.js");
1076 style_emit_script_builtin(1, 0, "fossil.page.wikiedit.js");
 
1077 }
1078
1079 /*
1080 ** WEBPAGE: wikiedit
1081 ** URL: /wikedit?name=PAGENAME
@@ -1263,11 +1259,11 @@
1259 CX("<hr><h3>Wiki Name Rules</h3>");
1260 well_formed_wiki_name_rules();
1261 CX("</div>"/*#wikiedit-tab-save*/);
1262 }
1263
1264 style_emit_script_builtin(0, 0, ":wikiedit.js");
1265
1266 /* Dynamically populate the editor... */
1267 style_emit_script_tag(0,0);
1268 CX("\nfossil.onPageLoad(function(){\n");
1269 CX("const P = fossil.page;\n"
1270

Keyboard Shortcuts

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