Fossil SCM

Change the name of "main.js" to "href.js". Rework the javascript code so that there can be multiple javascript files sourced on an as-needed basis.

drh 2017-12-05 15:09 trunk
Commit 09494b0207e4f2a55f02ef25a1a21845f660588f40e43e052447304c408e47a5
+5 -8
--- a/src/href.js
+++ b/src/href.js
@@ -1,7 +1,3 @@
1
-/* This script is sourced just prior to the </body> in every Fossil webpage */
2
-var x.hasAttribute("data-hrById("page-data");
3
-object OperaisOperaMini){
4
- docume
51
/* As an anti-robot defense, <a> edelay
62
**antiRobot = 7;
73
var j = anchors[i];
@@ -25,10 +21,11 @@
2521
x = document.getElementById("href-data");
2622
var jx = x.textContent || x.innerText;
2723
var g = JSON.parse(jx);
28
- if(g.antibot.enable){ent.getElementByTagName("body")[0] }
24
+ var isOperaMini =
25
+ Object.prototype.toString.call(window.operamini)==="[object OperaMini]";
26
+ if(g.mouseover && !isOperaMini){
27
+ document.getElementByTagName("body")[0] }
2928
}else
3029
}
3130
32
-"setAllHrefs();","setAllHrefs();antibotantibotantibot.delay);
33
- }
34
-}
31
+"setAllHrefs();","setAllHrefs();",
--- a/src/href.js
+++ b/src/href.js
@@ -1,7 +1,3 @@
1 /* This script is sourced just prior to the </body> in every Fossil webpage */
2 var x.hasAttribute("data-hrById("page-data");
3 object OperaisOperaMini){
4 docume
5 /* As an anti-robot defense, <a> edelay
6 **antiRobot = 7;
7 var j = anchors[i];
@@ -25,10 +21,11 @@
25 x = document.getElementById("href-data");
26 var jx = x.textContent || x.innerText;
27 var g = JSON.parse(jx);
28 if(g.antibot.enable){ent.getElementByTagName("body")[0] }
 
 
 
29 }else
30 }
31
32 "setAllHrefs();","setAllHrefs();antibotantibotantibot.delay);
33 }
34 }
--- a/src/href.js
+++ b/src/href.js
@@ -1,7 +1,3 @@
 
 
 
 
1 /* As an anti-robot defense, <a> edelay
2 **antiRobot = 7;
3 var j = anchors[i];
@@ -25,10 +21,11 @@
21 x = document.getElementById("href-data");
22 var jx = x.textContent || x.innerText;
23 var g = JSON.parse(jx);
24 var isOperaMini =
25 Object.prototype.toString.call(window.operamini)==="[object OperaMini]";
26 if(g.mouseover && !isOperaMini){
27 document.getElementByTagName("body")[0] }
28 }else
29 }
30
31 "setAllHrefs();","setAllHrefs();",
 
 
D src/main.js
-34
--- a/src/main.js
+++ b/src/main.js
@@ -1,34 +0,0 @@
1
-/* This script is sourced just prior to the </body> in every Fossil webpage */
2
-var x.hasAttribute("data-hrById("page-data");
3
-object OperaisOperaMini){
4
- docume
5
-/* As an anti-robot defense, <a> edelay
6
-**antiRobot = 7;
7
-var j = anchors[i];
8
-}
9
-e/* As an anti-robot defense, <a> evar antiRobotBodybody")[0]antiRobotBantiRobotBantiRobotBantiRobotBOnce = 0;SetAllHrefs(){
10
- if( antiRobotOnce ) return;
11
- antiRobotOnce = 1SetMouseEventHandler(){
12
- antiRobotSetAllHrefs();
13
- setTimeout(antiRobotSetMouseEventHandler, g.delay);
14
- }else{
15
- setTimeout(antiRobotSetAllHrefs, g.delay(var i=0; i<anchors.length; i++){
16
- var j = anchors[i];
17
- if(j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
18
- }
19
- var forms = document.getElementsByTagName("form");
20
- for(var i=0; i<forms.length; i++){
21
- var j = forms[i];
22
- if(j.hasAttribute("data-action")) j.action=j.getAttribute("data-action");
23
- }
24
-}
25
-x = document.getElementById("href-data");
26
- var jx = x.textContent || x.innerText;
27
- var g = JSON.parse(jx);
28
- if(g.antibot.enable){ent.getElementByTagName("body")[0] }
29
- }else
30
-}
31
-
32
-"setAllHrefs();","setAllHrefs();antibotantibotantibot.delay);
33
- }
34
-}
--- a/src/main.js
+++ b/src/main.js
@@ -1,34 +0,0 @@
1 /* This script is sourced just prior to the </body> in every Fossil webpage */
2 var x.hasAttribute("data-hrById("page-data");
3 object OperaisOperaMini){
4 docume
5 /* As an anti-robot defense, <a> edelay
6 **antiRobot = 7;
7 var j = anchors[i];
8 }
9 e/* As an anti-robot defense, <a> evar antiRobotBodybody")[0]antiRobotBantiRobotBantiRobotBantiRobotBOnce = 0;SetAllHrefs(){
10 if( antiRobotOnce ) return;
11 antiRobotOnce = 1SetMouseEventHandler(){
12 antiRobotSetAllHrefs();
13 setTimeout(antiRobotSetMouseEventHandler, g.delay);
14 }else{
15 setTimeout(antiRobotSetAllHrefs, g.delay(var i=0; i<anchors.length; i++){
16 var j = anchors[i];
17 if(j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
18 }
19 var forms = document.getElementsByTagName("form");
20 for(var i=0; i<forms.length; i++){
21 var j = forms[i];
22 if(j.hasAttribute("data-action")) j.action=j.getAttribute("data-action");
23 }
24 }
25 x = document.getElementById("href-data");
26 var jx = x.textContent || x.innerText;
27 var g = JSON.parse(jx);
28 if(g.antibot.enable){ent.getElementByTagName("body")[0] }
29 }else
30 }
31
32 "setAllHrefs();","setAllHrefs();antibotantibotantibot.delay);
33 }
34 }
--- a/src/main.js
+++ b/src/main.js
@@ -1,34 +0,0 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
+1 -1
--- src/main.mk
+++ src/main.mk
@@ -194,11 +194,11 @@
194194
$(SRCDIR)/../skins/xekri/css.txt \
195195
$(SRCDIR)/../skins/xekri/details.txt \
196196
$(SRCDIR)/../skins/xekri/footer.txt \
197197
$(SRCDIR)/../skins/xekri/header.txt \
198198
$(SRCDIR)/diff.tcl \
199
- $(SRCDIR)/main.js \
199
+ $(SRCDIR)/href.js \
200200
$(SRCDIR)/markdown.md \
201201
$(SRCDIR)/wiki.wiki
202202
203203
TRANS_SRC = \
204204
$(OBJDIR)/add_.c \
205205
--- src/main.mk
+++ src/main.mk
@@ -194,11 +194,11 @@
194 $(SRCDIR)/../skins/xekri/css.txt \
195 $(SRCDIR)/../skins/xekri/details.txt \
196 $(SRCDIR)/../skins/xekri/footer.txt \
197 $(SRCDIR)/../skins/xekri/header.txt \
198 $(SRCDIR)/diff.tcl \
199 $(SRCDIR)/main.js \
200 $(SRCDIR)/markdown.md \
201 $(SRCDIR)/wiki.wiki
202
203 TRANS_SRC = \
204 $(OBJDIR)/add_.c \
205
--- src/main.mk
+++ src/main.mk
@@ -194,11 +194,11 @@
194 $(SRCDIR)/../skins/xekri/css.txt \
195 $(SRCDIR)/../skins/xekri/details.txt \
196 $(SRCDIR)/../skins/xekri/footer.txt \
197 $(SRCDIR)/../skins/xekri/header.txt \
198 $(SRCDIR)/diff.tcl \
199 $(SRCDIR)/href.js \
200 $(SRCDIR)/markdown.md \
201 $(SRCDIR)/wiki.wiki
202
203 TRANS_SRC = \
204 $(OBJDIR)/add_.c \
205
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -160,11 +160,11 @@
160160
#
161161
set extra_files {
162162
diff.tcl
163163
markdown.md
164164
wiki.wiki
165
- main.js
165
+ *.js
166166
../skins/*/*.txt
167167
}
168168
169169
# Options used to compile the included SQLite library.
170170
#
171171
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -160,11 +160,11 @@
160 #
161 set extra_files {
162 diff.tcl
163 markdown.md
164 wiki.wiki
165 main.js
166 ../skins/*/*.txt
167 }
168
169 # Options used to compile the included SQLite library.
170 #
171
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -160,11 +160,11 @@
160 #
161 set extra_files {
162 diff.tcl
163 markdown.md
164 wiki.wiki
165 *.js
166 ../skins/*/*.txt
167 }
168
169 # Options used to compile the included SQLite library.
170 #
171
+69 -27
--- src/style.c
+++ src/style.c
@@ -83,10 +83,15 @@
8383
/*
8484
** Ad-unit styles.
8585
*/
8686
static unsigned adUnitFlags = 0;
8787
88
+/*
89
+** True if the "href.js" javascript file is required.
90
+*/
91
+static int needHrefJs = 0;
92
+
8893
8994
/*
9095
** Generate and return a anchor tag like this:
9196
**
9297
** <a href="URL">
@@ -138,10 +143,11 @@
138143
if( g.perm.Hyperlink && !g.javascriptHyperlink ){
139144
char *zHUrl = mprintf("<a %s href=\"%h\">", zExtra, zUrl);
140145
fossil_free(zUrl);
141146
return zHUrl;
142147
}
148
+ needHrefJs = 1;
143149
return mprintf("<a %s data-href='%z' href='%R/honeypot'>",
144150
zExtra, zUrl);
145151
}
146152
char *chref(const char *zExtra, const char *zFormat, ...){
147153
char *zUrl;
@@ -152,10 +158,11 @@
152158
if( g.perm.Hyperlink && !g.javascriptHyperlink ){
153159
char *zHUrl = mprintf("<a %s href=\"%h\">", zExtra, zUrl);
154160
fossil_free(zUrl);
155161
return zHUrl;
156162
}
163
+ needHrefJs = 1;
157164
return mprintf("<a class='%s' data-href='%z' href='%R/honeypot'>",
158165
zExtra, zUrl);
159166
}
160167
char *href(const char *zFormat, ...){
161168
char *zUrl;
@@ -166,10 +173,11 @@
166173
if( g.perm.Hyperlink && !g.javascriptHyperlink ){
167174
char *zHUrl = mprintf("<a href=\"%h\">", zUrl);
168175
fossil_free(zUrl);
169176
return zHUrl;
170177
}
178
+ needHrefJs = 1;
171179
return mprintf("<a data-href='%s' href='%R/honeypot'>",
172180
zUrl);
173181
}
174182
175183
/*
@@ -184,10 +192,11 @@
184192
zLink = vmprintf(zAction, ap);
185193
va_end(ap);
186194
if( g.perm.Hyperlink && !g.javascriptHyperlink ){
187195
@ <form method="POST" action="%z(zLink)" %s(zOtherArgs)>
188196
}else{
197
+ needHrefJs = 1;
189198
@ <form method="POST" data-action='%s(zLink)' action='%R/login' \
190199
@ %s(zOtherArgs)>
191200
}
192201
}
193202
@@ -503,10 +512,33 @@
503512
}else if( !fossil_all_whitespace(zAd = db_get("adunit",0)) ){
504513
return zAd;
505514
}
506515
return 0;
507516
}
517
+
518
+/*
519
+** Generate code to load a single javascript file
520
+*/
521
+static void style_load_one_js_file(const char *zFile){
522
+ @ <script src='%R/builtin/%s(zFile)/%S(MANIFEST_UUID)'></script>
523
+}
524
+
525
+/*
526
+** Generate code to load all required javascript files.
527
+*/
528
+static void style_load_all_js_files(void){
529
+ if( needHrefJs ){
530
+ int nDelay = db_get_int("auto-hyperlink-delay",0);
531
+ int bMouseover;
532
+ /* Load up the page data */
533
+ bMouseover = (!g.isHuman || db_get_boolean("auto-hyperlink-ishuman",0))
534
+ && db_get_boolean("auto-hyperlink-mouseover",0);
535
+ @ <script id='href-data' type='application/json'>\
536
+ @ {"delay":%d(nDelay),"mouseover":%d(bMouseover)}</script>
537
+ style_load_one_js_file("href.js");
538
+ }
539
+}
508540
509541
/*
510542
** Draw the footer at the bottom of the page.
511543
*/
512544
void style_footer(void){
@@ -662,32 +694,15 @@
662694
*/
663695
@ <div class="endContent"></div>
664696
}
665697
@ </div>
666698
667
- /* Load up the page data */
668
- @ <script id='page-data' type='application/json'>
669
- if( !g.javascriptHyperlink ){
670
- @ {"antibot":{"enable":0},
671
- }else{
672
- int nDelay = db_get_int("auto-hyperlink-delay",0);
673
- int bMouseover;
674
- bMouseover = (!g.isHuman || db_get_boolean("auto-hyperlink-ishuman",0))
675
- && db_get_boolean("auto-hyperlink-mouseover",0);
676
- @ {"antibot":
677
- @ {"enable":1,
678
- @ "delay":%d(nDelay),
679
- @ "mouseover":%d(bMouseover)},
680
- }
681
- @ "noop":0}
682
- @ </script>
683699
684700
685701
zFooter = skin_get("footer");
686702
if( sqlite3_strlike("%</body>%", zFooter, 0)==0 ){
687
- @ <script src='%s(g.zBaseURL)/main.js/%S(MANIFEST_UUID)' \
688
- @ type='application/javascript'></script>
703
+ style_load_all_js_files();
689704
}
690705
if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
691706
Th_Render(zFooter);
692707
if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
693708
@@ -698,12 +713,11 @@
698713
cgi_append_content("</span>\n", -1);
699714
}
700715
701716
/* Add document end mark if it was not in the footer */
702717
if( sqlite3_strlike("%</body>%", zFooter, 0)!=0 ){
703
- @ <script src='%s(g.zBaseURL)/main.js/%S(MANIFEST_UUID)' \
704
- @ type='application/javascript'></script>
718
+ style_load_all_js_files();
705719
@ </body>
706720
@ </html>
707721
}
708722
}
709723
@@ -837,19 +851,47 @@
837851
/* Tell CGI that the content returned by this page is considered cacheable */
838852
g.isConst = 1;
839853
}
840854
841855
/*
842
-** WEBPAGE: main.js
856
+** WEBPAGE: builtin
857
+** URL: builtin/FILENAME/VERSION
858
+**
859
+** Return the built-in text given by FILENAME. This is used internally
860
+** by many Fossil web pages to load built-in javascript files.
843861
**
844
-** Return the javascript
862
+** The VERSION string at the end is ignored. Fossil web pages will
863
+** typically put the current Fossil check-in hash as VERSION, to cause
864
+** javascript files to be reloaded rather than sourcing a stale javascript
865
+** file from cache.
845866
*/
846
-void page_main_js(void){
847
- Blob mainjs;
848
- cgi_set_content_type("application/javascript");
849
- blob_init(&mainjs, builtin_text("main.js"), -1);
850
- cgi_set_content(&mainjs);
867
+void page_builtin_text(void){
868
+ Blob out;
869
+ const char *zName = P("name");
870
+ const char *zTxt = 0;
871
+ if( zName ){
872
+ int i;
873
+ for(i=0; zName[i]; i++){
874
+ if( zName[i]=='/' ){
875
+ zName = mprintf("%.*s", i, zName);
876
+ break;
877
+ }
878
+ }
879
+ zTxt = builtin_text(zName);
880
+ }
881
+ if( zTxt==0 ){
882
+ cgi_set_status(404, "Not Found");
883
+ @ File \"%h(zName)\" not found
884
+ return;
885
+ }
886
+ if( sqlite3_strglob("*.js", zName)==0 ){
887
+ cgi_set_content_type("application/javascript");
888
+ }else{
889
+ cgi_set_content_type("text/plain");
890
+ }
891
+ blob_init(&out, zTxt, -1);
892
+ cgi_set_content(&out);
851893
g.isConst = 1;
852894
}
853895
854896
855897
/*
856898
--- src/style.c
+++ src/style.c
@@ -83,10 +83,15 @@
83 /*
84 ** Ad-unit styles.
85 */
86 static unsigned adUnitFlags = 0;
87
 
 
 
 
 
88
89 /*
90 ** Generate and return a anchor tag like this:
91 **
92 ** <a href="URL">
@@ -138,10 +143,11 @@
138 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
139 char *zHUrl = mprintf("<a %s href=\"%h\">", zExtra, zUrl);
140 fossil_free(zUrl);
141 return zHUrl;
142 }
 
143 return mprintf("<a %s data-href='%z' href='%R/honeypot'>",
144 zExtra, zUrl);
145 }
146 char *chref(const char *zExtra, const char *zFormat, ...){
147 char *zUrl;
@@ -152,10 +158,11 @@
152 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
153 char *zHUrl = mprintf("<a %s href=\"%h\">", zExtra, zUrl);
154 fossil_free(zUrl);
155 return zHUrl;
156 }
 
157 return mprintf("<a class='%s' data-href='%z' href='%R/honeypot'>",
158 zExtra, zUrl);
159 }
160 char *href(const char *zFormat, ...){
161 char *zUrl;
@@ -166,10 +173,11 @@
166 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
167 char *zHUrl = mprintf("<a href=\"%h\">", zUrl);
168 fossil_free(zUrl);
169 return zHUrl;
170 }
 
171 return mprintf("<a data-href='%s' href='%R/honeypot'>",
172 zUrl);
173 }
174
175 /*
@@ -184,10 +192,11 @@
184 zLink = vmprintf(zAction, ap);
185 va_end(ap);
186 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
187 @ <form method="POST" action="%z(zLink)" %s(zOtherArgs)>
188 }else{
 
189 @ <form method="POST" data-action='%s(zLink)' action='%R/login' \
190 @ %s(zOtherArgs)>
191 }
192 }
193
@@ -503,10 +512,33 @@
503 }else if( !fossil_all_whitespace(zAd = db_get("adunit",0)) ){
504 return zAd;
505 }
506 return 0;
507 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
509 /*
510 ** Draw the footer at the bottom of the page.
511 */
512 void style_footer(void){
@@ -662,32 +694,15 @@
662 */
663 @ <div class="endContent"></div>
664 }
665 @ </div>
666
667 /* Load up the page data */
668 @ <script id='page-data' type='application/json'>
669 if( !g.javascriptHyperlink ){
670 @ {"antibot":{"enable":0},
671 }else{
672 int nDelay = db_get_int("auto-hyperlink-delay",0);
673 int bMouseover;
674 bMouseover = (!g.isHuman || db_get_boolean("auto-hyperlink-ishuman",0))
675 && db_get_boolean("auto-hyperlink-mouseover",0);
676 @ {"antibot":
677 @ {"enable":1,
678 @ "delay":%d(nDelay),
679 @ "mouseover":%d(bMouseover)},
680 }
681 @ "noop":0}
682 @ </script>
683
684
685 zFooter = skin_get("footer");
686 if( sqlite3_strlike("%</body>%", zFooter, 0)==0 ){
687 @ <script src='%s(g.zBaseURL)/main.js/%S(MANIFEST_UUID)' \
688 @ type='application/javascript'></script>
689 }
690 if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
691 Th_Render(zFooter);
692 if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
693
@@ -698,12 +713,11 @@
698 cgi_append_content("</span>\n", -1);
699 }
700
701 /* Add document end mark if it was not in the footer */
702 if( sqlite3_strlike("%</body>%", zFooter, 0)!=0 ){
703 @ <script src='%s(g.zBaseURL)/main.js/%S(MANIFEST_UUID)' \
704 @ type='application/javascript'></script>
705 @ </body>
706 @ </html>
707 }
708 }
709
@@ -837,19 +851,47 @@
837 /* Tell CGI that the content returned by this page is considered cacheable */
838 g.isConst = 1;
839 }
840
841 /*
842 ** WEBPAGE: main.js
 
 
 
 
843 **
844 ** Return the javascript
 
 
 
845 */
846 void page_main_js(void){
847 Blob mainjs;
848 cgi_set_content_type("application/javascript");
849 blob_init(&mainjs, builtin_text("main.js"), -1);
850 cgi_set_content(&mainjs);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
851 g.isConst = 1;
852 }
853
854
855 /*
856
--- src/style.c
+++ src/style.c
@@ -83,10 +83,15 @@
83 /*
84 ** Ad-unit styles.
85 */
86 static unsigned adUnitFlags = 0;
87
88 /*
89 ** True if the "href.js" javascript file is required.
90 */
91 static int needHrefJs = 0;
92
93
94 /*
95 ** Generate and return a anchor tag like this:
96 **
97 ** <a href="URL">
@@ -138,10 +143,11 @@
143 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
144 char *zHUrl = mprintf("<a %s href=\"%h\">", zExtra, zUrl);
145 fossil_free(zUrl);
146 return zHUrl;
147 }
148 needHrefJs = 1;
149 return mprintf("<a %s data-href='%z' href='%R/honeypot'>",
150 zExtra, zUrl);
151 }
152 char *chref(const char *zExtra, const char *zFormat, ...){
153 char *zUrl;
@@ -152,10 +158,11 @@
158 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
159 char *zHUrl = mprintf("<a %s href=\"%h\">", zExtra, zUrl);
160 fossil_free(zUrl);
161 return zHUrl;
162 }
163 needHrefJs = 1;
164 return mprintf("<a class='%s' data-href='%z' href='%R/honeypot'>",
165 zExtra, zUrl);
166 }
167 char *href(const char *zFormat, ...){
168 char *zUrl;
@@ -166,10 +173,11 @@
173 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
174 char *zHUrl = mprintf("<a href=\"%h\">", zUrl);
175 fossil_free(zUrl);
176 return zHUrl;
177 }
178 needHrefJs = 1;
179 return mprintf("<a data-href='%s' href='%R/honeypot'>",
180 zUrl);
181 }
182
183 /*
@@ -184,10 +192,11 @@
192 zLink = vmprintf(zAction, ap);
193 va_end(ap);
194 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
195 @ <form method="POST" action="%z(zLink)" %s(zOtherArgs)>
196 }else{
197 needHrefJs = 1;
198 @ <form method="POST" data-action='%s(zLink)' action='%R/login' \
199 @ %s(zOtherArgs)>
200 }
201 }
202
@@ -503,10 +512,33 @@
512 }else if( !fossil_all_whitespace(zAd = db_get("adunit",0)) ){
513 return zAd;
514 }
515 return 0;
516 }
517
518 /*
519 ** Generate code to load a single javascript file
520 */
521 static void style_load_one_js_file(const char *zFile){
522 @ <script src='%R/builtin/%s(zFile)/%S(MANIFEST_UUID)'></script>
523 }
524
525 /*
526 ** Generate code to load all required javascript files.
527 */
528 static void style_load_all_js_files(void){
529 if( needHrefJs ){
530 int nDelay = db_get_int("auto-hyperlink-delay",0);
531 int bMouseover;
532 /* Load up the page data */
533 bMouseover = (!g.isHuman || db_get_boolean("auto-hyperlink-ishuman",0))
534 && db_get_boolean("auto-hyperlink-mouseover",0);
535 @ <script id='href-data' type='application/json'>\
536 @ {"delay":%d(nDelay),"mouseover":%d(bMouseover)}</script>
537 style_load_one_js_file("href.js");
538 }
539 }
540
541 /*
542 ** Draw the footer at the bottom of the page.
543 */
544 void style_footer(void){
@@ -662,32 +694,15 @@
694 */
695 @ <div class="endContent"></div>
696 }
697 @ </div>
698
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
699
700
701 zFooter = skin_get("footer");
702 if( sqlite3_strlike("%</body>%", zFooter, 0)==0 ){
703 style_load_all_js_files();
 
704 }
705 if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
706 Th_Render(zFooter);
707 if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
708
@@ -698,12 +713,11 @@
713 cgi_append_content("</span>\n", -1);
714 }
715
716 /* Add document end mark if it was not in the footer */
717 if( sqlite3_strlike("%</body>%", zFooter, 0)!=0 ){
718 style_load_all_js_files();
 
719 @ </body>
720 @ </html>
721 }
722 }
723
@@ -837,19 +851,47 @@
851 /* Tell CGI that the content returned by this page is considered cacheable */
852 g.isConst = 1;
853 }
854
855 /*
856 ** WEBPAGE: builtin
857 ** URL: builtin/FILENAME/VERSION
858 **
859 ** Return the built-in text given by FILENAME. This is used internally
860 ** by many Fossil web pages to load built-in javascript files.
861 **
862 ** The VERSION string at the end is ignored. Fossil web pages will
863 ** typically put the current Fossil check-in hash as VERSION, to cause
864 ** javascript files to be reloaded rather than sourcing a stale javascript
865 ** file from cache.
866 */
867 void page_builtin_text(void){
868 Blob out;
869 const char *zName = P("name");
870 const char *zTxt = 0;
871 if( zName ){
872 int i;
873 for(i=0; zName[i]; i++){
874 if( zName[i]=='/' ){
875 zName = mprintf("%.*s", i, zName);
876 break;
877 }
878 }
879 zTxt = builtin_text(zName);
880 }
881 if( zTxt==0 ){
882 cgi_set_status(404, "Not Found");
883 @ File \"%h(zName)\" not found
884 return;
885 }
886 if( sqlite3_strglob("*.js", zName)==0 ){
887 cgi_set_content_type("application/javascript");
888 }else{
889 cgi_set_content_type("text/plain");
890 }
891 blob_init(&out, zTxt, -1);
892 cgi_set_content(&out);
893 g.isConst = 1;
894 }
895
896
897 /*
898
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -603,11 +603,11 @@
603603
$(SRCDIR)/../skins/xekri/css.txt \
604604
$(SRCDIR)/../skins/xekri/details.txt \
605605
$(SRCDIR)/../skins/xekri/footer.txt \
606606
$(SRCDIR)/../skins/xekri/header.txt \
607607
$(SRCDIR)/diff.tcl \
608
- $(SRCDIR)/main.js \
608
+ $(SRCDIR)/href.js \
609609
$(SRCDIR)/markdown.md \
610610
$(SRCDIR)/wiki.wiki
611611
612612
TRANS_SRC = \
613613
$(OBJDIR)/add_.c \
614614
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -603,11 +603,11 @@
603 $(SRCDIR)/../skins/xekri/css.txt \
604 $(SRCDIR)/../skins/xekri/details.txt \
605 $(SRCDIR)/../skins/xekri/footer.txt \
606 $(SRCDIR)/../skins/xekri/header.txt \
607 $(SRCDIR)/diff.tcl \
608 $(SRCDIR)/main.js \
609 $(SRCDIR)/markdown.md \
610 $(SRCDIR)/wiki.wiki
611
612 TRANS_SRC = \
613 $(OBJDIR)/add_.c \
614
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -603,11 +603,11 @@
603 $(SRCDIR)/../skins/xekri/css.txt \
604 $(SRCDIR)/../skins/xekri/details.txt \
605 $(SRCDIR)/../skins/xekri/footer.txt \
606 $(SRCDIR)/../skins/xekri/header.txt \
607 $(SRCDIR)/diff.tcl \
608 $(SRCDIR)/href.js \
609 $(SRCDIR)/markdown.md \
610 $(SRCDIR)/wiki.wiki
611
612 TRANS_SRC = \
613 $(OBJDIR)/add_.c \
614
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -529,11 +529,11 @@
529529
$(SRCDIR)\../skins/xekri/css.txt \
530530
$(SRCDIR)\../skins/xekri/details.txt \
531531
$(SRCDIR)\../skins/xekri/footer.txt \
532532
$(SRCDIR)\../skins/xekri/header.txt \
533533
$(SRCDIR)\diff.tcl \
534
- $(SRCDIR)\main.js \
534
+ $(SRCDIR)\href.js \
535535
$(SRCDIR)\markdown.md \
536536
$(SRCDIR)\wiki.wiki
537537
538538
OBJ = $(OX)\add$O \
539539
$(OX)\allrepo$O \
540540
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -529,11 +529,11 @@
529 $(SRCDIR)\../skins/xekri/css.txt \
530 $(SRCDIR)\../skins/xekri/details.txt \
531 $(SRCDIR)\../skins/xekri/footer.txt \
532 $(SRCDIR)\../skins/xekri/header.txt \
533 $(SRCDIR)\diff.tcl \
534 $(SRCDIR)\main.js \
535 $(SRCDIR)\markdown.md \
536 $(SRCDIR)\wiki.wiki
537
538 OBJ = $(OX)\add$O \
539 $(OX)\allrepo$O \
540
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -529,11 +529,11 @@
529 $(SRCDIR)\../skins/xekri/css.txt \
530 $(SRCDIR)\../skins/xekri/details.txt \
531 $(SRCDIR)\../skins/xekri/footer.txt \
532 $(SRCDIR)\../skins/xekri/header.txt \
533 $(SRCDIR)\diff.tcl \
534 $(SRCDIR)\href.js \
535 $(SRCDIR)\markdown.md \
536 $(SRCDIR)\wiki.wiki
537
538 OBJ = $(OX)\add$O \
539 $(OX)\allrepo$O \
540

Keyboard Shortcuts

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