Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hcchengithub committed Sep 23, 2017
2 parents 7010d2e + 0e374a5 commit d02c7ba
Show file tree
Hide file tree
Showing 39 changed files with 5,409 additions and 5,257 deletions.
6 changes: 3 additions & 3 deletions 3ce/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
vm.screenbuffer = ""; // type() to screenbuffer before I/O ready; self-test needs it too.
vm.selftest_visible = true; // Dummy, background page does not have a display.
// vm.type() is the master typing or printing function.
// The type() called in code ... end-code is defined in the kernel jeforth.js.
// The type() called in code ... end-code is defined in the kernel projectk.js.
// type to vm.screenbuffer, although background page has no display.
vm.type = function (s) {
try {
Expand All @@ -26,14 +26,14 @@
}

// vm.panic() is the master panic handler. The panic() function defined in
// project-k kernel jeforth.js is the one called in code ... end-code.
// project-k kernel projectk.js is the one called in code ... end-code.
vm.panic = function(state){
vm.type(state.msg);
if (state.serious) debugger;
}

// Even in 3ce background page we still need the panic() function below
// but we can't see the one in jeforth.js so one is defined here for convenience.
// but we can't see the one in projectk.js so one is defined here for convenience.
function panic(msg,level) {
var state = {
msg:msg, level:level
Expand Down
8 changes: 4 additions & 4 deletions 3ce/ce.f
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function ce3_host_onmessage (message, sender, sendResponse) {
tabid {} js: tos().file="js/jquery-1.11.2.js" inject drop
then
tabid {} js: tos().file="js/version.js" inject drop
tabid {} js: tos().file="project-k/jeforth.js" inject drop
tabid {} js: tos().file="project-k/projectk.js" inject drop

\ Inject the main program of jeforrth.3ce (jeforth.3htm.js equivalent)
<ce>
Expand All @@ -259,7 +259,7 @@ function ce3_host_onmessage (message, sender, sendResponse) {
// We need to help it a little as the following example:

(function(){
// vm.minor_version = 204; // 3ce target page minor version. major version is from jeforth.js kernel.204; // 3ce target page minor version. major version is from jeforth.js kernel.
// vm.minor_version = 204; // 3ce target page minor version. major version is from projectk.js kernel.204; // 3ce target page minor version. major version is from projectk.js kernel.
vm.minor_version = jeforth3we_minor_version;
var version = vm.version = parseFloat(vm.major_version+"."+vm.minor_version);
vm.appname = "jeforth.3ce"; // 不要動, jeforth.3we kernel 用來分辨不同 application。
Expand Down Expand Up @@ -300,12 +300,12 @@ function target_f7_handler (message, sender, sendResponse) {
};
// vm.panic() is the master panic handler. The panic() function defined in
// project-k kernel jeforth.js is the one called in code ... end-code.
// project-k kernel projectk.js is the one called in code ... end-code.
vm.panic = function(state){
vm.type(state.msg);
if (state.serious) debugger;
}
// We need the panic() function below but we can't see the one in jeforth.js
// We need the panic() function below but we can't see the one in projectk.js
// so one is defined here for convenience.
function panic(msg,level) {
var state = {
Expand Down
2 changes: 1 addition & 1 deletion 3ce/jeforth.3ce.background.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>jeforth.3ce background page</title>
<script src="js/jquery-1.11.2.js"></script>
<Script src="project-k/jeforth.js"></Script>
<Script src="project-k/projectk.js"></Script>
<script src="js/version.js"></script>
<Script src="3ce/background.js"></Script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion 3ce/jeforth.3ce.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
</style>
<script src="js/jquery-1.11.2.js"></script>
<script src="project-k/jeforth.js"></script>
<script src="project-k/projectk.js"></script>
<script src="js/version.js"></script>
<script src="3ce/jeforth.3ce.js"></script>
</head>
Expand Down
8 changes: 4 additions & 4 deletions 3ce/jeforth.3ce.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
kvm.selftest_visible = true; // type() refers to it.

// kvm.type() is the master typing or printing function.
// The type() called in code ... end-code is defined in the kernel jeforth.js.
// We need to use type() below, and we can't see the jeforth.js' type() so one
// The type() called in code ... end-code is defined in the kernel projectk.js.
// We need to use type() below, and we can't see the projectk.js' type() so one
// is also defined here, even just for a few convenience. The two type() functions
// are both calling the same kvm.type().
var type = kvm.type = function (s) {
Expand All @@ -33,12 +33,12 @@
}

// kvm.panic() is the master panic handler. The panic() function defined in
// project-k kernel jeforth.js is the one called in code ... end-code.
// project-k kernel projectk.js is the one called in code ... end-code.
kvm.panic = function(state){
type(state.msg);
if (state.serious) debugger;
}
// We need the panic() function below but we can't see the one in jeforth.js
// We need the panic() function below but we can't see the one in projectk.js
// so one is defined here for convenience.
function panic(msg,level) {
var state = {
Expand Down
2 changes: 1 addition & 1 deletion 3ce/target.f
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Program path <span id=location>location</span><br>
// js: $(".console3we")[0].style.visibility="hidden"

// vm.type() is the master typing or printing function.
// The type() called in code ... end-code is defined in the kernel jeforth.js.
// The type() called in code ... end-code is defined in the kernel projectk.js.
// target_type(s) types to the target page outputbox, instead of to the host page
// that may be the popup page or a 3ce extension page.
function target_type(s) {
Expand Down
3 changes: 3 additions & 0 deletions 3hta/f/git.f
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
\ 今利用 jeforth 來管理這些命令跟建議。平時也可以簡化指令、做筆記、為每組命令添加 help
\ message。不管 GitHub 再怎麼複雜難用,配合 jeforth 只要 study 一次就永遠不會再忘記了。
\
\ 11:36 2017-09-11 參考本程式寫成的 python multiple line input tool pykb.f
\ 換台電腦跑就有點問題,一度以為 3hta 要 run as administrator 才可以,已證實不必。
\

js> vm.appname char jeforth.3hta != [if] ?abort" Sorry! git.f is for jeforth.3hta only." \s [then]
include vb.f
Expand Down
45 changes: 45 additions & 0 deletions 3hta/f/misc.hta.f
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,51 @@ Math.sign = function sign(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };
( Word array ) (aliases) ;
/// Used in DOS box batch program for jeforth to ignore DOS words.

\ ----- NIC on/off utility -----

19 value officeLAN // ( -- n ) DeviceID of the OA LAN NIC. Change this for your case.
/// "where deviceid = 19" is for my LRV2 OA only
/// Need administrator privilege, run 'dos' check title.
/// Run 3HTA.bat through right click to 'Run as administrator'.
/// Set NIC deviceID : "19 to officeLAN" misc.f
/// Get NIC deviceID : "activeNIC :> deviceid ." wmi.f
/// See all NIC devices : "list-all-nic" wmi.f

: (nicoff) ( -- ) \ Turn off the NIC (the certain where clause is for my LRV2 only)
\ s" where deviceid = 19" getNIC :> disable()
officeLAN s" where deviceid = _id_" :> replace(/_id_/,pop()) getNIC :> disable()
dup if
\ return 5 is failed when not an administrator
." Failed! Error code " . ." . Make sure to run as an administrator." cr
else
drop ." NIC device turned off sucessfully." cr
then ;
last :: comment=tick('officeLAN').comment

: nicon ( -- ) \ Turn on the NIC (the certain where clause is for my LRV2 only)
\ s" where deviceid = 19" getNIC :> enable()
officeLAN s" where deviceid = _id_" :> replace(/_id_/,pop()) getNIC :> enable()
dup if
\ return 5 is failed when not an administrator
." Failed! Error code " . ." . Make sure to run as an administrator." cr
else
drop ." NIC device turned on sucessfully." cr
then ;
last :: comment=tick('officeLAN').comment

: nicoff ( <minutes> -- ) \ Turn off the NIC 1~120 minutes, default 15 minutes
CR word js> parseFloat(pop()) ( min|NaN )
?dup if else 15 then \ default 15 minutes
js> (tos()>=1)&&(tos()<=360) if else
." Error: Given time period must be > 1 and <= 120 (minutes)." cr exit
then (nicoff) ." It'll be back " dup . ." minutes later." cr 60 * 1000 *
nap nicon ;
/// Run (nicoff) to turn off the NIC permanently
last :: comment+=tick('officeLAN').comment

\ : rdlan ( minutes -- ) \ Disable office LAN to use RD LAN through WiFi for a period of time that > 1 minute and <= 120 minutes
\ js> (tos()>=1)&&(tos()<=120) if else ." Error: Given time period must be > 1 and <= 120 (minutes)." cr exit then
\ nicoff 60 * 1000 * nap nicon ;
\ last :: comment=tick('officeLAN').comment


1 change: 1 addition & 0 deletions 3hta/f/platform.f
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
push(pathname ? pathname : "3hta/localstorage.json");
execute("readTextFile");
var ss = pop();
if (ss=="") return; // file not found
// if is from 3hta then it's utf-8 with BOM (EF BB BF) that bothers NW.js JSON.parse()
// ss.charCodeAt(0)==65279 that's utf-8 BOM
if (ss.charCodeAt(0)==65279) ss = ss.slice(1); // resolve the utf-8 BOM issue
Expand Down
Loading

0 comments on commit d02c7ba

Please sign in to comment.