-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
141 lines (117 loc) · 4.41 KB
/
index.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
<html>
<head>
<title>Codeplayer</title>
<style type="text/css">
body{
font-family:sans-serif;
margin:0;
padding:0;
}
.header{
background-color:#EEEEEE;
width:100%;
height:50px;
}
.logo{
font-weight:bold;
font-size:20px;
float:left;
padding-top:10px;
margin-left:10px;
}
.buttoncontainer{
position:relative;
left:500px;
padding-top:10px;
}
.button{
float:left;
border:1px solid grey;
border-right:none;
padding:5px;
}
#html{
border-top-left-radius:5px;
border-bottom-left-radius:5px;
}
#output{
border-right:1px solid grey;
border-top-right-radius:5px;
border-bottom-right-radius:5px;
}
.highlighted{
background-color:grey;
}
.active{
background-color:#b1e5f9;
}
textarea{
resize:none;
border-left:none;
height:100%;
background-color:#272822;
color:white
}
iframe{
border:none;
height:100%;
}
.hidden{
display:none;
}
</style>
</head>
<body>
<div class="header">
<div class="logo">
CodePlayer
</div>
<div class="buttoncontainer">
<div class="button" id="html">
HTML
</div>
<div class="button" id="css">
CSS
</div>
<div class="button" id="javascript">
JAVASCRIPT
</div>
<div class="button" id="output">
OUTPUT
</div>
</div>
</div>
<textarea id="htmlPanel" class="panel hidden"><!--Your HTML Code Here--></textarea>
<textarea id="cssPanel" class="panel hidden">/*Your CSS Code Here*/</textarea>
<textarea id="javascriptPanel" class="panel hidden">// Your Javascript Here</textarea>
<iframe id="outputPanel" class="panel hidden"></iframe>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script type="text/javascript">
//TO CHECK IF JQUERY IS INSTALLED OR NOT
// if(typeof jQuery=='undefined')
// alert("Not Installed");
// else
// alert("Jquery installed");
$(".button").hover(function(){
$(this).addClass("highlighted");
},function(){
$(this).removeClass("highlighted");
});
$(".button").click(function(){
$(this).toggleClass("active");
$(this).removeClass("highlighted");
var panel=$(this).attr("id")+"Panel";
$("#"+panel).toggleClass("hidden");
var numberofactive=$(".active").length;
$(".panel").width(($(window).width()/numberofactive)-10);
});
$("#outputPanel").contents().find("html").html("<html><head><style>"+$("#cssPanel").val()+"</style></head><body>"+$("#htmlPanel").val()+"</body></html>");
document.getElementById("outputPanel").contentWindow.eval($("#javascriptPanel").val());
$(".panel").on("change keyup paste", function () {
$("#outputPanel").contents().find("html").html("<html><head><style>"+$("#cssPanel").val()+"</style></head><body>"+$("#htmlPanel").val()+"</body></html>");
document.getElementById("outputPanel").contentWindow.eval($("#javascriptPanel").val());
// $("#outputPanel").contentWindow.eval($("#javascriptPanel").val());
});
</script>
</body>
</html>