Solumin / YGO-FM-FusionCalc

A Fusion calculator for Yu-Gi-Oh! Forbidden Memories
20 stars 17 forks source link

cosmetic changes and added event listeners to search field #1

Closed CathodeRaymond closed 8 years ago

CathodeRaymond commented 8 years ago

Hey man!

I put some CSS on this thing and added jquery which might see some use later on. I also added an "onchange" event listener to the search field. I was also going to change the way the "name" search function checks strings but I will check your changes first.

Let me know if there's anything specific you feel I should implement. I'm pretty good with JavaScript, and I am decent at Ruby, although I am not really familiar with taffyDB.

Solumin commented 8 years ago

Looks great! Thank you so much!

I'm not 100% sure if the onchange listener event is the best idea, but I'll play around with it and see. I think it'll make more sense if we separate out "Search by Card Name" and "Search by Type" into two separate options, so that only one or the other fires.

CathodeRaymond commented 8 years ago

Yeah I should have checked this thread before I made more changes, I could have separated the "Search by Name/Search by Type" functions since that also had occurred to me.

You can remove or comment out the search-every-keystroke event listener if you want, as it will only likely save the user time if it's paired with fuzzy searches. I don't know the game that well so I'm not sure where the most logical place a player would start searching most often, search-by-name or search-by-type.

Still though, it's working pretty well so far 👍 ! It'll probably work just fine on most tablets/mobile devices too. You should host it on a git page to make it really easy to access.

EDIT: Oh, also I should clarify: the

$("#cardname").keyup(function (){ clearAll(); searchDB(); });

On index.html line 174 Is what is actually searching on every key press. The onchange="searchDB()" in the input field on line 40 seems to only register the enter key, not adding characters to the input field. In some javascript libraries like React "onChange" really does mean any change, but not apparently in an HTML tag like that.