Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Minor C-side fossil JS API simplification to ease upcoming changes. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
58d86b16bf2c233e03f34ab9960ce753 |
User & Date: | stephan 2020-09-18 05:07:15 |
Context
2020-09-18
| ||
07:37 | The routines which emit fossil.XYZ.js modules now understand their dependencies, emit any deps in dependency order (recursively), and do not emit a given module more than once (simplifies usage and is an and overall improvement in cacheability). Added the pikchr click support to more pages. ... (check-in: 9b2b6f5b user: stephan tags: trunk) | |
05:07 | Minor C-side fossil JS API simplification to ease upcoming changes. ... (check-in: 58d86b16 user: stephan tags: trunk) | |
04:10 | pikchr js: hide/show the SVG's parent element instead of the SVG, so that output from pikchr print commands is hidden when the source is shown. ... (check-in: 43116c73 user: stephan tags: trunk) | |
Changes
Changes to src/builtin.c.
︙ | ︙ | |||
698 699 700 701 702 703 704 | if(0==once++){ builtin_emit_script_fossil_bootstrap(1); } zName = mprintf("fossil.%s.js", zApi); builtin_request_js(zName); fossil_free(zName); | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | if(0==once++){ builtin_emit_script_fossil_bootstrap(1); } zName = mprintf("fossil.%s.js", zApi); builtin_request_js(zName); fossil_free(zName); va_start(vargs,zApi); while( (zArg = va_arg (vargs, const char *))!=0 ){ zName = mprintf("fossil.%s.js", zArg); builtin_request_js(zName); fossil_free(zName); } va_end(vargs); } /* ** This is a variant of builtin_emit_fossil_js_apis() which is ** equivalent to: ** ** if(!builtin_bundle_all_fossil_js_apis()){ ** builtin_emit_fossil_js_apis(zApi, ...args); ** } ** */ void builtin_fossil_js_bundle_or( const char * zApi, ... ) { const char *zArg; char * zName; va_list vargs; static int once = 0; if(builtin_bundle_all_fossil_js_apis()){ return; } if(0==once++){ builtin_emit_script_fossil_bootstrap(1); } zName = mprintf("fossil.%s.js", zApi); builtin_request_js(zName); fossil_free(zName); va_start(vargs,zApi); while( (zArg = va_arg (vargs, const char *))!=0 ){ zName = mprintf("fossil.%s.js", zArg); builtin_request_js(zName); fossil_free(zName); } va_end(vargs); } /* ** If builtin_get_js_delivery_mode() returns JS_BUNDLED then this ** function emits, via builtin_request_js(), all JS fossil.XYZ APIs ** which are not strictly specific to a single page, and then calls ** builtin_fulfill_js_requests(). The idea is that we can get better ** bundle caching and reduced HTTP requests by including all JS, ** rather than creating separate bundles on a per-page basis. It then ** returns true. As a special case, if this is called more than once ** in bundled mode, subsequent calls are a no-op. ** ** If the current JS delivery mode is *not* JS_BUNDLED then this ** function is a no-op and returns false. The reason is simply because ** bundled mode is the only mode in which this API improves aggregate ** over-the-wire and HTTP request costs. For other modes, reducing the ** inclusion of fossil.XYZ APIs to their bare minimum provides the ** lowest aggregate costs. For debate and details, see the discussion ** at: ** ** https://fossil-scm.org/forum/forumpost/3fa2633f3e ** ** Minor caveat: the purpose of emitting all of the fossil.XYZ JS APIs ** at once is to reduce over-the-wire transfers by enabling cross-page |
︙ | ︙ | |||
757 758 759 760 761 762 763 | static int bundled = 0; if(JS_BUNDLED == builtin_get_js_delivery_mode()){ if(!bundled){ bundled = 1; builtin_emit_fossil_js_apis( /* The order of the following arguments is important: any which have dependencies must be listed after their | | | > | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 | static int bundled = 0; if(JS_BUNDLED == builtin_get_js_delivery_mode()){ if(!bundled){ bundled = 1; builtin_emit_fossil_js_apis( /* The order of the following arguments is important: any which have dependencies must be listed after their dependencies. ALL of them depend on the core window.fossil bootstrapping bits, and those are initialize by this call. */ "dom", "fetch", "storage", "tabs", "confirmer", "popupwidget", "copybutton", "numbered-lines", "pikchr", 0); builtin_fulfill_js_requests(); } return 1; }else{ return 0; } } |
Changes to src/doc.c.
︙ | ︙ | |||
402 403 404 405 406 407 408 | /* ** Emit Javascript which applies (or optionally can apply) to both the ** /doc and /wiki pages. None of this implements required ** functionality, just nice-to-haves. Only call this once per page. */ void document_emit_js(void){ | < | < < | 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | /* ** Emit Javascript which applies (or optionally can apply) to both the ** /doc and /wiki pages. None of this implements required ** functionality, just nice-to-haves. Only call this once per page. */ void document_emit_js(void){ builtin_fossil_js_bundle_or("dom", "copybutton", "pikchr", 0); style_script_begin(__FILE__,__LINE__); CX("window.addEventListener('load', " "()=>window.fossil.pikchr.addSrcView(), " "false);\n"); style_script_end(); } |
︙ | ︙ |
Changes to src/fileedit.c.
︙ | ︙ | |||
1985 1986 1987 1988 1989 1990 1991 | "is unspecified and may differ across environments. When " "committing or force-reloading a file, local edits to that " "file/check-in combination are discarded.</li>"); CX("</ul>"); } CX("</div>"/*#fileedit-tab-help*/); | < | | | < | 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 | "is unspecified and may differ across environments. When " "committing or force-reloading a file, local edits to that " "file/check-in combination are discarded.</li>"); CX("</ul>"); } CX("</div>"/*#fileedit-tab-help*/); builtin_fossil_js_bundle_or("fetch", "dom", "tabs", "confirmer", "storage", "popupwidget", "copybutton", "pikchr", 0); /* ** 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 after window.fossil has been intialized and before ** fossil.page.fileedit.js. Potential TODO: move this into the ** window.fossil bootstrapping so that we don't have to "fulfill" ** the JS multiple times. |
︙ | ︙ |
Changes to src/forum.c.
︙ | ︙ | |||
740 741 742 743 744 745 746 | /* ** Emit Forum Javascript which applies (or optionally can apply) ** to all forum-related pages. It does not include page-specific ** code (e.g. "forum.js"). */ static void forum_emit_js(void){ | < | < < | 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 | /* ** Emit Forum Javascript which applies (or optionally can apply) ** to all forum-related pages. It does not include page-specific ** code (e.g. "forum.js"). */ static void forum_emit_js(void){ builtin_fossil_js_bundle_or("dom", "copybutton", "pikchr", 0); builtin_emit_fossil_js_apis("page.forumpost", 0); } /* ** WEBPAGE: forumpost ** ** Show a single forum posting. The posting is shown in context with |
︙ | ︙ |
Changes to src/info.c.
︙ | ︙ | |||
2127 2128 2129 2130 2131 2132 2133 | cgi_printf("%z", htmlize(z, nZ)); CX("</code></pre></td></tr></tbody></table>\n"); if(includeJS && !emittedJS){ emittedJS = 1; if( db_int(0, "SELECT EXISTS(SELECT 1 FROM lnos)") ){ builtin_request_js("scroll.js"); } | < | | < | 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 | cgi_printf("%z", htmlize(z, nZ)); CX("</code></pre></td></tr></tbody></table>\n"); if(includeJS && !emittedJS){ emittedJS = 1; if( db_int(0, "SELECT EXISTS(SELECT 1 FROM lnos)") ){ builtin_request_js("scroll.js"); } builtin_fossil_js_bundle_or("dom", "copybutton", "popupwidget", "numbered-lines", 0); } } /* ** COMMAND: test-line-numbers ** ** Usage: %fossil test-line-numbers FILE ?LN-SPEC? |
︙ | ︙ |
Changes to src/pikchrshow.c.
︙ | ︙ | |||
355 356 357 358 359 360 361 | Blob out = empty_blob; pikchr_process(zContent, pikFlags, 0, &out); CX("%b", &out); blob_reset(&out); } CX("</div>"/*#pikchrshow-output*/); } CX("</fieldset>"/*#pikchrshow-output-wrapper*/); } CX("</div>"/*sbs-wrapper*/); | < | | < < | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | Blob out = empty_blob; pikchr_process(zContent, pikFlags, 0, &out); CX("%b", &out); blob_reset(&out); } CX("</div>"/*#pikchrshow-output*/); } CX("</fieldset>"/*#pikchrshow-output-wrapper*/); } CX("</div>"/*sbs-wrapper*/); builtin_fossil_js_bundle_or("dom", "fetch", "copybutton", "popupwidget", "storage", "pikchr", 0); builtin_emit_fossil_js_apis("page.pikchrshow", 0); builtin_fulfill_js_requests(); style_footer(); } /* ** COMMAND: pikchr* |
︙ | ︙ |
Changes to src/wiki.c.
︙ | ︙ | |||
1280 1281 1282 1283 1284 1285 1286 | "without having to actually save anything, nor pollute " "the repo with endless test runs. Any attempt to save the " "sandbox page will fail.</p>"); CX("<h2>Wiki Name Rules</h2>"); well_formed_wiki_name_rules(); CX("</div>"/*#wikiedit-tab-save*/); } | < | | | < | 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 | "without having to actually save anything, nor pollute " "the repo with endless test runs. Any attempt to save the " "sandbox page will fail.</p>"); CX("<h2>Wiki Name Rules</h2>"); well_formed_wiki_name_rules(); CX("</div>"/*#wikiedit-tab-save*/); } builtin_fossil_js_bundle_or("fetch", "dom", "tabs", "confirmer", "storage", "popupwidget", "copybutton", "pikchr", 0); builtin_request_js("sbsdiff.js"); builtin_request_js("fossil.page.wikiedit.js"); builtin_fulfill_js_requests(); /* Dynamically populate the editor... */ style_script_begin(__FILE__,__LINE__); { /* Render the current page list to save us an XHR request |
︙ | ︙ |