Commit Graph

33 Commits (2287be95c3bb41cc4967974f3c421bff3bf28a73)

Author SHA1 Message Date
Zaahir Moolla 5c391e1091 switch listen to touchend on mobile (#4488) 2017-09-14 17:17:44 +01:00
Zaahir Moolla 03ec6b3650 Calculator: Fix text selection across all browsers (#4417)
* Listen to calc--wrap and apply selected class as needed

* Remove unneeded mousedown handler

* Clean trailing spaces
2017-08-10 22:36:26 +01:00
PJ Hampton 1b10220bdc Add dark theme. (#4355) 2017-07-31 22:17:42 -04:00
Zaahir Moolla db434a22d0 Calculator: Fix text selection/copy for Firefox (#4351)
* Ensure mouseup doesn't remove focus for Firefox

* Use hover and selected classes to style calc input

* Ignore meta keys to allow copying in Firefox
2017-07-14 09:44:29 +01:00
PJ Hampton 9c581d9564 Calculator: Various Fixes (#4349)
* Fix weird error message.

* Stop algebra overtriggering.

* Fix overflow error.

* Fixed tests.

* Conclude big patch.

* Patch review bugs.
2017-07-13 18:04:32 -04:00
PJ Hampton af0a70222d Calculator: Fixes up trig functions. (#4339)
* Fixes up trig functions.

Replace regex.

* Fixed 1/(x) issues.

* Update dodgy lookahead.
2017-07-10 18:15:49 -04:00
PJ Hampton 65f69dab27 Calculator: Various improvements. (#4318)
* Various improvements.

query_nowhitespace removal workaround.

Updated code.

Update code.

Fix exponential state when squaring/cubing

Fix calculator bugs.

* Fix log.

* Various improvements.

* Update variable name.

* Remove debug statements.

* Fix logs/lns on front-end.
2017-06-29 16:55:27 -04:00
PJ Hampton 092124b817 Calculator: Fix non-whole expression rewriting (#4241)
* Fix non-whole expression rewriting.

* Add pixel to check for failure.
2017-06-03 10:00:43 -04:00
PJ Hampton 3869ad10ac Fix preprocessed query edgecase. (#4237) 2017-06-01 14:23:53 -04:00
PJ Hampton c1287cb1cc Allow keyboard input in firefox. (#4235) 2017-05-31 14:54:03 -04:00
PJ Hampton 900c5a3da5 Calculator: Fixes onload js issue / Patch triggering (#4230)
* catch value error on load.

* added quick win triggering edge cases from pixel logs.
2017-05-29 07:27:40 -04:00
Zaahir Moolla be057cf5ec Fix log rewrite 2017-05-25 12:03:40 -04:00
PJ Hampton 72729b7c16 Calculator: (URGENT) Fix math.js log|ln simplify issue. (#4183)
* Fix math.js simplify issue.

* Remove debug statements.

* Adds fact to the mix.

* Stash

* Fix greedy quantifier in trig and log/ln

* Don't trigger on anything with stuff after =

* allow triggering on <func> <number>

* Both sides of =

* Fix expressions.

* Tighten up triggering based on valid expressions.

* Remove dumper obj

* Tighten up word triggering.

* Allow only one currency through.

* Kill off symbols in js if allowed through.

* Allow negative numbers.

* Add support for negated numbers.

* Fix initialize issue.

* Refactor code slightly

* Tightened regexs

* Require space between log and input
2017-05-24 17:44:13 -04:00
PJ Hampton 312edbc53c Calculator: Removes 0 on bail (#4169)
* Removed 0 on error. Saves user confusion.

* Add tracking pixel.
2017-05-22 16:17:30 -04:00
PJ Hampton 137f98c31b Calculator: Add square root support from search bar. (#4182) 2017-05-09 16:53:43 -04:00
PJ Hampton 793cf24dff Removed comma with period. (#4130) 2017-04-26 13:04:55 -04:00
PJ Hampton 6dd0762f54 Fix rounding errors. (#4131) 2017-04-26 12:37:33 -04:00
PJ Hampton 31597d87b4 Calculator: Fix copy issue, remove -Infinity (#4095)
* Removed backspace with 'c' key to allow copying.

* Restart if result is -Infinity

* remove trailing space

* Detect metakey

* Fixed merge conflict.

* Fixed copy and paste issue with calculator

* Fixed copy and paste issue with calculator

* Accounts for ctrl key

* Fix handling of shift/ctrl/cmd keys

* remove trailing spaces

* more robust, simple cross browser keyboard handling

* add shortcuts for functions, replace c with cos

* Updated comments.
2017-04-24 19:40:59 +01:00
PJ Hampton 2e6590e29f Calculator: [Phase 4] Deprecate Perl Backend (#4110)
* Begin deprecating perl backend.

* Deprecate backend [skip ci]

* Routine checkin of code.

* Added docs + preprocessing.

* Deprecate perl eval backend.

* Checking in some code.'

* Handle bad search expressions by defaulting to 0

* Add ability to recover with grace from bad expressions from search bar.

* Removed unnessesary perl code.

* Add support for factorials with !

* cleanup trailing spaces

* Removed trig constants.

* Support tau in expression.

* Removed ln preprocess.

* Support leading =. Removed moot code.

* Add support for euro and pound.

* Removed nat lang query parsing from js.

* strip duplicate operators

* Fixed legacy spacing issue in tests.

* Remove empty exponent.

* Bail on hex looking entries.

* better handling of repeated operators

* Remove max import

* revert back to old check for 3+ operators

* relax phone number regex for now

* remove silly test
2017-04-21 13:12:41 -04:00
PJ Hampton 99f0ea0f09 Calculator: Update / Refactor Percent Normalizer (#4106)
* Update Percent Normalizer.

* Removed numerical restrictions.

* Update regex.

* Allow addition of float percents.

* Remove console.log
2017-04-19 22:50:28 -04:00
Zaahir Moolla d71b7c4eb7 use strings to prevent handling 0 as false (#4109) 2017-04-18 21:10:22 +01:00
PJ Hampton b2b7ae46f2 Calculator: Support multi factorial operations (#4105)
* Support multi factorial / refactor.

* Bail if following an operand.
2017-04-18 13:50:40 -04:00
Zaahir Moolla c8aef411bb Calculator: Allow user-select on history ledger, Add support for Numpad (#4108)
* Allow user-select on history ledger

* Add support for numpad keys
2017-04-18 18:08:51 +01:00
Zaahir Moolla 5ce2486225 remove float, breaks Safari 2017-04-13 21:52:10 -04:00
PJ Hampton 7d021663f6 Calculator: Update signal (#4090)
* Update signal.

* Updated calculator signal.

* replace semi-colon with comma
2017-04-13 17:19:45 -04:00
Zaahir Moolla 3c784f2582 Calculator: Mobile CSS, Corrected Trig Functionality (#4087)
* Enable history panel on mobile

* Namespace CSS rules, remove trailing spaces

* namespace all css rules

* cleanup indentation

* remove pete's css hacks

* Namespace additional css rules

* left align calculator with search box

* Implement full width mobile UI

* remove unused css

* remove unused ids

* Beter handling of history col for small screens

* Switch back to using on methd

* Fix trig regex and evaluation, remove precision

* Ensure subtitle overflows on left, prevent history item overflow

* Prevent subtitle text from being clipped

* Remove evalmath obj

* Updated conditional

* Add support for numpad period

* Fixed on start clear.

* Add postfix detection. Fixed infinity ledger.

* Removed Factorial BigNum hacks.

* Removed unnessesary code introduced.

* Fixed shift / clear issue.

* Remove undefined key strokes.

* Fix pi in exponents.

* Make return consistent.

* Fix broken history

* Apply user-select rules to desktop and mobile

* cleanup trailing spaces, commented out css

* Fix backspacing issue with operands.

* Remove console logs
2017-04-13 13:06:53 -04:00
PJ Hampton 0abd6a6554 Calculator: [Phase 2] Add Scientific calculator (#4067)
* Phase 1: Add basic calculator

* Updated tests.

* change template name, use base template, prefill calc with answer

* fix test

* Added backlog features.

* Updated js.

* Light refactoring work

* Refactored keycodes.

* Updated C button.

* Rewrote (+/-)% Expressions

* Updated the spacing dertermination

* Added expression to UI by default.

* Update tests.

* Updated formatting.

* Rewrite percent queries.

* Pushing updated codebase.

* Add calculator as trigger word

* Update tests for new triggers

* Stop initializing expression if 0

* add precision support to math eval object.

* Removed scientific buttons / history for Phase 1

* Updated math type.

* Prevents duplicate OPERADNS

* Add duplicate functionality.

* Updated unicode.

* Removed es6 feature.

* Stop first entry being an operand.

* Add operator flipping.

* Added Precision support.

* Handle numpad operator keys

* Set and maintain focus, Improved event handling

* Bind click handler in loop, stopPropgation of keydown

* Cleanup trailing spaces

* Fixed broken assignment.

* Prevent multiple commas.

* Fixed calculator stalling when trying to enter a new operator

* Initial refactor.

* Refactored out expression array.

* Refactored out display var.

* reintroduced matheval object for precision.

* Cleaned up formatting.

* Removed commify.

* Initial PR for Phase 2

* Add support for brackets.

* Added support for Pi

* Add support for sin, tan, cos

* Added factorial support

* Add support for squared / cubed functions

* Add support for natural log

* Support log_10 function.

* Add support for square roots.

* Add eulers number.

* Implement Engineers Exponent / Formatted Funcs.

* Add sci-tab id to handlebars.

* Removed positioning for mobile display.

* Custom exponents 🚀

* Implemented Euler exponent

* Support 1/x button.

* Interactified deg/rad toggle.

* Add support for degrees / radians

* Fix radians bug.

* Zaahirs / Mintsofts syntactic changes.

* Fixed regex for exponents

* Removed blue from toggle.

* Allow backspacing through functions.

* Allow backspacing through exponents.

* Fix +99% bug.

* Allow flipping of keypads.

* Stop ! being entered first.

* Stop EE being entered at start or multiple.

* Allow step back through EE

* Disallow multiple periods. [skip ci]

* Rewrote query to handle natural language.

* Addressed phase 1 feedback.

* Fixed backspace bug.

* Allow backspacing through constants.

* Add auto paren support for funcs.

* Started the commenting 💥

* Add some comments.

* Updated PercentNormalizer comment.

* Fix 0/0 Error.

* Add 'c' key support

* Fix back spacing.

* Positioned deg / rad toggle.

* Refactoring code. Stage 1.

* Added high signal.

* Add funcs for Initite/NaN

* Moved eval info into separate function.

* Abstracted clear function.

* Add paren manager.

* Refactored out paren state.

* Refactored out parenState global

* Removed meta.

* Backspace through functions.

* Set signal to high.

* Fixed signal

* Pushing updated code.

* Refactored backspacing.

* Fix up messy code / document.

* Fixed + percent bug.

* Support EE on mobile.

* opens pseudo paren for 1/(x)

* Fix large factorial issue.

* Allow pi | e as exponent.

* use exponents on π and e.

* Removed +-3 issue.

* Natural log and log now work as exponents

* nit: cleaned up expression.

* Fixed percent error.

* Add phase 3 ledger span (hidden)

* Disabled add digits.

* Check in UX fixes.

* Some light refactoring.

* Swap functions.

* Fixed shoddy regex.

* Add ledger object for phase 3.

* Updated percentage / trig regex

* Add blank expression if error.

* Allow factorial on decimals.

* Update code + comments.

* Add in calc trigger word. Fixed Backspace.

* All backspacing fixed.

* Try to recover from open/unfinished exponent

* Add high signal for

* Update comments.

* Updated comments.

* improve calculator regex

* Strip trailing spaces`

* Updated signal code.

* Fixed backspacing issue.

* swap id for class (ParenManger)

* Remove console logs.

* Update comment.

* Fix bug in regex replacement.

* Calculator: [Phase 3] Add History / Calc reloading (#4081)

* Set up UI.

* Phase 3 implemented.

* Remove array. Replace with handlebars.

* strip commas by default.

* Fixed html interpolation

* Add g flag to replacement regex

* Strip trailing spaces

* remove unneeded option from perl

* Added comments to backspace.

* Removed ledger properties. Updated using state.

* Addressed Zaahir's p2 feedback
2017-04-12 15:31:12 -04:00
PJ Hampton dc12d569c6 Calculator: [Phase 1] Add basic calculator (#4051)
* Phase 1: Add basic calculator

* Updated tests.

* change template name, use base template, prefill calc with answer

* fix test

* Added backlog features.

* Updated js.

* Light refactoring work

* Refactored keycodes.

* Updated C button.

* Rewrote (+/-)% Expressions

* Updated the spacing dertermination

* Added expression to UI by default.

* Update tests.

* Updated formatting.

* Rewrite percent queries.

* Pushing updated codebase.

* Add calculator as trigger word

* Update tests for new triggers

* Stop initializing expression if 0

* add precision support to math eval object.

* Removed scientific buttons / history for Phase 1

* Updated math type.

* Prevents duplicate OPERADNS

* Add duplicate functionality.

* Updated unicode.

* Removed es6 feature.

* Stop first entry being an operand.

* Add operator flipping.

* Added Precision support.

* Handle numpad operator keys

* Set and maintain focus, Improved event handling

* Bind click handler in loop, stopPropgation of keydown

* Cleanup trailing spaces

* Fixed broken assignment.

* Prevent multiple commas.

* Fixed calculator stalling when trying to enter a new operator

* Initial refactor.

* Refactored out expression array.

* Refactored out display var.

* reintroduced matheval object for precision.

* Cleaned up formatting.

* Removed commify.

* Removed positioning for mobile display.

* Don't set focus on Calc automatically when displayed

* Add touchstart support.

* Prevent zooming.

* ensure button text is not selectable

* Add right borders to calc, ensure same border colour

* Cleanup code style

* Only apply hover state css to desktop
2017-04-06 16:40:56 -04:00
Zaahir Moolla 5f7329fc67 Calculator: Switch to canonical structured answer (#3916)
* Switch Calculator to canoncial structured answer

* Add Goodie Template
2017-02-06 16:06:33 -05:00
Matt Miller fe1729edf1 Calculator: add structured answer. 2014-11-15 21:35:39 +02:00
Matt Miller ebd15f598a Move goodies to new styling mechanism.
- Rename 'style.css' to appropriate ID-based name.
- Remove explicit inclusion of CSS, as it will now be auto-included.
- Update tests which explicitly checked for styling.
2014-09-10 17:28:30 -04:00
Jag Talon f70f7b6d66 Calculator: Actually remove the color declaration. 2014-08-15 12:13:11 -04:00
Matt Miller 300cba4744 Calculator: style up the answer a bit.
This mostly just adds style to the HTML answers to be more in line with
other IAs.

The test changes are because, in general, the HTML answer is exactly the
same as the text answer, just wrapped up in some HTML. We're mostly
concerned with if we get correct answers, not how they happen to be
wrapped for HTML display.

In cases where that's different (the <sup> regression) we do more
thorough testing on the contents.

Also, removed one repeated test.

I'm starting to think this "apply_css" and maybe even "wrap_html" should
be in a role somewhere.
2014-06-10 20:42:52 +08:00