javascript JQuery 视觉差异插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3825443/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 02:23:40  来源:igfitidea点击:

JQuery Visual Diff Plugin

javascriptjqueryuser-interface

提问by Khalid Abuhakmeh

is there a JQuery visual diff plugin that anybody knows about. Something like you would see on GitHub, BitBucket, or any standard source control site?

是否有任何人都知道的 JQuery 视觉差异插件。类似于您在 GitHub、BitBucket 或任何标准源代码控制站点上看到的内容?

I have found this https://github.com/cemerick/jsdiffliband it looks pretty good, but wonder if there are more out there like it.

我找到了这个https://github.com/cemerick/jsdifflib,它看起来很不错,但想知道是否还有更多类似的。

Thank You.

谢谢。

采纳答案by rasata

I think you should consider doing a home made plugin, to do the Visual thing.

我认为你应该考虑做一个自制的插件,来做可视化的事情。

There is a jquery plugin which allow you to do $diff comparison like this one:

有一个 jquery 插件可以让你像这样进行 $diff 比较:

By using this you get a usable collection of elements:

通过使用它,您可以获得一个可用的元素集合:

$.diff(obj1, obj2) return  {mod: ..., add: ..., del: ...}

You could use jsfiddle to prototype your own plugin (http://jsfiddle.net/)

您可以使用 jsfiddle 来制作您自己的插件的原型(http://jsfiddle.net/)

回答by digitalextremist

This is long since done, but for posterity:

这已经很久了,但为了后代:

https://github.com/arnab/jQuery.PrettyTextDiff

https://github.com/arnab/jQuery.PrettyTextDiff

回答by harsimranb

https://code.google.com/p/google-diff-match-patch/is Google's library for diff. They have implementation for Java, JavaScript, Dart, C++, C#, Objective C, Lua and Python.

https://code.google.com/p/google-diff-match-patch/是 Google 的 diff 库。他们有 Java、JavaScript、Dart、C++、C#、Objective C、Lua 和 Python 的实现。

I have used it, its pretty neat and powerful.

我用过它,它非常简洁和强大。