Lecture 140 - Project - Codeplayer - Codeplayerdothtml
Lecture 140 - Project - Codeplayer - Codeplayerdothtml
html
!
!
<!doctype html>
<html>
<head>
<title>CodePlayer</title>
!
<meta charset="utf-8" />
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-
ui.min.js"></script>
<style>
* {
margin:0;
padding:0;
body, html {
height:100%;
width:100%;
#container {
height:100%;
#titlebar {
width:100%;
background-color:#EEEEEE;
height:40px;
#title {
padding:10px 0 0 20px;
font-weight:bold;
float:left;
#menu {
margin:0 auto;
width:220px;
padding:5px;
!
#menu ul {
border-radius:5px;
height:30px;
#menu li {
float:left;
list-style:none;
height:20px;
padding:5px 10px;
#menu li:hover {
background-color:grey;
.break {
clear:both;
.codecontainer {
width:50%;
float:left;
position:relative;
.code {
width:100%;
height:100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding:10px;
#cssContainer, #jsContainer {
display:none;
.containerTitle {
position:absolute;
right:20px;
top:10px;
background-color:#FFF;
padding:4px;
border-radius:4px;
.selected {
background-color:grey !important;
#runButton {
float:right;
margin:5px 20px 0 0;
#run {
font-size:130%;
border-radius:10px;
padding:0 10px;
#resultFrame {
width:100%;
height:100%;
border:0;
.resultContainer {
height:100%;
textarea {
border:none;
resize: none;
font-family:monotype;
font-size:100%;
}
</style>
<script>
$(function() {
$(".codecontainer").css("height",height+"px");
!
$(".selector").click(function() {
var id=$(this).attr("name");
$("#"+id+"Container").toggle();
}).length;
!
var width=100/number;
$(".codecontainer").css("width",width+"%");
});
$("#run").click(function() {
$('#resultFrame').contents().find('html').html("<style>"+$
('#css').val()+"</style>"+$("#html").val());
document.getElementById('resultFrame').contentWindow.eval( $
('#js').val() );
});
});
</script>
</head>
<body>
!
<div id="container">
<div id="titlebar">
!
<div id="title">
CodePlayer
</div>
<div id="runButton">
<button id="run">Run</button>
</div>
<div id="menu">
<ul>
</ul>
</div>
</div>
<div class="break"></div>
<span class="containerTitle">HTML</span>
<div id="test">sdf</div>
</textarea>
</div>
<span class="containerTitle">CSS</span>
<textarea class="code" id="css">
#test {
background:green;
</textarea>
</div>
<span class="containerTitle">JS</span>
alert(7);
</textarea>
</div>
!
<div class="codecontainer" id="resultContainer">
<span class="containerTitle">Result</span>
<div class="resultContainer">
<iframe id="resultFrame"></iframe>
</div>
</div>
!
!
!
</div>
</body>
</html>