1
0
Fork 0
mirror of https://github.com/jstrieb/urlpages.git synced 2025-03-15 13:04:33 +01:00
urlpages/editor/index.html

69 lines
1.3 KiB
HTML
Raw Normal View History

2019-06-29 21:53:15 -07:00
<!DOCTYPE html>
<html>
<head>
<title>Create and edit URL pages</title>
<style>
* {
margin: 0px;
box-sizing: border-box;
vertical-align: top;
}
html, body {
height: 100%;
}
2019-06-29 22:47:33 -07:00
#textboxes {
height: 40%;
width: 100%;
}
2019-06-29 21:53:15 -07:00
textarea {
resize: none;
width: 33.3333%;
2019-06-29 22:47:33 -07:00
height: 100%;
2019-06-29 21:53:15 -07:00
}
iframe {
width: 100%;
height: 60%;
}
textarea, iframe {
border: 0.5px solid;
}
</style>
2019-06-29 22:47:33 -07:00
<script type="text/javascript">
function update() {
var pageData =
`
<!DOCTYPE html>
<head>
<style>
${document.getElementById("css").value}
</style>
<script type="text/javascript">
${document.getElementById("javascript").value}
</` +
// TODO: Figure out how to avoid breaking this up
`script>
</head>
<body>
${document.getElementById("html").value}
</body>
`;
window.frames[0].location.replace(`data:text/html,${encodeURIComponent(pageData)}`);
}
</script>
2019-06-29 21:53:15 -07:00
</head>
<body>
2019-06-29 22:47:33 -07:00
<div id="textboxes" onkeyup="update()">
<!-- Unfortunately having these <textarea>s on one line is actually necessary to remove a tiny amount of horizontal space between them -->
2019-06-29 21:53:15 -07:00
<textarea id="html" placeholder="HTML" rows="9"></textarea><textarea id="css" placeholder="CSS" rows="9"></textarea><textarea id="javascript" placeholder="JavaScript" rows="9"></textarea>
2019-06-29 22:47:33 -07:00
</div>
2019-06-29 21:53:15 -07:00
<iframe id="display"></iframe>
</body>
</html>