Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Simplify the internal interfaces used for injecting built-in Javascript files onto a web page. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
036a9d5c586b58d76286f858efc7e936 |
User & Date: | drh 2020-07-31 22:04:26.337 |
Context
2020-07-31
| ||
23:54 | Fix caching for bundled access to /builtin. Add a missing semicolon to the end of graph.js. ... (check-in: 139db4c5 user: drh tags: trunk) | |
23:33 | Merged in trunk for builtin_request_js() changes and ported wikiedit/fileedit/forumpost to use those. ... (check-in: 2ec332a0 user: stephan tags: ajax-wiki-editor) | |
22:04 | Simplify the internal interfaces used for injecting built-in Javascript files onto a web page. ... (check-in: 036a9d5c user: drh tags: trunk) | |
21:57 | Further simplification of the javascript loading code. ... (Closed-Leaf check-in: b7f70ffc user: drh tags: refactor-js-handling) | |
21:51 | Permit the 'favicon.ico' image to be customized. ... (check-in: 37262b83 user: mistachkin tags: trunk) | |
Changes
Changes to src/browse.c.
︙ | ︙ | |||
909 910 911 912 913 914 915 | while( nClose-- > 0 ){ @ </ul> } } } @ </ul> @ </ul></div> | | | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | while( nClose-- > 0 ){ @ </ul> } } } @ </ul> @ </ul></div> builtin_request_js("tree.js"); style_footer(); /* We could free memory used by sTree here if we needed to. But ** the process is about to exit, so doing so would not really accomplish ** anything useful. */ } |
︙ | ︙ |
Changes to src/builtin.c.
︙ | ︙ | |||
209 210 211 212 213 214 215 | g.isConst = 1; }else{ etag_check(0,0); } blob_init(&out, zTxt, -1); cgi_set_content(&out); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | g.isConst = 1; }else{ etag_check(0,0); } blob_init(&out, zTxt, -1); cgi_set_content(&out); } /* Variables controlling the JS cache. */ static struct { int aReq[30]; /* Indexes of all requested built-in JS files */ int nReq; /* Number of slots in aReq[] currently used */ int nSent; /* Number of slots in aReq[] fulfilled */ int eDelivery; /* Delivery mechanism */ } builtin; #if INTERFACE /* Various delivery mechanisms. The 0 option is the default. */ #define JS_INLINE 0 /* inline, batched together at end of file */ #define JS_SEPARATE 1 /* Separate HTTP request for each JS file */ #define JS_BUNDLED 2 /* One HTTP request to load all JS files */ /* concatenated together into a bundle */ #endif /* INTERFACE */ /* ** The argument is a request to change the javascript delivery mode. ** The argument is a string which is a command-line option or CGI ** parameter. Try to match it against one of the delivery options ** and set things up accordingly. Throw an error if no match unless ** bSilent is true. */ void builtin_set_js_delivery_mode(const char *zMode, int bSilent){ if( zMode==0 ) return; if( strcmp(zMode, "inline")==0 ){ builtin.eDelivery = JS_INLINE; }else if( strcmp(zMode, "separate")==0 ){ builtin.eDelivery = JS_SEPARATE; }else if( strcmp(zMode, "bundled")==0 ){ builtin.eDelivery = JS_BUNDLED; }else if( !bSilent ){ fossil_fatal("unknown javascript delivery mode \"%s\" - should be" " one of: inline separate bundled", zMode); } } /* ** The caller wants the Javascript file named by zFilename to be ** included in the generated page. Add the file to the queue of ** requested javascript resources, if it is not there already. ** ** The current implementation queues the file to be included in the ** output later. However, the caller should not depend on that ** behavior. In the future, this routine might decide to insert ** the requested javascript inline, immedaitely, or to insert ** a <script src=..> element to reference the javascript as a ** separate resource. The exact behavior might change in the future ** so pages that use this interface must not rely on any particular ** behavior. ** ** All this routine guarantees is that the named javascript file ** will be requested by the browser at some point. This routine ** does not guarantee when the javascript will be included, and it ** does not guarantee whether the javascript will be added inline or ** delivered as a separate resource. */ void builtin_request_js(const char *zFilename){ int i = builtin_file_index(zFilename); int j; if( i<0 ){ fossil_panic("unknown javascript file: \"%s\"", zFilename); } for(j=0; j<builtin.nReq; j++){ if( builtin.aReq[j]==i ) return; /* Already queued or sent */ } if( builtin.nReq>=count(builtin.aReq) ){ fossil_panic("too many javascript files requested"); } builtin.aReq[builtin.nReq++] = i; } /* ** Fulfill all pending requests for javascript files. ** ** The current implementation delivers all javascript in-line. However, ** the caller should not depend on this. Future changes to this routine ** might choose to deliver javascript as separate resources. */ void builtin_fulfill_js_requests(void){ if( builtin.nSent>=builtin.nReq ) return; /* nothing to do */ switch( builtin.eDelivery ){ case JS_INLINE: { CX("<script nonce='%h'>\n",style_nonce()); do{ int i = builtin.aReq[builtin.nSent++]; CX("/* %s */\n", aBuiltinFiles[i].zName); cgi_append_content((const char*)aBuiltinFiles[i].pData, aBuiltinFiles[i].nByte); }while( builtin.nSent<builtin.nReq ); CX("</script>\n"); break; } case JS_BUNDLED: { if( builtin.nSent+1<builtin.nReq ){ Blob aList; blob_init(&aList,0,0); while( builtin.nSent<builtin.nReq ){ blob_appendf(&aList, ",%d", builtin.aReq[builtin.nSent++]+1); } CX("<script src='%R/builtin?m=%s&id=%.8s'></script>\n", blob_str(&aList)+1, fossil_exe_id()); blob_reset(&aList); break; } /* If there is only one JS file, fall through into the ** JS_SEPARATE case below. */ /*FALLTHROUGH*/ } case JS_SEPARATE: { /* Each JS file as a separate resource */ while( builtin.nSent<builtin.nReq ){ int i = builtin.aReq[builtin.nSent++]; CX("<script src='%R/builtin?name=%t&id=%.8s'></script>\n", aBuiltinFiles[i].zName, fossil_exe_id()); } break; } } } |
Changes to src/codecheck1.c.
︙ | ︙ | |||
405 406 407 408 409 410 411 | { "mprintf", 1, FMT_SAFE }, { "pop3_print", 2, FMT_SAFE }, { "smtp_send_line", 2, FMT_SAFE }, { "smtp_server_send", 2, FMT_SAFE }, { "socket_set_errmsg", 1, FMT_SAFE }, { "ssl_set_errmsg", 1, FMT_SAFE }, { "style_header", 1, FMT_HTML }, | < | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | { "mprintf", 1, FMT_SAFE }, { "pop3_print", 2, FMT_SAFE }, { "smtp_send_line", 2, FMT_SAFE }, { "smtp_server_send", 2, FMT_SAFE }, { "socket_set_errmsg", 1, FMT_SAFE }, { "ssl_set_errmsg", 1, FMT_SAFE }, { "style_header", 1, FMT_HTML }, { "style_set_current_page", 1, FMT_URL }, { "style_submenu_element", 2, FMT_URL }, { "style_submenu_sql", 3, FMT_SQL }, { "webpage_error", 1, FMT_SAFE }, { "xhref", 2, FMT_URL }, }; |
︙ | ︙ |
Changes to src/fileedit.c.
︙ | ︙ | |||
1949 1950 1951 1952 1953 1954 1955 | blob_appendf(&endScript,");\n"); } blob_reset(&err); CheckinMiniInfo_cleanup(&cimi); style_emit_script_fossil_bootstrap(0); append_diff_javascript(1); | | | > | | | > > | | 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 | blob_appendf(&endScript,");\n"); } blob_reset(&err); CheckinMiniInfo_cleanup(&cimi); style_emit_script_fossil_bootstrap(0); append_diff_javascript(1); builtin_request_js("fossil.fetch.js"); builtin_request_js("fossil.dom.js"); builtin_request_js("fossil.tabs.js"); builtin_request_js("fossil.confirmer.js"); builtin_request_js("fossil.storage.js"); /* ** Set up a JS-side mapping of the AJAX_RENDER_xyz values. This is ** used for dynamically toggling certain UI components on and off. ** Must come before fossil.page.fileedit.js and after the fetches ** above. */ builtin_fulfill_js_requests(); ajax_emit_js_preview_modes(1); builtin_request_js("fossil.page.fileedit.js"); if(blob_size(&endScript)>0){ style_emit_script_tag(0,0); CX("\n(function(){\n"); CX("try{\n%b}\n" "catch(e){" "fossil.error(e); console.error('Exception:',e);" "}\n", |
︙ | ︙ |
Changes to src/forum.c.
︙ | ︙ | |||
757 758 759 760 761 762 763 | ** closes the document's <BODY> and <HTML> tags). Calls after the first ** are a no-op. */ static void forum_emit_page_js(){ static int once = 0; if(0==once){ once = 1; | | | | | 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | ** closes the document's <BODY> and <HTML> tags). Calls after the first ** are a no-op. */ static void forum_emit_page_js(){ static int once = 0; if(0==once){ once = 1; builtin_request_js("forum.js"); style_emit_script_fossil_bootstrap(0); builtin_request_js("fossil.dom.js"); builtin_request_js("fossil.page.forumpost.js"); } } /* ** WEBPAGE: forumpost ** ** Show a single forum posting. The posting is shown in context with |
︙ | ︙ |
Changes to src/info.c.
︙ | ︙ | |||
439 440 441 442 443 444 445 | } /* ** Generate javascript to enhance HTML diffs. */ void append_diff_javascript(int sideBySide){ if( !sideBySide ) return; | | | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | } /* ** Generate javascript to enhance HTML diffs. */ void append_diff_javascript(int sideBySide){ if( !sideBySide ) return; builtin_request_js("sbsdiff.js"); } /* ** Construct an appropriate diffFlag for text_diff() based on query ** parameters and the to boolean arguments. */ u64 construct_diff_flags(int diffType){ |
︙ | ︙ | |||
2087 2088 2089 2090 2091 2092 2093 | else cgi_append_content("\n", 1); z += i; if( z[0]=='\n' ) z++; } if( n<iEnd ) cgi_printf("</div>"); @ </pre> if( db_int(0, "SELECT EXISTS(SELECT 1 FROM lnos)") ){ | | | 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 | else cgi_append_content("\n", 1); z += i; if( z[0]=='\n' ) z++; } if( n<iEnd ) cgi_printf("</div>"); @ </pre> if( db_int(0, "SELECT EXISTS(SELECT 1 FROM lnos)") ){ builtin_request_js("scroll.js"); } } /* ** WEBPAGE: artifact ** WEBPAGE: file |
︙ | ︙ | |||
3111 3112 3113 3114 3115 3116 3117 | @ <input type="submit" name="preview" value="Preview" /> if( P("preview") ){ @ <input type="submit" name="apply" value="Apply Changes" /> } @ </td></tr> @ </table> @ </div></form> | | | 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 | @ <input type="submit" name="preview" value="Preview" /> if( P("preview") ){ @ <input type="submit" name="apply" value="Apply Changes" /> } @ </td></tr> @ </table> @ </div></form> builtin_request_js("ci_edit.js"); style_footer(); } /* ** Prepare an ammended commit comment. Let the user modify it using the ** editor specified in the global_config table or either ** the VISUAL or EDITOR environment variable. |
︙ | ︙ |
Changes to src/login.c.
︙ | ︙ | |||
750 751 752 753 754 755 756 | @ <div class="captcha"><table class="captcha"><tr><td>\ @ <pre class="captcha"> @ %h(zCaptcha) @ </pre></td></tr></table> if( bAutoCaptcha ) { @ <input type="button" value="Fill out captcha" id='autofillButton' \ @ data-af='%s(zDecoded)' /> | | | 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | @ <div class="captcha"><table class="captcha"><tr><td>\ @ <pre class="captcha"> @ %h(zCaptcha) @ </pre></td></tr></table> if( bAutoCaptcha ) { @ <input type="button" value="Fill out captcha" id='autofillButton' \ @ data-af='%s(zDecoded)' /> builtin_request_js("login.js"); } @ </div> free(zCaptcha); } @ </form> } if( login_is_individual() ){ |
︙ | ︙ |
Changes to src/main.c.
︙ | ︙ | |||
2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 | ** name of the subdirectory under the skins/ directory that holds ** the elements of the built-in skin. If LABEL does not match, ** this directive is a silent no-op. */ skin_use_alternative(blob_str(&value)); blob_reset(&value); continue; } if( blob_eq(&key, "cgi-debug:") && blob_token(&line, &value) ){ /* cgi-debug: FILENAME ** ** Causes output from cgi_debug() and CGIDEBUG(()) calls to go ** into FILENAME. Useful for debugging CGI configuration problems. */ | > > > > > > > > > > > > > | 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 | ** name of the subdirectory under the skins/ directory that holds ** the elements of the built-in skin. If LABEL does not match, ** this directive is a silent no-op. */ skin_use_alternative(blob_str(&value)); blob_reset(&value); continue; } if( blob_eq(&key, "jsmode:") && blob_token(&line, &value) ){ /* jsmode: MODE ** ** Change how javascript resources are delivered with each HTML ** page. MODE is "inline" to put all JS inline, or "separate" to ** cause each JS file to be requested using a separate HTTP request, ** or "bundled" to have all JS files to be fetched with a single ** auxiliary HTTP request. */ builtin_set_js_delivery_mode(blob_str(&value),0); blob_reset(&value); continue; } if( blob_eq(&key, "cgi-debug:") && blob_token(&line, &value) ){ /* cgi-debug: FILENAME ** ** Causes output from cgi_debug() and CGIDEBUG(()) calls to go ** into FILENAME. Useful for debugging CGI configuration problems. */ |
︙ | ︙ | |||
2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 | ** --baseurl URL base URL (useful with reverse proxies) ** --extroot DIR document root for the /ext extension mechanism ** --files GLOB comma-separate glob patterns for static file to serve ** --host NAME specify hostname of the server ** --https signal a request coming in via https ** --in FILE Take input from FILE instead of standard input ** --ipaddr ADDR Assume the request comes from the given IP address ** --localauth enable automatic login for local connections ** --nocompress do not compress HTTP replies ** --nodelay omit backoffice processing if it would delay process exit ** --nojail drop root privilege but do not enter the chroot jail ** --nossl signal that no SSL connections are available ** --notfound URL use URL as "HTTP 404, object not found" page. ** --out FILE write results to FILE instead of to standard output | > > > > > > > > | 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 | ** --baseurl URL base URL (useful with reverse proxies) ** --extroot DIR document root for the /ext extension mechanism ** --files GLOB comma-separate glob patterns for static file to serve ** --host NAME specify hostname of the server ** --https signal a request coming in via https ** --in FILE Take input from FILE instead of standard input ** --ipaddr ADDR Assume the request comes from the given IP address ** --jsmode MODE Determine how javascript is delivered with pages. ** Mode can be one of: ** inline All javascript is inserted inline at ** the end of the HTML file. ** separate Separate HTTP requests are made for ** each javascript file. ** bundled One single separate HTTP fetches all ** javascript concatenated together. ** --localauth enable automatic login for local connections ** --nocompress do not compress HTTP replies ** --nodelay omit backoffice processing if it would delay process exit ** --nojail drop root privilege but do not enter the chroot jail ** --nossl signal that no SSL connections are available ** --notfound URL use URL as "HTTP 404, object not found" page. ** --out FILE write results to FILE instead of to standard output |
︙ | ︙ | |||
2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 | const char *zInFile; const char *zOutFile; int useSCGI; int noJail; int allowRepoList; Th_InitTraceLog(); /* The winhttp module passes the --files option as --files-urlenc with ** the argument being URL encoded, to avoid wildcard expansion in the ** shell. This option is for internal use and is undocumented. */ zFileGlob = find_option("files-urlenc",0,1); if( zFileGlob ){ | > | 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 | const char *zInFile; const char *zOutFile; int useSCGI; int noJail; int allowRepoList; Th_InitTraceLog(); builtin_set_js_delivery_mode(find_option("jsmode",0,1),0); /* The winhttp module passes the --files option as --files-urlenc with ** the argument being URL encoded, to avoid wildcard expansion in the ** shell. This option is for internal use and is undocumented. */ zFileGlob = find_option("files-urlenc",0,1); if( zFileGlob ){ |
︙ | ︙ | |||
2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 | ** --create Create a new REPOSITORY if it does not already exist ** --extroot DIR Document root for the /ext extension mechanism ** --files GLOBLIST Comma-separated list of glob patterns for static files ** --localauth enable automatic login for requests from localhost ** --localhost listen on 127.0.0.1 only (always true for "ui") ** --https Indicates that the input is coming through a reverse ** proxy that has already translated HTTPS into HTTP. ** --max-latency N Do not let any single HTTP request run for more than N ** seconds (only works on unix) ** --nocompress Do not compress HTTP replies ** --nojail Drop root privileges but do not enter the chroot jail ** --nossl signal that no SSL connections are available (Always ** set by default for the "ui" command) ** --notfound URL Redirect | > > > > > > > > | 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 | ** --create Create a new REPOSITORY if it does not already exist ** --extroot DIR Document root for the /ext extension mechanism ** --files GLOBLIST Comma-separated list of glob patterns for static files ** --localauth enable automatic login for requests from localhost ** --localhost listen on 127.0.0.1 only (always true for "ui") ** --https Indicates that the input is coming through a reverse ** proxy that has already translated HTTPS into HTTP. ** --jsmode MODE Determine how javascript is delivered with pages. ** Mode can be one of: ** inline All javascript is inserted inline at ** the end of the HTML file. ** separate Separate HTTP requests are made for ** each javascript file. ** bundled One single separate HTTP fetches all ** javascript concatenated together. ** --max-latency N Do not let any single HTTP request run for more than N ** seconds (only works on unix) ** --nocompress Do not compress HTTP replies ** --nojail Drop root privileges but do not enter the chroot jail ** --nossl signal that no SSL connections are available (Always ** set by default for the "ui" command) ** --notfound URL Redirect |
︙ | ︙ | |||
2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 | zStopperFile = find_option("stopper", 0, 1); #endif if( g.zErrlog==0 ){ g.zErrlog = "-"; } g.zExtRoot = find_option("extroot",0,1); zFileGlob = find_option("files-urlenc",0,1); if( zFileGlob ){ char *z = mprintf("%s", zFileGlob); dehttpize(z); zFileGlob = z; }else{ zFileGlob = find_option("files",0,1); | > | 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 | zStopperFile = find_option("stopper", 0, 1); #endif if( g.zErrlog==0 ){ g.zErrlog = "-"; } g.zExtRoot = find_option("extroot",0,1); builtin_set_js_delivery_mode(find_option("jsmode",0,1),0); zFileGlob = find_option("files-urlenc",0,1); if( zFileGlob ){ char *z = mprintf("%s", zFileGlob); dehttpize(z); zFileGlob = z; }else{ zFileGlob = find_option("files",0,1); |
︙ | ︙ |
Changes to src/mkbuiltin.c.
︙ | ︙ | |||
86 87 88 89 90 91 92 93 94 95 96 97 98 99 | while( j>0 && (z[j-1]==' ' || z[j-1]=='\t') ){ j--; } for(k=i+2; k<n && z[k]!='\n'; k++){} i = k-1; continue; } } if( c=='\n' ){ while( j>0 && isspace(z[j-1]) ) j--; z[j++] = '\n'; while( i+1<n && isspace(z[i+1]) ) i++; continue; } z[j++] = c; } | > | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | while( j>0 && (z[j-1]==' ' || z[j-1]=='\t') ){ j--; } for(k=i+2; k<n && z[k]!='\n'; k++){} i = k-1; continue; } } if( c=='\n' ){ if( j==0 ) continue; while( j>0 && isspace(z[j-1]) ) j--; z[j++] = '\n'; while( i+1<n && isspace(z[i+1]) ) i++; continue; } z[j++] = c; } |
︙ | ︙ |
Changes to src/setupuser.c.
︙ | ︙ | |||
700 701 702 703 704 705 706 | } @ <input type="submit" name="can" value="Cancel"></td> @ </tr> } @ </table> @ </div></form> @ </div> | | | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | } @ <input type="submit" name="can" value="Cancel"></td> @ </tr> } @ </table> @ </div></form> @ </div> builtin_request_js("useredit.js"); @ <hr> @ <h1>Notes On Privileges And Capabilities:</h1> @ <ul> if( higherUser ){ @ <li><p class="missingPriv"> @ User %h(zLogin) has Setup privileges and you only have Admin privileges @ so you are not permitted to make changes to %h(zLogin). |
︙ | ︙ |
Changes to src/skins.c.
︙ | ︙ | |||
1099 1100 1101 1102 1103 1104 1105 | if( !g.perm.Admin ){ @ <p>Administrators can optionally save or restore legacy skins, and/or @ undo a prior publish. }else{ @ <p>Visit the <a href='%R/setup_skin_admin'>Skin Admin</a> page @ for cleanup and recovery actions. } | | | 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 | if( !g.perm.Admin ){ @ <p>Administrators can optionally save or restore legacy skins, and/or @ undo a prior publish. }else{ @ <p>Visit the <a href='%R/setup_skin_admin'>Skin Admin</a> page @ for cleanup and recovery actions. } builtin_request_js("skin.js"); style_footer(); } |
Changes to src/style.c.
︙ | ︙ | |||
86 87 88 89 90 91 92 | */ static int submenuEnable = 1; /* ** Flags for various javascript files needed prior to </body> */ static int needHrefJs = 0; /* href.js */ | < < < < | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | */ static int submenuEnable = 1; /* ** Flags for various javascript files needed prior to </body> */ static int needHrefJs = 0; /* href.js */ /* ** Extra JS added to the end of the file. */ static Blob blobOnLoad = BLOB_INITIALIZER; /* |
︙ | ︙ | |||
482 483 484 485 486 487 488 | }else{ zResult = mprintf( zBtnFmt/*works-like:"%h%s%h%h%d"*/, zTargetId,zText,zTargetId,zTargetId,cchLength); } } free(zText); | | | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | }else{ zResult = mprintf( zBtnFmt/*works-like:"%h%s%h%h%d"*/, zTargetId,zText,zTargetId,zTargetId,cchLength); } } free(zText); builtin_request_js("copybtn.js"); return zResult; } /* ** Return a random nonce that is stored in static space. For a particular ** run, the same nonce is always returned. */ |
︙ | ︙ | |||
692 693 694 695 696 697 698 | return 0; } /* ** Indicate that the table-sorting javascript is needed. */ void style_table_sorter(void){ | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < | < < < < < < < < < < < < < | < < < < < < < < | 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | return 0; } /* ** Indicate that the table-sorting javascript is needed. */ void style_table_sorter(void){ builtin_request_js("sorttable.js"); } /* ** Generate code to load all required javascript files. */ 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); } if( blob_size(&blobOnLoad)>0 ){ @ window.onload = function(){ cgi_append_content(blob_buffer(&blobOnLoad), blob_size(&blobOnLoad)); cgi_append_content("\n}\n", -1); } @ </script> builtin_fulfill_js_requests(); } /* ** Draw the footer at the bottom of the page. */ void style_footer(void){ const char *zFooter; |
︙ | ︙ | |||
914 915 916 917 918 919 920 | } } @ </div> if( nSubmenuCtrl ){ cgi_query_parameters_to_hidden(); cgi_tag_query_parameter(0); @ </form> | | | 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | } } @ </div> if( nSubmenuCtrl ){ cgi_query_parameters_to_hidden(); cgi_tag_query_parameter(0); @ </form> builtin_request_js("menu.js"); } } zAd = style_adunit_text(&mAdFlags); if( (mAdFlags & ADUNIT_RIGHT_OK)!=0 ){ @ <div class="content adunit_right_container"> @ <div class="adunit_right"> |
︙ | ︙ | |||
1541 1542 1543 1544 1545 1546 1547 | */ CX("window.fossil.page = {" "name:\"%T\"" "};\n", g.zPath); CX("})();\n"); /* The remaining fossil object bootstrap code is not dependent on ** C-runtime state... */ | < < < < | < | 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 | */ CX("window.fossil.page = {" "name:\"%T\"" "};\n", g.zPath); CX("})();\n"); /* The remaining fossil object bootstrap code is not dependent on ** C-runtime state... */ style_emit_script_tag(1,0); builtin_request_js("fossil.bootstrap.js"); } } /* ** 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 |
︙ | ︙ | |||
1580 1581 1582 1583 1584 1585 1586 | }else{ CX("<script nonce='%s'>", style_nonce()); } }else{ CX("</script>\n"); } } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1499 1500 1501 1502 1503 1504 1505 | }else{ CX("<script nonce='%s'>", style_nonce()); } }else{ CX("</script>\n"); } } |
Changes to src/timeline.c.
︙ | ︙ | |||
1081 1082 1083 1084 1085 1086 1087 | } if( k ) cgi_printf("],"); cgi_printf("\"br\":\"%j\",", pRow->zBranch ? pRow->zBranch : ""); cgi_printf("\"h\":\"%!S\"}%s", pRow->zUuid, pRow->pNext ? ",\n" : "]\n"); } @ }</script> | | | | 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | } if( k ) cgi_printf("],"); cgi_printf("\"br\":\"%j\",", pRow->zBranch ? pRow->zBranch : ""); cgi_printf("\"h\":\"%!S\"}%s", pRow->zUuid, pRow->pNext ? ",\n" : "]\n"); } @ }</script> builtin_request_js("graph.js"); builtin_request_js("copybtn.js"); /* Required by graph.js */ graph_free(pGraph); } } /* ** Create a temporary table suitable for storing timeline data. */ |
︙ | ︙ | |||
1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 | nEntry = 10; } } }else{ z = "50"; nEntry = 50; } secondaryRid = name_to_typed_rid(P("sel2"),"ci"); selectedRid = name_to_typed_rid(P("sel1"),"ci"); cgi_replace_query_parameter("n",z); cookie_write_parameter("n","n",0); tmFlags |= timeline_ss_submenu(); cookie_link_parameter("advm","advm","0"); advancedMenu = atoi(PD("advm","0")); | > > > > | 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 | nEntry = 10; } } }else{ z = "50"; nEntry = 50; } /* Undocumented query parameter to set JS mode */ builtin_set_js_delivery_mode(P("jsmode"),1); secondaryRid = name_to_typed_rid(P("sel2"),"ci"); selectedRid = name_to_typed_rid(P("sel1"),"ci"); cgi_replace_query_parameter("n",z); cookie_write_parameter("n","n",0); tmFlags |= timeline_ss_submenu(); cookie_link_parameter("advm","advm","0"); advancedMenu = atoi(PD("advm","0")); |
︙ | ︙ |
Changes to src/wiki.c.
︙ | ︙ | |||
1842 1843 1844 1845 1846 1847 1848 | wiki_convert(pBody, 0, WIKI_BUTTONS); @ </div></div> blob_reset(&tail); blob_reset(&title); blob_reset(&wiki); } manifest_destroy(pWiki); | | | 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 | wiki_convert(pBody, 0, WIKI_BUTTONS); @ </div></div> blob_reset(&tail); blob_reset(&title); blob_reset(&wiki); } manifest_destroy(pWiki); builtin_request_js("accordion.js"); return 1; } |