2 <html lang=
"en-us"><head><meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8"><style id=
"stndz-style"></style>
5 <link rel=
"icon" type=
"image/x-icon" href=
"./edid-decode.ico">
7 <title>EDID Decode
</title>
19 background-color: black;
21 font-family: 'Lucida Console', Monaco, monospace;
26 background-color: white;
38 <div style=
"display:flex">
39 <div style=
"margin:10px">
40 <h3 style=
"float:left">EDID
</h3>
41 <input type=
"file" id=
"upload" style=
"float:left; margin-left: 10px;">
42 <div style=
"clear:both"></div>
43 <textarea id=
"input" style=
"width:40vw; height: 300px;" placeholder=
"Paste EDID hex here"></textarea>
44 <button id=
"process">Process
</button>
45 <div><a href=
"https://git.linuxtv.org/edid-decode.git/">edid-decode.git
</a></div>
47 Credits: copied from Ilia Mirkin's website https://people.freedesktop.org/~imirkin/edid-decode/
48 <textarea readonly=
"" id=
"error" style=
"width: 40vw; height: 100px; resize: none;"></textarea>
50 <div style=
"margin:10px">
52 <textarea readonly=
"" id=
"output" rows=
"8" style=
"width:55vw; height: calc(100vh - 80px)"></textarea>
55 <script type=
"text/javascript">
57 document
.getElementById("upload").addEventListener("change", function(e
) {
58 if (typeof WebAssembly
=== 'undefined') return;
59 document
.getElementById("output").value
= "";
60 document
.getElementById("error").value
= "";
63 var file
= input
.files
[0];
65 var fr
= new FileReader();
66 fr
.onload = function(e
) {
67 process(new Uint8Array(e
.target
.result
));
69 fr
.readAsArrayBuffer(file
);
72 document
.getElementById("process").addEventListener("click", function(e
) {
73 if (typeof WebAssembly
=== 'undefined') return;
74 document
.getElementById("output").value
= "";
75 document
.getElementById("error").value
= "";
76 process(document
.getElementById("input").value
);
79 function process(input
) {
80 FS
.writeFile("input-file", input
);
81 Module
.ccall('parse_edid', 'number', ['string'], ['input-file']);
83 // Look for the hex in the EDID output
84 var output = document.getElementById("output").value;
85 var m = output.match(/^edid-decode \(hex\):\n([0-9a-f \n]*)\n/ms);
87 var hex = m[1].replace(/\s/g, '');
99 var element
= document
.getElementById('output');
100 if (element
) element
.value
= ''; // clear browser cache
101 return function(text
) {
102 if (arguments
.length
> 1) text
= Array
.prototype.slice
.call(arguments
).join(' ');
103 // These replacements are necessary if you render to raw HTML
104 //text = text.replace(/&/g, "&");
105 //text = text.replace(/</g, "<");
106 //text = text.replace(/>/g, ">");
107 //text = text.replace('\n', '<br>', 'g');
110 element
.value
+= text
+ "\n";
111 element
.scrollTop
= element
.scrollHeight
; // focus on bottom
115 printErr
: (function() {
116 var element
= document
.getElementById('error');
117 if (element
) element
.value
= ''; // clear browser cache
118 return function(text
) {
119 if (arguments
.length
> 1) text
= Array
.prototype.slice
.call(arguments
).join(' ');
122 element
.value
+= text
+ "\n";
123 element
.scrollTop
= element
.scrollHeight
;
127 setStatus: function(text
) {
128 if (!Module
.setStatus
.last
) Module
.setStatus
.last
= { time
: Date
.now(), text
: '' };
129 if (text
=== Module
.setStatus
.last
.text
) return;
132 totalDependencies
: 0,
133 monitorRunDependencies: function(left
) {
134 this.totalDependencies
= Math
.max(this.totalDependencies
, left
);
135 Module
.setStatus(left
? 'Preparing... (' + (this.totalDependencies
-left
) + '/' + this.totalDependencies
+ ')' : 'All downloads complete.');
138 Module
.setStatus('Downloading...');
139 window
.onerror = function(event
) {
140 // TODO: do not warn on ok events like simulating an infinite loop or exitStatus
141 Module
.setStatus('Exception thrown, see JavaScript console');
142 Module
.setStatus = function(text
) {
143 if (text
) Module
.printErr('[post-exception status] ' + text
);
147 <script async=
"" type=
"text/javascript" src=
"./edid-decode.js"></script>