Commit 2aee6936 authored by Yuanle Song's avatar Yuanle Song
Browse files

tested on mobile device. update UI.

- stack and trail buttons: use shorter label.
- swap location of minus and return key.
- add a round operator button. feature not implemented yet.
- update fabfile to support zip/tar.gz distribution.
- add doc about it runs slow on firefox mobile.
parent 04eca5fa
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -194,8 +194,8 @@
	<div class="title">
	  <h3>Stack</h3>
	  <div class="title-button-group">
	    <a title="clear stack" id="clear-stack" href="#">Clear Stack</a>
	    <a title="expand stack" id="expand-stack" href="#">Expand Stack</a>
	    <a title="clear stack" id="clear-stack" href="#">Clear</a>
	    <a title="expand stack" id="expand-stack" href="#">Expand</a>
	  </div>
	</div>
	<div id="stack-content"></div>
@@ -232,7 +232,8 @@
	      <td data-bt-name="num1">1</td>
	      <td data-bt-name="num2">2</td>
	      <td data-bt-name="num3">3</td>
	      <td title="minus" data-bt-name="minus">-</td>
	      <td title="push pending number to stack or duplicate top number on stack (Enter)"
		  data-bt-name="return">⏎</td>
	    </tr>
	    <tr>
	      <td data-bt-name="num0">0</td>
@@ -244,14 +245,13 @@
	      <td title="swap top two numbers on stack" data-bt-name="swap">SWAP</td>
	      <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>
	      <td title="minus" data-bt-name="minus">-</td>
	    </tr>
	    <tr>
	      <td title="sum all numbers in stack" data-bt-name="sum-all">Σ</td>
	      <td title="square root (Q)" data-bt-name="square-root">√</td>
	      <td title="power (^)" data-bt-name="power">^</td>
	      <td></td>
	      <td title="round (R)" data-bt-name="round">ROUND</td>
	    </tr>
	  </table>
	</div>
@@ -260,8 +260,8 @@
	<div class="title">
	  <h3>Trail</h3>
	  <div class="title-button-group">
	    <a title="clear trail" id="clear-trail" href="#">Clear Trail</a>
	    <a title="expand trail" id="expand-trail" href="#">Expand Trail</a>
	    <a title="clear trail" id="clear-trail" href="#">Clear</a>
	    <a title="expand trail" id="expand-trail" href="#">Expand</a>
	  </div>
	</div>
	<div id="trail-content"></div>
@@ -758,10 +758,10 @@
	      const oldMaxHeight = $('#stack-content').css("max-height");
	      if (oldMaxHeight === "100px") {
		  $('#stack-content').css("max-height", "300px");
		  $('#expand-stack').text("Shrink Stack");
		  $('#expand-stack').text("Shrink");
	      } else {
		  $('#stack-content').css("max-height", "100px");
		  $('#expand-stack').text("Expand Stack");
		  $('#expand-stack').text("Expand");
	      }
	      return false;
	  });
@@ -769,10 +769,10 @@
	      const oldMaxHeight = $('#trail-content').css("max-height");
	      if (oldMaxHeight === "300px") {
		  $('#trail-content').css("max-height", "100px");
		  $('#expand-trail').text("Expand Trail");
		  $('#expand-trail').text("Expand");
	      } else {
		  $('#trail-content').css("max-height", "300px");
		  $('#expand-trail').text("Shrink Trail");
		  $('#expand-trail').text("Shrink");
	      }
	      return false;
	  });
+21 −3
Original line number Diff line number Diff line
@@ -11,14 +11,32 @@ env.use_ssh_config = True


SERVER = 'de01'

FILES = "calc.html fifo.js fsm.js sw.js vendor/ favicon.ico"

def deploy():
    with lcd("~/websites/rpn-calculator/"):
        local("rsync -n -irt calc.html fifo.js fsm.js sw.js vendor/ favicon.ico"
              " %s:/var/www/rpn.emacsos.com/" % (SERVER,))
        local("rsync -n -irt %s"
              " %s:/var/www/rpn.emacsos.com/" % (FILES, SERVER))


@hosts(SERVER)
def init():
    run("mkdir -p /var/www/rpn.emacsos.com/")


def tar():
    """create an archive that can be run locally.

    obviously service worker won't work there.

    """
    local("tar czf rpn-calculator.tar.gz %s" % (FILES,))


def zip():
    """create an archive that can be run locally.

    obviously service worker won't work there.

    """
    local("zip -q -r rpn-calculator.zip %s" % (FILES,))
+34 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ Time-stamp: <2017-01-28>
** 2017-01-27 steps to add new operator button.				:doc:
- add button in UI HTML.
- update fsm.js keyNames, shortKeyNames, operatorKeyList.
- add operator handling code.
- add operator handling code in fsm.js.

  If you can use this.doBinaryOperator(), use that is easier.

@@ -35,6 +35,9 @@ Time-stamp: <2017-01-28>
  - manipulate numberStack.
  - if there is error, call this.setErrorMsg(), pop snapshot and do early return.
  - if there is no error, push result in numberStack, push new op and result to this.trail.
- add event handler in calc.html.
  set data-bt-name on td.
  if there is a hotkey, handle that hotkey.

** 2017-01-26 design data structure for the calculator.
- this can be written and tested independently from the web UI.
@@ -72,6 +75,10 @@ Time-stamp: <2017-01-28>
    not modify the number.

* later                                                               :entry:
** 2017-01-28 check why it runs slow in firefox mobile on android. :performance:
try type digits 1 to 9, not all numbers get accepted.
it has no problem in chrome.

** 2017-01-28 try convert it to native app using phonegap.
I like HTML5 offline website better than phonegap app.
I prefer either native app or real website.
@@ -120,6 +127,7 @@ the parent DOM.

* current                                                             :entry:
** 
** 2017-01-28 add a round operator.
** 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.
@@ -127,6 +135,31 @@ should set a max-width on #number-display.
overflow: auto
doesn't work with <td> in firefox.
* done                                                                :entry:
** 2017-01-28 try it on mate8.
I can transfer files using bluetooth.

- problems
  - mate8 File app can't extract tar.gz. try zip file.
  - when I click on html file, there is no open by chrome choice on android. why?
  - html file runs slow in firefox mobile.
    touch button feels very slow. not a good UX at all.
    landscape mode fails badly when I don't hide location bar. I can't even
    see return key.
  - try copy URL from firefox to chrome.
    paste URL in chrome works.
    it runs much faster in chrome. touch keyboard button is just like native app.

** 2017-01-28 UI on mobile device is not good.
- I can't see top 3 number on stack.
  I can see it when location bar is hidden.

- make title line smaller, use slide in panel/tab for buttons and detail views.

  hide trail by default.
  move stack to top.
- swap - and return location
- I think it's good enough on chrome mobile

** 2017-01-28 UI tweaks
- DONE about page, HELP should be centered. change "Close" to "Return to calc".
  put back button on the rhs.