Skip to content
Permalink
Browse files

Better string diffs for hotfixes

  • Loading branch information
Marlamin committed Feb 8, 2020
1 parent b286c8d commit 1e96983df716a50388ea5675c7612937382c4a24
Showing with 15 additions and 5 deletions.
  1. +12 −3 dbc/hotfixes.php
  2. +3 −2 dbc/index.php
@@ -58,6 +58,7 @@
<script src="/dbc/js/dbc.js?v=<?=filemtime("/var/www/wow.tools/dbc/js/dbc.js")?>"></script>
<script src="/dbc/js/flags.js?v=<?=filemtime("/var/www/wow.tools/dbc/js/flags.js")?>"></script>
<script src="/dbc/js/enums.js?v=<?=filemtime("/var/www/wow.tools/dbc/js/enums.js")?>"></script>
<script src="https://wow.tools/js/diff_match_patch.js"></script>
<script type='text/javascript'>
var table = $('#hotfixTable').DataTable({
"processing": true,
@@ -138,9 +139,17 @@ function showRowDiff(dbc, build, recordID){
}else{
Object.keys(before).forEach(function (key) {
if(before[key] != after[key]){
let addendumBefore = getAddendum(dbc, key, before[key]);
let addendumAfter = getAddendum(dbc, key, after[key]);
changes += "<tr><td>" + key + "</td><td><del class='diff-removed'>" + before[key] + addendumBefore + "</del> &rarr; <ins class='diff-added'>" + after[key] + addendumAfter + "</ins></td></tr>";
if (!isNaN(before[key]) && !isNaN(after[key])) {
let addendumBefore = getAddendum(dbc, key, before[key]);
let addendumAfter = getAddendum(dbc, key, after[key]);
changes += "<tr><td>" + key + "</td><td><del class='diff-removed'>" + before[key] + addendumBefore + "</del> &rarr; <ins class='diff-added'>" + after[key] + addendumAfter + "</ins></td></tr>";
} else {
var dmp = new diff_match_patch();
var dmp_diff = dmp.diff_main(before[key], after[key]);
dmp.diff_cleanupSemantic(dmp_diff);
data = dmp.diff_prettyHtml(dmp_diff);
changes += "<tr><td>" + key + "</td><td>" + data + "</td></tr>";
}
}
});
}
@@ -187,10 +187,11 @@ function toggleFilters(){
filtersEnabled = false;
}
}

(function() {
$('#fileFilter').select2();
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
let vars = {};
let parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});

0 comments on commit 1e96983

Please sign in to comment.
You can’t perform that action at this time.