|
4 | 4 | <html> |
5 | 5 |
|
6 | 6 | <head> |
| 7 | + <meta charset=utf-8> |
7 | 8 |
|
8 | | - <title>text diff</title> |
| 9 | + <title> |
| 10 | + Text Diff |
| 11 | + </title> |
| 12 | + |
9 | 13 | <meta name=description content='Compare and highlight differences between two text files instantly with this free online text-diff tool. Fast, secure, and easy to use—no downloads required'> |
10 | 14 |
|
11 | 15 | <base href='https://ext-code.com/utils/editors/text-diff/'> |
12 | | - <base href='https://javascript-2020.github.io/utils/editors/text-diff/'> |
13 | 16 | <link rel=canonical href='https://ext-code.com/utils/editors/text-diff/text-diff.html'> |
14 | 17 |
|
15 | 18 | <meta name=viewport content='width=device-width, initial-scale=1'> |
16 | | - <link rel=icon type='image/png' href='images/text-diff-favicon.png'> |
| 19 | + <link rel=icon type='image/png' href='iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAMAAAAM7l6QAAAAnFBMVEVHcEwAAAEHBg9gNqsEAwlXMZwUCyMAAAA1RJkAAAAAAAAAAAAfKFsAAAAdEDQAAAAAAAAAAAAKCRgkFEAAAABlObUVGz04SKIAAABBJHM+UbUAAAAAAAAAAAAvPYk0HV0AAAARFjIAAABPLI0AAAAAAAAmMW4aIUwAAAApNHYAAAAAAABnOrg/UbUAAAFAUrdoO7k7TKsMECVpO7uPyrl7AAAALHRSTlMA/P39//z95vzdQPb64fsWsCT9+17+/f3S+v41ju7++pz7UfsKd/r7KvzFaJeOgx8AAAGbSURBVCjPXZPttmswEEATgqqPolUUpUV7eq474tz3f7c7I47S/SPWshMzGTOMsbxO7Zm03rMP7h4IbUaAddravSXc3YIryu35ANzL8OYBwfT68KV0GSXDX+JCy5BE9oFs4OWT5j/jZJPnizaMP1bIWFvD92Gth52mPS6zbgtI54//nr48Jj/pjts5W/RwPRMRaK+B9MmxlvRJuzDzJN2V5fvypMcr8orglqDmjvOHrTUmNgzjmSzGBgj2RH7YZB6RxQeAM1GmXfvOfNyRTW7gHxW+4EXLbHFVVcOVIvh6r4gbE5Po+G33W/DxCb4h+16qDY1IsboQPV3FGUyyuhFPWjcdrH5h8enSuGqN7KV+jAypNKfkv+4nIgAwY7IY/5+Ui567xuLc1Hu0UWYg+kbvPaewUFeAvcWRSq50nvIuRC0zDpqPHLOVDr+hYKT7OONaFiOr2GEAdas0eqFtMmesgAB/gNLoj0a/0fcipP6zI1VRVRVpROVHU1e9XMBLBNuRKEXVGDNNJayPkTptBsq7fw4cjqM3k9bYrf8B50dH+JJaGO8AAAAASUVORK5CYII='> |
| 20 | + |
| 21 | + <script type='application/ld+json'> |
| 22 | + { |
| 23 | + "@context" : "https://schema.org", |
| 24 | + "@type" : "SoftwareApplication", |
| 25 | + "name" : "Text Diff", |
| 26 | + "url" : "https://ext-code.com/utils/editors/text-diff/text-diff.html", |
| 27 | + "author" : {"@type":"Person","name":"Matthew Richards"}, |
| 28 | + "description" : "Compare and highlight differences between two text files instantly with this free online text-diff tool. Fast, secure, and easy to use—no downloads required", |
| 29 | + "applicationCategory" : "DeveloperApplication", |
| 30 | + "operatingSystem" : "All", |
| 31 | + "browserRequirements" : "Requires JavaScript-enabled browser", |
| 32 | + "softwareVersion" : "1.0.0", |
| 33 | + "offers" : {"@type":"Offer","price":"0","priceCurrency":"GBP"} |
| 34 | + } |
| 35 | + </script> |
17 | 36 |
|
18 | 37 |
|
19 | 38 | <script src="https://cdn.jsdelivr.net/npm/diff@latest/dist/diff.min.js"></script> |
|
26 | 45 | console.log('text-diff-v2.0.html'); |
27 | 46 | console.log(); |
28 | 47 | console.json=v=>console.log(JSON.stringify(v,null,4)); |
| 48 | + var df=true,version='v2.0' |
| 49 | + ; |
| 50 | + |
29 | 51 | var ext; |
30 | 52 | var $; |
31 | 53 | var datatype; |
32 | 54 | var menumod; |
33 | 55 | var keydown; |
| 56 | + var debug; |
34 | 57 |
|
35 | 58 | var menu; |
36 | 59 |
|
|
46 | 69 | //: |
47 | 70 |
|
48 | 71 |
|
49 | | - mod.stack.add = init; |
50 | | - |
51 | 72 | async function init(){ |
52 | | - console.log('init'); |
| 73 | + debug('init',version); |
53 | 74 |
|
54 | 75 |
|
55 | 76 | //keydown = keydown(); |
56 | 77 | menu = menumod(); |
57 | 78 |
|
58 | | - hdr = mod.hdr; |
| 79 | + hdr = mod['editors-hdr']; |
59 | 80 | //mod.menu.main = mod.menu.main(); |
60 | 81 | //debugger; |
61 | | - primary.filemod = mod['filemod[1]']; |
62 | | - primary.editor = mod['editor[1]']; |
| 82 | + primary.filemod = mod.file1; |
| 83 | + primary.editor = mod.editor1; |
63 | 84 |
|
64 | | - secondary.filemod = mod['filemod[2]']; |
65 | | - secondary.editor = mod['editor[2]']; |
| 85 | + secondary.filemod = mod.file2; |
| 86 | + secondary.editor = mod.editor2; |
66 | 87 |
|
67 | | - output = mod['editor[output]']; |
68 | | - log = mod.log; |
| 88 | + output = mod.output; |
| 89 | + log = mod['log-mod']; |
69 | 90 |
|
70 | 91 |
|
71 | 92 | hdr.initmod({ext,$,menu,menumod}); |
|
80 | 101 | output.initmod({ext,$,menu}); |
81 | 102 | log.initmod({ext,$}); |
82 | 103 |
|
83 | | - |
84 | | - await hdr.init(); |
85 | | - //await mod.menu.main.init(); |
86 | | - await primary.filemod.init(); |
87 | | - await primary.editor.init(); |
| 104 | + await Promise.all([ |
| 105 | + hdr.init(), |
| 106 | + //mod.menu.main.init(), |
| 107 | + primary.filemod.init(), |
| 108 | + primary.editor.init(), |
| 109 | + |
| 110 | + secondary.filemod.init(), |
| 111 | + secondary.editor.init(), |
88 | 112 |
|
89 | | - await secondary.filemod.init(); |
90 | | - await secondary.editor.init(); |
| 113 | + //publish.init(), |
91 | 114 |
|
92 | | - //publish.init(); |
| 115 | + output.init(), |
| 116 | + log.init(), |
| 117 | + ]); |
93 | 118 |
|
94 | | - await output.init(); |
95 | | - await log.init(); |
96 | 119 |
|
97 | | - //: |
98 | 120 |
|
99 | 121 | window.onfocus = ()=>primary.editor && primary.editor.focus(); |
100 | 122 | keydown.add(kd); |
|
117 | 139 | 'js/dom/$.js', |
118 | 140 | 'js/core/datatype.js', |
119 | 141 | 'js/dom/menumod/menumod.js', |
120 | | - 'js/dom/keydown/keydown.js' |
| 142 | + 'js/dom/keydown/keydown.js', |
| 143 | + 'js/debug/debug.js', |
121 | 144 | ); |
122 | | - [$,datatype,menumod,keydown] = await promise; |
| 145 | + [$,datatype,menumod,keydown,debug] = await promise; |
123 | 146 |
|
124 | 147 | mod.stack.complete; |
125 | 148 |
|
|
139 | 162 | html |
140 | 163 | {height:100%;font-family:arial} |
141 | 164 | body |
142 | | - {display:flex;flex-direction:column;height:calc(100% - 40px);margin:20px} |
143 | | - |
| 165 | + {display:flex;flex-direction:column;height:calc(100% - 40px);margin:20px;gap:10px} |
| 166 | + |
| 167 | + #output-hdr |
| 168 | + {display:flex;gap:10px;} |
| 169 | + #output-hdr>div |
| 170 | + {display:flex;gap:10px;align-items:center;border:1px solid lightgray;border-radius:5px;padding:3px 5px} |
| 171 | + [type=checkbox] |
| 172 | + {width:20px;height:20px;margin:0} |
| 173 | + [value=check] |
| 174 | + {flex:1} |
144 | 175 |
|
145 | 176 | input |
146 | 177 | {font-size:16px;padding:5px;cursor:pointer} |
|
179 | 210 | #label |
180 | 211 | {flex:1;text-align-center} |
181 | 212 |
|
182 | | - editor-root |
| 213 | + web-editor |
183 | 214 | {flex:1;border-top:1px solid lightgray} |
184 | 215 |
|
185 | 216 | #output |
|
199 | 230 |
|
200 | 231 | <body> |
201 | 232 |
|
202 | | - <hdr component=grp v2.0> |
203 | | - <img class=title src='images/text-diff.png' style='top:5px;height:35px'> |
204 | | - <span slot=date>24 Aug 2025</span> |
205 | | - </hdr> |
| 233 | + <editors-hdr component=grp> |
| 234 | + <img class=title src='images/text-diff.png' style='top:5px;height:45px'> |
| 235 | + <time slot=date datetime=2025-10-31>31 Oct 2025</time> |
| 236 | + </editors-hdr> |
206 | 237 |
|
207 | | - |
208 | | - <input type=button value=check> |
| 238 | + <div id=output-hdr> |
| 239 | + <div> |
| 240 | + show output |
| 241 | + <input type=checkbox checked> |
| 242 | + </div> |
| 243 | + <input type=button value=check> |
| 244 | + </div> |
209 | 245 |
|
210 | 246 | <div id=main> |
211 | 247 | <div id=view1> |
212 | 248 | <div id=hdr> |
213 | | - <filemod inst=1 component v2.0></filemod> |
| 249 | + <file-mod id=file1 component></file-mod> |
214 | 250 | <div id=label>primary</div> |
215 | 251 | </div> |
216 | | - <editor inst=1 component v2.0></editor> |
| 252 | + <web-editor id=editor1 component></web-editor> |
217 | 253 | </div> |
218 | 254 | <div id=view2> |
219 | 255 | <div id=hdr> |
220 | | - <filemod inst=2 component v2.0></filemod> |
| 256 | + <file-mod id=file2 component></file-mod> |
221 | 257 | <div id=label>secondary</div> |
222 | 258 | </div> |
223 | | - <editor inst=2 component v2.0></editor> |
| 259 | + <web-editor id=editor2 component></web-editor> |
224 | 260 | </div> |
225 | 261 | </div> |
226 | 262 |
|
227 | 263 | <div id=output> |
228 | | - <editor inst=output component v2.0></editor> |
| 264 | + <web-editor id=output component v2.0></web-editor> |
229 | 265 | </div> |
230 | 266 |
|
231 | 267 |
|
232 | | - <log component v2.0></log> |
| 268 | + <log-mod component></log-mod> |
233 | 269 |
|
234 | 270 |
|
235 | 271 |
|
|
257 | 293 |
|
258 | 294 |
|
259 | 295 | async function initdom(rootnode){ |
260 | | - console.log('initdom'); |
| 296 | + debug('initdom'); |
261 | 297 | var root = rootnode; |
262 | 298 |
|
263 | 299 | keydown.initdom(); |
|
267 | 303 |
|
268 | 304 | //mod.menu.main.initdom(); |
269 | 305 |
|
270 | | - |
271 | | - $('[value=check]').onclick = btn.check; |
| 306 | + $('#output-hdr [type=checkbox]').onclick = btn['output-chk']; |
| 307 | + $('[value=check]').onclick = btn.check; |
272 | 308 |
|
273 | 309 |
|
274 | 310 |
|
275 | | - var view1 = $('#view1'); |
| 311 | + var view1 = $('#view1'); |
276 | 312 | primary.filemod.initdom(view1); |
277 | 313 | primary.editor.initdom(view1,{mode:'text'}); |
278 | 314 |
|
279 | | - var view2 = $('#view2'); |
| 315 | + var view2 = $('#view2'); |
280 | 316 | secondary.filemod.initdom(view2); |
281 | 317 | secondary.editor.initdom(view2,{mode:'text'}); |
282 | 318 |
|
283 | | - var node = $('#output'); |
| 319 | + var node = $('#output'); |
284 | 320 | await output.initdom(node,{mode:'text'}); |
| 321 | + |
| 322 | + |
285 | 323 |
|
286 | | - var style = document.createElement('style'); |
| 324 | + var style = document.createElement('style'); |
287 | 325 | style.textContent = ` |
288 | 326 | .red |
289 | 327 | {position:absolute;background:var(--red);z-index:20} |
290 | 328 | .green |
291 | 329 | {position:absolute;background:var(--green);z-index:20} |
292 | 330 | `; |
293 | 331 |
|
294 | | - output.root.shadowRoot.append(style); |
| 332 | + output.shadowRoot.append(style); |
| 333 | + |
| 334 | + |
| 335 | + |
| 336 | + |
| 337 | + |
| 338 | + |
295 | 339 |
|
296 | 340 | }//initdom |
297 | 341 |
|
298 | 342 |
|
299 | 343 | //: |
300 | 344 |
|
301 | 345 |
|
| 346 | + btn['output-chk'] = function(){ |
| 347 | + |
| 348 | + var output = $('#output'); |
| 349 | + var chk = $('#output-hdr [type=checkbox]'); |
| 350 | + if(chk.checked){ |
| 351 | + output.style.display = ''; |
| 352 | + }else{ |
| 353 | + output.style.display = 'none'; |
| 354 | + } |
| 355 | + |
| 356 | + }//output-chk |
| 357 | + |
| 358 | + |
302 | 359 | btn.check = function(){ |
303 | 360 |
|
304 | 361 | check(); |
|
0 commit comments