-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
135 lines (108 loc) · 4.03 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
<html>
<head>
<title>Code-Player</title>
<script type="text/javascript" src="jquery.min.js"></script>
<style type="text/css">
body{
font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
padding:0px;
margin:0px;
}
#header{
width:100%;
background-color: dimgrey;
padding:5px;
height:40px;
}
#buttonContainer{
margin:0 auto;
width:250px;
}
#logo{
float:left;
font-weight: bold;
font-size:150%;
padding:5px 5px;
}
.toggle-button{
float:left;
border:2px solid rgb(196, 192, 182);
padding:10px;
border-right: none;
font-size :95%;
}
#html{
border-top-left-radius: 5px;
border-bottom-left-radius:5px;
}
#output{
border-top-right-radius: 5px;
border-bottom-right-radius:5px;
border-right:2px solid rgb(196, 192, 182);
}
.active{
background-color: rgb(184, 233, 233);
}
.highlight{
background-color: rgb(196, 192, 182);
}
textarea{
resize:none;
border-top: none;
border-color: black;
border-bottom: none;
}
.panel{
float:left;
width:50%;
border-left: none;
}
iframe{
border:none;
}
.hidden{
display:none;
}
</style>
</head>
<body>
<div id="header">
<div id="logo">
Code-Player
</div>
<div id="buttonContainer">
<div class="toggle-button active"id="html">HTML</div>
<div class="toggle-button"id="css">CSS</div>
<div class="toggle-button"id="javascript">JS</div>
<div class="toggle-button active"id="output">Output</div>
</div>
</div>
<div id="body-container">
<textarea id="htmlPanel" class="Panel">Hello fucker</textarea>
<textarea id="cssPanel" class="Panel hidden">Hello fucker</textarea>
<textarea id="javascriptPanel" class="Panel hidden">Hello fucker</textarea>
<iframe id="outputPanel" class="Panel">djfd</iframe>
</div>
<script type="text/javascript">
$(".toggle-button").hover(function(){
$(this).addClass("highlight");
},function(){
$(this).removeClass("highlight");
})
$(".toggle-button").click(function(){
$(this).toggleClass("active");
$(this).removeClass("highlight");
var panelid= $(this).attr("id")+"Panel";
$("#"+panelid).toggleClass("hidden");
var activePanels=4 - $('.hidden').length;
$(".Panel").width($(window).width()/activePanels-5);
})
$(".panel").height($(window).height()-$("#header").height()+415); // Ineffective code
$("iframe").contents().find("html").html($("#htmlPanel").val());
$("textarea").on('change keyup paste',function(){
$("iframe").contents().find("html").html("<html><head><style type='text/css'>"+$("#cssPanel").val()
+"</style></head><body>"+$("#htmlPanel").val()+"</body></html>");
})
</script>
</body>
</html>