Loading calc.html +41 −7 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ <td data-bt-name="num7">7</td> <td data-bt-name="num8">8</td> <td data-bt-name="num9">9</td> <td title="delete pending digit or number in stack" data-bt-name="backspace">←</td> <td title="delete pending digit or number in stack (q)" data-bt-name="backspace">←</td> </tr> <tr> <td data-bt-name="num4">4</td> Loading @@ -172,21 +172,21 @@ </tr> <tr> <td data-bt-name="num0">0</td> <td title="change sign" data-bt-name="change-sign">±</td> <td title="change sign (n)" data-bt-name="change-sign">±</td> <td title="dot" data-bt-name="dot">.</td> <td title="plus" data-bt-name="plus">+</td> </tr> <tr> <td title="swap top two numbers on stack" data-bt-name="swap">SWAP</td> <td title="undo last operator" data-bt-name="undo">UNDO</td> <td title="divide" data-bt-name="divide">÷</td> <td title="push pending number to stack or duplicate top number on stack" <td title="undo last operator (U)" data-bt-name="undo">UNDO</td> <td title="divide (/)" data-bt-name="divide">÷</td> <td title="push pending number to stack or duplicate top number on stack (Enter)" data-bt-name="return">⏎</td> </tr> <tr> <td title="sum all numbers in stack" data-bt-name="sum-all">Σ</td> <td title="square root" data-bt-name="square-root">√</td> <td title="power" data-bt-name="power">^</td> <td title="square root (Q)" data-bt-name="square-root">√</td> <td title="power (^)" data-bt-name="power">^</td> <td></td> </tr> </table> Loading Loading @@ -610,6 +610,40 @@ $('#expand-trail').text("Shrink Trail"); } }); $(document).keypress(function (evt) { // map evt.key to RPNCalculator keyName. const keyMap = { "1": "num1", "2": "num2", "3": "num3", "4": "num4", "5": "num5", "6": "num6", "7": "num7", "8": "num8", "9": "num9", "0": "num0", ".": "dot", "Enter": "return", "+": "plus", "-": "minus", "*": "times", "/": "divide", "n": "change-sign", "^": "power", "Q": "square-root", "U": "undo", // below is not from emacs calc "q": "backspace", }; console.log("charCode=" + evt.charCode + ", key=" + evt.key); console.log(typeof(evt.key)); const keyName = keyMap[evt.key]; if (keyName !== undefined) { rpnCalculator.sendKey(keyName); updateUI(rpnCalculator); } }); }()); </script> </body> Loading operational +14 −8 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ Time-stamp: <2017-01-27> not modify the number. * later :entry: ** 2017-01-27 how to capture backspace key in javascript? what about TAB key? ** 2017-01-27 the whole FSM can be made persistent across sessions. not only trail. Loading @@ -71,6 +72,16 @@ the parent DOM. * current :entry: ** ** 2017-01-27 deploy on https://www.emacsos.com/rpn-calculator.html ** 2017-01-27 add some visual feedback when clicking a button. like in material design. ** 2017-01-27 UI problem: when input a very large number, #number-display and keyboard will grow. should set a max-width on #number-display. overflow: auto doesn't work with <td> in firefox. ** 2017-01-26 make it work offline, add sw.js * done :entry: ** 2017-01-27 accept keyboard event as well. :low:featurereq: - num0 to num9 - dot Loading @@ -88,15 +99,10 @@ the parent DOM. Can I skip a JS code block when executing on mobile browser that doesn't have physical keyboard? ** 2017-01-27 add some visual feedback when clicking a button. like in material design. ** 2017-01-27 UI problem: when input a very large number, #number-display and keyboard will grow. should set a max-width on #number-display. overflow: auto doesn't work with <td> in firefox. - problems - backspace doesn't trigger .keypress(). - tab jump between links. doesn't trigger .keypress(). ** 2017-01-26 make it work offline, add sw.js * done :entry: ** 2017-01-27 add a button: sum-all, it will sum all numbers on stack. :featurereq: - make UI auto height based on keyboard height. - add three buttons: sum-all, square-root, power Loading Loading
calc.html +41 −7 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ <td data-bt-name="num7">7</td> <td data-bt-name="num8">8</td> <td data-bt-name="num9">9</td> <td title="delete pending digit or number in stack" data-bt-name="backspace">←</td> <td title="delete pending digit or number in stack (q)" data-bt-name="backspace">←</td> </tr> <tr> <td data-bt-name="num4">4</td> Loading @@ -172,21 +172,21 @@ </tr> <tr> <td data-bt-name="num0">0</td> <td title="change sign" data-bt-name="change-sign">±</td> <td title="change sign (n)" data-bt-name="change-sign">±</td> <td title="dot" data-bt-name="dot">.</td> <td title="plus" data-bt-name="plus">+</td> </tr> <tr> <td title="swap top two numbers on stack" data-bt-name="swap">SWAP</td> <td title="undo last operator" data-bt-name="undo">UNDO</td> <td title="divide" data-bt-name="divide">÷</td> <td title="push pending number to stack or duplicate top number on stack" <td title="undo last operator (U)" data-bt-name="undo">UNDO</td> <td title="divide (/)" data-bt-name="divide">÷</td> <td title="push pending number to stack or duplicate top number on stack (Enter)" data-bt-name="return">⏎</td> </tr> <tr> <td title="sum all numbers in stack" data-bt-name="sum-all">Σ</td> <td title="square root" data-bt-name="square-root">√</td> <td title="power" data-bt-name="power">^</td> <td title="square root (Q)" data-bt-name="square-root">√</td> <td title="power (^)" data-bt-name="power">^</td> <td></td> </tr> </table> Loading Loading @@ -610,6 +610,40 @@ $('#expand-trail').text("Shrink Trail"); } }); $(document).keypress(function (evt) { // map evt.key to RPNCalculator keyName. const keyMap = { "1": "num1", "2": "num2", "3": "num3", "4": "num4", "5": "num5", "6": "num6", "7": "num7", "8": "num8", "9": "num9", "0": "num0", ".": "dot", "Enter": "return", "+": "plus", "-": "minus", "*": "times", "/": "divide", "n": "change-sign", "^": "power", "Q": "square-root", "U": "undo", // below is not from emacs calc "q": "backspace", }; console.log("charCode=" + evt.charCode + ", key=" + evt.key); console.log(typeof(evt.key)); const keyName = keyMap[evt.key]; if (keyName !== undefined) { rpnCalculator.sendKey(keyName); updateUI(rpnCalculator); } }); }()); </script> </body> Loading
operational +14 −8 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ Time-stamp: <2017-01-27> not modify the number. * later :entry: ** 2017-01-27 how to capture backspace key in javascript? what about TAB key? ** 2017-01-27 the whole FSM can be made persistent across sessions. not only trail. Loading @@ -71,6 +72,16 @@ the parent DOM. * current :entry: ** ** 2017-01-27 deploy on https://www.emacsos.com/rpn-calculator.html ** 2017-01-27 add some visual feedback when clicking a button. like in material design. ** 2017-01-27 UI problem: when input a very large number, #number-display and keyboard will grow. should set a max-width on #number-display. overflow: auto doesn't work with <td> in firefox. ** 2017-01-26 make it work offline, add sw.js * done :entry: ** 2017-01-27 accept keyboard event as well. :low:featurereq: - num0 to num9 - dot Loading @@ -88,15 +99,10 @@ the parent DOM. Can I skip a JS code block when executing on mobile browser that doesn't have physical keyboard? ** 2017-01-27 add some visual feedback when clicking a button. like in material design. ** 2017-01-27 UI problem: when input a very large number, #number-display and keyboard will grow. should set a max-width on #number-display. overflow: auto doesn't work with <td> in firefox. - problems - backspace doesn't trigger .keypress(). - tab jump between links. doesn't trigger .keypress(). ** 2017-01-26 make it work offline, add sw.js * done :entry: ** 2017-01-27 add a button: sum-all, it will sum all numbers on stack. :featurereq: - make UI auto height based on keyboard height. - add three buttons: sum-all, square-root, power Loading