在线文本比较工具

经常有文本比对的需求,但是现在很多的比对工具都需要安装客户端,很是麻烦,有没有那种网页上一键打开,然后立即开始对比的文本比较工具呢,现在我们就搞一个,废话不多说,直接上效果:

 很赞,清晰明了,效果显著

在线预览地址

index.html

<!--
This example demonstrates the minimum amount of code required to use Mergely.
-->
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<title>在线文本比较工具</title>
	<meta http-equiv="X-UA-Compatible" content="chrome=1, IE=edge">
	<link rel="shortcut icon" href="http://www.mergely.com/favicon.ico">
	<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 src="https://cdn.bootcdn.net/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript"></script>
	<!-- Requires CodeMirror -->
	<script type="text/javascript" src="./lib/codemirror.js"></script>
	<link type="text/css" rel="stylesheet" href="./lib/codemirror.css" />
	<!-- Requires Mergely -->
	<script type="text/javascript" src="./lib/mergely.js"></script>
	<link type="text/css" rel="stylesheet" href="./lib/mergely.css" />
</head>
<body>
	<div id="mergely-resizer">
		<div id="compare">
		</div>
	</div>
</body>
<script type="text/javascript">
	function getWinHeight() {
		var winHeight = 0;
		if (window.innerHeight)
			winHeight = window.innerHeight;
		else if ((document.body) && (document.body.clientHeight))
			winHeight = document.body.clientHeight;
		return winHeight;
	}
	function getWinWidth() {
		var winWidth = 0;
		if (window.innerWidth)
			winWidth = window.innerWidth;
		else if ((document.body) && (document.body.clientWidth))
			winWidth = document.body.clientWidth;
		return winWidth;
	}
	$(document).ready(function () {
		$('#compare').mergely({
			width: 'auto',
			height: '400',
			cmsettings: {
				readOnly: false, 
				lineWrapping: true,
			},
			lhs: function(setValue) {
				setValue('你好\n' +'你好');
			},
			rhs: function(setValue) {
				setValue('你很好\n' + '你好');
			}
		});
		$(window).resize(function() {
			$('#compare').mergely('options', {height:getWinHeight() - 30, width:getWinWidth() - 30});
			$('#compare').mergely('update')
		});
		$(window).resize();
	});
	
</script>
</html>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值