-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodePlayerScript.js
45 lines (28 loc) · 1.18 KB
/
codePlayerScript.js
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
function updateOutput(){
$("iframe").contents().find("html").html("<html><head><style type='text/css'>"+
$("#csspanel").val()+"</style></head><body>"+$("#htmlpanel").val()+
"</body></html>");
document.getElementById("outputpanel").contentWindow.eval($("#javascriptpanel").val());
}
$(".toggleButton").hover(function () { //cursor in
$(this).addClass("higlight");
}, function () { //cursor out
$(this).removeClass("higlight");
});
$(".toggleButton").click(function () {
if ($(this).hasClass("active")) {
$(this).removeClass("active");
} else {
$(this).addClass("active");
}
var panelId = $(this).attr("id") + "panel";
$("#"+panelId).toggleClass("hidden");
var numberOfActivePanels=4-$('.hidden').length;
$(".panel").width(($(window).width()/numberOfActivePanels)-15);
});
$(".panel").height($(window).height() - $("#header").height() - 15);
$(".panel").width(($(window).width()/2)-15);
updateOutput();
$("textarea").on('change keyup paste', function () {
updateOutput();
});