Fossil SCM
cosmetic internal tweaks.
Commit
bb71f9ecd2f064ba2707b05067ae0b2da5b911961325a5844cf48596c1530c0c
Parent
9085ec2351d4296…
2 files changed
+7
-4
+5
-3
+7
-4
| --- src/fossil.bootstrap.js | ||
| +++ src/fossil.bootstrap.js | ||
| @@ -79,19 +79,22 @@ | ||
| 79 | 79 | If the 2nd argument is an array, each encoded element is appended |
| 80 | 80 | to that array and tgtArray is returned. The above object would be |
| 81 | 81 | appended as ['a','=','1','&','b','=','2']. This form is used for |
| 82 | 82 | building up parameter lists before join('')ing the array to create |
| 83 | 83 | the result string. |
| 84 | + | |
| 85 | + If passed a truthy 3rd argument, it does not really encode each | |
| 86 | + component - it simply concatenates them together. | |
| 84 | 87 | */ |
| 85 | - F.encodeUrlArgs = function(obj,tgtArray){ | |
| 88 | + F.encodeUrlArgs = function(obj,tgtArray,fakeEncode){ | |
| 86 | 89 | if(!obj) return ''; |
| 87 | - const a = (tgtArray instanceof Array) ? tgtArray : []; | |
| 90 | + const a = (tgtArray instanceof Array) ? tgtArray : [], | |
| 91 | + enc = fakeEncode ? (x)=>x : encodeURIComponent; | |
| 88 | 92 | let k, i = 0; |
| 89 | 93 | for( k in obj ){ |
| 90 | 94 | if(i++) a.push('&'); |
| 91 | - a.push(encodeURIComponent(k), | |
| 92 | - '=',encodeURIComponent(obj[k])); | |
| 95 | + a.push(enc(k),'=',enc(obj[k])); | |
| 93 | 96 | } |
| 94 | 97 | return a===tgtArray ? a : a.join(''); |
| 95 | 98 | }; |
| 96 | 99 | /** |
| 97 | 100 | repoUrl( repoRelativePath [,urlParams] ) |
| 98 | 101 |
| --- src/fossil.bootstrap.js | |
| +++ src/fossil.bootstrap.js | |
| @@ -79,19 +79,22 @@ | |
| 79 | If the 2nd argument is an array, each encoded element is appended |
| 80 | to that array and tgtArray is returned. The above object would be |
| 81 | appended as ['a','=','1','&','b','=','2']. This form is used for |
| 82 | building up parameter lists before join('')ing the array to create |
| 83 | the result string. |
| 84 | */ |
| 85 | F.encodeUrlArgs = function(obj,tgtArray){ |
| 86 | if(!obj) return ''; |
| 87 | const a = (tgtArray instanceof Array) ? tgtArray : []; |
| 88 | let k, i = 0; |
| 89 | for( k in obj ){ |
| 90 | if(i++) a.push('&'); |
| 91 | a.push(encodeURIComponent(k), |
| 92 | '=',encodeURIComponent(obj[k])); |
| 93 | } |
| 94 | return a===tgtArray ? a : a.join(''); |
| 95 | }; |
| 96 | /** |
| 97 | repoUrl( repoRelativePath [,urlParams] ) |
| 98 |
| --- src/fossil.bootstrap.js | |
| +++ src/fossil.bootstrap.js | |
| @@ -79,19 +79,22 @@ | |
| 79 | If the 2nd argument is an array, each encoded element is appended |
| 80 | to that array and tgtArray is returned. The above object would be |
| 81 | appended as ['a','=','1','&','b','=','2']. This form is used for |
| 82 | building up parameter lists before join('')ing the array to create |
| 83 | the result string. |
| 84 | |
| 85 | If passed a truthy 3rd argument, it does not really encode each |
| 86 | component - it simply concatenates them together. |
| 87 | */ |
| 88 | F.encodeUrlArgs = function(obj,tgtArray,fakeEncode){ |
| 89 | if(!obj) return ''; |
| 90 | const a = (tgtArray instanceof Array) ? tgtArray : [], |
| 91 | enc = fakeEncode ? (x)=>x : encodeURIComponent; |
| 92 | let k, i = 0; |
| 93 | for( k in obj ){ |
| 94 | if(i++) a.push('&'); |
| 95 | a.push(enc(k),'=',enc(obj[k])); |
| 96 | } |
| 97 | return a===tgtArray ? a : a.join(''); |
| 98 | }; |
| 99 | /** |
| 100 | repoUrl( repoRelativePath [,urlParams] ) |
| 101 |
+5
-3
| --- src/fossil.page.fileedit.js | ||
| +++ src/fossil.page.fileedit.js | ||
| @@ -126,11 +126,11 @@ | ||
| 126 | 126 | E('#r-link').setAttribute( |
| 127 | 127 | 'href', |
| 128 | 128 | F.repoUrl('info/'+rev) |
| 129 | 129 | ); |
| 130 | 130 | E('#r-label').innerText = rev; |
| 131 | - const purlArgs = F.encodeUrlArgs({file, r:rShort}); | |
| 131 | + const purlArgs = F.encodeUrlArgs({file, r:rShort},false,true); | |
| 132 | 132 | const purl = F.repoUrl('fileedit',purlArgs); |
| 133 | 133 | const e = E('#permalink'); |
| 134 | 134 | e.innerText='fileedit?'+purlArgs; |
| 135 | 135 | e.setAttribute('href',purl); |
| 136 | 136 | return this; |
| @@ -180,12 +180,14 @@ | ||
| 180 | 180 | target = this.e.tabs.preview.querySelector( |
| 181 | 181 | '#fileedit-tab-preview-wrapper' |
| 182 | 182 | ), |
| 183 | 183 | self = this; |
| 184 | 184 | const updateView = function(c){ |
| 185 | - if(c) target.innerHTML = c; | |
| 186 | - else D.clearElement(target); | |
| 185 | + D.clearElement(target); | |
| 186 | + if('string'===typeof c){ | |
| 187 | + target.innerHTML = c; | |
| 188 | + } | |
| 187 | 189 | F.message('Updated preview.'); |
| 188 | 190 | if(switchToTab) self.tabs.switchToTab(self.e.tabs.preview); |
| 189 | 191 | }; |
| 190 | 192 | if(!content){ |
| 191 | 193 | updateView(''); |
| 192 | 194 |
| --- src/fossil.page.fileedit.js | |
| +++ src/fossil.page.fileedit.js | |
| @@ -126,11 +126,11 @@ | |
| 126 | E('#r-link').setAttribute( |
| 127 | 'href', |
| 128 | F.repoUrl('info/'+rev) |
| 129 | ); |
| 130 | E('#r-label').innerText = rev; |
| 131 | const purlArgs = F.encodeUrlArgs({file, r:rShort}); |
| 132 | const purl = F.repoUrl('fileedit',purlArgs); |
| 133 | const e = E('#permalink'); |
| 134 | e.innerText='fileedit?'+purlArgs; |
| 135 | e.setAttribute('href',purl); |
| 136 | return this; |
| @@ -180,12 +180,14 @@ | |
| 180 | target = this.e.tabs.preview.querySelector( |
| 181 | '#fileedit-tab-preview-wrapper' |
| 182 | ), |
| 183 | self = this; |
| 184 | const updateView = function(c){ |
| 185 | if(c) target.innerHTML = c; |
| 186 | else D.clearElement(target); |
| 187 | F.message('Updated preview.'); |
| 188 | if(switchToTab) self.tabs.switchToTab(self.e.tabs.preview); |
| 189 | }; |
| 190 | if(!content){ |
| 191 | updateView(''); |
| 192 |
| --- src/fossil.page.fileedit.js | |
| +++ src/fossil.page.fileedit.js | |
| @@ -126,11 +126,11 @@ | |
| 126 | E('#r-link').setAttribute( |
| 127 | 'href', |
| 128 | F.repoUrl('info/'+rev) |
| 129 | ); |
| 130 | E('#r-label').innerText = rev; |
| 131 | const purlArgs = F.encodeUrlArgs({file, r:rShort},false,true); |
| 132 | const purl = F.repoUrl('fileedit',purlArgs); |
| 133 | const e = E('#permalink'); |
| 134 | e.innerText='fileedit?'+purlArgs; |
| 135 | e.setAttribute('href',purl); |
| 136 | return this; |
| @@ -180,12 +180,14 @@ | |
| 180 | target = this.e.tabs.preview.querySelector( |
| 181 | '#fileedit-tab-preview-wrapper' |
| 182 | ), |
| 183 | self = this; |
| 184 | const updateView = function(c){ |
| 185 | D.clearElement(target); |
| 186 | if('string'===typeof c){ |
| 187 | target.innerHTML = c; |
| 188 | } |
| 189 | F.message('Updated preview.'); |
| 190 | if(switchToTab) self.tabs.switchToTab(self.e.tabs.preview); |
| 191 | }; |
| 192 | if(!content){ |
| 193 | updateView(''); |
| 194 |