<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<title>查看差异文件</title>
		<link rel="stylesheet" href="../static/web/css/diffview.css">
		<script src="../static/web/js/jquery.min.js"></script>
		<script src="../static/web/js/diffview.js"></script>
		<script src="../static/web/js/difflib.js"></script>
		<style>body{font-size:12px}h2{margin:0.5em 0 0.1em;text-align:center}.top{text-align:center}.textInput{display:block;width:50%;float:left}textarea{width:100%;height:300px}label:hover{text-decoration:underline;cursor:pointer}.spacer{margin-left:10px}.viewType{font-size:16px;clear:both;text-align:center;padding:1em}#diffoutput{width:100%}</style>
	</head>
	<body>
		<textarea id="baseText" style="display:none"><?php echo $base ;?></textarea>
		<textarea id="newText" style="display:none"><?php echo $new ;?></textarea>
		<div id="diffoutput"></div>
		<script>
			function diffUsingJS(viewType) {
				"use strict";
				var base = difflib.stringAsLines($("#baseText").val()),
					newtxt = difflib.stringAsLines($("#newText").val()),
					sm = new difflib.SequenceMatcher(base, newtxt),
					opcodes = sm.get_opcodes(),
					diffoutputdiv = $("#diffoutput");
					diffoutputdiv.html("")
					diffoutputdiv.html(diffview.buildView({
					baseTextLines: base,
					newTextLines: newtxt,
					opcodes: opcodes,
					baseTextName: "官方服务器文件",
					newTextName: "本地文件",
					viewType: 0
				}));
			}
		</script>
		<script>
			$(document).ready(function() {
				diffUsingJS(1);
			});
		</script>
	</body>
</html>