712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
|
static void style_load_all_js_files(void){
if( needHrefJs ){
int nDelay = db_get_int("auto-hyperlink-delay",0);
int bMouseover = db_get_boolean("auto-hyperlink-mouseover",0);
@ <script id='href-data' type='application/json'>\
@ {"delay":%d(nDelay),"mouseover":%d(bMouseover)}</script>
}
@ <script nonce="%h(style_nonce())">
@ function debugMsg(msg){
@ var n = document.getElementById("debugMsg");
@ if(n){n.textContent=msg;}
@ }
if( needHrefJs ){
@ /* href.js */
cgi_append_content(builtin_text("href.js"),-1);
|
|
|
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
|
static void style_load_all_js_files(void){
if( needHrefJs ){
int nDelay = db_get_int("auto-hyperlink-delay",0);
int bMouseover = db_get_boolean("auto-hyperlink-mouseover",0);
@ <script id='href-data' type='application/json'>\
@ {"delay":%d(nDelay),"mouseover":%d(bMouseover)}</script>
}
@ <script nonce="%h(style_nonce())">/* style.c:%d(__LINE__) */
@ function debugMsg(msg){
@ var n = document.getElementById("debugMsg");
@ if(n){n.textContent=msg;}
@ }
if( needHrefJs ){
@ /* href.js */
cgi_append_content(builtin_text("href.js"),-1);
|
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
|
CX("</select>\n");
CX("</div>\n");
va_end(vargs);
fossil_free(zLabelID);
}
/*
** If passed 0 as its first argument, it emits a script opener tag
** with this request's nonce. If passed non-0 it emits a script
** closing tag. Mnemonic for remembering the order in which to pass 0
** or 1 as the first argument to this function: 0 comes before 1.
**
** If passed 0 as its first argument and a non-NULL/non-empty zSrc,
** then it instead emits:
**
** <script src='%R/{{zSrc}}'></script>
**
** zSrc is always assumed to be a repository-relative path without
** a leading slash, and has %R/ prepended to it.
**
** Meaning that no follow-up call to pass a non-0 first argument
** to close the tag. zSrc is ignored if the first argument is not
** 0.
*/
void style_emit_script_tag(int isCloser, const char * zSrc){
if(0==isCloser){
if(zSrc!=0 && zSrc[0]!=0){
CX("<script src='%R/%T'></script>\n", zSrc);
}else{
CX("<script nonce='%s'>", style_nonce());
}
}else{
CX("</script>\n");
}
}
/*
** Emits a NOSCRIPT tag with an error message stating that JS is
** required for the current page. This "should" be called near the top
** of pages which *require* JS. The inner DIV has the CSS class
** 'error' and can be styled via a (noscript > .error) CSS selector.
*/
void style_emit_noscript_for_js_page(void){
CX("<noscript><div class='error'>"
"This page requires JavaScript (ES2015, a.k.a. ES6, or newer)."
"</div></noscript>");
}
|
<
<
<
<
<
<
<
<
|
<
<
<
<
<
>
|
>
|
>
|
|
<
<
>
>
|
|
|
>
>
>
|
<
|
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
|
CX("</select>\n");
CX("</div>\n");
va_end(vargs);
fossil_free(zLabelID);
}
/*
** Generate a <script> with an appropriate nonce.
**
** zOrigin and iLine are the source code filename and line number
** that generated this request.
*/
void style_script_begin(const char *zOrigin, int iLine){
const char *z;
for(z=zOrigin; z[0]!=0; z++){
if( z[0]=='/' || z[0]=='\\' ){
zOrigin = z+1;
}
}
CX("<script nonce='%s'>/* %s:%d */\n", style_nonce(), zOrigin, iLine);
}
/* Generate the closing </script> tag
*/
void style_script_end(void){
CX("</script>\n");
}
/*
** Emits a NOSCRIPT tag with an error message stating that JS is
** required for the current page. This "should" be called near the top
** of pages which *require* JS. The inner DIV has the CSS class
** 'error' and can be styled via a (noscript > .error) CSS selector.
*/
void style_emit_noscript_for_js_page(void){
CX("<noscript><div class='error'>"
"This page requires JavaScript (ES2015, a.k.a. ES6, or newer)."
"</div></noscript>");
}
|