0.1.4b
This commit is contained in:
parent
fb16985f60
commit
d2f430b464
111
agenda-wm.js
Normal file
111
agenda-wm.js
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* _____/\\\\\\\\\______________________________________________________/\\\_________________
|
||||
* ___/\\\\\\\\\\\\\___________________________________________________\/\\\_________________
|
||||
* __/\\\/////////\\\___/\\\\\\\\______________________________________\/\\\_________________
|
||||
* _\/\\\_______\/\\\__/\\\////\\\_____/\\\\\\\\___/\\/\\\\\\__________\/\\\___/\\\\\\\\\____
|
||||
* _\/\\\\\\\\\\\\\\\_\//\\\\\\\\\___/\\\/////\\\_\/\\\////\\\____/\\\\\\\\\__\////////\\\___
|
||||
* _\/\\\/////////\\\__\///////\\\__/\\\\\\\\\\\__\/\\\__\//\\\__/\\\////\\\____/\\\\\\\\\\__
|
||||
* _\/\\\_______\/\\\__/\\_____\\\_\//\\///////___\/\\\___\/\\\_\/\\\__\/\\\___/\\\/////\\\__
|
||||
* _\/\\\_______\/\\\_\//\\\\\\\\___\//\\\\\\\\\\_\/\\\___\/\\\_\//\\\\\\\/\\_\//\\\\\\\\/\\_
|
||||
* _\///________\///___\////////_____\//////////__\///____\///___\///////\//___\////////\//__
|
||||
* "So, what's on the agenda?"
|
||||
* (C) Innovation Inc. 2020
|
||||
*/
|
||||
|
||||
function initAgendaWM() {
|
||||
startTime();
|
||||
makeDraggable();
|
||||
} // Initialize Agenda
|
||||
|
||||
function makeDraggable() {
|
||||
$(".framewrap")
|
||||
.draggable()
|
||||
.resizable();
|
||||
} // Makes all applications with the framewrap class draggable. Has to be ran every time applications are launched or things get sticky.
|
||||
|
||||
function moveToFront(app) {
|
||||
$('.framewrap').css('z-index', 1);
|
||||
$('#' + app).css('z-index', 9999);
|
||||
} // Move a clicked application to the front
|
||||
|
||||
function openApplication(app, width, height, appIcon) {
|
||||
// Set width and height as default if one is <=-1
|
||||
if (width <= -1 || height <= -1 || width == undefined || height == undefined) {
|
||||
width="500";
|
||||
height="300";
|
||||
}
|
||||
var i = 0;
|
||||
// Get the first available application ID.
|
||||
while ($('#' + i).length)
|
||||
i++;
|
||||
/*
|
||||
This is just the following as a string:
|
||||
<div onclick=moveToFront('[windowID]') id='[windowID]' class='framewrap' style='width:[width]px; height=[height]px'>
|
||||
<input type='button' onclick="closeApplication('[windowID]')" value='X' />
|
||||
<input type='button' onclick="maximizeApplication('[windowID]')" value='\u25A1' />
|
||||
<input type='button' onclick="minimizeApplication('[windowID]')" value='_' />
|
||||
<iframe class='appFrame' src='apps/[application name]'></iframe>
|
||||
</div>
|
||||
[windowID] is replaced with i (defined above)
|
||||
[application name] is replaced with parameter "app" (used to determine the application name to open).
|
||||
|
||||
The app parameter points to a subdirectory called apps. This means if you were to run openApplication(foo), it will attempt to open an
|
||||
Application stored at apps/foo/
|
||||
|
||||
Quite frustrating to work with, but it works. I'll make it fancier later, but right now it is good enough.
|
||||
*/
|
||||
var application="<div onclick=\"moveToFront('" + i + "')\" name='" + app + "' id='" + i + "' class='framewrap' style='width:" + width + "px; height:" + height + "px'><input type='button' onclick=\"closeApplication('" + i + "')\" value='X' /><input type='button' onclick=\"maximizeApplication('" + i + "')\" value='\u25A1' /><input type='button' onclick=\"minimizeApplication('" + i + "')\" value='_' /><iframe class='appFrame' src='apps/" + app + "/'></iframe></div>";
|
||||
var taskbarApp="<div id='task" + i + "' onclick=\"minimizeApplication('" + i + "')\" class='taskbarApps'><img src='apps/" + app + "/" + appIcon + "' style='width:32px;height:32px' align='middle' /></div>";
|
||||
var parent=document.getElementById('appContainer');
|
||||
parent.insertAdjacentHTML('beforeend', application);
|
||||
var parent=document.getElementById('taskbarApps');
|
||||
parent.insertAdjacentHTML('beforeend', taskbarApp);
|
||||
if (width == "max" || height == "max")
|
||||
maximizeApplication(i);
|
||||
moveToFront(i);
|
||||
makeDraggable();
|
||||
} // Opens an application.
|
||||
|
||||
function closeApplication(id) {
|
||||
var application = document.getElementById(id);
|
||||
var taskbarApp = document.getElementById('task' + id);
|
||||
application.parentNode.removeChild(application);
|
||||
taskbarApp.parentNode.removeChild(taskbarApp);
|
||||
} // Closes an application.
|
||||
|
||||
function maximizeApplication(id) {
|
||||
document.getElementById(id).setAttribute('style', "height: 92%; width: 99%; top: 42px; left: 0px");
|
||||
} // Maximize application
|
||||
|
||||
function minimizeApplication(id) {
|
||||
var application = document.getElementById(id);
|
||||
if (application.style.display === "none") {
|
||||
application.style.display = "block";
|
||||
} else {
|
||||
application.style.display = "none";
|
||||
}
|
||||
} // Minimize application
|
||||
|
||||
function idExists(id) {
|
||||
if ($('#' + id).length)
|
||||
return $('#' + id).attr('name');
|
||||
else
|
||||
return false;
|
||||
} // Check if an ID exists
|
||||
|
||||
function startTime() {
|
||||
var today = new Date();
|
||||
var h = today.getHours();
|
||||
var m = today.getMinutes();
|
||||
var s = today.getSeconds();
|
||||
m = checkTime(m);
|
||||
s = checkTime(s);
|
||||
document.getElementById('txt').innerHTML =
|
||||
h + ":" + m + ":" + s;
|
||||
var t = setTimeout(startTime, 500);
|
||||
} // Tick tock, Mr. Wick...
|
||||
|
||||
function checkTime(i) {
|
||||
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
|
||||
return i;
|
||||
}
|
|
@ -6,13 +6,18 @@
|
|||
<body>
|
||||
<h1>About DremJS</h1>
|
||||
<h2>Version: 0.1.4b</h2>
|
||||
<h2>Agenda WM 0.0.9b</h2>
|
||||
<h2>Agenda WM 0.1.0b</h2>
|
||||
<p>Note: If something isn't right with your desktop, try reloading the frame! If that doesn't work, clear your browsers cache!</p>
|
||||
<p>Another Note: When loading an app or clicking the Start button, flickering is normal. This is just because the IFrame is loading the application.</p>
|
||||
<p>Changelog:</p>
|
||||
<p>Version 0.1.4b</p>
|
||||
<p>+Added ProcMan (Process Manager) to the terminal which allows you to list all processes or kill a process</p>
|
||||
<p>~Updated to Agenda WM 0.0.9b, which adds some new features and tweaks including, but not limited to:</p>
|
||||
<p>+Added insmod (Install Module). It's on its first prototype so it's not able to do much.</p>
|
||||
<p>~Separated Terminal from Debug and made it accessible when not in Debug mode.</p>
|
||||
<p>~Updated Terminal image.</p>
|
||||
<p>~Probable a ton more changes that I forgot about before I went on a break</p>
|
||||
<p>~Updated to Agenda WM 0.1.0b, which adds some new features and tweaks including, but not limited to:</p>
|
||||
<p> ~Made Agenda its own .js file</p>
|
||||
<p> ~Moved the taskbar that was originally in DremJS into Agenda WM</p>
|
||||
<p> +Added the ability to minimize and restore applications (hence the taskbar move)</p>
|
||||
<p>Version 0.1.3b</p>
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
<a target="_blank" href="https://gitreports.com/issue/DremOSDeveloperTeam/DremJS"><button>Proceed</button></a>
|
||||
<hr />
|
||||
<!-- Uncomment everything below to enable the Debug Menu -->
|
||||
<!--<h2>Debug Menu (only works if DremJS is on the root of your HTML server)</h2>
|
||||
<h2>Debug Menu (only works if DremJS is on the root of your HTML server)</h2>
|
||||
<p>Notice: the debug menu is fairly useless at the moment.</p>
|
||||
<a href="/404.html"><button>Initiate 404 Crash</button></a>
|
||||
<a href="/index.html" target="_parent"><button>Force DremJS to go to the Home Menu</button></a>
|
||||
<a href="../../terminal.html"><button>Start Terminal</button></a>-->
|
||||
<a href="../../terminal.html"><button>Start Terminal</button></a>
|
||||
</body>
|
||||
</html>
|
||||
|
|
6
apps/terminal/index.html
Normal file
6
apps/terminal/index.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
<!-- Terminal Forwarder -->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;url=../../terminal.html" />
|
||||
</head>
|
||||
</html>
|
BIN
apps/terminal/terminal.png
Normal file
BIN
apps/terminal/terminal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
107
index.html
107
index.html
|
@ -107,10 +107,11 @@
|
|||
<div class="start startgray">
|
||||
<ul class="astart">
|
||||
<dt><a onclick="openApplication('About', 800, 500, 'about.png')"><p><img src="apps/About/about.png" align="top"> About DremJS</p></a></dt>
|
||||
<dt><a onclick="openApplication('HowTo', 800, 500, 'howto.png')"><p><img src="apps/HowTo/howto.png" align="top"> How to Install Applications</p></a></dt>
|
||||
<dt><a onclick="openApplication('HowTo', 800, 500, 'howto.png')"><p><img src="apps/HowTo/howto.png" align="top"> How to Install Applications</p></a></dt>
|
||||
<dt><a onclick="openApplication('Market', 'max', 'max', 'market.png')"><p><img src="apps/Market/market.png" align="top"> DremJS Market</p></a></dt>
|
||||
<dt><a onclick="openApplication('debug', -1, -1, 'debug.png')"><p><img src="apps/debug/debug.png" align="top"> Report a Bug</p></a></dt>
|
||||
<!--Below is where remotely installed apps will start -->
|
||||
<dt><a onclick="openApplication('debug', 700, 450, 'debug.png')"><p><img src="apps/debug/debug.png" align="top"> Report a Bug</p></a></dt>
|
||||
<dt><a onclick="openApplication('terminal', 700, 450, 'terminal.png')"><p><img src="apps/terminal/terminal.png" align="top" width="16" height="16"> Terminal</p></a></dt>
|
||||
<!--Below is where remotely installed apps will start -->
|
||||
|
||||
<hr />
|
||||
<dt><a target="_top" href="shuttingdown.html"><p><img src="shutdown.png" align="top" style="width:16px;height:16px;"> Shutdown DremJS</p></dt>
|
||||
|
@ -129,105 +130,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="agenda-wm.js"></script>
|
||||
<script>
|
||||
function initAgendaWM() {
|
||||
startTime();
|
||||
makeDraggable();
|
||||
} // Initialize Agenda
|
||||
|
||||
function startTime() {
|
||||
var today = new Date();
|
||||
var h = today.getHours();
|
||||
var m = today.getMinutes();
|
||||
var s = today.getSeconds();
|
||||
m = checkTime(m);
|
||||
s = checkTime(s);
|
||||
document.getElementById('txt').innerHTML =
|
||||
h + ":" + m + ":" + s;
|
||||
var t = setTimeout(startTime, 500);
|
||||
} // Tick tock, Mr. Wick...
|
||||
|
||||
function checkTime(i) {
|
||||
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
|
||||
return i;
|
||||
}
|
||||
|
||||
function makeDraggable() {
|
||||
$(".framewrap")
|
||||
.draggable()
|
||||
.resizable();
|
||||
} // Makes all applications with the framewrap class draggable. Has to be ran every time applications are launched or things get sticky.
|
||||
|
||||
function moveToFront(app) {
|
||||
$('.framewrap').css('z-index', 1);
|
||||
$('#' + app).css('z-index', 9999);
|
||||
} // Move a clicked application to the front
|
||||
|
||||
function openApplication(app, width, height, appIcon) {
|
||||
// Set width and height as default if one is <=-1
|
||||
if (width <= -1 || height <= -1 || width == undefined || height == undefined) {
|
||||
width="500";
|
||||
height="300";
|
||||
}
|
||||
var i = 0;
|
||||
// Get the first available application ID.
|
||||
while ($('#' + i).length)
|
||||
i++;
|
||||
/*
|
||||
This is just the following as a string:
|
||||
<div onclick=moveToFront('[windowID]') id='[windowID]' class='framewrap' style='width:[width]px; height=[height]px'>
|
||||
<input type='button' onclick="closeApplication('[windowID]')" value='X' />
|
||||
<input type='button' onclick="maximizeApplication('[windowID]')" value='\u25A1' />
|
||||
<input type='button' onclick="minimizeApplication('[windowID]')" value='_' />
|
||||
<iframe class='appFrame' src='apps/[application name]'></iframe>
|
||||
</div>
|
||||
[windowID] is replaced with i (defined above)
|
||||
[application name] is replaced with parameter "app" (used to determine the application name to open).
|
||||
|
||||
The app parameter points to a subdirectory called apps. This means if you were to run openApplication(foo), it will attempt to open an
|
||||
Application stored at apps/foo/
|
||||
|
||||
Quite frustrating to work with, but it works. I'll make it fancier later, but right now it is good enough.
|
||||
*/
|
||||
var application="<div onclick=\"moveToFront('" + i + "')\" name='" + app + "' id='" + i + "' class='framewrap' style='width:" + width + "px; height:" + height + "px'><input type='button' onclick=\"closeApplication('" + i + "')\" value='X' /><input type='button' onclick=\"maximizeApplication('" + i + "')\" value='\u25A1' /><input type='button' onclick=\"minimizeApplication('" + i + "')\" value='_' /><iframe class='appFrame' src='apps/" + app + "/'></iframe></div>";
|
||||
var taskbarApp="<div id='task" + i + "' onclick=\"minimizeApplication('" + i + "')\" class='taskbarApps'><img src='apps/" + app + "/" + appIcon + "' style='width:32px;height:32px' align='middle' /></div>";
|
||||
var parent=document.getElementById('appContainer');
|
||||
parent.insertAdjacentHTML('beforeend', application);
|
||||
var parent=document.getElementById('taskbarApps');
|
||||
parent.insertAdjacentHTML('beforeend', taskbarApp);
|
||||
if (width == "max" || height == "max")
|
||||
maximizeApplication(i);
|
||||
moveToFront(i);
|
||||
makeDraggable();
|
||||
} // Opens an application.
|
||||
|
||||
function closeApplication(id) {
|
||||
var application = document.getElementById(id);
|
||||
var taskbarApp = document.getElementById('task' + id);
|
||||
application.parentNode.removeChild(application);
|
||||
taskbarApp.parentNode.removeChild(taskbarApp);
|
||||
} // Closes an application.
|
||||
|
||||
function maximizeApplication(id) {
|
||||
document.getElementById(id).setAttribute('style', "height: 92%; width: 99%; top: 42px; left: 0px");
|
||||
} // Maximize application
|
||||
|
||||
function minimizeApplication(id) {
|
||||
var application = document.getElementById(id);
|
||||
if (application.style.display === "none") {
|
||||
application.style.display = "block";
|
||||
} else {
|
||||
application.style.display = "none";
|
||||
}
|
||||
} // Minimize application
|
||||
|
||||
function idExists(id) {
|
||||
if ($('#' + id).length)
|
||||
return $('#' + id).attr('name');
|
||||
else
|
||||
return false;
|
||||
} // Check if an ID exists
|
||||
console.log("tomato");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
BIN
js/.terminal.js.swp
Normal file
BIN
js/.terminal.js.swp
Normal file
Binary file not shown.
|
@ -2,7 +2,7 @@ $(function() {
|
|||
|
||||
// Set the command-line prompt to include the user's IP Address
|
||||
//$('.prompt').html('[' + codehelper_ip["IP"] + '@HTML5] # ');
|
||||
$('.prompt').html('[user@HTML5] # ');
|
||||
$('.prompt').html('[user@DremJS] # ');
|
||||
|
||||
// Initialize a new terminal object
|
||||
var term = new Terminal('#input-line .cmdline', '#container output');
|
||||
|
@ -19,4 +19,4 @@ $(function() {
|
|||
r("hour", 30*(d.getHours()%12) + d.getMinutes()/2)
|
||||
}, 1000);
|
||||
|
||||
});
|
||||
});
|
||||
|
|
170
js/terminal.js
170
js/terminal.js
|
@ -1,5 +1,13 @@
|
|||
var util = util || {};
|
||||
var infinateLoopDetect;
|
||||
var i = 0;
|
||||
var f = 0;
|
||||
var moduleTypeFlag = 0;
|
||||
var cmdString = "";
|
||||
var modules = [];
|
||||
var moduleCode = [];
|
||||
var modInstall;
|
||||
var firstLine = "";
|
||||
|
||||
util.toArray = function(list) {
|
||||
return Array.prototype.slice.call(list || [], 0);
|
||||
|
@ -23,8 +31,8 @@ var Terminal = Terminal || function(cmdLineContainer, outputContainer) {
|
|||
var cmdLine_ = document.querySelector(cmdLineContainer);
|
||||
var output_ = document.querySelector(outputContainer);
|
||||
|
||||
const CMDS_ = [
|
||||
'cat', 'clear', 'clock', 'date', 'echo', 'help', 'uname', 'whoami', 'cmd_fm', 'procman',
|
||||
cmds = [
|
||||
'cat', 'clear', 'clock', 'date', 'echo', 'help', 'uname', 'cmd_fm', 'procman', 'insmod', 'rmmod'
|
||||
];
|
||||
|
||||
var fs_ = null;
|
||||
|
@ -137,22 +145,45 @@ var Terminal = Terminal || function(cmdLineContainer, outputContainer) {
|
|||
output( args.join(' ') );
|
||||
break;
|
||||
case 'help':
|
||||
output('<div class="ls-files">' + CMDS_.join('<br>') + '</div>');
|
||||
if (!arguments || (args[0] != "modules")) {
|
||||
cmdString = "";
|
||||
output('DremJS Terminal Help Menu');
|
||||
output('All default commands (without modules) for the terminal are as follows:');
|
||||
for (i = 0; i < cmds.length; i++)
|
||||
cmdString += cmds[i] + " ";
|
||||
output(cmdString);
|
||||
cmdString = "";
|
||||
output('Module commands:');
|
||||
for (i = 0; i < modules.length; i++)
|
||||
cmdString += modules[i] + " ";
|
||||
output(cmdString);
|
||||
cmdString = "";
|
||||
output('For information on Modules, run "help modules"');
|
||||
} else if (args[0] == "modules") {
|
||||
output('DremJS Terminal Help Menu - Modules');
|
||||
output('What are Modules?');
|
||||
output('Modules are a simple way to temporarily add new functionality to DremJS. Modules have a .djsm (DremJS Module) file extension and contain JavaScript code which can be ran immediately or from a terminal. DremJS Modules can also be installed in batch with a .djsms (DremJS Module Script). These scripts will automatically handle installations of modules that may be too complex to fit into one file and therefor have multiple modules.\n\n');
|
||||
output('Currently, there are three different types of modules: immediate, terminal, and parentscript. An immediate module does exactly what it says: run the code immediately. A terminal module adds functionality to the terminal, such as a new command. However, terminal modules are not persistent after you close the terminal (yet). A parentscript module adds functionality to the main Agenda WM script.\n\n');
|
||||
output('The pros and cons of modules');
|
||||
output('The pros of modules is that you can add new functionality to DremJS or the terminal without having to install an application.');
|
||||
output('The cons of a module is that, since it adds or runs code on-the-fly to DremJS, they are very insecure. A man-in-the-middle attack or other naughty module can cause your data to be stolen (please never use DremJS with any personal data), DremJS to become unstable, or completely crash. This is why we made it so modules are not permanently installed. If you want code that stays put, it is recommended to use an application.');
|
||||
}
|
||||
break;
|
||||
case 'uname':
|
||||
output(navigator.appVersion);
|
||||
break;
|
||||
case 'whoami':
|
||||
/*case 'whoami':
|
||||
var result = "<img src=\"" + codehelper_ip["Flag"]+ "\"><br><br>";
|
||||
for (var prop in codehelper_ip)
|
||||
result += prop + ": " + codehelper_ip[prop] + "<br>";
|
||||
output(result);
|
||||
break;
|
||||
break;*/
|
||||
case 'cmd_fm':
|
||||
window.open("https://cmd.to/fm","_self")
|
||||
break;
|
||||
case 'spin':
|
||||
show_image('spin.gif', 100, 100, 'Spinny');
|
||||
//show_image('spin.gif', 100, 100, 'Spinny');
|
||||
output('<img align="left" src="spin.gif" width="100" height="100">');
|
||||
break;
|
||||
case 'procman':
|
||||
var arguments = args.join(' ');
|
||||
|
@ -163,10 +194,10 @@ var Terminal = Terminal || function(cmdLineContainer, outputContainer) {
|
|||
break;
|
||||
} else if (args[0] == "list") {
|
||||
var i = 0;
|
||||
output('ID Name');
|
||||
output('ID\t\tName');
|
||||
while (i <= 1000) {
|
||||
if (parent.idExists(i))
|
||||
output(i + " " + parent.idExists(i));
|
||||
output(i + "\t\t" + parent.idExists(i));
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
|
@ -180,20 +211,121 @@ var Terminal = Terminal || function(cmdLineContainer, outputContainer) {
|
|||
output("fatal: application ID " + args[1] + " does not exist.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'insmod':
|
||||
i=0;
|
||||
modInstall="";
|
||||
firstLine="";
|
||||
if (!arguments || (args[0] != "remote" && args[0] != "local")) {
|
||||
output('Install Module (insmod) help');
|
||||
output('NOTICE: insmod is currently a prototype and is not yet feature-complete or secured at all. NEVER INSTALL A MODULE UNLESS YOU ARE ON YOUR LOCAL NETWORK!');
|
||||
output('To install a module not inside the DremJS folder (not recommended, insecure):');
|
||||
output('insmod remote https://example.com/path/to/foo.djsm\n');
|
||||
output('To install a module inside the DremJS folder');
|
||||
output('insmod remote http://your.local.ip.address/path/to/foo.djsm');
|
||||
output('Planned features that aren\'t yet implimented:');
|
||||
output('Batch installs (DremJS Module Installation Scripts)');
|
||||
output('Local installations');
|
||||
//output('insmod local path/to/module.djsm\n');
|
||||
//output('To run a module installation script for batch installations that is not inside the DremJS folder:');
|
||||
//output('insmod remote https://example.com/foo.djsms\n');
|
||||
//output('To run a module installation script that is not inside the DremJS folder:');
|
||||
//output('insmod local path/to/script.djsms\n');
|
||||
output('For more information on modules, please run: help modules');
|
||||
} else if (args[0] == "remote") {
|
||||
if (args[1] != undefined) {
|
||||
if ((args[1].substring(args[1].length-5)) == ".djsm") {
|
||||
output('[insmod] Loading modue at ' + args[1] + '...');
|
||||
var modInstall;
|
||||
jQuery.get(args[1], function(data) {
|
||||
// Welcome to callback hell
|
||||
modInstall = data;
|
||||
output('[insmod] Parsing module...');
|
||||
i=0;
|
||||
while (modInstall.charAt(i) != ';' && i < 50) {
|
||||
firstLine += modInstall.charAt(i);
|
||||
i++;
|
||||
}
|
||||
modInstall = modInstall.substring(i+1, modInstall.length);
|
||||
if (firstLine == "type immediate") {
|
||||
output('[insmod] module type is immediate');
|
||||
moduleTypeFlag = 1;
|
||||
output('[insmod] fatal: module type "immediate" not implimented. Maybe 0.1.5b?');
|
||||
} else if (firstLine == "type terminal") {
|
||||
output('[insmod] module type is terminal');
|
||||
moduleTypeFlag = 2;
|
||||
firstLine = "";
|
||||
i=0;
|
||||
while (modInstall.charAt(i) != ';' && i < 50) {
|
||||
firstLine += modInstall.charAt(i);
|
||||
i++;
|
||||
}
|
||||
newCmdName = firstLine.substring(6, firstLine.length);
|
||||
output('[insmod] adding command with name "' + newCmdName + '" to terminal modules list...');
|
||||
modules.push(newCmdName);
|
||||
output('[insmod] installing module...');
|
||||
modInstall = modInstall.substring(3+firstLine.length, modInstall.length);
|
||||
moduleCode.push(modInstall);
|
||||
} else if (firstLine == "type parentscript") {
|
||||
output('[insmod] module type is parentscript');
|
||||
moduleTypeFlag = 3;
|
||||
output('[insmod] fatal: module type "parentscript" not implimented. Maybe 0.1.5b?');
|
||||
} else {
|
||||
output('[insmod] fatal: the input file is not a DremJS Module or DremJS Module Script');
|
||||
moduleTypeFlag = 0;
|
||||
}
|
||||
/*if (moduleTypeFlag = 1) {
|
||||
output('[insmod] fatal: not implimented. Maybe 0.1.5b?');
|
||||
} else if */
|
||||
});
|
||||
|
||||
//output('[insmod] Installing module...');
|
||||
|
||||
break;
|
||||
} else if ((args[1].substring(args[1].length-6)) == ".djsms") {
|
||||
//output('Running module installation script at ' + args[1] + '...');
|
||||
output('[insmod] fatal: module installation scripts are not implimented. Maybe 0.1.5b?');
|
||||
} else {
|
||||
output('[insmod] fatal: the input file is not a DremJS Module or DremJS Module Script');
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
output('[insmod] fatal: no input file was provided.');
|
||||
break;
|
||||
}
|
||||
} else if (args[0] == "local") {
|
||||
output('[insmod] fatal: local installation is not yet implimented. Remote installation can do this. For example: insmod remote http://localhost:8000/modules/foo-0.0.0.djsm');
|
||||
}
|
||||
break;
|
||||
case 'rmmod':
|
||||
output('[rmmod] fatal: not implimented. Maybe 0.1.5b?');
|
||||
break;
|
||||
default:
|
||||
var notFoundFlag = 0;
|
||||
|
||||
var notFoundFlag = 1;
|
||||
if (cmd != undefined) {
|
||||
for (i = 0; i < CMDS_.length; i++)
|
||||
if (cmd != CMDS_[i])
|
||||
// Checks if the default terminal command exists
|
||||
for (i = 0; i < cmds.length; i++)
|
||||
if (cmd != cmds[i])
|
||||
notFoundFlag = 1;
|
||||
else {
|
||||
notFoundFlag = 0;
|
||||
i = CMDS_.length;
|
||||
i = cmds.length;
|
||||
}
|
||||
|
||||
// Checks if a module with the command name is installed
|
||||
for (i = 0; i < modules.length; i++) {
|
||||
if (cmd != modules[i])
|
||||
notFoundFlag = 1;
|
||||
else {
|
||||
notFoundFlag = 0;
|
||||
eval(moduleCode[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cmd = "";
|
||||
notFoundFlag = 1;
|
||||
}
|
||||
|
||||
if (notFoundFlag == 1) {
|
||||
output(cmd + ': command not found');
|
||||
}
|
||||
|
@ -229,6 +361,16 @@ var Terminal = Terminal || function(cmdLineContainer, outputContainer) {
|
|||
output_.insertAdjacentHTML('beforeEnd', '<p>' + html + '</p>');
|
||||
}
|
||||
|
||||
function sleep(delay) {
|
||||
var start = new Date().getTime();
|
||||
while (new Date().getTime() < start + delay);
|
||||
} // Cyclefucker 1000
|
||||
|
||||
function fileToVar(t) {
|
||||
modInstall = t;
|
||||
alert(modInstall);
|
||||
}
|
||||
|
||||
// Cross-browser impl to get document's height.
|
||||
function getDocHeight_() {
|
||||
var d = document;
|
||||
|
@ -242,7 +384,7 @@ var Terminal = Terminal || function(cmdLineContainer, outputContainer) {
|
|||
//
|
||||
return {
|
||||
init: function() {
|
||||
output('<img align="left" src="http://www.w3.org/html/logo/downloads/HTML5_Badge_128.png" width="100" height="100" style="padding: 0px 10px 20px 0px"><h2 style="letter-spacing: 4px">HTML5 Web Terminal</h2><p>' + new Date() + '</p><p>Enter "help" for more information.</p>');
|
||||
output('<img align="left" src="termlogo.png" width="100" height="100" style="padding: 0px 10px 20px 0px"><h2 style="letter-spacing: 4px">DremJS Terminal</h2><p>' + new Date() + '</p><p>Enter "help" for more information.</p>');
|
||||
},
|
||||
output: output
|
||||
}
|
||||
|
|
5
modules/hello_world-0.0.0.djsm
Normal file
5
modules/hello_world-0.0.0.djsm
Normal file
|
@ -0,0 +1,5 @@
|
|||
type terminal;
|
||||
name hello;
|
||||
|
||||
output("world");
|
||||
//break;
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>HTML5 Web Terminal</title>
|
||||
<title>DremJS Terminal</title>
|
||||
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
<title>HTML5 Web Terminal</title>
|
||||
<title>DremJS</title>
|
||||
<link href="https://fonts.googleapis.com/css?family=Inconsolata"
|
||||
rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
|
|
BIN
termlogo.png
Normal file
BIN
termlogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 508 KiB |
BIN
termlogo_old.png
Normal file
BIN
termlogo_old.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Loading…
Reference in a new issue