Fossil

Check-in [699a977c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Replace various style_emit_script...() calls with builtin_request_js().
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | refactor-js-handling
Files: files | file ages | folders
SHA3-256: 699a977cfc8dda790517140dbf04d1ab102ed5e9db903ec04cee70ba85d6d7f5
User & Date: drh 2020-07-31 21:47:23.897
Context
2020-07-31
21:57
Further simplification of the javascript loading code. ... (Closed-Leaf check-in: b7f70ffc user: drh tags: refactor-js-handling)
21:47
Replace various style_emit_script...() calls with builtin_request_js(). ... (check-in: 699a977c user: drh tags: refactor-js-handling)
21:32
Reduce the number of jsmode options to three: inline, separate, bundled. ... (check-in: 38f3d978 user: drh tags: refactor-js-handling)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/fileedit.c.
1949
1950
1951
1952
1953
1954
1955
1956
1957

1958
1959

1960
1961
1962
1963
1964
1965
1966
    blob_appendf(&endScript,");\n");
  }

  blob_reset(&err);
  CheckinMiniInfo_cleanup(&cimi);
  style_emit_script_fossil_bootstrap(0);
  append_diff_javascript(1);
  style_emit_script_fetch(0);
  style_emit_script_tabs(0)/*also emits fossil.dom*/;

  style_emit_script_confirmer(0);
  style_emit_script_builtin(0, "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.
  */
  ajax_emit_js_preview_modes(1);







|
|
>
|
|
>







1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
    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");
  builtin_fulfill_js_requests();

  /*
  ** 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.
  */
  ajax_emit_js_preview_modes(1);
Changes to src/style.c.
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
    char * zFullName = mprintf("builtin/%s",zName);
    const char * zHash = fossil_exe_id();
    CX("<script src='%R/%T?cache=%.8s'></script>\n",
       zFullName, zHash);
    fossil_free(zFullName);
  }
}

/*
** The first time this is called it emits the JS code from the
** built-in file fossil.fossil.js. Subsequent calls are no-ops.
**
** If passed a true value, it emits the contents directly
** to the page output, else it emits a script tag with a
** src=builtin/... to load the script.
**
** Note that this code relies on that loaded via
** style_emit_script_fossil_bootstrap() but it does not call that
** routine.
*/
void style_emit_script_fetch(int asInline){
  static int once = 0;
  if(0==once++){
    style_emit_script_builtin(asInline, "fossil.fetch.js");
  }
}

/*
** The first time this is called it emits the JS code from the
** built-in file fossil.dom.js. Subsequent calls are no-ops.
**
** If passed a true value, it emits the contents directly
** to the page output, else it emits a script tag with a
** src=builtin/... to load the script.
**
** Note that this code relies on that loaded via
** style_emit_script_fossil_bootstrap(), but it does not call that
** routine.
*/
void style_emit_script_dom(int asInline){
  static int once = 0;
  if(0==once++){
    style_emit_script_builtin(asInline, "fossil.dom.js");
  }
}

/*
** The first time this is called, it calls style_emit_script_dom(),
** passing it the given asInline value, and emits the JS code from the
** built-in file fossil.tabs.js. Subsequent calls are no-ops.
**
** If passed a true value, it emits the contents directly
** to the page output, else it emits a script tag with a
** src=builtin/... to load the script.
*/
void style_emit_script_tabs(int asInline){
  static int once = 0;
  if(0==once++){
    style_emit_script_dom(asInline);
    style_emit_script_builtin(asInline, "fossil.tabs.js");
  }
}

/*
** The first time this is called it emits the JS code from the
** built-in file fossil.confirmer.js. Subsequent calls are no-ops.
**
** If passed a true value, it emits the contents directly
** to the page output, else it emits a script tag with a
** src=builtin/... to load the script.
*/
void style_emit_script_confirmer(int asInline){
  static int once = 0;
  if(0==once++){
    style_emit_script_builtin(asInline, "fossil.confirmer.js");
  }
}







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
1528
1529
1530
1531
1532
1533
1534






































































    char * zFullName = mprintf("builtin/%s",zName);
    const char * zHash = fossil_exe_id();
    CX("<script src='%R/%T?cache=%.8s'></script>\n",
       zFullName, zHash);
    fossil_free(zFullName);
  }
}