File size: 1,683 Bytes
4edb0a8
 
61e59f4
4edb0a8
5be30bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61e59f4
 
 
 
 
 
 
 
 
 
d949fc5
61e59f4
 
 
 
 
4edb0a8
 
 
 
 
 
 
 
61e59f4
 
5fd7f67
4edb0a8
61e59f4
 
 
 
 
 
5fd7f67
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
// New window: show and bring to top
function newWindow(element) {
    $(element).show();
    $(element).selectWindow();

    if (element == '#doom') {
    	loadDoom();
    }
}


// Load DOOM, because we can
function loadDoom() {
	$.getScript('https://js-dos.com/6.22/current/js-dos.js', function() {
		Dos(document.getElementById("doomcanvas"), {
	        wdosboxUrl: "https://js-dos.com/6.22/current/wdosbox.js",
	        cycles: 1000,
	        autolock: false,
	    }).ready(function (fs, main) {
	      fs.extract("https://js-dos.com/cdn/upload/[email protected]").then(function () {
	        main(["-c", "cd DOOM", "-c", "DOOM.EXE"]).then(function (ci) {
	            window.ci = ci;
	        });
	      });
	    });
	});
}

$( function() {
    // Window drag
    $( ".window" ).draggable({ handle: "div.windowtitle" });

    // Window resize
    $( ".window" ).resizable({ handles: "all", alsoresize: ".windowinner" });

    // Window close
    $('.windowclose').on("dblclick", function () { $(this).parents('div.window').hide(); });

    // Window click-to-bring-to-top
    (function() {
        var highest = 100;

        $.fn.selectWindow = function() {
            // Make top
            this.css('z-index', ++highest);
            // Make this window selected and others not
            this.addClass('selectedwindow');
            $('.window').not(this).each(function(){
                $(this).removeClass('selectedwindow');
             });
        };
    })();
    $('.window').mousedown(function() {
        $(this).selectWindow();
    });

    // Icon single click
    $('.icon').click(function() {
      $(this).find('p').toggleClass('highlight');
    });
} );