| | @@ -38,35 +38,34 @@ |
| 38 | 38 | } |
| 39 | 39 | const checkWidth = function f(){ |
| 40 | 40 | if(undefined === f.lastWidth){ |
| 41 | 41 | f.lastWidth = 0; |
| 42 | 42 | } |
| 43 | | - if( document.body.clientWidth!=f.lastWidth ){ |
| 44 | | - f.lastWidth = document.body.clientWidth; |
| 45 | | - var w = f.lastWidth*0.5 - 100; |
| 46 | | - if(!f.colsL){ |
| 47 | | - f.colsL = document.querySelectorAll('td.difftxtl pre'); |
| 48 | | - } |
| 49 | | - for(let i=0; i<f.colsL.length; i++){ |
| 50 | | - f.colsL[i].style.width = w + "px"; |
| 51 | | - f.colsL[i].style.maxWidth = w + "px"; |
| 52 | | - } |
| 53 | | - if(!f.colsR){ |
| 54 | | - f.colsR = document.querySelectorAll('td.difftxtr pre'); |
| 55 | | - } |
| 56 | | - for(let i=0; i<f.colsR.length; i++){ |
| 57 | | - f.colsR[i].style.width = w + "px"; |
| 58 | | - f.colsR[i].style.maxWidth = w + "px"; |
| 59 | | - } |
| 60 | | - if(!f.allDiffs){ |
| 61 | | - f.allDiffs = document.querySelectorAll('table.diff'); |
| 62 | | - } |
| 63 | | - w = f.lastWidth; |
| 64 | | - for(let i=0; i<f.allDiffs.length; i++){ |
| 65 | | - f.allDiffs[i].style.width = '100%'; // setting to w causes unsightly horiz. scrollbar |
| 66 | | - f.allDiffs[i].style.maxWidth = w + "px"; |
| 67 | | - } |
| 43 | + if( document.body.clientWidth===f.lastWidth ) return; |
| 44 | + f.lastWidth = document.body.clientWidth; |
| 45 | + var w = f.lastWidth*0.5 - 100; |
| 46 | + if(!f.colsL){ |
| 47 | + f.colsL = document.querySelectorAll('td.difftxtl pre'); |
| 48 | + } |
| 49 | + for(let i=0; i<f.colsL.length; i++){ |
| 50 | + f.colsL[i].style.width = w + "px"; |
| 51 | + f.colsL[i].style.maxWidth = w + "px"; |
| 52 | + } |
| 53 | + if(!f.colsR){ |
| 54 | + f.colsR = document.querySelectorAll('td.difftxtr pre'); |
| 55 | + } |
| 56 | + for(let i=0; i<f.colsR.length; i++){ |
| 57 | + f.colsR[i].style.width = w + "px"; |
| 58 | + f.colsR[i].style.maxWidth = w + "px"; |
| 59 | + } |
| 60 | + if(!f.allDiffs){ |
| 61 | + f.allDiffs = document.querySelectorAll('table.diff'); |
| 62 | + } |
| 63 | + w = f.lastWidth; |
| 64 | + for(let i=0; i<f.allDiffs.length; i++){ |
| 65 | + f.allDiffs[i].style.width = '100%'; // setting to w causes unsightly horiz. scrollbar |
| 66 | + f.allDiffs[i].style.maxWidth = w + "px"; |
| 68 | 67 | } |
| 69 | 68 | }; |
| 70 | 69 | checkWidth(); |
| 71 | 70 | window.addEventListener('resize', checkWidth); |
| 72 | 71 | }, false); |
| 73 | 72 | |