diff --git a/demo.html b/demo.html index 3c5b5ed..254c463 100644 --- a/demo.html +++ b/demo.html @@ -33,10 +33,6 @@ - - @@ -374,7 +370,11 @@ $(document).ready(function() { var diff2htmlUi = new Diff2HtmlUI({diff: lineDiffExample}); - diff2htmlUi.draw('#line-by-line', {inputFormat: 'json', showFiles: true, matching: 'lines'}); + diff2htmlUi.draw('#line-by-line', { + inputFormat: 'json', + showFiles: true, + matching: 'lines' + }); diff2htmlUi.fileListCloseable('#line-by-line', false); diff2htmlUi.highlightCode('#line-by-line'); @@ -382,7 +382,8 @@ inputFormat: 'json', showFiles: true, matching: 'lines', - outputFormat: 'side-by-side' + outputFormat: 'side-by-side', + synchronisedScroll: true }); diff2htmlUi.fileListCloseable('#side-by-side', false); diff2htmlUi.highlightCode('#side-by-side'); diff --git a/diff2html-ui.js b/diff2html-ui.js index 7557388..75d32ba 100644 --- a/diff2html-ui.js +++ b/diff2html-ui.js @@ -36,8 +36,22 @@ var cfg = config || {}; var $target = this._getTarget(targetId); $target.html(Diff2Html.getPrettyHtml(diffJson, cfg)); + + synchronisedScroll($target, config); }; + function synchronisedScroll($target, config) { + if (config.synchronisedScroll) { + + $target.find(".d2h-file-side-diff").scroll(function() { + var $this = $(this); + $this.closest(".d2h-file-wrapper").find(".d2h-file-side-diff") + .scrollLeft($this.scrollLeft()); + }); + + } + } + Diff2HtmlUI.prototype.fileListCloseable = function(targetId, startVisible) { var $target = this._getTarget(targetId); diff --git a/diff2html-ui.min.js b/diff2html-ui.min.js index 6a39ce7..79dd8d3 100644 --- a/diff2html-ui.min.js +++ b/diff2html-ui.min.js @@ -1 +1 @@ -!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o/gm,">")}function tag(node){return node.nodeName.toLowerCase()}HighlightJS.prototype.nodeStream=function(node){var result=[];return function _nodeStream(node,offset){for(var child=node.firstChild;child;child=child.nextSibling)3==child.nodeType?offset+=child.nodeValue.length:1==child.nodeType&&(result.push({event:"start",offset:offset,node:child}),offset=_nodeStream(child,offset),tag(child).match(/br|hr|img|input/)||result.push({event:"stop",offset:offset,node:child}));return offset}(node,0),result},HighlightJS.prototype.mergeStreams=function(original,highlighted,value){function selectStream(){return original.length&&highlighted.length?original[0].offset!=highlighted[0].offset?original[0].offset"}function close(node){result+=""}function render(event){("start"==event.event?open:close)(event.node)}for(var processed=0,result="",nodeStack=[];original.length||highlighted.length;){var stream=selectStream();if(result+=escape(value.substr(processed,stream[0].offset-processed)),processed=stream[0].offset,stream==original){nodeStack.reverse().forEach(close);do render(stream.splice(0,1)[0]),stream=selectStream();while(stream==original&&stream.length&&stream[0].offset==processed);nodeStack.reverse().forEach(open)}else"start"==stream[0].event?nodeStack.push(stream[0].node):nodeStack.pop(),render(stream.splice(0,1)[0])}return result+escape(value.substr(processed))},module.exports.HighlightJS=new HighlightJS}()},{}]},{},[1]); \ No newline at end of file +!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o/gm,">")}function tag(node){return node.nodeName.toLowerCase()}HighlightJS.prototype.nodeStream=function(node){var result=[];return function _nodeStream(node,offset){for(var child=node.firstChild;child;child=child.nextSibling)3==child.nodeType?offset+=child.nodeValue.length:1==child.nodeType&&(result.push({event:"start",offset:offset,node:child}),offset=_nodeStream(child,offset),tag(child).match(/br|hr|img|input/)||result.push({event:"stop",offset:offset,node:child}));return offset}(node,0),result},HighlightJS.prototype.mergeStreams=function(original,highlighted,value){function selectStream(){return original.length&&highlighted.length?original[0].offset!=highlighted[0].offset?original[0].offset"}function close(node){result+=""}function render(event){("start"==event.event?open:close)(event.node)}for(var processed=0,result="",nodeStack=[];original.length||highlighted.length;){var stream=selectStream();if(result+=escape(value.substr(processed,stream[0].offset-processed)),processed=stream[0].offset,stream==original){nodeStack.reverse().forEach(close);do render(stream.splice(0,1)[0]),stream=selectStream();while(stream==original&&stream.length&&stream[0].offset==processed);nodeStack.reverse().forEach(open)}else"start"==stream[0].event?nodeStack.push(stream[0].node):nodeStack.pop(),render(stream.splice(0,1)[0])}return result+escape(value.substr(processed))},module.exports.HighlightJS=new HighlightJS}()},{}]},{},[1]); \ No newline at end of file diff --git a/diff2html.css b/diff2html.css index 9d4096d..88f41a4 100644 --- a/diff2html.css +++ b/diff2html.css @@ -16,6 +16,8 @@ } .d2h-file-stats { + display: -webkit-box; + display: -ms-flexbox; display: flex; margin-left: auto; font-size: 14px; @@ -41,8 +43,12 @@ } .d2h-file-name-wrapper { + display: -webkit-box; + display: -ms-flexbox; display: flex; - align-items: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; width: 100%; font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; @@ -242,6 +248,8 @@ } .d2h-file-list-line { + display: -webkit-box; + display: -ms-flexbox; display: flex; text-align: left; } @@ -300,6 +308,8 @@ } .d2h-tag { + display: -webkit-box; + display: -ms-flexbox; display: flex; font-size: 10px; margin-left: 5px; @@ -337,12 +347,21 @@ .selecting-right td.d2h-code-side-linenumber * { -webkit-touch-callout: none; -webkit-user-select: none; - -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } +.selecting-left .d2h-code-line::-moz-selection, +.selecting-left .d2h-code-line *::-moz-selection +.selecting-right td.d2h-code-linenumber::-moz-selection, +.selecting-left .d2h-code-side-line::-moz-selection, +.selecting-left .d2h-code-side-line *::-moz-selection, +.selecting-right td.d2h-code-side-linenumber::-moz-selection, +.selecting-right td.d2h-code-side-linenumber *::-moz-selection { + background: transparent; +} + .selecting-left .d2h-code-line::selection, .selecting-left .d2h-code-line *::selection .selecting-right td.d2h-code-linenumber::selection, diff --git a/diff2html.min.css b/diff2html.min.css index 7b403e2..0ae00b9 100644 --- a/diff2html.min.css +++ b/diff2html.min.css @@ -1 +1 @@ -.d2h-code-line-prefix,.line-num1{float:left}.d2h-wrapper{text-align:left}.d2h-file-header{padding:5px 10px;border-bottom:1px solid #d8d8d8;background-color:#f7f7f7}.d2h-file-stats{display:flex;margin-left:auto;font-size:14px}.d2h-lines-added{text-align:right;border:1px solid #b4e2b4;border-radius:5px 0 0 5px;color:#399839;padding:2px;vertical-align:middle}.d2h-lines-deleted{text-align:left;border:1px solid #e9aeae;border-radius:0 5px 5px 0;color:#c33;padding:2px;vertical-align:middle;margin-left:1px}.d2h-file-name-wrapper{display:flex;align-items:center;width:100%;font-family:"Source Sans Pro","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:15px;line-height:15px}.d2h-file-name{line-height:33px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.d2h-file-diff,.d2h-file-side-diff{overflow-x:scroll;overflow-y:hidden}.d2h-file-wrapper{border:1px solid #ddd;border-radius:3px;margin-bottom:1em}.d2h-diff-table{width:100%;border-collapse:collapse;font-family:Menlo,Consolas,monospace;font-size:13px}.d2h-diff-tbody>tr>td>div{height:16px;line-height:16px}.d2h-files-diff{width:100%}.d2h-file-side-diff{display:inline-block;width:50%;margin-right:-4px}.d2h-code-line,.d2h-code-side-line{display:block;white-space:nowrap;padding:0 10px}.d2h-code-line{margin-left:80px}.d2h-code-side-line{height:18px;line-height:18px;margin-left:50px}.d2h-code-line del,.d2h-code-side-line del{display:inline-block;margin-top:-1px;text-decoration:none;background-color:#ffb6ba;border-radius:.2em}.d2h-code-line ins,.d2h-code-side-line ins{display:inline-block;margin-top:-1px;text-decoration:none;background-color:#97f295;border-radius:.2em}.d2h-code-line-ctn,.d2h-code-line-prefix{background:0 0;padding:0}.d2h-code-linenumber,.d2h-code-side-linenumber{position:absolute;height:18px;line-height:18px;background-color:#fff;text-align:right;color:rgba(0,0,0,.3);cursor:pointer}.line-num1,.line-num2{width:40px;padding-left:3px;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis}.line-num2{float:right}.d2h-code-linenumber{box-sizing:border-box;width:86px;padding-left:2px;padding-right:2px;border:solid #eee;border-width:0 1px}.d2h-code-side-linenumber{box-sizing:border-box;width:56px;padding-left:5px;padding-right:5px;border:solid #eee;border-width:0 1px;overflow:hidden;text-overflow:ellipsis}.d2h-del{background-color:#fee8e9;border-color:#e9aeae}.d2h-ins{background-color:#dfd;border-color:#b4e2b4}.d2h-info{background-color:#f8fafd;color:rgba(0,0,0,.3);border-color:#d5e4f2}.d2h-file-diff .d2h-del.d2h-change{background-color:#fdf2d0}.d2h-file-diff .d2h-ins.d2h-change{background-color:#ded}.d2h-file-list-wrapper{margin-bottom:10px}.d2h-file-list-wrapper a{text-decoration:none;color:#3572b0}.d2h-file-list-wrapper a:visited{color:#3572b0}.d2h-file-list-header{text-align:left}.d2h-file-list-title{font-weight:700}.d2h-file-list-line{display:flex;text-align:left}.d2h-file-list-line .d2h-file-name{line-height:21px}.d2h-file-list{display:block;list-style:none;padding:0;margin:0}.d2h-file-list>li{border-bottom:#ddd solid 1px;padding:5px 10px;margin:0}.d2h-file-list>li:last-child{border-bottom:none}.d2h-file-switch{display:none;font-size:10px;cursor:pointer}.d2h-icon-wrapper{line-height:31px}.d2h-icon{vertical-align:middle;margin-right:10px;fill:currentColor}.d2h-deleted{color:#c33}.d2h-added{color:#399839}.d2h-changed{color:#d0b44c}.d2h-moved{color:#3572b0}.d2h-tag{display:flex;font-size:10px;margin-left:5px;padding:0 2px;background-color:#fff}.d2h-deleted-tag{border:1px solid #c33}.d2h-added-tag{border:1px solid #399839}.d2h-changed-tag{border:1px solid #d0b44c}.d2h-moved-tag{border:1px solid #3572b0}.selecting-left .d2h-code-line,.selecting-left .d2h-code-line *,.selecting-left .d2h-code-side-line,.selecting-left .d2h-code-side-line *,.selecting-right td.d2h-code-linenumber,.selecting-right td.d2h-code-linenumber *,.selecting-right td.d2h-code-side-linenumber,.selecting-right td.d2h-code-side-linenumber *{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.selecting-left .d2h-code-line ::selection .selecting-right td.d2h-code-linenumber::selection,.selecting-left .d2h-code-line::selection,.selecting-left .d2h-code-side-line ::selection,.selecting-left .d2h-code-side-line::selection,.selecting-right td.d2h-code-side-linenumber ::selection,.selecting-right td.d2h-code-side-linenumber::selection{background:0 0} \ No newline at end of file +.d2h-code-line-prefix,.line-num1{float:left}.d2h-wrapper{text-align:left}.d2h-file-header{padding:5px 10px;border-bottom:1px solid #d8d8d8;background-color:#f7f7f7}.d2h-file-stats{display:-webkit-box;display:-ms-flexbox;display:flex;margin-left:auto;font-size:14px}.d2h-lines-added{text-align:right;border:1px solid #b4e2b4;border-radius:5px 0 0 5px;color:#399839;padding:2px;vertical-align:middle}.d2h-lines-deleted{text-align:left;border:1px solid #e9aeae;border-radius:0 5px 5px 0;color:#c33;padding:2px;vertical-align:middle;margin-left:1px}.d2h-file-name-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;font-family:"Source Sans Pro","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:15px;line-height:15px}.d2h-file-name{line-height:33px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.d2h-file-diff,.d2h-file-side-diff{overflow-x:scroll;overflow-y:hidden}.d2h-file-wrapper{border:1px solid #ddd;border-radius:3px;margin-bottom:1em}.d2h-diff-table{width:100%;border-collapse:collapse;font-family:Menlo,Consolas,monospace;font-size:13px}.d2h-diff-tbody>tr>td>div{height:16px;line-height:16px}.d2h-files-diff{width:100%}.d2h-file-side-diff{display:inline-block;width:50%;margin-right:-4px}.d2h-code-line,.d2h-code-side-line{display:block;white-space:nowrap;padding:0 10px}.d2h-code-line{margin-left:80px}.d2h-code-side-line{height:18px;line-height:18px;margin-left:50px}.d2h-code-line del,.d2h-code-side-line del{display:inline-block;margin-top:-1px;text-decoration:none;background-color:#ffb6ba;border-radius:.2em}.d2h-code-line ins,.d2h-code-side-line ins{display:inline-block;margin-top:-1px;text-decoration:none;background-color:#97f295;border-radius:.2em}.d2h-code-line-ctn,.d2h-code-line-prefix{background:0 0;padding:0}.d2h-code-linenumber,.d2h-code-side-linenumber{position:absolute;height:18px;line-height:18px;background-color:#fff;text-align:right;color:rgba(0,0,0,.3);cursor:pointer}.line-num1,.line-num2{width:40px;padding-left:3px;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis}.line-num2{float:right}.d2h-code-linenumber{box-sizing:border-box;width:86px;padding-left:2px;padding-right:2px;border:solid #eee;border-width:0 1px}.d2h-code-side-linenumber{box-sizing:border-box;width:56px;padding-left:5px;padding-right:5px;border:solid #eee;border-width:0 1px;overflow:hidden;text-overflow:ellipsis}.d2h-del{background-color:#fee8e9;border-color:#e9aeae}.d2h-ins{background-color:#dfd;border-color:#b4e2b4}.d2h-info{background-color:#f8fafd;color:rgba(0,0,0,.3);border-color:#d5e4f2}.d2h-file-diff .d2h-del.d2h-change{background-color:#fdf2d0}.d2h-file-diff .d2h-ins.d2h-change{background-color:#ded}.d2h-file-list-wrapper{margin-bottom:10px}.d2h-file-list-wrapper a{text-decoration:none;color:#3572b0}.d2h-file-list-wrapper a:visited{color:#3572b0}.d2h-file-list-header{text-align:left}.d2h-file-list-title{font-weight:700}.d2h-file-list-line{display:-webkit-box;display:-ms-flexbox;display:flex;text-align:left}.d2h-file-list-line .d2h-file-name{line-height:21px}.d2h-file-list{display:block;list-style:none;padding:0;margin:0}.d2h-file-list>li{border-bottom:#ddd solid 1px;padding:5px 10px;margin:0}.d2h-file-list>li:last-child{border-bottom:none}.d2h-file-switch{display:none;font-size:10px;cursor:pointer}.d2h-icon-wrapper{line-height:31px}.d2h-icon{vertical-align:middle;margin-right:10px;fill:currentColor}.d2h-deleted{color:#c33}.d2h-added{color:#399839}.d2h-changed{color:#d0b44c}.d2h-moved{color:#3572b0}.d2h-tag{display:-webkit-box;display:-ms-flexbox;display:flex;font-size:10px;margin-left:5px;padding:0 2px;background-color:#fff}.d2h-deleted-tag{border:1px solid #c33}.d2h-added-tag{border:1px solid #399839}.d2h-changed-tag{border:1px solid #d0b44c}.d2h-moved-tag{border:1px solid #3572b0}.selecting-left .d2h-code-line,.selecting-left .d2h-code-line *,.selecting-left .d2h-code-side-line,.selecting-left .d2h-code-side-line *,.selecting-right td.d2h-code-linenumber,.selecting-right td.d2h-code-linenumber *,.selecting-right td.d2h-code-side-linenumber,.selecting-right td.d2h-code-side-linenumber *{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.selecting-left .d2h-code-line ::-moz-selection .selecting-right td.d2h-code-linenumber::-moz-selection,.selecting-left .d2h-code-line::-moz-selection,.selecting-left .d2h-code-side-line ::-moz-selection,.selecting-left .d2h-code-side-line::-moz-selection,.selecting-right td.d2h-code-side-linenumber ::-moz-selection,.selecting-right td.d2h-code-side-linenumber::-moz-selection{background:0 0}.selecting-left .d2h-code-line ::selection .selecting-right td.d2h-code-linenumber::selection,.selecting-left .d2h-code-line::selection,.selecting-left .d2h-code-side-line ::selection,.selecting-left .d2h-code-side-line::selection,.selecting-right td.d2h-code-side-linenumber ::selection,.selecting-right td.d2h-code-side-linenumber::selection{background:0 0} \ No newline at end of file diff --git a/img/snapshot-1.png b/img/snapshot-1.png index ac30b85..d52efda 100644 Binary files a/img/snapshot-1.png and b/img/snapshot-1.png differ diff --git a/img/snapshot-2.png b/img/snapshot-2.png index 1547147..fb52e79 100644 Binary files a/img/snapshot-2.png and b/img/snapshot-2.png differ diff --git a/img/snapshot-3.png b/img/snapshot-3.png index 9c0beab..afe3a0f 100644 Binary files a/img/snapshot-3.png and b/img/snapshot-3.png differ diff --git a/index.html b/index.html index 7927f96..582134c 100644 --- a/index.html +++ b/index.html @@ -33,10 +33,6 @@ - -
@@ -87,7 +83,7 @@

Diff parser and pretty html generator

Better diffs, unmatched reviews.

- Live Demo + Live Demo
@@ -157,9 +153,8 @@

Install with Bower

You can install and manage diff2html's CSS and JS using Bower:

-

- > $ bower install diff2html -

+

> $ bower install diff2html

+ Copy
@@ -168,9 +163,8 @@

Install with npm

You can also install diff2html using npm:

-

- > $ npm install diff2html -

+

> $ npm install diff2html

+ Copy
@@ -194,22 +188,133 @@

- > $ npm install -g diff2html-cli
- diff2html cli installed! + > $ npm install -g diff2html-cli
+ diff2html cli installed!

- > $ diff2html
- Previous commit changes on your browser + > $ diff2html
+ Previous commit changes on your browser

- > $ is that it?
- Yup, it's that simple. + > $ is that it?
+ Yup, it's that simple.

-
+
+
+
+
+

Projects using diff2html

+
+
+
+
+
+
+
diff2html-cli
+

diff2html from your terminal to the browser.

+ + View GitHub + +
+
+
+
+
+
+
Ungit
+

The easiest way to use git. On any platform. Anywhere.

+ + View GitHub + +
+
+
+
+
+
+
Diffy
+

Share your diffs and explain your ideas without committing.

+ + Webpage + +
+
+
+
+
+
+
node-git
+

Execute Git Command by Node.js.

+ + View GitHub + +
+
+
+
+
+
+
+
+
diff-pane
+

Atom - Diff two panes.

+ + View GitHub + +
+
+
+
+
+
+
node-giff
+

Display git diff on browser.

+ + View GitHub + +
+
+
+
+
+
+
edgar-monitor
+

A module that processes new Edgar filings and sends out + notifications.

+ + View GitHub + +
+
+
+
+
+
+
 
+

Your project here.

+ + GitHub + +
+
+
+
+
+
+ +

Open Source

diff2html is open source. @@ -217,7 +322,7 @@ find us on GitHub and Gitter. Need any help?

- + Read more in the Docs
@@ -258,5 +363,22 @@ integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"> + + + + + + \ No newline at end of file diff --git a/main.css b/main.css index 0fe1638..6f84284 100644 --- a/main.css +++ b/main.css @@ -11,6 +11,12 @@ padding-top: 15px !important } +@media (min-width: 768px) { + p.m-b { + height: 75px; + } +} + .errors ul { list-style: none; margin: 0; @@ -19,9 +25,6 @@ .btn { display: inline-block; - font-size: 14px; - padding: 7px 24px; - border-radius: 4px; color: #fff; background: #26A65B; font-weight: 400 @@ -32,6 +35,25 @@ background: #5dbe5d; } +.btn-clipboard { + position: absolute; + top: 0; + right: 0; + z-index: 10; + display: block; + padding: 5px 8px; + font-size: 12px; + color: #fff; + background-color: #767676; + border-radius: 0 4px 0 4px; + cursor: pointer; +} + +.btn-clipboard:hover { + color: #000; + background-color: #dcdfe4; +} + .footer { position: relative; padding: 40px 0; @@ -101,13 +123,11 @@ label, legend { .row-centered { display: -webkit-box; - display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-box-align: center; - -webkit-align-items: center; -ms-flex-align: center; - align-items: center + align-items: center; } } @@ -142,6 +162,7 @@ label, legend { margin-left: -40%; height: 1px; background: -webkit-radial-gradient(center, ellipse, rgba(0, 0, 0, 0.2) 0, rgba(255, 255, 255, 0) 75%); + background: -webkit-radial-gradient(center ellipse, rgba(0, 0, 0, 0.2) 0, rgba(255, 255, 255, 0) 75%); background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.2) 0, rgba(255, 255, 255, 0) 75%) } @@ -328,7 +349,7 @@ hr { .navbar-nav > li > a { display: inline-block; - margin-left: 50px + margin-left: 13px } .navbar-nav > li:first-child > a { @@ -599,6 +620,7 @@ a:hover, a:focus { } .homepage-terminal-example, .homepage-code-example { + position: relative; font-family: monospace; background: #272b38; color: #48d8a0; @@ -606,7 +628,8 @@ a:hover, a:focus { padding: 30px } -.homepage-terminal-example .text-muted { +.homepage-terminal-example .text-muted, +.homepage-code-example .text-muted { color: #6a7490 } @@ -660,3 +683,12 @@ a:hover, a:focus { .row-padded-small { padding: 40px 0; } + +*.unselectable { + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + diff --git a/src/main.js b/src/main.js index 961361b..60e44ce 100644 --- a/src/main.js +++ b/src/main.js @@ -5,12 +5,13 @@ var hogan = require('hogan.js'); var template = hogan.compile(readFile('src/templates/template.mustache')); var index = readFile('src/templates/index.partial.html'); +var indexScripts = readFile('src/templates/index-scripts.partial.html'); var demo = readFile('src/templates/demo.partial.html'); var demoAssets = readFile('src/templates/demo-assets.partial.html'); var demoScripts = readFile('src/templates/demo-scripts.partial.html'); -var indexHtml = template.render({assets: '', scripts: '', content: index}); +var indexHtml = template.render({assets: '', scripts: indexScripts, content: index}); writeFile('index.html', indexHtml); diff --git a/src/templates/demo-scripts.partial.html b/src/templates/demo-scripts.partial.html index de51e97..8f0a6b0 100644 --- a/src/templates/demo-scripts.partial.html +++ b/src/templates/demo-scripts.partial.html @@ -243,7 +243,11 @@ $(document).ready(function() { var diff2htmlUi = new Diff2HtmlUI({diff: lineDiffExample}); - diff2htmlUi.draw('#line-by-line', {inputFormat: 'json', showFiles: true, matching: 'lines'}); + diff2htmlUi.draw('#line-by-line', { + inputFormat: 'json', + showFiles: true, + matching: 'lines' + }); diff2htmlUi.fileListCloseable('#line-by-line', false); diff2htmlUi.highlightCode('#line-by-line'); @@ -251,7 +255,8 @@ inputFormat: 'json', showFiles: true, matching: 'lines', - outputFormat: 'side-by-side' + outputFormat: 'side-by-side', + synchronisedScroll: true }); diff2htmlUi.fileListCloseable('#side-by-side', false); diff2htmlUi.highlightCode('#side-by-side'); diff --git a/src/templates/index-scripts.partial.html b/src/templates/index-scripts.partial.html new file mode 100644 index 0000000..7267503 --- /dev/null +++ b/src/templates/index-scripts.partial.html @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/src/templates/index.partial.html b/src/templates/index.partial.html index f4cbe82..bf71e1b 100644 --- a/src/templates/index.partial.html +++ b/src/templates/index.partial.html @@ -5,7 +5,7 @@

Diff parser and pretty html generator

Better diffs, unmatched reviews.

- Live Demo + Live Demo
@@ -75,9 +75,8 @@

Install with Bower

You can install and manage diff2html's CSS and JS using Bower:

-

- > $ bower install diff2html -

+

> $ bower install diff2html

+ Copy
@@ -86,9 +85,8 @@

Install with npm

You can also install diff2html using npm:

-

- > $ npm install diff2html -

+

> $ npm install diff2html

+ Copy
@@ -112,22 +110,133 @@

- > $ npm install -g diff2html-cli
- diff2html cli installed! + > $ npm install -g diff2html-cli
+ diff2html cli installed!

- > $ diff2html
- Previous commit changes on your browser + > $ diff2html
+ Previous commit changes on your browser

- > $ is that it?
- Yup, it's that simple. + > $ is that it?
+ Yup, it's that simple.

-
+
+
+
+
+

Projects using diff2html

+
+
+
+
+
+
+
diff2html-cli
+

diff2html from your terminal to the browser.

+ + View GitHub + +
+
+
+
+
+
+
Ungit
+

The easiest way to use git. On any platform. Anywhere.

+ + View GitHub + +
+
+
+
+
+
+
Diffy
+

Share your diffs and explain your ideas without committing.

+ + Webpage + +
+
+
+
+
+
+
node-git
+

Execute Git Command by Node.js.

+ + View GitHub + +
+
+
+
+
+
+
+
+
diff-pane
+

Atom - Diff two panes.

+ + View GitHub + +
+
+
+
+
+
+
node-giff
+

Display git diff on browser.

+ + View GitHub + +
+
+
+
+
+
+
edgar-monitor
+

A module that processes new Edgar filings and sends out + notifications.

+ + View GitHub + +
+
+
+
+
+
+
 
+

Your project here.

+ + GitHub + +
+
+
+
+
+
+ +

Open Source

diff2html is open source. @@ -135,7 +244,7 @@ find us on GitHub and Gitter. Need any help?

- + Read more in the Docs
diff --git a/src/templates/template.mustache b/src/templates/template.mustache index 99da7ee..d844cf6 100644 --- a/src/templates/template.mustache +++ b/src/templates/template.mustache @@ -33,10 +33,6 @@ - - {{#assets}} {{{assets}}}