1
0
mirror of https://github.com/danbee/neompc synced 2025-03-04 08:39:10 +00:00

~ Tweaked volume control to work better. It updates the server every 250ms while being dragged, and doesn't jump about with updates from the server any more.

This commit is contained in:
Dan Barber 2010-01-13 20:17:54 +00:00
parent 20f5bb09cf
commit 5747e587b2
4 changed files with 43 additions and 33 deletions

View File

@ -109,15 +109,19 @@ $(document).ready(function(){
$('#volume_slider').draggable({
axis: 'y',
containment: 'parent',
opacity: 0.5,
containment: $('#slider_container'),
start: function() {
this.rel = '1';
vol_int = setInterval('ajax_control(\'volume\', new_volume);', 250);
},
drag: function() {
new_volume = pos_to_volume(parseInt($('#volume_slider').css('top')));
//ajax_control('volume', new_volume);
},
stop: function() {
pos = parseInt($('#volume_slider').css('top'));
ajax_control('volume', pos_to_volume(pos));
this.rel = '';
clearInterval(vol_int);
ajax_control('volume', new_volume);
setTimeout('$(\'#volume_slider\').attr(\'rel\', \'\');', 1000);
}
});

View File

@ -1,4 +1,4 @@
<?php /* Smarty version 2.6.26, created on 2010-01-13 17:13:45
<?php /* Smarty version 2.6.26, created on 2010-01-13 20:15:06
compiled from ../lib/js/neompc.js */ ?>
progressbar_width = <?php echo $this->_tpl_vars['progressbar_width']; ?>
;
@ -116,15 +116,19 @@ $(document).ready(function(){
$('#volume_slider').draggable({
axis: 'y',
containment: 'parent',
opacity: 0.5,
containment: $('#slider_container'),
start: function() {
this.rel = '1';
vol_int = setInterval('ajax_control(\'volume\', new_volume);', 250);
},
drag: function() {
new_volume = pos_to_volume(parseInt($('#volume_slider').css('top')));
//ajax_control('volume', new_volume);
},
stop: function() {
pos = parseInt($('#volume_slider').css('top'));
ajax_control('volume', pos_to_volume(pos));
this.rel = '';
clearInterval(vol_int);
ajax_control('volume', new_volume);
setTimeout('$(\'#volume_slider\').attr(\'rel\', \'\');', 1000);
}
});

View File

@ -39,8 +39,8 @@
<div id="volume_container">
<div id="slider_container">
<a id="volume_slider"></a>
<a id="volume_hide" href="index.php?action=hide_volume"></a>
</div>
<a id="volume_hide" href="index.php?action=hide_volume"></a>
</div>
<a rel="volume" id="volume_button" href="index.php?action=show_volume"></a>
<a rel="repeat" id="repeat_button" class="control_button" href="index.php?action=repeat"></a>

View File

@ -230,27 +230,29 @@ img.button {
background: url(templates/{:$template:}/images/volume_container.png) center center no-repeat;
height: 160px;
width: 30px;
}
#volume_container #slider_container {
position: absolute;
top: 5px;
height: 130px;
width: 28px;
}
#volume_container a#volume_hide {
position: absolute;
top: 140px;
left: 0px;
width: 30px;
height: 20px;
}
#volume_container #volume_slider {
background: url(templates/{:$template:}/images/volume_slider.png) center center no-repeat;
position: absolute;
top: 5px;
left: 5px;
width: 20px;
height: 30px;
}
#volume_container #slider_container {
position: absolute;
padding: 0;
margin: 0;
top: 5px;
height: 130px;
width: 28px;
}
#volume_container a#volume_hide {
position: absolute;
top: 140px;
left: 0px;
width: 30px;
height: 20px;
}
#volume_container #volume_slider {
background: url(templates/{:$template:}/images/volume_slider.png) center center no-repeat;
position: absolute;
top: 5px;
left: 5px;
width: 20px;
height: 30px;
}
#crumb_trail ul {