-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTempindex.html
More file actions
130 lines (117 loc) · 3.85 KB
/
Tempindex.html
File metadata and controls
130 lines (117 loc) · 3.85 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!doctype html>
<html>
<head>
<style>
body {
background-color: #555555;
color: white;
display: flex;
justify-content: space-between;
}
.code-container {
width: 45%;
margin: 10px;
border: 1px solid white;
padding: 10px;
overflow-y: scroll;
}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PureWizard</title>
</head>
<body>
<div class="code-container">
<head>
<style>
body {
background-color: #555555;
color: white;
}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body></body>
<script src="bundle.js"></script>
</html>
</div>
<div class="code-container">
<h2>Code 2</h2>
<head>
<style>
#file-input {
display: none;
}
#file-content {
width: 350px;
height: 570px;
border: 4px solid #111999;
padding: 10px;
overflow-y: scroll;
}
.copy-button {
display: none;
}
</style>
</head>
<body>
<button onclick="selectFile()">Select File</button>
<div id="file-content"></div>
<script>
function selectFile() {
var fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.accept = '.txt'; // Specify the file types allowed, e.g., .txt, .csv
fileInput.addEventListener('change', function(event) {
var file = event.target.files[0];
var reader = new FileReader();
reader.onload = function(e) {
var contents = e.target.result;
displayFileContents(contents);
};
reader.readAsText(file);
});
fileInput.click();
}
function displayFileContents(contents) {
var fileContentDiv = document.getElementById('file-content');
fileContentDiv.innerHTML = '';
var lines = contents.split('\n');
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
var lineElement = document.createElement('div');
lineElement.textContent = line;
var copyButton = document.createElement('button');
copyButton.textContent = 'Copy';
copyButton.addEventListener('click', function() {
copyToClipboard(this.parentNode.firstChild.textContent);
});
lineElement.appendChild(copyButton);
fileContentDiv.appendChild(lineElement);
}
}
function copyToClipboard(text) {
var textarea = document.createElement('textarea');
textarea.value = text;
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
}
</script>
</body>
</html>
<pre>
<!doctype html>
<html>
<head>
<title>Code 2<
</head>
<body>
</body>
</html>
</pre>
</div>
</body>
</html>