diff --git a/exec/noyesbar.js b/exec/noyesbar.js new file mode 100755 index 0000000000000000000000000000000000000000..3220872b89f223485fa8069a81de0a50b3034fab --- /dev/null +++ b/exec/noyesbar.js @@ -0,0 +1,42 @@ +// JS version of noyesbar.src + +const yes_str = bbs.text(bbs.text.Yes); +const yes_key = yes_str[0]; +const no_str = bbs.text(bbs.text.No); +const no_key = no_str[0]; + +while(console.question.substring(0, 2) == "\r\n") { + console.crlf(); + console.question = console.question.substring(2); +} + +console.putmsg("\x01n\x01b\x01h[\x01c@CHECKMARK@\x01b] \x01y@QUESTION->@? @CLEAR_HOT@"); +var affirm = false; +while(bbs.online && !js.terminated) { + var str; + if(affirm) + str = format("\x01n\x01b\x01h \x01~%s \x014\x01w\x01e[\x01~%s]", no_str, yes_str); + else + str = format("\x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s ", no_str, yes_str); + console.print(str); + var key = console.getkey(0).toUpperCase(); + console.backspace(console.strlen(str)); + console.print("\1n\1h\1>"); + if(console.aborted) { + affirm = false; + break; + } + if(key == '\r') + break; + if(key == yes_key) { + affirm = true; + break; + } + if(key == no_key) { + affirm = false; + break; + } + affirm = !affirm; +} + +console.ungetstr(affirm ? yes_key : no_key); diff --git a/exec/yesnobar.js b/exec/yesnobar.js new file mode 100755 index 0000000000000000000000000000000000000000..85bc47e742cc16f2df59e335a3b324d60352b952 --- /dev/null +++ b/exec/yesnobar.js @@ -0,0 +1,42 @@ +// JS version of yesnobar.src + +const yes_str = bbs.text(bbs.text.Yes); +const yes_key = yes_str[0]; +const no_str = bbs.text(bbs.text.No); +const no_key = no_str[0]; + +while(console.question.substring(0, 2) == "\r\n") { + console.crlf(); + console.question = console.question.substring(2); +} + +console.putmsg("\x01n\x01b\x01h[\x01c@CHECKMARK@\x01b] \x01y@QUESTION->@? @CLEAR_HOT@"); +var affirm = true; +while(bbs.online && !js.terminated) { + var str; + if(affirm) + str = format("\x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s ", yes_str, no_str); + else + str = format("\x01n\x01b\x01h \x01~%s \x014\x01w\x01e[\x01~%s]", yes_str, no_str); + console.print(str); + var key = console.getkey(0).toUpperCase(); + console.backspace(console.strlen(str)); + console.print("\1n\1h\1>"); + if(console.aborted) { + affirm = false; + break; + } + if(key == '\r') + break; + if(key == yes_key) { + affirm = true; + break; + } + if(key == no_key) { + affirm = false; + break; + } + affirm = !affirm; +} + +console.ungetstr(affirm ? yes_key : no_key);