I’ve upgraded the calculator a little, tinkered a bit with the design with a new header and some minor tweaks for better appearance, and managed to get the javascript to run in IE as well, thanks to a little help from saiboten.
What went wrong was as simple as using type=”text/javascript” for javascripts in stead of type=”application/javascript”. gah.
As allways, feedback is appreciated!
the new version is located here.
The old versions can still be found here if anything stops working for you:
Related posts:
12 Comments
Nice app….. I’m about to start tangling with an enemy, so this is useful.
Nice tool, very handy
Bug I noticed – I accidentally left the “Attacker WS” field blank on the “How many ships to win?” section. When I hit Go, Firefox froze. After a few seconds it said this:
“A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.
Script: http://www.josteinb.com/npCalc/:88”
I suspect that the way it performs this calculation means that an entry of zero for WS causes it to go into an infinite loop. You should probably add a check to see that all the fields are filled in (and non-zero) before the script tries to calculate.
Oh and further to my previous post:
Same thing happens if you put -1 as Defender WS in the “How many ships to survive?” section, so it’s almost definitely an infinite loop caused by your algorithm repeatedly subtracting zero from the ship numbers.
Thanks
I was aware of the infinite loop on no input, but hadn’t tried the -1 one. It’s still there because of laziness.. haha. But I’ll get around to fix them shortly. I haven’t bothered with input validation yet since nothing gets stored, and it is safe for the server since javascript executes at client side. Not very nice towards the users though :p
Appreciate the feedback from both of you!
– Jostein
I really appreciate the calculator. I haven’t noticed any bugs through regular use and find that it’s quite fast. One suggestion would be a version that’s optimized for a thin view – that way Firefox’s “load in sidebar” would work well with the applet. It’s sort of annoying to have a tab open just for the calculator and having to switch back and forth – this would solve that issue. You’d have to design something without the (albeit very aesthetically pleasing) graphics and CSS. Something under 100px wide would probably be optimal.
Hello! I discovered this calculator for NP and fell in love with it immediately. Indesribably helpful. A very large thank you from a big NP fan from Greece!
Cubilone
Awesome, thanks.
Been using it for a few weeks now, it helps a lot. Thanks!
Awesome, thanks!
Wonderful! It is so very helpful!
Jostein, this is a nice calc. I own the domain http://www.npcalc.com and was intending to do pretty much the same as you have (I even have the site written) but you beat me to it…
Please contact me and I’d be happy to use the domain to point to your calculator!
Great app. I just use it to double check my mental math… It works very well!