Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix「字庫練習」輸入框:末題再答、題目重碼、下一題效率、提示效率 #16

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Commits on Oct 3, 2023

  1. fix(composeExercise.js): fix passed questions not able to be answered…

    … again
    
    It is possible to input a character from other questions.
    
    However, it was not possible to input a character from any passed question,
    because these characters were removed from the input table.
    
    This caused an issue for the last question,
    since the "next" question of the last question is currently itself.
    
    This issue is fixed by separating the input table and the question list.
    
    * MapCharacterTable()
        * add this.questList (init-ed to have the same content as this.table)
    * MapCharacterTable.prototype.getCharacterAndAlphabet()
        * make the previous question deleted from this.questList instead
    IepIweidieng committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    4af654b View commit details
    Browse the repository at this point in the history
  2. fix(composeExercise.js): make answer field emptied on pressing Enter

    This prevents the user from wrongly pressing Space right after pressing Enter.
    
    * inputBar.oninput()
        * reset visualBar.node.textContent on pressing Enter
    IepIweidieng committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    86efc7c View commit details
    Browse the repository at this point in the history
  3. fix(composeExercise.js): keep same-Cangjie questions; make question a…

    …dvancing O(1) time
    
    The question 叭 (口金; rc) was inaccessible
    due to its Cangjie code being the same as 只 (口金; rc).
    
    This issue is fixed by using an Array for MapCharacterTable.questList.
    
    * MapCharacterTable()
        * make this.questList an array (LIFO)
        * reverse the iteration of `this.questList`-building `for` loop
    * MapCharacterTable.prototype.getCharacterAndAlphabet()
        * simplify question advancing by using Array.prototype.pop()
        * overwrite input table with the answer of the current question
          for handling characters with the same Cangjie code within the same stage
    IepIweidieng committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    4a143ba View commit details
    Browse the repository at this point in the history
  4. perf(composeExercise.js): make hint revealing O(1) time

    * initialize hintBar with attrs hintState & hideState
    * hintBar.newHintState()
        * initialize this.hintState & this.hideState
    * hintBar.hintCharacter()
        * cache hintState into `this`
        * cache hideState into `this`
        * avoid string comparisons by accessing & modifying this.hideState instead
    IepIweidieng committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    e5370ac View commit details
    Browse the repository at this point in the history