First off:
* Copyright (c) 2009 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* http://www.jwz.org/tipcalculator/
*
*/
ok now since that is out of the way :)
June 27: com.tipcalculator_1.0.4.3_a.ipk the update that adds keyboard support and fixes some decimal issues
com.tipcalculator.ipk < the .ipk tested @ 6:04ish on June 24th on a non rooted pre, works and is deletable. However use this at your own risk as always.
my_tipCalculator_modifications_Source.gz < the source, pretty much the same thing you should get when using ar -x the .ipk
Adding a decimal is a simple task, to do so:
Download the .ipk
ar -x the said ipk
well pretty much follow the instructions on http://predev.wikidot.com/installing-apps-without-rooting until you get the untar'd data file which would have the usr folder.
#1 under /usr/palm/applications/org.jwz.tipcalculator/app/assistants is firstassistant.js
open the file and add since these are functions i belive their location is irrelevant, however this is Js and i have no solid background here.
// The dot(.) button
//
this.controller.setupWidget('.', {},
{buttonLabel: '.', disabled:false});
Mojo.Event.listen(this.controller.get('.'),
Mojo.Event.tap, this.dot.bindAsEventListener(this));
// Taps on the "." button
//
FirstAssistant.prototype.dot = function(event){
var s = '' + this.model.price;
if (s.length >= 6) return;
if (s == '0') { s = ''; }
s += '.';
this.model.price = s;
this.update(event);
}
replace all visible parseInt with parseFloat
also almost at the bottom of the page will be an update section
replace
this.controller.get('price').update(Math.ceil(price));
this.controller.get('tax') .update(Math.ceil(tax));
this.controller.get('tip') .update(Math.ceil(tip));
this.controller.get('total').update(Math.ceil(total));
this.controller.get('each') .update(Math.ceil(each));
with
this.controller.get('price').update(parseFloat(price));
this.controller.get('tax') .update(Math.round(tax*100)/100);
this.controller.get('tip') .update(Math.round(tip*100)/100);
this.controller.get('total').update(Math.round(total*100)/100);
this.controller.get('each') .update(Math.round(each*100)/100);
the reather useless Math.round(each*100)/100) aproach was my quick fix for the endless decimal places.
#2 Here is the second part and that is adding a . button in the UI
which is located at /usr/palm/applications/org.jwz.tipcalculator/app/views/first
scroll down to the bottom and add <td><div x-mojo-element="Button" id="."></div></td> wherever you feel is appropriate which would make a 3x3 for numbers 1-9 and the last row would be a 1x4
Edit: also changed the icon to incorporate money and coins, also the footer that puts out the suggestive messages is editable at the very bottom of first-scene.html