Skip to content

Commit

Permalink
Update to version 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jaromaz committed Nov 7, 2021
1 parent 87e1ece commit 32bae65
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 55 deletions.
30 changes: 23 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
# JSLinux Mobile – Linux for iOS

<a href="https://jm.iq.pl/jslinux-mobile"><img align="right" width="280" height="497" src="https://jm.iq.pl/jslinux-mobile/js_linux_mobile_for_iOS.gif"></a>A mobile version of a PC emulator written in Javascript, with a running, fully functional Linux system. The emulator can be run offline in full-screen mode on iOS and Android devices.
<a href="https://jm.iq.pl/jslinux-mobile"><img align="right" width="280" height="497" src="https://jm.iq.pl/jslinux-mobile/js_linux_mobile_for_iOS.gif"></a>A
mobile version of a PC emulator written in Javascript, with a running, fully functional
Linux system. The emulator can be run offline in full-screen mode on iOS and Android devices.

Apple does not allow hardware emulation in iOS – the AppStore has no such software, so I have transformed the perfect Linux emulator by Fabrice Bellard (with his kind permission) so that it works properly with iOS device keyboards and bluetooth keyboards in ordinary web browsers (a lot of Javascript tricks :) . All is available in full-screen mode simultaneously emulating modern terminals – appropriate fonts and window appearance.
Apple does not allow hardware emulation in iOS – the AppStore has no such software, so I have
transformed the perfect Linux emulator by Fabrice Bellard (with his kind permission) so that
it works properly with iOS device keyboards and bluetooth keyboards.
All is available in full-screen mode simultaneously emulating modern terminals – with appropriate
fonts and window appearance.

