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.
Commit
0f03f78a8b060650151b6350209083e45dd1f6f2190b7518838ed1bcf8a621ac
Parent
c0cb0b9d33b9d3e…
5 files changed
+1
-1
+2
-2
+1
-1
+2
-2
+1
-1
+1
-1
| --- src/fossil.numbered-lines.js | ||
| +++ src/fossil.numbered-lines.js | ||
| @@ -25,11 +25,11 @@ | ||
| 25 | 25 | .replace(/&?\bln=[^&]*/,'') /* inbound line number/range */ |
| 26 | 26 | .replace('?&','?'), |
| 27 | 27 | start: 0, end: 0 |
| 28 | 28 | }; |
| 29 | 29 | |
| 30 | - const lineTip = new fossil.PopupWidget({ | |
| 30 | + const lineTip = new F.PopupWidget({ | |
| 31 | 31 | style: { |
| 32 | 32 | cursor: 'pointer' |
| 33 | 33 | }, |
| 34 | 34 | refresh: function(){ |
| 35 | 35 | const link = this.state.link; |
| 36 | 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 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 |
+2
-2
| --- src/fossil.page.fileedit.js | ||
| +++ src/fossil.page.fileedit.js | ||
| @@ -638,11 +638,11 @@ | ||
| 638 | 638 | }; |
| 639 | 639 | |
| 640 | 640 | F.onPageLoad(function() { |
| 641 | 641 | P.base = {tag: E('base')}; |
| 642 | 642 | P.base.originalHref = P.base.tag.href; |
| 643 | - P.tabs = new fossil.TabManager('#fileedit-tabs'); | |
| 643 | + P.tabs = new F.TabManager('#fileedit-tabs'); | |
| 644 | 644 | P.e = { /* various DOM elements we work with... */ |
| 645 | 645 | taEditor: E('#fileedit-content-editor'), |
| 646 | 646 | taCommentSmall: E('#fileedit-comment'), |
| 647 | 647 | taCommentBig: E('#fileedit-comment-big'), |
| 648 | 648 | taComment: undefined/*gets set to one of taComment{Big,Small}*/, |
| @@ -1142,11 +1142,11 @@ | ||
| 1142 | 1142 | mimetype: P.finfo.mimetype, |
| 1143 | 1143 | element: P.e.previewTarget |
| 1144 | 1144 | }); |
| 1145 | 1145 | }, |
| 1146 | 1146 | onerror: (e)=>{ |
| 1147 | - fossil.fetch.onerror(e); | |
| 1147 | + F.fetch.onerror(e); | |
| 1148 | 1148 | callback("Error fetching preview: "+e); |
| 1149 | 1149 | } |
| 1150 | 1150 | }); |
| 1151 | 1151 | return this; |
| 1152 | 1152 | }; |
| 1153 | 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 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 |
+1
-1
| --- src/fossil.page.forumpost.js | ||
| +++ src/fossil.page.forumpost.js | ||
| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | (function(F/*the fossil object*/){ |
| 2 | 2 | "use strict"; |
| 3 | 3 | /* 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; | |
| 5 | 5 | |
| 6 | 6 | F.onPageLoad(function(){ |
| 7 | 7 | const scrollbarIsVisible = (e)=>e.scrollHeight > e.clientHeight; |
| 8 | 8 | /* Returns an event handler which implements the post expand/collapse toggle |
| 9 | 9 | on contentElem when the given widget is activated. */ |
| 10 | 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 = 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 |
+2
-2
| --- src/fossil.page.wikiedit.js | ||
| +++ src/fossil.page.wikiedit.js | ||
| @@ -855,11 +855,11 @@ | ||
| 855 | 855 | diff: E('#wikiedit-tab-diff'), |
| 856 | 856 | misc: E('#wikiedit-tab-misc') |
| 857 | 857 | //commit: E('#wikiedit-tab-commit') |
| 858 | 858 | } |
| 859 | 859 | }; |
| 860 | - P.tabs = new fossil.TabManager(D.clearElement(P.e.tabContainer)); | |
| 860 | + P.tabs = new F.TabManager(D.clearElement(P.e.tabContainer)); | |
| 861 | 861 | P.tabs.e.container.insertBefore( |
| 862 | 862 | /* Move the status bar between the tab buttons and |
| 863 | 863 | tab panels. Seems to be the best fit in terms of |
| 864 | 864 | functionality and visibility. */ |
| 865 | 865 | E('#fossil-status-bar'), P.tabs.e.tabs |
| @@ -1322,11 +1322,11 @@ | ||
| 1322 | 1322 | mimetype: mimetype, |
| 1323 | 1323 | element: P.e.previewTarget |
| 1324 | 1324 | }); |
| 1325 | 1325 | }, |
| 1326 | 1326 | onerror: (e)=>{ |
| 1327 | - fossil.fetch.onerror(e); | |
| 1327 | + F.fetch.onerror(e); | |
| 1328 | 1328 | callback("Error fetching preview: "+e); |
| 1329 | 1329 | } |
| 1330 | 1330 | }); |
| 1331 | 1331 | return this; |
| 1332 | 1332 | }; |
| 1333 | 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 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 |
+1
-1
| --- src/fossil.storage.js | ||
| +++ src/fossil.storage.js | ||
| @@ -89,11 +89,11 @@ | ||
| 89 | 89 | page-instance-local proxy, if neither one is availble. |
| 90 | 90 | |
| 91 | 91 | Which exact storage implementation is uses is unspecified, and |
| 92 | 92 | apps must not rely on it. |
| 93 | 93 | */ |
| 94 | - fossil.storage = { | |
| 94 | + F.storage = { | |
| 95 | 95 | storageKeyPrefix: storageKeyPrefix, |
| 96 | 96 | /** Sets the storage key k to value v, implicitly converting |
| 97 | 97 | it to a string. */ |
| 98 | 98 | set: (k,v)=>$storage.setItem(storageKeyPrefix+k,v), |
| 99 | 99 | /** Sets storage key k to JSON.stringify(v). */ |
| 100 | 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 | 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 |