[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linterna-magica-commit] [70] Code cleanup.
From: |
Ivaylo Valkov |
Subject: |
[linterna-magica-commit] [70] Code cleanup. |
Date: |
Sun, 15 May 2011 10:34:03 +0000 |
Revision: 70
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=70
Author: valkov
Date: 2011-05-15 10:34:02 +0000 (Sun, 15 May 2011)
Log Message:
-----------
Code cleanup.
Modified Paths:
--------------
trunk/src/lm_constructors.js
Modified: trunk/src/lm_constructors.js
===================================================================
--- trunk/src/lm_constructors.js 2011-05-13 18:07:27 UTC (rev 69)
+++ trunk/src/lm_constructors.js 2011-05-15 10:34:02 UTC (rev 70)
@@ -257,78 +257,76 @@
{
// Sometimes it skips seconds if the
// interval is 1sec
- this.player_timers[id] = setInterval(function()
- {
- self.ticker.apply(self,[id]);
- }, 500);
+ this.player_timers[id] =
+ setInterval(function()
+ {
+ self.ticker.apply(self,[id]);
+ }, 500);
}
+ var volume_interval_function = function()
+ {
+ var knob =
+ document.getElementById("linterna-magica-controls-"+
+ "volume-slider-knob-"+id);
- var volume_interval =
- setInterval(function()
- {
- var knob = document.getElementById(
- "linterna-magica-controls-"+
- "volume-slider-knob-"+id);
+ if (!knob)
+ {
+ return null;
+ }
- if (!knob)
- return;
+ var text = knob.nextSibling;
+ var slider = knob.parentNode;
+ var vol = null;
- var text = knob.nextSibling;
- var slider = knob.parentNode;
- var vol = null;
+ var video_object = self.get_video_object(id);
- var video_object = self.
- get_video_object(id);
+ var player_name = video_object.getAttribute("player_name");
- var player_name =
- video_object.
- getAttribute("player_name");
+ if (/gecko/i.test(player_name)
+ || /quicktime plug-in/i.test(player_name))
+ {
+ try
+ {
+ vol = video_object.GetVolume();
- if (/gecko/i.test(player_name)
- || /quicktime plug-in/i.test(player_name))
- {
- try
- {
- vol =
- video_object.GetVolume();
- if (/quicktime/i.test(player_name))
- {
- // totemNarrowspace uses 255 as max
- // calculate as 100 %
- vol = parseInt(vol * 100/255);
- }
+ if (/quicktime/i.test(player_name))
+ {
+ // totemNarrowspace uses 255 as max
+ // calculate as 100 %
+ vol = parseInt(vol * 100/255);
+ }
+ }
+ catch(e)
+ {
+ }
+ }
+ else if (/vlc/i.test(player_name))
+ {
+ if (video_object.audio)
+ {
+ vol =
+ video_object.audio.
+ volume;
+ }
+ }
- }
- catch(e)
- {
- }
- }
- else if (/vlc/i.test(player_name))
- {
- if (video_object.audio)
- {
- vol =
- video_object.audio.
- volume;
- }
- }
+ if (vol)
+ {
+ var pos =
+ parseInt((slider.clientWidth*vol/100) -
+ knob.clientWidth-knob.clientWidth/2);
- if (vol)
- {
- var pos = parseInt(
- (slider.clientWidth*vol/100) -
- knob.clientWidth-knob.clientWidth/2);
+ knob.style.setProperty("left", pos+"px", "important");
- knob.style.setProperty("left", pos+"px",
- "important");
+ text.textContent = vol+"%";
- text.textContent = vol+"%";
+ clearInterval(volume_interval);
+ }
+ }
- clearInterval(volume_interval);
- }
-
- }, 800);
+ var volume_interval =
+ setInterval(volube_interval_function, 800);
}
// Localization languages object
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [linterna-magica-commit] [70] Code cleanup.,
Ivaylo Valkov <=