-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
41 lines (32 loc) · 1.32 KB
/
index.html
File metadata and controls
41 lines (32 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<html>
<head></head>
<body>
<div id="editor"></div>
<script>
// open /Applications/Google\ Chrome.app/ --args --allow-file-access-from-files
function readTextFile(file) {
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function () {
if (rawFile.readyState === 4) {
if (rawFile.status === 200 || rawFile.status == 0) {
var allText = rawFile.responseText;
const result = allText.split(/\r?\n/);
for(i = 0; i < result.length; i++){
lineData = result[i];
if(lineData.includes("=")){
tmplineData = lineData.split("=");
lineData = tmplineData[0] + ' = <input type="text" value="'+tmplineData[1]+'" />';
}
document.getElementById("editor").innerHTML += lineData + "<br>";
}
document.getElementById("editor").innerHTML += "<button>Save</button>";
}
}
}
rawFile.send(null);
}
readTextFile("sample.ini");
</script>
</body>
</html>