Skip to content

Commit

Permalink
allow programs to be passed params
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkins committed Mar 6, 2017
1 parent 290881e commit 5a2f28b
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ function Task($win){
});
}

function $DesktopIcon(title, icon_name, exe, is_shortcut){
function $DesktopIcon(title, icon_name, exe, is_shortcut, params){
var $container = $("<div class='desktop-icon' draggable='true'/>").appendTo($desktop);
var $icon_wrapper = $("<div class='icon-wrapper'/>").appendTo($container).width(DESKTOP_ICON_SIZE).height(DESKTOP_ICON_SIZE);
var $icon = $Icon([icon_name, "task"], DESKTOP_ICON_SIZE).width(DESKTOP_ICON_SIZE).height(DESKTOP_ICON_SIZE);
var $title = $("<div class='title'/>").text(title);
$container.append($icon_wrapper, $title);
$icon_wrapper.append($icon);
$container.on("dblclick", function(){
new exe
new exe(params);
});
$container.on("pointerdown", function(){
$desktop.find(".desktop-icon").removeClass("selected");
Expand Down Expand Up @@ -195,16 +195,10 @@ function SoundRecorder(){
return new Task($win);
}

function Notepad(){
var $win = new $IframeWindow("notepad/index.html", "Notepad");
$win.title("untitled - Text Edit");
return new Task($win);
}

function NotepadFile(file, title){
var $win = new $IframeWindow("notepad/index.html?file="+file, "Notepad");
$win.title(title);
return new Task($win);
function Notepad(file, title){
var $win = new $IframeWindow("notepad/index.html?file="+file, "Notepad");
$win.title(title);
return new Task($win);
}

// be creepy
Expand Down Expand Up @@ -312,4 +306,5 @@ new $DesktopIcon("Paint", ("paint"), Paint, "shortcut");
new $DesktopIcon("Minesweeper", ("minesweeper"), Minesweeper, "shortcut");
new $DesktopIcon("Sound Recorder", ("speaker"), SoundRecorder, "shortcut");
new $DesktopIcon("Notepad", ("notepad"), Notepad, "shortcut");
new $DesktopIcon("Notepad", ("notepad-file"), Notepad, "shortcut");
var myNote = {"file": "test", "title": "test"};
new $DesktopIcon("Notepad", ("notepad-file"), Notepad, "shortcut", myNote);

0 comments on commit 5a2f28b

Please sign in to comment.