65 } |
65 } |
66 } |
66 } |
67 }); |
67 }); |
68 } |
68 } |
69 |
69 |
|
70 function volume_custom_form() |
|
71 { |
|
72 if ( $('volumebox').object ) |
|
73 { |
|
74 return false; |
|
75 } |
|
76 var box = document.createElement('div'); |
|
77 $(box) |
|
78 .css('position', 'absolute') |
|
79 .css('padding', '50px 80px') |
|
80 .css('background-image', 'url(/trans80.png)') |
|
81 .css('color', 'black') |
|
82 .css('text-align', 'center') |
|
83 .attr('id', 'volumebox') |
|
84 .insertText('volume:') |
|
85 .insertBR().insertBR() |
|
86 .opacity(0); |
|
87 document.body.appendChild(box); |
|
88 |
|
89 var field = document.createElement('input'); |
|
90 $(field) |
|
91 .attr('type', 'text') |
|
92 .attr('value', '') |
|
93 .attr('size', '7') |
|
94 .css('text-align', 'center'); |
|
95 box.appendChild(field); |
|
96 |
|
97 $(box) |
|
98 .css('top', (( $(window).Height() / 2 ) - ( $(box).Height() / 2 )) + 'px') |
|
99 .css('left', (( $(document.body).Width() / 2 ) - ( $(box).Width() / 2 )) + 'px'); |
|
100 |
|
101 $(box).fadeIn(250); |
|
102 field.focus(); |
|
103 field.onkeyup = function(e) |
|
104 { |
|
105 if ( e.keyCode == 13 ) |
|
106 { |
|
107 if ( this.value == '' ) |
|
108 { |
|
109 $(this.parentNode).fadeOut(250, function(o) |
|
110 { |
|
111 o.parentNode.removeChild(o); |
|
112 }); |
|
113 } |
|
114 else if ( !this.value.match(/^[0-9]+$/) ) |
|
115 { |
|
116 $(this.parentNode).insertBR().insertText('please enter a number'); |
|
117 } |
|
118 else |
|
119 { |
|
120 set_volume(parseInt(this.value)); |
|
121 $(this.parentNode).fadeOut(250, function(o) |
|
122 { |
|
123 o.parentNode.removeChild(o); |
|
124 }); |
|
125 } |
|
126 } |
|
127 } |
|
128 } |
|
129 |
|
130 addOnloadHook(function() |
|
131 { |
|
132 window.onkeyup = function(e) |
|
133 { |
|
134 if ( e.keyCode == 86 ) |
|
135 { |
|
136 volume_custom_form(); |
|
137 } |
|
138 } |
|
139 }); |