-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.js
30 lines (26 loc) · 979 Bytes
/
player.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
<script type="text/javascript">
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(){
$(this).addClass("highlightedButton");
},function() {
$(this).removeClass("highlightedButton");
});
$(".toggleButton").click(function(){
$(this).toggleClass("active");
$(this).removeClass("highlightedButton");
var panelId= $(this).attr("id") + "Panel"
$("#"+ panelId).toggleClass("hidden");
var numberOfActivePanels=4-$(".hidden").length;
$(".panel").width(($(window).width()/numberOfActivePanels)-10);
});
$(".panel").height($(window).height()-$("#header").height()-15);
$(".panel").width(($(window).width()/2)-10);
updateOutput();
$("textarea").on('change keyup paste',function() {
updateOutput();
});
</script>