EVR.Sound.Audio.Embed = function(container)
{
   EVR.Sound.Audio.call(this, container, "embed", "mp3");
   this.set_attributes();
}
EVR.Sound.Audio.Embed.prototype = new EVR.Sound.Audio;
EVR.Sound.Audio.Embed.prototype.set_attributes = function()
{
   this.element.setAttribute("loop", true);
   this.element.setAttribute("hidden", true);
   this.element.setAttribute("autostart", true);
}
EVR.Sound.Audio.Embed.prototype.toggle = function()
{
   if (this.attached)
   {
      this.remove();
   }
   else
   {
      this.append();
   }
}
EVR.Sound.Audio.Embed.prototype.set_song = function(name)
{
   EVR.Sound.Audio.prototype.set_song.call(this, name);
   if (this.attached)
   {
      this.remove();
      this.append();
   }
}
EVR.Sound.Audio.Embed.prototype.toString = function()
{
   return "[object EVR.Sound.Audio.Embed]";
}
EVR.include("sound/controls/button/Button.js");
EVR.Sound.Controls = function(container)
{
   EVR.Graphic.call(this, container, null, null, ALIGN_CENTER);
   this.set_proportions(SOUND_CONTROLS_WIDTH, SOUND_CONTROLS_HEIGHT);
   this.append();
   this.add_buttons();
}
EVR.Sound.Controls.prototype = new EVR.Graphic;
EVR.Sound.Controls.prototype.add_buttons = function()
{
   this.buttons = [
      new EVR.Sound.Controls.Button.Indicator(this),
      new EVR.Sound.Controls.Button.Volume.Amplify(this),
      new EVR.Sound.Controls.Button.Volume.Deamplify(this)
   ];
}
EVR.Sound.Controls.prototype.hide = function()
{
   var buttons = this.buttons;
   for (var ii = 0; ii < buttons.length; ii++)
   {
      buttons[ii].set_opacity(0);
   }
}
EVR.Sound.Controls.prototype.show = function()
{
   var buttons = this.buttons;
   for (var ii = 0; ii < buttons.length; ii++)
   {
      buttons[ii].set_opacity(SOUND_CONTROLS_UNFOCUSED_OPACITY);
   }
}
EVR.Sound.Controls.prototype.draw = function()
{
   EVR.Graphic.prototype.draw.call(this);
   if (!!this.buttons)
   {
      var buttons = this.buttons;
      for (var ii = 0; ii < buttons.length; ii++)
      {
	 buttons[ii].draw();
      }
   }
}
EVR.Sound.Controls.prototype.update = function()
{
   var buttons = this.buttons;
   for (var ii = 0; ii < buttons.length; ii++)
   {
      buttons[ii].update();
   }
   var prompt = this.container.prompt;
   if (prompt.attached)
   {
      prompt.remove();
   }
}
EVR.Sound.Controls.prototype.toString = function()
{
   return "[object EVR.Sound.Controls]";
}
EVR.include("sound/controls/button/Indicator.js");
EVR.include("sound/controls/button/volume/Volume.js");
EVR.Sound.Controls.Button = function(container, alignment, ratio)
{
   EVR.Graphic.call(this, container, ratio, null, alignment)
   this.focused = false;
   this.unfocused_opacity = SOUND_CONTROLS_UNFOCUSED_OPACITY;
   this.focused_opacity = SOUND_CONTROLS_FOUCUSED_OPACITY;
   this.add_listeners();
   this.set_opacity();
   container != null && (this.audio = container.container.audio);
}
EVR.Sound.Controls.Button.prototype = new EVR.Graphic;
EVR.Sound.Controls.Button.prototype.add_listeners = function()
{
   var current = this;
   this.element.onclick = function() { current.respond() };
   this.element.onmouseover = function() { current.focus() };
   this.element.onmouseout = function() { current.unfocus() };
}
EVR.Sound.Controls.Button.prototype.set_opacity = function(opacity)
{
   if (opacity != null)
   {
      this.unfocused_opacity = opacity;
   }
   var opacity;
   if (this.focused)
   {
      opacity = this.focused_opacity;
   }
   else
   {
      opacity = this.unfocused_opacity;
   }
   EVR.Graphic.prototype.set_opacity.call(this, opacity);
}
EVR.Sound.Controls.Button.prototype.respond = function()
{
   this.container.update();
}
EVR.Sound.Controls.Button.prototype.focus = function()
{
   this.focused = true;
   this.set_opacity();
}
EVR.Sound.Controls.Button.prototype.unfocus = function()
{
   this.focused = false;
   this.set_opacity();
}
EVR.Sound.Controls.Button.prototype.toString = function()
{
   return "[EVR.Sound.Controls.Button]";
}
EVR.Sound.Controls.Button.Indicator = function(container)
{
   EVR.Sound.Controls.Button.call(this, container, ALIGN_CENTER, RATIO_HEIGHT);
   this.border_width = SOUND_INDICATOR_BORDER_WIDTH;
   this.set_attributes();
   this.append();
}
EVR.Sound.Controls.Button.Indicator.prototype = new EVR.Sound.Controls.Button;
EVR.Sound.Controls.Button.Indicator.prototype.set_attributes = function()
{
   this.set_proportions(1, SOUND_ENABLE_SIZE);
   this.css.border = this.border_width + "px " + SOUND_INDICATOR_BORDER;
   this.set_color();
}
EVR.Sound.Controls.Button.Indicator.prototype.set_color = function()
{
   var color = SOUND_INDICATOR_INACTIVE_COLOR;
   if (!this.audio.muted)
   {
      color = SOUND_INDICATOR_ACTIVE_COLOR;
   }
   EVR.Sound.Controls.Button.prototype.set_color.call(this, color);
}
EVR.Sound.Controls.Button.Indicator.prototype.shape = function()
{
   EVR.Sound.Controls.Button.prototype.shape.call(this);
   if (!!!window.ActiveXObject)
   {
      var dimensions = this.get_dimensions();
      var offset = 4 * this.border_width;
      this.set_dimensions(dimensions[0] - offset, dimensions[1] - offset);
   }
}
EVR.Sound.Controls.Button.Indicator.prototype.respond = function()
{
   this.audio.mute();
   EVR.Sound.Controls.Button.prototype.respond.call(this);
}
EVR.Sound.Controls.Button.Indicator.prototype.update = function()
{
   this.set_color();
}
EVR.Sound.Controls.Button.Indicator.prototype.toString = function()
{
   return "[EVR.Sound.Controls.Button.Indicator]";
}
3.238.235.155
3.238.235.155
3.238.235.155
 
June 5, 2016