scripts/volume.js
changeset 78 08f8a72b1f7b
parent 61 88b105a901be
--- a/scripts/volume.js	Fri Jun 12 13:49:22 2009 -0400
+++ b/scripts/volume.js	Fri Jun 12 13:50:13 2009 -0400
@@ -46,6 +46,11 @@
 
 function set_volume(level)
 {
+  if ( !verify_online() )
+  {
+    return false;
+  }
+  
   setAjaxLoading();
   if ( level == current_volume )
     return false;
@@ -125,6 +130,32 @@
       }
     }
   }
+  if ( window.iPhone )
+  {
+    // iPhone Safari can't do keyup events
+    field.onblur = function()
+    {
+      if ( this.value == '' )
+      {
+        $(this.parentNode).fadeOut(250, function(o)
+          {
+            o.parentNode.removeChild(o);
+          });
+      }
+      else if ( !this.value.match(/^[0-9]+$/) )
+      {
+        $(this.parentNode).insertBR().insertText('please enter a number');
+      }
+      else
+      {
+        set_volume(parseInt(this.value));
+        $(this.parentNode).fadeOut(250, function(o)
+          {
+            o.parentNode.removeChild(o);
+          });
+      }
+    }
+  }
 }
 
 addOnloadHook(function()