scripts/volume.js
author Dan
Fri, 12 Jun 2009 13:50:13 -0400
changeset 78 08f8a72b1f7b
parent 61 88b105a901be
permissions -rw-r--r--
Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
     1
/**
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
     2
 * Volume widget presentation code
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
     3
 * 
6
5f35ebc4f9bb First release version. Renamed to Greyhound and readme/license files added.
Dan
parents: 5
diff changeset
     4
 * Greyhound - real web management for Amarok
5
9b96265b5918 Relicensed to GPLv2. Previous revisions should not be downloaded as they do not contain copies of appropriate licenses, which will be added in a later commit. Completed interface for mobile devices.
Dan
parents: 2
diff changeset
     5
 * Copyright (C) 2008 Dan Fuhry
2
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
     6
 *
5
9b96265b5918 Relicensed to GPLv2. Previous revisions should not be downloaded as they do not contain copies of appropriate licenses, which will be added in a later commit. Completed interface for mobile devices.
Dan
parents: 2
diff changeset
     7
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
9b96265b5918 Relicensed to GPLv2. Previous revisions should not be downloaded as they do not contain copies of appropriate licenses, which will be added in a later commit. Completed interface for mobile devices.
Dan
parents: 2
diff changeset
     8
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
9b96265b5918 Relicensed to GPLv2. Previous revisions should not be downloaded as they do not contain copies of appropriate licenses, which will be added in a later commit. Completed interface for mobile devices.
Dan
parents: 2
diff changeset
     9
 *
9b96265b5918 Relicensed to GPLv2. Previous revisions should not be downloaded as they do not contain copies of appropriate licenses, which will be added in a later commit. Completed interface for mobile devices.
Dan
parents: 2
diff changeset
    10
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
9b96265b5918 Relicensed to GPLv2. Previous revisions should not be downloaded as they do not contain copies of appropriate licenses, which will be added in a later commit. Completed interface for mobile devices.
Dan
parents: 2
diff changeset
    11
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
2
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    12
 */
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    13
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    14
var current_volume = 0;
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    15
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    16
function set_volume_fill(amount)
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    17
{
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    18
  amount = 10 * ( Math.round(amount / 10) );
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    19
  if ( amount == 0 )
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    20
    amount = -10;
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    21
  for ( var i = 0; i <= amount; i += 10 )
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    22
  {
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    23
    if ( !$('volbtn_' + i).hasClass('volume_button_active') )
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    24
    {
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    25
      $('volbtn_' + i).addClass('volume_button_active');
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    26
    }
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    27
  }
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    28
  for ( ; i <= 100; i += 10 )
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    29
  {
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    30
    if ( $('volbtn_' + i).hasClass('volume_button_active') )
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    31
    {
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    32
      $('volbtn_' + i).rmClass('volume_button_active');
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    33
    }
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    34
  }
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    35
}
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    36
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    37
function volume_over(amount)
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    38
{
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    39
  set_volume_fill(amount);
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    40
}
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    41
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    42
function volume_out()
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    43
{
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    44
  set_volume_fill(current_volume);
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    45
}
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    46
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    47
function set_volume(level)
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    48
{
78
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
    49
  if ( !verify_online() )
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
    50
  {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
    51
    return false;
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
    52
  }
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
    53
  
2
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    54
  setAjaxLoading();
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    55
  if ( level == current_volume )
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    56
    return false;
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    57
  ajaxGet('/action.json/volume/' + level, function()
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    58
    {
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    59
      if ( ajax.readyState == 4 && ajax.status == 200 )
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    60
      {
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    61
        unsetAjaxLoading();
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    62
        var response = (' ' + ajax.responseText).substr(1);
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    63
        // quickie JSON parser :)
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    64
        response = eval('(' + response + ')');
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    65
        // update volume
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    66
        if ( response.volume != current_volume )
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    67
        {
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    68
          set_volume_fill(response.volume);
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    69
          current_volume = response.volume;
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    70
        }
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    71
      }
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    72
    });
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    73
}
860ba7141641 Should be nearly finished now - includes volume control, length measurement, and seems pretty stable
Dan
parents:
diff changeset
    74