[Live version](https://jm.iq.pl/jslinux-mobile)
-----------------------------------------------------------------------

For full-screen mode open JSLinux Mobile in the Safari browser and look in its menu for an option named "Add to Home Screen" - a new icon will be created in your applications. The default preset is intended for iPad with a bluetooth keyboard, but you can change the appearance of the application. Each change of the settings will be saved in cookies and stored.
For full-screen mode open JSLinux Mobile in the Safari browser and look in its menu for an
option named *Add to Home Screen* - a new icon will be created in your applications. The
default preset is intended for iPad with a bluetooth keyboard, but you can change the
appearance of the application to fit your iPhone or any other device. Each change of the
settings will be saved in cookies and stored.

This basic Linux can be used to practice programming in C, bash, support for awk and sed, create a pseudo-network (because this version of the emulator does not allow Linux to connect to the Internet), and learn the basic Linux commands thanks to the Busybox software. In the video bellow, I present the capabilities of the emulator in conjunction with iPad Mini and a bluetooth keyboard:
JSLinux Mobile can also be used on regular computers e.g. in schools or universities
to practice programming in **C**, **bash**, **awk** and **sed**, or to create a pseudo-network
(because this version of the emulator does not allow Linux to connect to the Internet),
and learn the basic Linux commands thanks to the **Busybox** software.

<a href="https://www.youtube.com/watch?v=LWnDismrV3Q"><img src="https://jm.iq.pl/graf/jslinuxplay.jpg" width="500"></a>
In the video bellow, I present the capabilities of the emulator in combination with
an iPad Mini and a bluetooth keyboard:

For more information please visit my website: https://jm.iq.pl/jslinux-mobile
<a href="https://www.youtube.com/watch?v=LWnDismrV3Q"><img src="https://jm.iq.pl/graf/jslinuxplay.jpg" width="70%"></a>

Copyright (c) 2021 Jaromaz https://jm.iq.pl
For more information please visit my website: [jm.iq.pl/jslinux-mobile](https://jm.iq.pl/jslinux-mobile)

Copyright (c) 2021 Jaromaz [jm.iq.pl](https://jm.iq.pl/en)
64 changes: 16 additions & 48 deletions js/mobile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

/* ---------------------------------------------------------
/* ----------------------------------------------------------------
JSLinux by Fabrice Bellard https://bellard.org
Mobile version by Jaromaz https://jm.iq.pl/jslinux-mobile
--------------------------------------------------------- */
JSLinux Mobile v.1.3 by Jaromaz https://jm.iq.pl/jslinux-mobile
---------------------------------------------------------------- */

var activated = false;
var defaultPreset = { "topmargin": 3, "columns": 92, "rows": 30, "font": 1, "fontcolor": 4, "fontsize": 18, "bgcolor": 5, "spacing": 2, "ram": 1, "options": 0 };
Expand Down Expand Up @@ -30,12 +30,12 @@
var appStart = Cookies.get("appstart");

if (appStart == undefined) {
var date = new Date();
date.setTime(date.getTime() + 9000000);
Cookies.set("appstart", true, { expires: 365 });
Cookies.set("appsupport", true, { expires: date });
appStart = true;
appSupport = true;
var date = new Date();
date.setTime(date.getTime() + 9000000);
Cookies.set("appstart", true, { expires: 365 });
Cookies.set("appsupport", true, { expires: date });
appStart = true;
appSupport = true;
console.log(date);
}

Expand Down Expand Up @@ -94,58 +94,26 @@
<option value="3" ${fill["ram"][3]}>64</option>
</select> Mb.
&copy; <a href="http://bellard.org">Fabrice Bellard</a> / Mobile version by <a href="http://jm.iq.pl">Jaromaz</a>. `;
&copy; <a href="http://bellard.org">Fabrice Bellard</a> / Mobile version by <a href="http://jm.iq.pl/en">Jaromaz</a>. `;

var info = infoLong;

if (window.location.hostname == 'localhost' || (appStart && !appSupport)) {
info += `Please
<select id="support">
<option value="1">support</option>
<option value="5">5 $</option>
<option value="10">10 $</option>
<option value="15">15 $</option>
<option value="20">20 $</option>
<option value="30">30 $</option>
<option value="50">50 $</option>
<option value="70">70 $</option>
<option value="100">100 $</option>
<option value="300">300 $</option>
<option value="500">500 $</option>
<option value="700">700 $</option>
<option value="1000">1K $</option>
<option value="5000">5K $</option>
<option value="10000">10K $</option>
</select> my projects via PayPal if you like this mobile version.
`;
}

if (defaultPreset["options"] == 1) {
info = `The user option was used. You can change the options by pressing the upper right corner of the screen. For full support for the VI editor you need a bluetooth keyboard (CTRL+h or CTRL+c will leave the VI edition mode), and after running Linux enter the command: <i><strong>stty -F /dev/ttyS0 rows ${defaultPreset["rows"]} cols ${defaultPreset["columns"]}</strong></i> . &copy; <a href="http://bellard.org">Fabrice Bellard</a> / Mobile version by <a href="https://jm.iq.pl">Jaromaz</a>. `;
info = `The user option was used. You can change the options by pressing the upper right corner of the screen. For full support for the VI editor you need a bluetooth keyboard (CTRL+h or CTRL+c will leave the VI edition mode), and after running Linux enter the command: <i><strong>stty -F /dev/ttyS0 rows ${defaultPreset["rows"]} cols ${defaultPreset["columns"]}</strong></i> . &copy; <a href="http://bellard.org">Fabrice Bellard</a> / Mobile version by <a href="https://jm.iq.pl/en">Jaromaz</a>. `;
}

$( document ).ready(function() {

$(".term").css("font-family", selectableOptions["font"][defaultPreset["font"]]);
$(".term").css("font-size", (defaultPreset["fontsize"]+"px"));
$("#consotab").css("padding-top", (defaultPreset["topmargin"] + "px"));
$(".cover").css("padding-top", (defaultPreset["topmargin"] + "px"));
$(".term").css("padding-bottom", (defaultPreset["spacing"] + "px"));
$(".term, .tapinfo span").css("color", (selectableOptions["fontcolor"][defaultPreset["fontcolor"]]));
$(".termReverse").css("color", (selectableOptions["bgcolor"][defaultPreset["bgcolor"]]));
$(".termReverse").css("color", (selectableOptions["bgcolor"][defaultPreset["bgcolor"]]));
$(".term").css("border-color", (selectableOptions["bgcolor"][defaultPreset["bgcolor"]]));
$(".tapinfo").css("border-color", (selectableOptions["fontcolor"][defaultPreset["fontcolor"]]));
$(".tapinfo").css("margin-top", ((parseInt(defaultPreset["topmargin"], 10) + 10) + "px"));
$("html, body, .cover, .tapinfo span").css("background-color", (selectableOptions["bgcolor"][defaultPreset["bgcolor"]]));

if ($("#support").length > 0) {
$("#support").on("change", function() {
if ($(this).val() > 1) {
$("#consotab").hide();
location.href="https://www.paypal.me/jaromaz/"+ $(this).val() + "usd";
}
});
}
$("html, body, .cover, .tapinfo span").css("background-color", (selectableOptions["bgcolor"][defaultPreset["bgcolor"]]));
});

var options = function () {
Expand All @@ -156,8 +124,8 @@
presetNew[key] = $("#" + key).val();
}

Cookies.remove("preset");
Cookies.set("preset", presetNew, { expires: 365 });
Cookies.remove("preset");
Cookies.set("preset", presetNew, { expires: 365 });

for (var key in defaultPreset) {
if (key != "options") {
Expand All @@ -177,7 +145,7 @@
};

$(".taparea").on('click', function (e) {
activated = false;
activated = false;
$.alert(info, "JSLinux Mobile", function () {
options();
});
Expand Down

0 comments on commit 32bae65

Please sign in to comment.