Fossil SCM
For the --webpage output, use javascript to resize all side-by-side diff columns so that they completely fill the available screen width.
Commit
571dd613ac47cf75cbc3c23fbbbb47588ae883fe9b67b7c3bec5e48b45c0b559
Parent
7e37ae9549c1a17…
1 file changed
+25
+25
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -168,10 +168,11 @@ | ||
| 168 | 168 | */ |
| 169 | 169 | static const char zWebpageHdr[] = |
| 170 | 170 | @ <!DOCTYPE html> |
| 171 | 171 | @ <html> |
| 172 | 172 | @ <head> |
| 173 | +@ <meta charset="UTF-8"> | |
| 173 | 174 | @ <style> |
| 174 | 175 | @ table.sbsdiffcols { |
| 175 | 176 | @ width: 90%; |
| 176 | 177 | @ border-spacing: 0; |
| 177 | 178 | @ font-size: xx-small; |
| @@ -220,10 +221,34 @@ | ||
| 220 | 221 | @ </style> |
| 221 | 222 | @ </head> |
| 222 | 223 | @ <body> |
| 223 | 224 | ; |
| 224 | 225 | const char zWebpageEnd[] = |
| 226 | +@ <script> | |
| 227 | +@ (function(){ | |
| 228 | +@ var lastWidth = 0; | |
| 229 | +@ function checkWidth(){ | |
| 230 | +@ if( document.body.clientWidth!=lastWidth ){ | |
| 231 | +@ lastWidth = document.body.clientWidth; | |
| 232 | +@ var w = lastWidth*0.5 - 100; | |
| 233 | +@ var allCols = document.getElementsByClassName('difftxtcol'); | |
| 234 | +@ for(let i=0; i<allCols.length; i++){ | |
| 235 | +@ allCols[i].style.width = w + "px"; | |
| 236 | +@ allCols[i].style.maxWidth = w + "px"; | |
| 237 | +@ } | |
| 238 | +@ var allDiffs = document.getElementsByClassName('sbsdiffcols'); | |
| 239 | +@ w = lastWidth; | |
| 240 | +@ for(let i=0; i<allDiffs.length; i++){ | |
| 241 | +@ allDiffs[i].style.width = w + "px"; | |
| 242 | +@ allDiffs[i].style.maxWidth = w + "px"; | |
| 243 | +@ } | |
| 244 | +@ } | |
| 245 | +@ setTimeout(checkWidth, 100) | |
| 246 | +@ } | |
| 247 | +@ checkWidth(); | |
| 248 | +@ }()); | |
| 249 | +@ </script> | |
| 225 | 250 | @ </body> |
| 226 | 251 | @ </html> |
| 227 | 252 | ; |
| 228 | 253 | |
| 229 | 254 | /* |
| 230 | 255 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -168,10 +168,11 @@ | |
| 168 | */ |
| 169 | static const char zWebpageHdr[] = |
| 170 | @ <!DOCTYPE html> |
| 171 | @ <html> |
| 172 | @ <head> |
| 173 | @ <style> |
| 174 | @ table.sbsdiffcols { |
| 175 | @ width: 90%; |
| 176 | @ border-spacing: 0; |
| 177 | @ font-size: xx-small; |
| @@ -220,10 +221,34 @@ | |
| 220 | @ </style> |
| 221 | @ </head> |
| 222 | @ <body> |
| 223 | ; |
| 224 | const char zWebpageEnd[] = |
| 225 | @ </body> |
| 226 | @ </html> |
| 227 | ; |
| 228 | |
| 229 | /* |
| 230 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -168,10 +168,11 @@ | |
| 168 | */ |
| 169 | static const char zWebpageHdr[] = |
| 170 | @ <!DOCTYPE html> |
| 171 | @ <html> |
| 172 | @ <head> |
| 173 | @ <meta charset="UTF-8"> |
| 174 | @ <style> |
| 175 | @ table.sbsdiffcols { |
| 176 | @ width: 90%; |
| 177 | @ border-spacing: 0; |
| 178 | @ font-size: xx-small; |
| @@ -220,10 +221,34 @@ | |
| 221 | @ </style> |
| 222 | @ </head> |
| 223 | @ <body> |
| 224 | ; |
| 225 | const char zWebpageEnd[] = |
| 226 | @ <script> |
| 227 | @ (function(){ |
| 228 | @ var lastWidth = 0; |
| 229 | @ function checkWidth(){ |
| 230 | @ if( document.body.clientWidth!=lastWidth ){ |
| 231 | @ lastWidth = document.body.clientWidth; |
| 232 | @ var w = lastWidth*0.5 - 100; |
| 233 | @ var allCols = document.getElementsByClassName('difftxtcol'); |
| 234 | @ for(let i=0; i<allCols.length; i++){ |
| 235 | @ allCols[i].style.width = w + "px"; |
| 236 | @ allCols[i].style.maxWidth = w + "px"; |
| 237 | @ } |
| 238 | @ var allDiffs = document.getElementsByClassName('sbsdiffcols'); |
| 239 | @ w = lastWidth; |
| 240 | @ for(let i=0; i<allDiffs.length; i++){ |
| 241 | @ allDiffs[i].style.width = w + "px"; |
| 242 | @ allDiffs[i].style.maxWidth = w + "px"; |
| 243 | @ } |
| 244 | @ } |
| 245 | @ setTimeout(checkWidth, 100) |
| 246 | @ } |
| 247 | @ checkWidth(); |
| 248 | @ }()); |
| 249 | @ </script> |
| 250 | @ </body> |
| 251 | @ </html> |
| 252 | ; |
| 253 | |
| 254 | /* |
| 255 |