58
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    75
function volume_custom_form()
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    76
{
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    77
  if ( $('volumebox').object )
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    78
  {
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    79
    return false;
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    80
  }
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    81
  var box = document.createElement('div');
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    82
  $(box)
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    83
    .css('position', 'absolute')
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    84
    .css('padding', '50px 80px')
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    85
    .css('background-image', 'url(/trans80.png)')
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    86
    .css('color', 'black')
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    87
    .css('text-align', 'center')
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    88
    .attr('id', 'volumebox')
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    89
    .insertText('volume:')
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    90
    .insertBR().insertBR()
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    91
    .opacity(0);
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    92
  document.body.appendChild(box);
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    93
  
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    94
  var field = document.createElement('input');
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    95
  $(field)
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    96
    .attr('type', 'text')
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    97
    .attr('value', '')
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    98
    .attr('size', '7')
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
    99
    .css('text-align', 'center');
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   100
  box.appendChild(field);
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   101
  
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   102
  $(box)
60
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   103
    .css('top',  (( getHeight() / 2 ) - ( $(box).Height() / 2 ) + getScrollOffset()) + 'px')
58
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   104
    .css('left', (( $(document.body).Width() / 2 ) - ( $(box).Width() / 2 )) + 'px');
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   105
  
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   106
  $(box).fadeIn(250);
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   107
  field.focus();
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   108
  field.onkeyup = function(e)
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   109
  {
61
88b105a901be Escape key closes volume box
Dan
parents: 60
diff changeset
   110
    if ( e.keyCode == 13 || e.keyCode == 27 )
58
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   111
    {
61
88b105a901be Escape key closes volume box
Dan
parents: 60
diff changeset
   112
      if ( this.value == '' || e.keyCode == 27 )
58
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   113
      {
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   114
        $(this.parentNode).fadeOut(250, function(o)
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   115
          {
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   116
            o.parentNode.removeChild(o);
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   117
          });
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   118
      }
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   119
      else if ( !this.value.match(/^[0-9]+$/) )
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   120
      {
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   121
        $(this.parentNode).insertBR().insertText('please enter a number');
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   122
      }
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   123
      else
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   124
      {
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   125
        set_volume(parseInt(this.value));
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   126
        $(this.parentNode).fadeOut(250, function(o)
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   127
          {
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   128
            o.parentNode.removeChild(o);
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   129
          });
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   130
      }
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   131
    }
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   132
  }
78
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   133
  if ( window.iPhone )
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   134
  {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   135
    // iPhone Safari can't do keyup events
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   136
    field.onblur = function()
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   137
    {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   138
      if ( this.value == '' )
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   139
      {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   140
        $(this.parentNode).fadeOut(250, function(o)
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   141
          {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   142
            o.parentNode.removeChild(o);
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   143
          });
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   144
      }
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   145
      else if ( !this.value.match(/^[0-9]+$/) )
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   146
      {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   147
        $(this.parentNode).insertBR().insertText('please enter a number');
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   148
      }
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   149
      else
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   150
      {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   151
        set_volume(parseInt(this.value));
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   152
        $(this.parentNode).fadeOut(250, function(o)
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   153
          {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   154
            o.parentNode.removeChild(o);
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   155
          });
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   156
      }
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   157
    }
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 61
diff changeset
   158
  }
58
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   159
}
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   160
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   161
addOnloadHook(function()
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   162
  {
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   163
    window.onkeyup = function(e)
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   164
    {
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   165
      if ( e.keyCode == 86 )
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   166
      {
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   167
        volume_custom_form();
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   168
      }
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   169
    }
05a69bab5f10 Added custom volume setting function (press v in the playlist window)
Dan
parents: 6
diff changeset
   170
  });
59
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   171
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   172
function getHeight() {
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   173
  var myHeight = 0;
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   174
  if( typeof( window.innerWidth ) == 'number' ) {
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   175
    myHeight = window.innerHeight;
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   176
  } else if( document.documentElement &&
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   177
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   178
    myHeight = document.documentElement.clientHeight;
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   179
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   180
    myHeight = document.body.clientHeight;
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   181
  }
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   182
  return myHeight;
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   183
}
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   184
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   185
function getWidth() {
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   186
  var myWidth = 0;
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   187
  if( typeof( window.innerWidth ) == 'number' ) {
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   188
    myWidth = window.innerWidth;
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   189
  } else if( document.documentElement &&
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   190
      ( document.documentElement.clientWidth || document.documentElement.clientWidth ) ) {
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   191
    myWidth = document.documentElement.clientWidth;
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   192
  } else if( document.body && ( document.body.clientWidth || document.body.clientWidth ) ) {
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   193
    myWidth = document.body.clientWidth;
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   194
  }
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   195
  return myWidth;
a4ca1e7c0073 Fixed position of floating volume div
Dan
parents: 58
diff changeset
   196
}
60
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   197
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   198
function getScrollOffset(el)
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   199
{
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   200
  var position;
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   201
  var s = el || self;
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   202
  el = el || document;
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   203
  if ( el.scrollTop )
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   204
  {
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   205
    position = el.scrollTop;
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   206
  }
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   207
  else if (s.pageYOffset)
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   208
  {
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   209
    position = self.pageYOffset;
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   210
  }
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   211
  else if (document.documentElement && document.documentElement.scrollTop)
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   212
  {
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   213
    position = document.documentElement.scrollTop;
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   214
  }
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   215
  else if (document.body)
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   216
  {
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   217
    position = document.body.scrollTop;
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   218
  }
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   219
  return position;
acc7755e15b6 ...it should be cool with scrolling now.
Dan
parents: 59
diff changeset
   220
}