forked from html-preview/html-preview.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
172 lines (146 loc) · 4.35 KB
/
Copy pathindex.html
File metadata and controls
172 lines (146 loc) · 4.35 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Enhanced Git-Forge HTML Preview</title>
<style>
body {
font: 12px 'Helvetica Neue', Helvetica, Arial, freesans, clean, sans-serif;
color: #333;
margin: 0;
padding: 0;
}
h1 {
font-size: 20px;
}
a {
color: #666;
}
strong {
color: #333;
background-color: #FAFAFA;
padding: 0.1em;
}
#footer {
margin: 20px 0;
font-size: 10px;
color: #666;
}
#previewform {
display: none;
padding: 20px;
text-align: center;
}
.parameter-section {
margin: 15px 0;
padding: 10px;
border: 1px solid #eee;
border-radius: 5px;
}
.parameter-section h3 {
margin-top: 0;
}
.form-group {
margin: 10px 0;
text-align: left;
}
.form-group label {
display: inline-block;
width: 150px;
text-align: right;
margin-right: 10px;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group select {
width: 300px;
padding: 5px;
}
.form-group input[type="checkbox"] {
margin-left: 160px;
}
.form-group .checkbox-label {
width: auto;
margin-left: 5px;
}
#preview-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
display: none;
z-index: 9999;
}
#preview-frame {
position: absolute;
top: 0;
left: 0;
border: none;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
display: block;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
/* Full page mode styles */
body.preview-mode {
margin: 0;
padding: 0;
overflow: hidden;
}
body.preview-mode #previewform {
display: none !important;
}
body.preview-mode #preview-container {
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
</style>
</head>
<body>
<form id="previewform" onsubmit="location.href='/?'+serializeParameters();return false">
<h1>Enhanced Git-Forge HTML Preview</h1>
<p>⚠️ WARNING ⚠️</p>
<br>
<p>Please read <a href="https://github.com/html-preview/html-preview.github.io/blob/d1478a9f702fb28f1295e5c5e6d1c9b9e7a3c7a7/README.md">security warnings</a></p>
<div class="parameter-section">
<h3>HTML File URL</h3>
<div class="form-group">
<label for="file">URL:</label>
<input type="url" id="file" value="" placeholder="e.g. https://github.com/user/repo/blob/master/index.html">
</div>
</div>
<div class="form-group">
<input type="submit" value="Preview">
</div>
<p>or prepend to the URL:</p>
<p><code><strong id="service_base">https://itseyup.github.io/html-preview.github.io/?url=</strong></code></p>
<p>Contribute on <a href="https://github.com/itseyup/html-preview.github.io">GitHub</a></p>
</form>
<div id="preview-container"></div>
<script src="htmlpreview.js"></script>
<script>
// Serialize parameters for URL
function serializeParameters() {
const fileUrl = document.getElementById('file').value.trim();
if (!fileUrl) return '';
return 'url=' + encodeURIComponent(fileUrl);
}
</script>
</body>
</html>