This repository has been archived by the owner on Jan 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
htmltemplates.html
executable file
·234 lines (229 loc) · 7.73 KB
/
htmltemplates.html
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>HTML Templates</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="Vlad Podvorny" />
<style>
* {padding:0; margin:0;}
body {font:10pt verdana,arial,sans-serif; background:#fff;}
h1 {font:14pt verdana,arial,sans-serif; color:#666; padding:0.2em;}
p {padding:2px 0;}
a {text-decoration:none; color:#03c;}
a:hover {color:#c30; text-decoration:underline;}
div.main {margin:4px 8px;}
.small {font:normal 8pt arial,sans-serif; line-height:1.1;}
.big {font:bold 16pt verdana,arial,sans-serif; color:#03c;}
.code {font:10pt 'courier new',monospace; color:#039; background-color:#dcdcdc;}
div.code {border:1px solid #ccc;}
.clear {clear:both;}
span.small {color:#000;}
a.small {color:#00f;}
a.small:hover {color:#f00;}
ul.nobull {list-style-type:none; margin-left:1em;}
</style>
<script type="text/javascript"><!--//--><![CDATA[//><!--
var oHtmlTpl={
/*
'html401t':{
'title':"",
'content':''
},
*/
'html401t':{
'title':"HTML 4.01 Trans.",
'content':'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n\t\t\t"http://www.w3.org/TR/html4/loose.dtd">\n'
},
'html401s':{
'title':"HTML 4.01 Strict",
'content':'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"\n\t\t\t"http://www.w3.org/TR/html4/strict.dtd">\n'
},
'xhtml1t':{
'title':"XHTML 1.0 Trans.",
'content':'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">\n'
},
'xhtml1s':{
'title':"XHTML 1.0 Strict",
'content':'<?xml version="1.0" encoding="utf-8"?>\n<'+'!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">\n'
},
'fieldset':{
'title':"fieldset",
'content':'<fieldset><legend>Title</legeng>\n\n</fieldset>\n'
},
'form':{
'title':"form",
'content':'<form method="post" action="myaction" onsubmit="return validateMyForm()">\n\n</form>\n'
},
/*
'formfile':{
'title':"form/upload",
'content':'<form method="post" action="myaction" enctype="multipart/form-data" onsubmit="return validateMyForm()">\n\t<input type="file" name="myfile" />\n</form>\n'
},
*/
'iframe':{
'title':"iframe",
'content':'<iframe src="http://www.example.com/" width="200" height="200" frameborder="0" scrolling="auto" noresize="noresize"></iframe>'
},
'img':{
'title':"img",
'content':'<img src="myimage.jpg" border="0" width="100" height="100" title="" alt="" />'
},
'checkbox':{
'title':"input/checkbox",
'content':'<input type="checkbox" name="mybox" value="1" checked="checked" />'
},
'inbutton':{
'title':"input/button",
'content':'<input type="button" name="mybutton" value="Go" onclick="myClickProc()" />'
},
'hidden':{
'title':"input/hidden",
'content':'<input type="hidden" name="myhidden" value="myvalue" />'
},
'inimage':{
'title':"input/image",
'content':'<input type="image" name="myimage" src="myimage.jpg" alt="Go" />'
},
'inpass':{
'title':"input/password",
'content':'<input type="password" name="mypass" size="20" maxlength="20" />'
},
'radio':{
'title':"input/radio",
'content':'<input type="radio" name="myradio" value="1" checked="checked" /> first\n<input type="radio" name="myradio" value="2" /> second\n'
},
'reset':{
'title':"input/reset",
'content':'<input type="reset" value="Reset" />'
},
'submit':{
'title':"input/submit",
'content':'<input type="submit" name="mysubmit" value="Go" />'
},
'intext':{
'title':"input/text",
'content':'<input type="text" name="mytext" size="20" maxlength="100" value="" />'
},
'favicon':{
'title':"link/icon",
'content':'<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">'
},
'css':{
'title':"link/stylesheet",
'content':'<link rel="stylesheet" href="stylesheet.css" type="text/css">'
},
'meta':{
'title':"meta",
'content':'<meta name="keywords" content="" />'
},
'charset':{
'title':"meta/charset",
'content':'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'
},
'refresh':{
'title':"meta/refresh",
'content':'<meta http-equiv="Refresh" content="5; url=http://www.example.com/" />'
},
'script':{
'title':"script",
'content':'<'+'script type="text/javascript"><'+'!--//--'+'><![CDATA[//><'+'!--\n\n//--'+'><!]]></'+'script>\n'
},
'scriptsrc':{
'title':"script/src",
'content':'<'+'script type="text/javascript" src="myscript.js"></'+'script>\n'
},
'select':{
'title':"select",
'content':'<select name="myselectname" size="1">\n\t<option value="1" selected="selected">Option 1</option>\n\t<option value="2">Option 2</option>\n</select>\n'
},
'table':{
'title':"table",
'content':'<table border="0" cellpadding="0" cellspacing="0">\n\t<tr><td></td></tr>\n\t<tr><td></td></tr>\n</table>\n'
},
'textarea':{
'title':"textarea",
'content':'<textarea name="mytextarea" cols="40" rows="5"></textarea>'
}
}
oHtmlTpl['page']={
'title':"Blank Document",
'content':oHtmlTpl.xhtml1t.content+'<head><title>Document</title>\n</head>\n<body>\n\n</body>\n</html>'
}
function replSpecChars(sText){
var aChars=[['<', '<'], ['>', '>'], ['"', '"'], ['\\n', '<br/>'], ['\\t', ' ']];
var s=sText;
for (var i=0, n=aChars.length; i<n; i++) {
eval("re=/"+aChars[i][0]+"/g");
s=s.replace(re, aChars[i][1]);
}
return s;
}
function showPreview(sText){
oEl=document.getElementById('preview');
oEl.style.display='block';
oEl.innerHTML=replSpecChars(sText);
}
function showTplPreview(sSelector){
showPreview(oHtmlTpl[sSelector].content);
}
function hidePreview(){
oEl=document.getElementById('preview');
oEl.style.display='none';
oEl.innerHTML='';
}
function getTemplateItems(){
var aOut=[];
for (sItem in oHtmlTpl) {
aOut.push(sItem);
}
// put last one on top
var s=aOut.pop();
aOut.unshift(s);
return aOut;
}
/*
function getTplContent(sSelector){
return oHtmlTpl[sSelector].content;
}
*/
function outputTemplate(sSelector){
var oTA=document.getElementById('output');
//oTA.innerHTML=getTplContent(sSelector);
oTA.value=oHtmlTpl[sSelector].content;
oTA.focus();
//oTA.select();
document.getElementById('preview').innerHTML='Press Ctrl-C to copy';
}
window.onload=function(){
var aItems=getTemplateItems(), iLen=aItems.length, a=[];
if (iLen) {
for (var i=0; i<iLen; i++) {
var oItem=oHtmlTpl[aItems[i]];
a.push('<li><a href="javascript:outputTemplate(\''+aItems[i]+'\')" onmouseover="showTplPreview(\''+aItems[i]+'\')" onmouseout="hidePreview()">'+oItem.title+'</a></li>');
}
var sStyle=(iLen>40)? ' style="height:600px; overflow-y:scroll;"':'';
document.getElementById('tplList').innerHTML='<ul class="nobull"'+sStyle+'>'+a.join('')+'</ul>';
}
}
//--><!]]></script>
</head>
<body>
<div class="main" style="width:900px;">
<script type="text/javascript"><!--//--><![CDATA[//><!--
if (top.location.href!=self.location.href) {
document.write('<p><a class="small" href="javascript:top.location.href=self.location.href;">remove frames</a></p>');
}
//--><!]]></script>
<h1>HTML Templates.</h1>
<div id="tplList" style="width:160px; float:left;">
</div>
<div style="width:700px; float:left;">
<div>
<textarea id="output" rows="10" cols="80" onfocus="this.select()"></textarea>
</div>
<p> </p>
<div id="preview" class="code" style="display:none;"></div>
</div>
</div><!-- .main -->
</body>
</html>