diff --git a/src/main/webapp/assets/common/js/gitbucket.js b/src/main/webapp/assets/common/js/gitbucket.js index 2d77efe..33e996c 100644 --- a/src/main/webapp/assets/common/js/gitbucket.js +++ b/src/main/webapp/assets/common/js/gitbucket.js @@ -138,24 +138,24 @@ var o = oplines[i]; switch(o.change){ case 'skip': - $('').html('...').appendTo(tbody); + $('').html('...').appendTo(tbody); break; case 'delete': case 'insert': case 'equal': $('').append( - lineNum('old',o.base), + lineNum('old',o.base, o.change), $('').html(o.base ? baseTextDom(o.base): "").addClass(o.change), - lineNum('old',o.head), + lineNum('old',o.head, o.change), $('').html(o.head ? headTextDom(o.head): "").addClass(o.change) ).appendTo(tbody); break; case 'replace': var ld = lineDiff(baseTextDom(o.base), headTextDom(o.head)); $('').append( - lineNum('old',o.base), + lineNum('old',o.base, 'delete'), $('').append(ld.base).addClass('delete'), - lineNum('old',o.head), + lineNum('old',o.head, 'insert'), $('').append(ld.head).addClass('insert') ).appendTo(tbody); break; @@ -170,14 +170,14 @@ var o = oplines[i]; switch(o.change){ case 'skip': - tbody.append($('').html('')); + tbody.append($('').html('')); break; case 'delete': case 'insert': case 'equal': tbody.append($('').append( - lineNum('old',o.base), - lineNum('new',o.head), + lineNum('old',o.base, o.change), + lineNum('new',o.head, o.change), $('').addClass(o.change).html(o.head ? headTextDom(o.head) : baseTextDom(o.base)))); break; case 'replace': @@ -185,12 +185,12 @@ while(oplines[i] && oplines[i].change == 'replace'){ if(oplines[i].base && oplines[i].head){ var ld = lineDiff(baseTextDom(oplines[i].base), headTextDom(oplines[i].head)); - tbody.append($('').append(lineNum('old',oplines[i].base),'',$('').append(ld.base))); - deletes.push($('').append('',lineNum('new',oplines[i].head),$('').append(ld.head))); + tbody.append($('').append(lineNum('old', oplines[i].base, 'delete'),'',$('').append(ld.base))); + deletes.push($('').append('',lineNum('new',oplines[i].head, 'insert'),$('').append(ld.head))); }else if(oplines[i].base){ - tbody.append($('').append(lineNum('old',oplines[i].base),'',$('').html(baseTextDom(oplines[i].base)))); + tbody.append($('').append(lineNum('old', oplines[i].base, 'delete'),'',$('').html(baseTextDom(oplines[i].base)))); }else if(oplines[i].head){ - deletes.push($('').append('',lineNum('new',oplines[i].head),$('').html(headTextDom(oplines[i].head)))); + deletes.push($('').append('',lineNum('new',oplines[i].head, 'insert'),$('').html(headTextDom(oplines[i].head)))); } i++; } @@ -202,8 +202,8 @@ return table; } }; - function lineNum(type,num){ - var cell = $('').addClass(type+'line'); + function lineNum(type, num, klass){ + var cell = $('').addClass(type+'line').addClass(klass); if(num){ cell.attr('line-number',num); } diff --git a/src/main/webapp/assets/vendors/jsdifflib/diffview.css b/src/main/webapp/assets/vendors/jsdifflib/diffview.css index 09454b1..3a5b52e 100644 --- a/src/main/webapp/assets/vendors/jsdifflib/diffview.css +++ b/src/main/webapp/assets/vendors/jsdifflib/diffview.css @@ -51,7 +51,7 @@ font-size:11px; font-weight:normal; border-top:none; /* for overriding bootstrap */ - color:#886; + color: rgba(0,0,0,0.3);; padding:.3em .5em .1em 2em; text-align:right; vertical-align:top @@ -80,14 +80,26 @@ background-color:#ffecec; } table.diff .skip { - background-color: #F8F8FF; + background-color: #f8fafd; +} +table.diff th.skip { + background-color: #f0f5fa; } table.diff .skip:before { - content: " ..."; + content: " "; } table.diff .insert { background-color:#eaffea } +table.diff th.insert { + background-color: #c1e9c1; + background-color: #dbffdb; +} +table.diff th.delete { + background-color: #ffdddd; + border-color: #f1c0c0; +} + table.diff th.author { text-align:right; border-top:1px solid #BBC;