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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html>
|
| 2 |
+
|
| 3 |
+
<head>
|
| 4 |
+
<script type='text/javascript' src='http://code.jquery.com/jquery-2.0.2.js'></script>
|
| 5 |
+
<link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
|
| 6 |
+
<script type='text/javascript' src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
| 7 |
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
| 8 |
+
<style type="text/css">
|
| 9 |
+
.text {
|
| 10 |
+
width: 95%;
|
| 11 |
+
margin-top: 20px;
|
| 12 |
+
margin-bottom: 20px;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
#text {
|
| 16 |
+
padding: 30px;
|
| 17 |
+
font-size: 30px;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.image {
|
| 21 |
+
max-width: 95%;
|
| 22 |
+
margin-top: 20px;
|
| 23 |
+
margin-bottom: 20px;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
img {
|
| 27 |
+
max-width: 95%;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
ins {
|
| 31 |
+
background-color: #d4fcbc;
|
| 32 |
+
text-decoration: none !important;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
del {
|
| 37 |
+
background-color: #fbb6c2;
|
| 38 |
+
color: #555;
|
| 39 |
+
text-decoration: none !important;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
diff {
|
| 43 |
+
background-color: #fbf6b6;
|
| 44 |
+
color: #555;
|
| 45 |
+
text-decoration: none !important;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
#test {
|
| 49 |
+
font-size: 2.3vw
|
| 50 |
+
}
|
| 51 |
+
</style>
|
| 52 |
+
<script type="text/javascript">
|
| 53 |
+
/**
|
| 54 |
+
* htmldiff.js a diff algorithm that understands HTML, and produces HTML in the browser.
|
| 55 |
+
*
|
| 56 |
+
* @author https://github.com/tnwinc
|
| 57 |
+
* @see https://github.com/tnwinc/htmldiff.js
|
| 58 |
+
*/
|
| 59 |
+
!function () {
|
| 60 |
+
var e, n, t, r, i, f, _, a, o, s, u, h, l, c, d, b, p;
|
| 61 |
+
o = function (e) {
|
| 62 |
+
return ">" === e
|
| 63 |
+
}, s = function (e) {
|
| 64 |
+
return "<" === e
|
| 65 |
+
}, h = function (e) {
|
| 66 |
+
return /^\s+$/.test(e)
|
| 67 |
+
}, u = function (e) {
|
| 68 |
+
return /^\s*<[^>]+>\s*$/.test(e)
|
| 69 |
+
}, l = function (e) {
|
| 70 |
+
return !u(e)
|
| 71 |
+
}, e = function () {
|
| 72 |
+
return function (e, n, t) {
|
| 73 |
+
this.start_in_before = e, this.start_in_after = n, this.length = t, this.end_in_before = this.start_in_before + this.length - 1, this.end_in_after = this.start_in_after + this.length - 1
|
| 74 |
+
}
|
| 75 |
+
}(), a = function (e) {
|
| 76 |
+
var n, t, r, i, f, _;
|
| 77 |
+
for (f = "char", t = "", _ = [], r = 0, i = e.length; r < i; r++) switch (n = e[r], f) {
|
| 78 |
+
case "tag":
|
| 79 |
+
o(n) ? (t += ">", _.push(t), t = "", f = h(n) ? "whitespace" : "char") : t += n;
|
| 80 |
+
break;
|
| 81 |
+
case "char":
|
| 82 |
+
s(n) ? (t && _.push(t), t = "<", f = "tag") : /\s/.test(n) ? (t && _.push(t), t = n, f = "whitespace") : /[\w\#@]+/i.test(n) ? t += n : (t && _.push(t), t = n);
|
| 83 |
+
break;
|
| 84 |
+
case "whitespace":
|
| 85 |
+
s(n) ? (t && _.push(t), t = "<", f = "tag") : h(n) ? t += n : (t && _.push(t), t = n, f = "char");
|
| 86 |
+
break;
|
| 87 |
+
default:
|
| 88 |
+
throw new Error("Unknown mode " + f)
|
| 89 |
+
}
|
| 90 |
+
return t && _.push(t), _
|
| 91 |
+
}, f = function (n, t, r, i, f, _, a) {
|
| 92 |
+
var o, s, u, h, l, c, d, b, p, g, w, v, k, m, y;
|
| 93 |
+
for (s = i, o = _, u = 0, w = {}, c = h = m = i, y = f; m <= y ? h < y : h > y; c = m <= y ? ++h : --h) {
|
| 94 |
+
for (k = {}, d = 0, b = (p = r[n[c]]).length; d < b; d++) if (!((l = p[d]) < _)) {
|
| 95 |
+
if (l >= a) break;
|
| 96 |
+
null == w[l - 1] && (w[l - 1] = 0), v = w[l - 1] + 1, k[l] = v, v > u && (s = c - v + 1, o = l - v + 1, u = v)
|
| 97 |
+
}
|
| 98 |
+
w = k
|
| 99 |
+
}
|
| 100 |
+
return 0 !== u && (g = new e(s, o, u)), g
|
| 101 |
+
}, d = function (e, n, t, r, i, _, a, o) {
|
| 102 |
+
var s;
|
| 103 |
+
return null != (s = f(e, 0, t, r, i, _, a)) && (r < s.start_in_before && _ < s.start_in_after && d(e, n, t, r, s.start_in_before, _, s.start_in_after, o), o.push(s), s.end_in_before <= i && s.end_in_after <= a && d(e, n, t, s.end_in_before + 1, i, s.end_in_after + 1, a, o)), o
|
| 104 |
+
}, r = function (e) {
|
| 105 |
+
var n, t, r, i, f, _;
|
| 106 |
+
if (null == e.find_these) throw new Error("params must have find_these key");
|
| 107 |
+
if (null == e.in_these) throw new Error("params must have in_these key");
|
| 108 |
+
for (r = {}, n = 0, i = (f = e.find_these).length; n < i; n++) for (r[_ = f[n]] = [], t = e.in_these.indexOf(_); -1 !== t;) r[_].push(t), t = e.in_these.indexOf(_, t + 1);
|
| 109 |
+
return r
|
| 110 |
+
}, _ = function (e, n) {
|
| 111 |
+
var t, i;
|
| 112 |
+
return i = [], t = r({ find_these: e, in_these: n }), d(e, n, t, 0, e.length, 0, n.length, i)
|
| 113 |
+
}, n = function (n, t) {
|
| 114 |
+
var r, i, f, a, o, s, u, h, l, c, d, b, p, g, w, v;
|
| 115 |
+
if (null == n) throw new Error("before_tokens?");
|
| 116 |
+
if (null == t) throw new Error("after_tokens?");
|
| 117 |
+
for (w = g = 0, p = [], r = {
|
| 118 |
+
"false,false": "replace",
|
| 119 |
+
"true,false": "insert",
|
| 120 |
+
"false,true": "delete",
|
| 121 |
+
"true,true": "none"
|
| 122 |
+
}, (d = _(n, t)).push(new e(n.length, t.length, 0)), a = f = 0, h = d.length; f < h; a = ++f) "none" !== (i = r[[w === (c = d[a]).start_in_before, g === c.start_in_after].toString()]) && p.push({
|
| 123 |
+
action: i,
|
| 124 |
+
start_in_before: w,
|
| 125 |
+
end_in_before: "insert" !== i ? c.start_in_before - 1 : void 0,
|
| 126 |
+
start_in_after: g,
|
| 127 |
+
end_in_after: "delete" !== i ? c.start_in_after - 1 : void 0
|
| 128 |
+
}), 0 !== c.length && p.push({
|
| 129 |
+
action: "equal",
|
| 130 |
+
start_in_before: c.start_in_before,
|
| 131 |
+
end_in_before: c.end_in_before,
|
| 132 |
+
start_in_after: c.start_in_after,
|
| 133 |
+
end_in_after: c.end_in_after
|
| 134 |
+
}), w = c.end_in_before + 1, g = c.end_in_after + 1;
|
| 135 |
+
for (v = [], u = { action: "none" }, o = function (e) {
|
| 136 |
+
return "equal" === e.action && (e.end_in_before - e.start_in_before == 0 && /^\s$/.test(n.slice(e.start_in_before, +e.end_in_before + 1 || 9e9)))
|
| 137 |
+
}, s = 0, l = p.length; s < l; s++) o(b = p[s]) && "replace" === u.action || "replace" === b.action && "replace" === u.action ? (u.end_in_before = b.end_in_before, u.end_in_after = b.end_in_after) : (v.push(b), u = b);
|
| 138 |
+
return v
|
| 139 |
+
}, t = function (e, n, t) {
|
| 140 |
+
var r, i, f, _, a, o;
|
| 141 |
+
for (_ = void 0, f = i = 0, a = (n = n.slice(e, +n.length + 1 || 9e9)).length; i < a && (o = n[f], !0 === (r = t(o)) && (_ = f), !1 !== r); f = ++i);
|
| 142 |
+
return null != _ ? n.slice(0, +_ + 1 || 9e9) : []
|
| 143 |
+
}, p = function (e, n) {
|
| 144 |
+
var r, i, f, _, a;
|
| 145 |
+
for (_ = "", f = 0, r = n.length; ;) {
|
| 146 |
+
if (f >= r) break;
|
| 147 |
+
if (i = t(f, n, l), f += i.length, 0 !== i.length && (_ += "<" + e + ">" + i.join("") + "</" + e + ">"), f >= r) break;
|
| 148 |
+
f += (a = t(f, n, u)).length, _ += a.join("")
|
| 149 |
+
}
|
| 150 |
+
return _
|
| 151 |
+
}, mm = function (pp) {
|
| 152 |
+
for (var _ = "", r = 0; r < i.length; r++) _ += " ";
|
| 153 |
+
return _
|
| 154 |
+
}, xx = function (e, n) {
|
| 155 |
+
var r, i, f, _, a;
|
| 156 |
+
for (_ = "", f = 0, r = n.length; ;) {
|
| 157 |
+
if (f >= r) break;
|
| 158 |
+
if (i = t(f, n, l), f += i.length, 0 !== i.length && (_ += "<" + e + ">" + mm(i) + "</" + e + ">"), f >= r) break;
|
| 159 |
+
f += (a = t(f, n, u)).length, _ += a.join("")
|
| 160 |
+
}
|
| 161 |
+
return _
|
| 162 |
+
}, (c = {
|
| 163 |
+
equal: function (e, n, t) {
|
| 164 |
+
return n.slice(e.start_in_before, +e.end_in_before + 1 || 9e9).join("")
|
| 165 |
+
}, insert: function (e, n, t) {
|
| 166 |
+
var r;
|
| 167 |
+
return r = t.slice(e.start_in_after, +e.end_in_after + 1 || 9e9), xx("ins", r)
|
| 168 |
+
}, delete: function (e, n, t) {
|
| 169 |
+
var r;
|
| 170 |
+
return r = n.slice(e.start_in_before, +e.end_in_before + 1 || 9e9), p("ins", r)
|
| 171 |
+
}, diff: function (e, n, t) {
|
| 172 |
+
var r;
|
| 173 |
+
return r = n.slice(e.start_in_before, +e.end_in_before + 1 || 9e9), p("del", r)
|
| 174 |
+
}
|
| 175 |
+
}).replace = function (e, n, t) {
|
| 176 |
+
return c.diff(e, n, t)
|
| 177 |
+
}, b = function (e, n, t) {
|
| 178 |
+
var r, i, f, _;
|
| 179 |
+
for (_ = "", r = 0, i = t.length; r < i; r++) f = t[r], _ += c[f.action](f, e, n);
|
| 180 |
+
return _
|
| 181 |
+
}, (i = function (e, t) {
|
| 182 |
+
var r;
|
| 183 |
+
return e === t ? e : (e = a(e), t = a(t), r = n(e, t), b(e, t, r))
|
| 184 |
+
}).html_to_tokens = a, i.find_matching_blocks = _, _.find_match = f, _.create_index = r, i.calculate_operations = n, i.render_operations = b, "function" == typeof define ? define([], function () {
|
| 185 |
+
return i
|
| 186 |
+
}) : "undefined" != typeof module && null !== module ? module.exports = i : "undefined" != typeof window && (window.htmldiff = i)
|
| 187 |
+
}();
|
| 188 |
+
</script>
|
| 189 |
+
</head>
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
<body style="margin-left: 20px">
|
| 193 |
+
<br><br>
|
| 194 |
+
<input type='file' onchange='openFile(event)'><br>
|
| 195 |
+
<input type="number" name="line" id="line">
|
| 196 |
+
<button id="search">find</button>
|
| 197 |
+
<div id='output' class="row" style="margin-left: 0; margin-right: 0">
|
| 198 |
+
<div class="text">
|
| 199 |
+
<input class="form-control" type="text" name="time" value="08">
|
| 200 |
+
</div>
|
| 201 |
+
<div class="image">
|
| 202 |
+
<img src="">
|
| 203 |
+
</div>
|
| 204 |
+
</div>
|
| 205 |
+
<div id='test' class="row" style="margin-left: 0; margin-right: 0"></div>
|
| 206 |
+
<!-- <div id='raw_crnn' class="row" style="margin-left: 0; margin-right: 0"></div>-->
|
| 207 |
+
<button id="prev">previous</button><button id="next">next</button></br></br>
|
| 208 |
+
<button id="save">SAVE</button>
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
<script>
|
| 212 |
+
var data;
|
| 213 |
+
var total = [];
|
| 214 |
+
var diff_total = [];
|
| 215 |
+
// var t = JSON.parse(total);
|
| 216 |
+
var count = 0;
|
| 217 |
+
var showData = function (text, diffc) {
|
| 218 |
+
let t = text[count];
|
| 219 |
+
let html = "";
|
| 220 |
+
html += '<h3>' + t[0] + '</h3>'
|
| 221 |
+
html += '<div class="text"><input id="text" class="form-control" type="text" name="time" value="' + t[1] + '"></div>';
|
| 222 |
+
html += '<div class="image"><img src="./imgs/' + encodeURIComponent(t[0]) + '"></div>';
|
| 223 |
+
let cc = $('#output');
|
| 224 |
+
cc.html(html);
|
| 225 |
+
let x = diffc.find(function (d) {
|
| 226 |
+
return d[0].trim() == t[0].trim()
|
| 227 |
+
})
|
| 228 |
+
if (x) {
|
| 229 |
+
let diff1 = htmldiff(x[1], x[2]);
|
| 230 |
+
let diff2 = htmldiff(x[2], x[1]);
|
| 231 |
+
// $("#test").html(diff1 +'</br>'+ diff2+'</br>'+x[7])
|
| 232 |
+
$("#test").html(diff1 + '</br>' + diff2)
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
}
|
| 236 |
+
var openFile = function (event) {
|
| 237 |
+
total = [];
|
| 238 |
+
count = 0;
|
| 239 |
+
var input = event.target;
|
| 240 |
+
var reader = new FileReader();
|
| 241 |
+
reader.onload = function () {
|
| 242 |
+
var data = reader.result;
|
| 243 |
+
let lines = data.split('\n');
|
| 244 |
+
for (let i in lines) {
|
| 245 |
+
t = lines[i].split('\t');
|
| 246 |
+
total.push(t);
|
| 247 |
+
}
|
| 248 |
+
showData(total, diff_total);
|
| 249 |
+
};
|
| 250 |
+
try {
|
| 251 |
+
if (input.files[0])
|
| 252 |
+
reader.readAsText(input.files[0]);
|
| 253 |
+
} catch (e) {
|
| 254 |
+
alert("Error")
|
| 255 |
+
}
|
| 256 |
+
};
|
| 257 |
+
var openCSV = function (event) {
|
| 258 |
+
diff_total = [];
|
| 259 |
+
count = 0;
|
| 260 |
+
var input = event.target;
|
| 261 |
+
var reader = new FileReader();
|
| 262 |
+
reader.onload = function () {
|
| 263 |
+
var data = reader.result;
|
| 264 |
+
let lines = data.split('\n');
|
| 265 |
+
for (let i in lines) {
|
| 266 |
+
t = lines[i].split('\t');
|
| 267 |
+
diff_total.push(t);
|
| 268 |
+
}
|
| 269 |
+
showData(total, diff_total);
|
| 270 |
+
};
|
| 271 |
+
try {
|
| 272 |
+
if (input.files[0])
|
| 273 |
+
reader.readAsText(input.files[0]);
|
| 274 |
+
} catch (e) {
|
| 275 |
+
alert("Error")
|
| 276 |
+
}
|
| 277 |
+
};
|
| 278 |
+
$(document).ready(function () {
|
| 279 |
+
$(document).keyup(function (event) {
|
| 280 |
+
if (event.keyCode == 40) {
|
| 281 |
+
count += 1;
|
| 282 |
+
$('#line').val(count);
|
| 283 |
+
let t = total[count];
|
| 284 |
+
let html = "";
|
| 285 |
+
t[1] = t[1].replace(/"/g, """);
|
| 286 |
+
html += '<h3>' + t[0] + '</h3>'
|
| 287 |
+
html += '<div class="text"><input id="text" class="form-control" type="text" name="time" value="' + t[1] + '"></div>';
|
| 288 |
+
html += '<div class="image"><img src="./imgs/' + encodeURIComponent(t[0]) + '"></textarea></div>';
|
| 289 |
+
let cc = $('#output');
|
| 290 |
+
cc.html(html);
|
| 291 |
+
$('#text').focus();
|
| 292 |
+
let x = diff_total.find(function (d) {
|
| 293 |
+
return d[0].trim() == t[0].trim()
|
| 294 |
+
})
|
| 295 |
+
if (x) {
|
| 296 |
+
let diff1 = htmldiff(x[1], x[2]);
|
| 297 |
+
let diff2 = htmldiff(x[2], x[1]);
|
| 298 |
+
let raw_crnn = x[7];
|
| 299 |
+
// $("#test").html(diff1 + '</br>'+ diff2+'</br>'+raw_crnn)
|
| 300 |
+
$("#test").html(diff1 + '</br>' + diff2)
|
| 301 |
+
}
|
| 302 |
+
}
|
| 303 |
+
else if (event.keyCode == 38) {
|
| 304 |
+
if (count >= 1) {
|
| 305 |
+
count -= 1;
|
| 306 |
+
let t = total[count];
|
| 307 |
+
t[1] = t[1].replace(/"/g, """);
|
| 308 |
+
$('#line').val(count);
|
| 309 |
+
let html = "";
|
| 310 |
+
html += '<h3>' + t[0] + '</h3>'
|
| 311 |
+
html += '<div class="text"><input id="text" class="form-control" type="text" name="time" value="' + t[1] + '"></div>';
|
| 312 |
+
html += '<div class="image"><img src="./imgs/' + encodeURIComponent(t[0]) + '"></textarea></div>';
|
| 313 |
+
let cc = $('#output');
|
| 314 |
+
cc.html(html);
|
| 315 |
+
$('#text').focus()
|
| 316 |
+
let x = diff_total.find(function (d) {
|
| 317 |
+
return d[0].trim() == t[0].trim()
|
| 318 |
+
})
|
| 319 |
+
if (x) {
|
| 320 |
+
let diff1 = htmldiff(x[1], x[2]);
|
| 321 |
+
let diff2 = htmldiff(x[2], x[1]);
|
| 322 |
+
let raw_crnn = x[7];
|
| 323 |
+
// $("#test").html(diff1 +'</br>'+ diff2+'</br>'+raw_crnn)
|
| 324 |
+
$("#test").html(diff1 + '</br>' + diff2)
|
| 325 |
+
}
|
| 326 |
+
}
|
| 327 |
+
}
|
| 328 |
+
else {
|
| 329 |
+
try {
|
| 330 |
+
total[count][1] = $('#text').val();
|
| 331 |
+
} catch (e) {
|
| 332 |
+
console.log(e)
|
| 333 |
+
}
|
| 334 |
+
}
|
| 335 |
+
$('#prev').on('click', function () {
|
| 336 |
+
if (count >= 1) {
|
| 337 |
+
count -= 1;
|
| 338 |
+
let t = total[count];
|
| 339 |
+
t[1] = t[1].replace(/"/g, """);
|
| 340 |
+
$('#line').val(count);
|
| 341 |
+
let html = "";
|
| 342 |
+
html += '<h3>' + t[0] + '</h3>'
|
| 343 |
+
html += '<div class="text"><input id="text" class="form-control" type="text" name="time" value="' + t[1] + '"></div>';
|
| 344 |
+
html += '<div class="image"><img src="./imgs/' + encodeURIComponent(t[0]) + '"></textarea></div>';
|
| 345 |
+
let cc = $('#output');
|
| 346 |
+
cc.html(html);
|
| 347 |
+
$('#text').focus()
|
| 348 |
+
let x = diff_total.find(function (d) {
|
| 349 |
+
return d[0].trim() == t[0].trim()
|
| 350 |
+
})
|
| 351 |
+
if (x) {
|
| 352 |
+
let diff1 = htmldiff(x[1], x[2]);
|
| 353 |
+
let diff2 = htmldiff(x[2], x[1]);
|
| 354 |
+
let raw_crnn = x[7];
|
| 355 |
+
// $("#test").html(diff1 +'</br>'+ diff2+'</br>'+raw_crnn)
|
| 356 |
+
$("#test").html(diff1 + '</br>' + diff2)
|
| 357 |
+
}
|
| 358 |
+
}
|
| 359 |
+
})
|
| 360 |
+
$('#next').on('click', function () {
|
| 361 |
+
count += 1;
|
| 362 |
+
$('#line').val(count);
|
| 363 |
+
let t = total[count];
|
| 364 |
+
let html = "";
|
| 365 |
+
t[1] = t[1].replace(/"/g, """);
|
| 366 |
+
html += '<h3>' + t[0] + '</h3>'
|
| 367 |
+
html += '<div class="text"><input id="text" class="form-control" type="text" name="time" value="' + t[1] + '"></div>';
|
| 368 |
+
html += '<div class="image"><img src="./imgs/' + encodeURIComponent(t[0]) + '"></textarea></div>';
|
| 369 |
+
let cc = $('#output');
|
| 370 |
+
cc.html(html);
|
| 371 |
+
$('#text').focus();
|
| 372 |
+
let x = diff_total.find(function (d) {
|
| 373 |
+
return d[0].trim() == t[0].trim()
|
| 374 |
+
})
|
| 375 |
+
if (x) {
|
| 376 |
+
let diff1 = htmldiff(x[1], x[2]);
|
| 377 |
+
let diff2 = htmldiff(x[2], x[1]);
|
| 378 |
+
let raw_crnn = x[7];
|
| 379 |
+
// $("#test").html(diff1 + '</br>'+ diff2+'</br>'+raw_crnn)
|
| 380 |
+
$("#test").html(diff1 + '</br>' + diff2)
|
| 381 |
+
}
|
| 382 |
+
})
|
| 383 |
+
});
|
| 384 |
+
|
| 385 |
+
|
| 386 |
+
$('#search').on('click', function () {
|
| 387 |
+
let d = $('#line').val();
|
| 388 |
+
count = parseInt(d);
|
| 389 |
+
let t = total[count];
|
| 390 |
+
let html = "";
|
| 391 |
+
html += '<h3>' + t[0] + '</h3>'
|
| 392 |
+
html += '<div class="text"><input id="text" class="form-control" type="text" name="time" value="' + t[1] + '"></div>';
|
| 393 |
+
html += '<div class="image"><img src="./imgs/' + encodeURIComponent(t[0]) + '"></textarea></div>';
|
| 394 |
+
let cc = $('#output');
|
| 395 |
+
cc.html(html);
|
| 396 |
+
$('#text').focus()
|
| 397 |
+
let x = diff_total.find(function (d) {
|
| 398 |
+
return d[0].trim() == t[0].trim()
|
| 399 |
+
})
|
| 400 |
+
if (x) {
|
| 401 |
+
let diff1 = htmldiff(x[1], x[2]);
|
| 402 |
+
let diff2 = htmldiff(x[2], x[1]);
|
| 403 |
+
let raw_crnn = x[7];
|
| 404 |
+
// $("#test").html(diff1 +'</br>'+ diff2+'</br>'+raw_crnn)
|
| 405 |
+
$("#test").html(diff1 + '</br>' + diff2)
|
| 406 |
+
}
|
| 407 |
+
});
|
| 408 |
+
$('#save').on('click', function () {
|
| 409 |
+
let html = '';
|
| 410 |
+
for (var i = 0; i < total.length; i++) {
|
| 411 |
+
html += total[i][0] + '\t' + total[i][1] + '\n';
|
| 412 |
+
}
|
| 413 |
+
console.log(html);
|
| 414 |
+
function download() {
|
| 415 |
+
var fileContents = html;
|
| 416 |
+
var fileName = count + "_anotate.txt";
|
| 417 |
+
var pp = document.createElement('a');
|
| 418 |
+
pp.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(fileContents));
|
| 419 |
+
pp.setAttribute('download', fileName);
|
| 420 |
+
pp.click();
|
| 421 |
+
}
|
| 422 |
+
setTimeout(function () {
|
| 423 |
+
download()
|
| 424 |
+
}, 500);
|
| 425 |
+
})
|
| 426 |
+
})
|
| 427 |
+
window.onbeforeunload = function (e) {
|
| 428 |
+
return 'Dialog text here.';
|
| 429 |
+
};
|
| 430 |
+
</script>
|
| 431 |
+
</body>
|
| 432 |
+
|
| 433 |
+
</html>
|