国内流行的内容管理系统(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.

sys_safetest_viewdiff.htm 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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" type="text/css" href="../static/css/diffview.css" />
  8. <script type="text/javascript" src="../static/js/jquery.js"></script>
  9. <script type="text/javascript" src="../static/js/diffview.js"></script>
  10. <script type="text/javascript" src="../static/js/difflib.js"></script>
  11. <style type="text/css">
  12. body {
  13. font-size: 12px;
  14. font-family: Sans-Serif;
  15. }
  16. h2 {
  17. margin: 0.5em 0 0.1em;
  18. text-align: center;
  19. }
  20. .top {
  21. text-align: center;
  22. }
  23. .textInput {
  24. display: block;
  25. width: 49%;
  26. float: left;
  27. }
  28. textarea {
  29. width: 100%;
  30. height: 300px;
  31. }
  32. label:hover {
  33. text-decoration: underline;
  34. cursor: pointer;
  35. }
  36. .spacer {
  37. margin-left: 10px;
  38. }
  39. .viewType {
  40. font-size: 16px;
  41. clear: both;
  42. text-align: center;
  43. padding: 1em;
  44. }
  45. #diffoutput {
  46. width: 100%;
  47. }
  48. </style>
  49. <script type="text/javascript">
  50. function diffUsingJS(viewType) {
  51. "use strict";
  52. var base = difflib.stringAsLines($("#baseText").val()),
  53. newtxt = difflib.stringAsLines($("#newText").val()),
  54. sm = new difflib.SequenceMatcher(base, newtxt),
  55. opcodes = sm.get_opcodes(),
  56. diffoutputdiv = $("#diffoutput");
  57. diffoutputdiv.html("")
  58. diffoutputdiv.html(diffview.buildView({
  59. baseTextLines: base,
  60. newTextLines: newtxt,
  61. opcodes: opcodes,
  62. baseTextName: "官方服务器文件",
  63. newTextName: "本地文件",
  64. viewType: 0
  65. }));
  66. }
  67. </script>
  68. </head>
  69. <body>
  70. <textarea id="baseText" style="display: none;"><?php echo $base ;?></textarea>
  71. <textarea id="newText" style="display: none;"><?php echo $new ;?></textarea>
  72. <div id="diffoutput"> </div>
  73. <script>
  74. $(document).ready(function () {
  75. diffUsingJS(1);
  76. });
  77. </script>
  78. </body>
  79. </html>