Fossil SCM

Replace various style_emit_script...() calls with builtin_request_js().

drh 2020-07-31 21:47 refactor-js-handling
Commit 699a977cfc8dda790517140dbf04d1ab102ed5e9db903ec04cee70ba85d6d7f5
2 files changed +6 -4 -70
+6 -4
--- src/fileedit.c
+++ src/fileedit.c
@@ -1951,14 +1951,16 @@
19511951
19521952
blob_reset(&err);
19531953
CheckinMiniInfo_cleanup(&cimi);
19541954
style_emit_script_fossil_bootstrap(0);
19551955
append_diff_javascript(1);
1956
- style_emit_script_fetch(0);
1957
- style_emit_script_tabs(0)/*also emits fossil.dom*/;
1958
- style_emit_script_confirmer(0);
1959
- style_emit_script_builtin(0, "fossil.storage.js");
1956
+ builtin_request_js("fossil.fetch.js");
1957
+ builtin_request_js("fossil.dom.js");
1958
+ builtin_request_js("fossil.tabs.js");
1959
+ builtin_request_js("fossil.confirmer.js");
1960
+ builtin_request_js("fossil.storage.js");
1961
+ builtin_fulfill_js_requests();
19601962
19611963
/*
19621964
** Set up a JS-side mapping of the AJAX_RENDER_xyz values. This is
19631965
** used for dynamically toggling certain UI components on and off.
19641966
** Must come before fossil.page.fileedit.js.
19651967
--- src/fileedit.c
+++ src/fileedit.c
@@ -1951,14 +1951,16 @@
1951
1952 blob_reset(&err);
1953 CheckinMiniInfo_cleanup(&cimi);
1954 style_emit_script_fossil_bootstrap(0);
1955 append_diff_javascript(1);
1956 style_emit_script_fetch(0);
1957 style_emit_script_tabs(0)/*also emits fossil.dom*/;
1958 style_emit_script_confirmer(0);
1959 style_emit_script_builtin(0, "fossil.storage.js");
 
 
1960
1961 /*
1962 ** Set up a JS-side mapping of the AJAX_RENDER_xyz values. This is
1963 ** used for dynamically toggling certain UI components on and off.
1964 ** Must come before fossil.page.fileedit.js.
1965
--- src/fileedit.c
+++ src/fileedit.c
@@ -1951,14 +1951,16 @@
1951
1952 blob_reset(&err);
1953 CheckinMiniInfo_cleanup(&cimi);
1954 style_emit_script_fossil_bootstrap(0);
1955 append_diff_javascript(1);
1956 builtin_request_js("fossil.fetch.js");
1957 builtin_request_js("fossil.dom.js");
1958 builtin_request_js("fossil.tabs.js");
1959 builtin_request_js("fossil.confirmer.js");
1960 builtin_request_js("fossil.storage.js");
1961 builtin_fulfill_js_requests();
1962
1963 /*
1964 ** Set up a JS-side mapping of the AJAX_RENDER_xyz values. This is
1965 ** used for dynamically toggling certain UI components on and off.
1966 ** Must come before fossil.page.fileedit.js.
1967
-70
--- src/style.c
+++ src/style.c
@@ -1530,75 +1530,5 @@
15301530
CX("<script src='%R/%T?cache=%.8s'></script>\n",
15311531
zFullName, zHash);
15321532
fossil_free(zFullName);
15331533
}
15341534
}
1535
-
1536
-/*
1537
-** The first time this is called it emits the JS code from the
1538
-** built-in file fossil.fossil.js. Subsequent calls are no-ops.
1539
-**
1540
-** If passed a true value, it emits the contents directly
1541
-** to the page output, else it emits a script tag with a
1542
-** src=builtin/... to load the script.
1543
-**
1544
-** Note that this code relies on that loaded via
1545
-** style_emit_script_fossil_bootstrap() but it does not call that
1546
-** routine.
1547
-*/
1548
-void style_emit_script_fetch(int asInline){
1549
- static int once = 0;
1550
- if(0==once++){
1551
- style_emit_script_builtin(asInline, "fossil.fetch.js");
1552
- }
1553
-}
1554
-
1555
-/*
1556
-** The first time this is called it emits the JS code from the
1557
-** built-in file fossil.dom.js. Subsequent calls are no-ops.
1558
-**
1559
-** If passed a true value, it emits the contents directly
1560
-** to the page output, else it emits a script tag with a
1561
-** src=builtin/... to load the script.
1562
-**
1563
-** Note that this code relies on that loaded via
1564
-** style_emit_script_fossil_bootstrap(), but it does not call that
1565
-** routine.
1566
-*/
1567
-void style_emit_script_dom(int asInline){
1568
- static int once = 0;
1569
- if(0==once++){
1570
- style_emit_script_builtin(asInline, "fossil.dom.js");
1571
- }
1572
-}
1573
-
1574
-/*
1575
-** The first time this is called, it calls style_emit_script_dom(),
1576
-** passing it the given asInline value, and emits the JS code from the
1577
-** built-in file fossil.tabs.js. Subsequent calls are no-ops.
1578
-**
1579
-** If passed a true value, it emits the contents directly
1580
-** to the page output, else it emits a script tag with a
1581
-** src=builtin/... to load the script.
1582
-*/
1583
-void style_emit_script_tabs(int asInline){
1584
- static int once = 0;
1585
- if(0==once++){
1586
- style_emit_script_dom(asInline);
1587
- style_emit_script_builtin(asInline, "fossil.tabs.js");
1588
- }
1589
-}
1590
-
1591
-/*
1592
-** The first time this is called it emits the JS code from the
1593
-** built-in file fossil.confirmer.js. Subsequent calls are no-ops.
1594
-**
1595
-** If passed a true value, it emits the contents directly
1596
-** to the page output, else it emits a script tag with a
1597
-** src=builtin/... to load the script.
1598
-*/
1599
-void style_emit_script_confirmer(int asInline){
1600
- static int once = 0;
1601
- if(0==once++){
1602
- style_emit_script_builtin(asInline, "fossil.confirmer.js");
1603
- }
1604
-}
16051535
--- src/style.c
+++ src/style.c
@@ -1530,75 +1530,5 @@
1530 CX("<script src='%R/%T?cache=%.8s'></script>\n",
1531 zFullName, zHash);
1532 fossil_free(zFullName);
1533 }
1534 }
1535
1536 /*
1537 ** The first time this is called it emits the JS code from the
1538 ** built-in file fossil.fossil.js. Subsequent calls are no-ops.
1539 **
1540 ** If passed a true value, it emits the contents directly
1541 ** to the page output, else it emits a script tag with a
1542 ** src=builtin/... to load the script.
1543 **
1544 ** Note that this code relies on that loaded via
1545 ** style_emit_script_fossil_bootstrap() but it does not call that
1546 ** routine.
1547 */
1548 void style_emit_script_fetch(int asInline){
1549 static int once = 0;
1550 if(0==once++){
1551 style_emit_script_builtin(asInline, "fossil.fetch.js");
1552 }
1553 }
1554
1555 /*
1556 ** The first time this is called it emits the JS code from the
1557 ** built-in file fossil.dom.js. Subsequent calls are no-ops.
1558 **
1559 ** If passed a true value, it emits the contents directly
1560 ** to the page output, else it emits a script tag with a
1561 ** src=builtin/... to load the script.
1562 **
1563 ** Note that this code relies on that loaded via
1564 ** style_emit_script_fossil_bootstrap(), but it does not call that
1565 ** routine.
1566 */
1567 void style_emit_script_dom(int asInline){
1568 static int once = 0;
1569 if(0==once++){
1570 style_emit_script_builtin(asInline, "fossil.dom.js");
1571 }
1572 }
1573
1574 /*
1575 ** The first time this is called, it calls style_emit_script_dom(),
1576 ** passing it the given asInline value, and emits the JS code from the
1577 ** built-in file fossil.tabs.js. Subsequent calls are no-ops.
1578 **
1579 ** If passed a true value, it emits the contents directly
1580 ** to the page output, else it emits a script tag with a
1581 ** src=builtin/... to load the script.
1582 */
1583 void style_emit_script_tabs(int asInline){
1584 static int once = 0;
1585 if(0==once++){
1586 style_emit_script_dom(asInline);
1587 style_emit_script_builtin(asInline, "fossil.tabs.js");
1588 }
1589 }
1590
1591 /*
1592 ** The first time this is called it emits the JS code from the
1593 ** built-in file fossil.confirmer.js. Subsequent calls are no-ops.
1594 **
1595 ** If passed a true value, it emits the contents directly
1596 ** to the page output, else it emits a script tag with a
1597 ** src=builtin/... to load the script.
1598 */
1599 void style_emit_script_confirmer(int asInline){
1600 static int once = 0;
1601 if(0==once++){
1602 style_emit_script_builtin(asInline, "fossil.confirmer.js");
1603 }
1604 }
1605
--- src/style.c
+++ src/style.c
@@ -1530,75 +1530,5 @@
1530 CX("<script src='%R/%T?cache=%.8s'></script>\n",
1531 zFullName, zHash);
1532 fossil_free(zFullName);
1533 }
1534 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1535

Keyboard Shortcuts

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