国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.6KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  6. <title>查看差异文件</title>
  7. <link rel="stylesheet" href="../static/web/css/diffview.css">
  8. <script src="../static/web/js/jquery.min.js"></script>
  9. <script src="../static/web/js/diffview.js"></script>
  10. <script src="../static/web/js/difflib.js"></script>
  11. <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>
  12. </head>
  13. <body>
  14. <textarea id="baseText" style="display:none"><?php echo $base ;?></textarea>
  15. <textarea id="newText" style="display:none"><?php echo $new ;?></textarea>
  16. <div id="diffoutput"></div>
  17. <script>
  18. function diffUsingJS(viewType) {
  19. "use strict";
  20. var base = difflib.stringAsLines($("#baseText").val()),
  21. newtxt = difflib.stringAsLines($("#newText").val()),
  22. sm = new difflib.SequenceMatcher(base, newtxt),
  23. opcodes = sm.get_opcodes(),
  24. diffoutputdiv = $("#diffoutput");
  25. diffoutputdiv.html("")
  26. diffoutputdiv.html(diffview.buildView({
  27. baseTextLines: base,
  28. newTextLines: newtxt,
  29. opcodes: opcodes,
  30. baseTextName: "官方服务器文件",
  31. newTextName: "本地文件",
  32. viewType: 0
  33. }));
  34. }
  35. $(document).ready(function() {
  36. diffUsingJS(1);
  37. });
  38. </script>
  39. </body>
  40. </html>