aboutsummaryrefslogtreecommitdiff
path: root/budget/static/js/ihatemoney.js
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-11-27 23:28:24 +0100
committerAlexis Metaireau <alexis@notmyidea.org>2011-11-28 00:20:30 +0100
commit8570e79170e28ad0437a6b663066e7d54b0c682d (patch)
tree054415cdc9b7c5a1391f3471d20cfde0e302bcad /budget/static/js/ihatemoney.js
parent44060f03dfd6fb9f1925496f06992984ef41062b (diff)
downloadihatemoney-mirror-8570e79170e28ad0437a6b663066e7d54b0c682d.zip
ihatemoney-mirror-8570e79170e28ad0437a6b663066e7d54b0c682d.tar.gz
ihatemoney-mirror-8570e79170e28ad0437a6b663066e7d54b0c682d.tar.bz2
reorganize the static folder structure
Diffstat (limited to 'budget/static/js/ihatemoney.js')
-rw-r--r--budget/static/js/ihatemoney.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/budget/static/js/ihatemoney.js b/budget/static/js/ihatemoney.js
new file mode 100644
index 0000000..0bbd542
--- /dev/null
+++ b/budget/static/js/ihatemoney.js
@@ -0,0 +1,44 @@
+ // Add a script to select all or non of the checkboxes in the add_bill form
+ function toggle()
+ {
+ var els = document.getElementsByName('payed_for');
+ for(var i =0;i<els.length;i++)
+ {
+ if(document.getElementById('toggleField').checked)
+ {
+ els[i].checked=true;
+ }
+ else
+ {
+ els[i].checked=false;
+ }
+ }
+ }
+
+// Automatically hide and show the default value of a text field
+// handly in order to write user information in the text field.
+// jquery selector should return only one text field.
+ var auto_hide_default_text = function(text_field_selector){
+ // record the text in the text field before the first text field focus
+ var default_text;
+
+ var hide_text = function(){
+ if(default_text==undefined){
+ default_text=this.value;
+ this.value="";
+ }
+ else if(this.value==default_text){
+ this.value="";
+ }
+ }
+
+ var show_text = function(){
+ if(this.value==""){
+ this.value=default_text;
+ }
+ }
+
+ var field = $(text_field_selector);
+ field.focus(hide_text);
+ field.blur(show_text);
+ } \ No newline at end of file