Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposed as a function so that multiple instances of it can be created wi… #31

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"curly": true,
"bitwise": false,
"eqeqeq": true,
"es3": true,
"esversion": 9,
"forin": true,
"freeze": true,
"immed": true,
Expand Down
206 changes: 130 additions & 76 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,83 +1,137 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JSON Diff - The semantic JSON compare tool</title>

<link rel="stylesheet" href="reset.css" type="text/css" media="screen">
<link rel="stylesheet" href="throbber.css" type="text/css" media="screen">
<link rel="stylesheet" href="jdd.css" type="text/css" media="screen">

<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>

<script src="jsl/jsl.format.js" type="text/javascript" charset="utf-8"></script>
<script src="jsl/jsl.parser.js" type="text/javascript" charset="utf-8"></script>
<script src="jdd.js" type="text/javascript" charset="utf-8"></script>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JSON Diff - The semantic JSON compare tool</title>

<link rel="stylesheet" href="reset.css" type="text/css" media="screen">
<link rel="stylesheet" href="throbber.css" type="text/css" media="screen">
<link rel="stylesheet" href="jdd.css" type="text/css" media="screen">

<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript"
charset="utf-8"></script>

<script src="jsl/jsl.format.js" type="text/javascript" charset="utf-8"></script>
<script src="jsl/jsl.parser.js" type="text/javascript" charset="utf-8"></script>
<script src="jdd.js" type="text/javascript" charset="utf-8"></script>
<script src="polyfill.js" type="text/javascript" charset="utf-8"></script>
<script>
jQuery(document).ready(function() {
const jddObj = new Jdd($('body'));
$('#compare').click(function() {
jddObj.compare();
});

if (jddObj.getParameterByName('left')) {
$('#textarealeft').val(jddObj.getParameterByName('left'));
}

if (jddObj.getParameterByName('right')) {
$('#textarearight').val(jddObj.getParameterByName('right'));
}

if (jddObj.getParameterByName('left') && jddObj.getParameterByName('right')) {
jddObj.compare();
}


$('#sample').click(function(e) {
e.preventDefault();
jddObj.loadSampleData();
});

$(document).keydown(function(event) {
if (event.keyCode === 78 || event.keyCode === 39) {
/*
* The N key or right arrow key
*/
jddObj.highlightNextDiff();
} else if (event.keyCode === 80 || event.keyCode === 37) {
/*
* The P key or left arrow key
*/
jddObj.highlightPrevDiff();
}
});
});
</script>

<script>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

ga('create', 'UA-26336682-2', 'auto');
ga('send', 'pageview');

</script>
</head>
<body>

<div id="main">
<div class="header">
<h1>JSON Diff</h1>
<h3>The semantic JSON compare tool</h3>

<div class="weak">
<p>
Validate, format, and compare two JSON documents. See the differences between the objects instead of just the new lines and mixed up properties.
</p>

<p>
Created by <a href="http://www.zackgrossbart.com">Zack Grossbart</a>. Get the <a href="https://github.com/zgrossbart/jdd">source code</a>.
</p>

<p>
Big thanks owed to the team behind <a href="http://www.jsonlint.com">JSONLint</a>.
</p>

</div>
</div>

<div class="initContainer">
<div class="left">
<textarea spellcheck="false" id="textarealeft" placeholder="Enter JSON to compare, enter an URL to JSON"></textarea>
<pre id="errorLeft" class="error"></pre>
<span class="fileInput">or <input type="file" id="fileLeft" onchange="jdd.handleFiles(this.files, 'left')"></span>
</div>

<div class="center">
<button id="compare">Compare</button>
<div class="throbber-loader"></div>
<br/><br/>
or try some<br /><a href="#" id="sample">sample data</a>

</div>

<div class="right">
<textarea spellcheck="false" class="right" id="textarearight" placeholder="Enter JSON to compare, enter an URL to JSON"></textarea>
<pre id="errorRight" class="error"></pre>
<span class="fileInput">or <input type="file" id="fileRight" onchange="jdd.handleFiles(this.files, 'right')"></span>
</div>
</div>

<div class="diffcontainer">
<div id="report">
</div>
<pre id="out" class="left" class="codeBlock"></pre>
<pre id="out2" class="right" class="codeBlock"></pre>
<ul id="toolbar" class="toolbar"></ul>
</div>
</head>
<body>

<div id="main">
<div class="header">
<h1>JSON Diff</h1>
<h3>The semantic JSON compare tool</h3>

<div class="weak">
<p>
Validate, format, and compare two JSON documents. See the differences between the objects instead of
just the new lines and mixed up properties.
</p>

<p>
Created by <a href="http://www.zackgrossbart.com">Zack Grossbart</a>. Get the <a
href="https://github.com/zgrossbart/jdd">source code</a>.
</p>

<p>
Big thanks owed to the team behind <a href="http://www.jsonlint.com">JSONLint</a>.
</p>

</div>

</body>
</div>

<div class="initContainer">
<div class="left">
<textarea spellcheck="false" id="textarealeft"
placeholder="Enter JSON to compare, enter an URL to JSON"></textarea>
<pre id="errorLeft" class="error"></pre>
<span class="fileInput">or <input type="file" id="fileLeft" onchange="jdd.handleFiles(this.files, 'left')"></span>
</div>

<div class="center">
<button id="compare">Compare</button>
<div class="throbber-loader"></div>
<br/><br/>
or try some<br/><a href="#" id="sample">sample data</a>

</div>

<div class="right">
<textarea spellcheck="false" class="right" id="textarearight"
placeholder="Enter JSON to compare, enter an URL to JSON"></textarea>
<pre id="errorRight" class="error"></pre>
<span class="fileInput">or <input type="file" id="fileRight"
onchange="jdd.handleFiles(this.files, 'right')"></span>
</div>
</div>

<div class="diffcontainer">
<div id="report">
</div>
<pre id="out" class="left" class="codeBlock"></pre>
<pre id="out2" class="right" class="codeBlock"></pre>
<ul id="toolbar" class="toolbar"></ul>
</div>
</div>

</body>
</html>
Loading