mergely
Version:
A javascript UI for diff/merge
117 lines (106 loc) • 3.28 kB
HTML
<!--
This example demonstrates how to enable line wrapping
-->
<html lang="en">
<head>
<meta charset="utf-8" /><title>Mergely - Simple Example</title>
<meta http-equiv="X-UA-Compatible" content="chrome=1, IE=edge">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="description" content="Merge and Diff your documents with diff online and share" />
<meta name="keywords" content="diff,merge,compare,jsdiff,comparison,difference,file,text,unix,patch,algorithm,saas,longest common subsequence" />
<meta name="author" content="Jamie Peabody" />
<!-- Requires jQuery -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Requires CodeMirror -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.32.0/codemirror.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.32.0/addon/search/searchcursor.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.32.0/codemirror.min.css" />
<!-- Requires Mergely -->
<script type="text/javascript" src="../lib/mergely.js"></script>
<link type="text/css" rel="stylesheet" href="../lib/mergely.css" />
<script type="text/javascript">
$(document).ready(function () {
$('#compare1').mergely({
width: 'auto',
height: 200,
license: 'lgpl-separate-notice',
cmsettings: {
readOnly: false,
lineWrapping: true,
}
});
$('#compare2').mergely({
width: 'auto',
height: 200,
license: 'lgpl-separate-notice',
cmsettings: {
readOnly: false,
lineWrapping: true,
}
});
$('#compare3').mergely({
width: 500,
height: 200,
license: 'lgpl-separate-notice',
cmsettings: {
readOnly: false,
lineWrapping: true,
}
});
$('#compare4').mergely({
width: 500,
height: 200,
license: 'lgpl-separate-notice',
cmsettings: {
readOnly: false,
lineWrapping: true,
}
});
$('#compare5').mergely({
width: 'auto',
height: 200,
autoresize: false,
license: 'lgpl-separate-notice',
cmsettings: {
readOnly: false,
lineWrapping: true,
}
});
$.ajax({
type: 'GET', async: true, dataType: 'text',
url: 'lhs.txt',
success: function (response) {
$('#compare1').mergely('lhs', response);
$('#compare2').mergely('lhs', response);
$('#compare3').mergely('lhs', response);
$('#compare4').mergely('lhs', response);
$('#compare5').mergely('lhs', response);
}
});
$.ajax({
type: 'GET', async: true, dataType: 'text',
url: 'rhs.txt',
success: function (response) {
$('#compare1').mergely('rhs', response);
$('#compare2').mergely('rhs', response);
$('#compare3').mergely('rhs', response);
$('#compare4').mergely('rhs', response);
$('#compare5').mergely('rhs', response);
}
});
});
</script>
</head>
<body>
<div id="compare1"></div>
<div id="compare2"></div>
<table style="width:100%">
<tr>
<td><div id="compare3"></div></td>
<td><div id="compare4"></div></td>
</tr>
</table>
<div id="compare5"></div>
</body>
</html>