Fossil SCM

Using parameters to namespace functions in fossil*.js instead of the global "fossil" object. Squishes a complaint by GCC and makes the code a smidge smaller besides.

wyoung 2020-08-20 22:40 trunk
Commit 0f03f78a8b060650151b6350209083e45dd1f6f2190b7518838ed1bcf8a621ac
--- src/fossil.numbered-lines.js
+++ src/fossil.numbered-lines.js
@@ -25,11 +25,11 @@
2525
.replace(/&?\bln=[^&]*/,'') /* inbound line number/range */
2626
.replace('?&','?'),
2727
start: 0, end: 0
2828
};
2929
30
- const lineTip = new fossil.PopupWidget({
30
+ const lineTip = new F.PopupWidget({
3131
style: {
3232
cursor: 'pointer'
3333
},
3434
refresh: function(){
3535
const link = this.state.link;
3636
--- src/fossil.numbered-lines.js
+++ src/fossil.numbered-lines.js
@@ -25,11 +25,11 @@
25 .replace(/&?\bln=[^&]*/,'') /* inbound line number/range */
26 .replace('?&','?'),
27 start: 0, end: 0
28 };
29
30 const lineTip = new fossil.PopupWidget({
31 style: {
32 cursor: 'pointer'
33 },
34 refresh: function(){
35 const link = this.state.link;
36
--- src/fossil.numbered-lines.js
+++ src/fossil.numbered-lines.js
@@ -25,11 +25,11 @@
25 .replace(/&?\bln=[^&]*/,'') /* inbound line number/range */
26 .replace('?&','?'),
27 start: 0, end: 0
28 };
29
30 const lineTip = new F.PopupWidget({
31 style: {
32 cursor: 'pointer'
33 },
34 refresh: function(){
35 const link = this.state.link;
36
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -638,11 +638,11 @@
638638
};
639639
640640
F.onPageLoad(function() {
641641
P.base = {tag: E('base')};
642642
P.base.originalHref = P.base.tag.href;
643
- P.tabs = new fossil.TabManager('#fileedit-tabs');
643
+ P.tabs = new F.TabManager('#fileedit-tabs');
644644
P.e = { /* various DOM elements we work with... */
645645
taEditor: E('#fileedit-content-editor'),
646646
taCommentSmall: E('#fileedit-comment'),
647647
taCommentBig: E('#fileedit-comment-big'),
648648
taComment: undefined/*gets set to one of taComment{Big,Small}*/,
@@ -1142,11 +1142,11 @@
11421142
mimetype: P.finfo.mimetype,
11431143
element: P.e.previewTarget
11441144
});
11451145
},
11461146
onerror: (e)=>{
1147
- fossil.fetch.onerror(e);
1147
+ F.fetch.onerror(e);
11481148
callback("Error fetching preview: "+e);
11491149
}
11501150
});
11511151
return this;
11521152
};
11531153
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -638,11 +638,11 @@
638 };
639
640 F.onPageLoad(function() {
641 P.base = {tag: E('base')};
642 P.base.originalHref = P.base.tag.href;
643 P.tabs = new fossil.TabManager('#fileedit-tabs');
644 P.e = { /* various DOM elements we work with... */
645 taEditor: E('#fileedit-content-editor'),
646 taCommentSmall: E('#fileedit-comment'),
647 taCommentBig: E('#fileedit-comment-big'),
648 taComment: undefined/*gets set to one of taComment{Big,Small}*/,
@@ -1142,11 +1142,11 @@
1142 mimetype: P.finfo.mimetype,
1143 element: P.e.previewTarget
1144 });
1145 },
1146 onerror: (e)=>{
1147 fossil.fetch.onerror(e);
1148 callback("Error fetching preview: "+e);
1149 }
1150 });
1151 return this;
1152 };
1153
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -638,11 +638,11 @@
638 };
639
640 F.onPageLoad(function() {
641 P.base = {tag: E('base')};
642 P.base.originalHref = P.base.tag.href;
643 P.tabs = new F.TabManager('#fileedit-tabs');
644 P.e = { /* various DOM elements we work with... */
645 taEditor: E('#fileedit-content-editor'),
646 taCommentSmall: E('#fileedit-comment'),
647 taCommentBig: E('#fileedit-comment-big'),
648 taComment: undefined/*gets set to one of taComment{Big,Small}*/,
@@ -1142,11 +1142,11 @@
1142 mimetype: P.finfo.mimetype,
1143 element: P.e.previewTarget
1144 });
1145 },
1146 onerror: (e)=>{
1147 F.fetch.onerror(e);
1148 callback("Error fetching preview: "+e);
1149 }
1150 });
1151 return this;
1152 };
1153
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -1,9 +1,9 @@
11
(function(F/*the fossil object*/){
22
"use strict";
33
/* JS code for /forumpage and friends. Requires fossil.dom. */
4
- const P = fossil.page, D = fossil.dom;
4
+ const P = F.page, D = F.dom;
55
66
F.onPageLoad(function(){
77
const scrollbarIsVisible = (e)=>e.scrollHeight > e.clientHeight;
88
/* Returns an event handler which implements the post expand/collapse toggle
99
on contentElem when the given widget is activated. */
1010
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -1,9 +1,9 @@
1 (function(F/*the fossil object*/){
2 "use strict";
3 /* JS code for /forumpage and friends. Requires fossil.dom. */
4 const P = fossil.page, D = fossil.dom;
5
6 F.onPageLoad(function(){
7 const scrollbarIsVisible = (e)=>e.scrollHeight > e.clientHeight;
8 /* Returns an event handler which implements the post expand/collapse toggle
9 on contentElem when the given widget is activated. */
10
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -1,9 +1,9 @@
1 (function(F/*the fossil object*/){
2 "use strict";
3 /* JS code for /forumpage and friends. Requires fossil.dom. */
4 const P = F.page, D = F.dom;
5
6 F.onPageLoad(function(){
7 const scrollbarIsVisible = (e)=>e.scrollHeight > e.clientHeight;
8 /* Returns an event handler which implements the post expand/collapse toggle
9 on contentElem when the given widget is activated. */
10
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -855,11 +855,11 @@
855855
diff: E('#wikiedit-tab-diff'),
856856
misc: E('#wikiedit-tab-misc')
857857
//commit: E('#wikiedit-tab-commit')
858858
}
859859
};
860
- P.tabs = new fossil.TabManager(D.clearElement(P.e.tabContainer));
860
+ P.tabs = new F.TabManager(D.clearElement(P.e.tabContainer));
861861
P.tabs.e.container.insertBefore(
862862
/* Move the status bar between the tab buttons and
863863
tab panels. Seems to be the best fit in terms of
864864
functionality and visibility. */
865865
E('#fossil-status-bar'), P.tabs.e.tabs
@@ -1322,11 +1322,11 @@
13221322
mimetype: mimetype,
13231323
element: P.e.previewTarget
13241324
});
13251325
},
13261326
onerror: (e)=>{
1327
- fossil.fetch.onerror(e);
1327
+ F.fetch.onerror(e);
13281328
callback("Error fetching preview: "+e);
13291329
}
13301330
});
13311331
return this;
13321332
};
13331333
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -855,11 +855,11 @@
855 diff: E('#wikiedit-tab-diff'),
856 misc: E('#wikiedit-tab-misc')
857 //commit: E('#wikiedit-tab-commit')
858 }
859 };
860 P.tabs = new fossil.TabManager(D.clearElement(P.e.tabContainer));
861 P.tabs.e.container.insertBefore(
862 /* Move the status bar between the tab buttons and
863 tab panels. Seems to be the best fit in terms of
864 functionality and visibility. */
865 E('#fossil-status-bar'), P.tabs.e.tabs
@@ -1322,11 +1322,11 @@
1322 mimetype: mimetype,
1323 element: P.e.previewTarget
1324 });
1325 },
1326 onerror: (e)=>{
1327 fossil.fetch.onerror(e);
1328 callback("Error fetching preview: "+e);
1329 }
1330 });
1331 return this;
1332 };
1333
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -855,11 +855,11 @@
855 diff: E('#wikiedit-tab-diff'),
856 misc: E('#wikiedit-tab-misc')
857 //commit: E('#wikiedit-tab-commit')
858 }
859 };
860 P.tabs = new F.TabManager(D.clearElement(P.e.tabContainer));
861 P.tabs.e.container.insertBefore(
862 /* Move the status bar between the tab buttons and
863 tab panels. Seems to be the best fit in terms of
864 functionality and visibility. */
865 E('#fossil-status-bar'), P.tabs.e.tabs
@@ -1322,11 +1322,11 @@
1322 mimetype: mimetype,
1323 element: P.e.previewTarget
1324 });
1325 },
1326 onerror: (e)=>{
1327 F.fetch.onerror(e);
1328 callback("Error fetching preview: "+e);
1329 }
1330 });
1331 return this;
1332 };
1333
--- src/fossil.storage.js
+++ src/fossil.storage.js
@@ -89,11 +89,11 @@
8989
page-instance-local proxy, if neither one is availble.
9090
9191
Which exact storage implementation is uses is unspecified, and
9292
apps must not rely on it.
9393
*/
94
- fossil.storage = {
94
+ F.storage = {
9595
storageKeyPrefix: storageKeyPrefix,
9696
/** Sets the storage key k to value v, implicitly converting
9797
it to a string. */
9898
set: (k,v)=>$storage.setItem(storageKeyPrefix+k,v),
9999
/** Sets storage key k to JSON.stringify(v). */
100100
--- src/fossil.storage.js
+++ src/fossil.storage.js
@@ -89,11 +89,11 @@
89 page-instance-local proxy, if neither one is availble.
90
91 Which exact storage implementation is uses is unspecified, and
92 apps must not rely on it.
93 */
94 fossil.storage = {
95 storageKeyPrefix: storageKeyPrefix,
96 /** Sets the storage key k to value v, implicitly converting
97 it to a string. */
98 set: (k,v)=>$storage.setItem(storageKeyPrefix+k,v),
99 /** Sets storage key k to JSON.stringify(v). */
100
--- src/fossil.storage.js
+++ src/fossil.storage.js
@@ -89,11 +89,11 @@
89 page-instance-local proxy, if neither one is availble.
90
91 Which exact storage implementation is uses is unspecified, and
92 apps must not rely on it.
93 */
94 F.storage = {
95 storageKeyPrefix: storageKeyPrefix,
96 /** Sets the storage key k to value v, implicitly converting
97 it to a string. */
98 set: (k,v)=>$storage.setItem(storageKeyPrefix+k,v),
99 /** Sets storage key k to JSON.stringify(v). */
100

Keyboard Shortcuts

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