home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2003 January
/
Chip_2003-01_cd1.bin
/
zkuste
/
wmakeup
/
download
/
elvis.wmz
/
elvis.js
< prev
next >
Wrap
Text File
|
2002-06-14
|
8KB
|
342 lines
/*
(c)2000 Tattoo Media. All rights reserved.
Dev work: robwest jon munro
*/
var vidIsRunning = false;
var playlistIsVisible = false;
var eqIsVisible = false;
var vidIsVisible = false;
var eqStatus = false;
var plStatus = false;
var vidStatus = false;
var efStatus = false;
function Init()
{
loadPrefs();
UpdateMetaData();
vidIsRunning = (player.currentMedia.ImageSourceWidth>0);
Elvis_playlist.setColumnResizeMode( 0, "Stretches" );
Elvis_playlist.setColumnResizeMode( 1, "AutoSizeData" );
volume_slider.value = player.settings.volume;
if (vidIsRunning){
vidIsVisible=false;
StartVideo();
}
else {
EndVideo();
}
OnPlayStateChange();
}
function savePrefs() {
theme.savePreference('eqStatus',eqStatus);
theme.savePreference('plStatus',plStatus);
theme.savePreference('vidStatus',vidStatus);
theme.savePreference('efStatus',efStatus);
mediacenter.effectType = Elvis_effects.currentEffectType;
mediacenter.effectPreset = Elvis_effects.currentPreset;
}
function loadPrefs() {
var _eqStatus = theme.loadPreference('eqStatus');
var _plStatus = theme.loadPreference('plStatus');
var _vidStatus = theme.loadPreference('vidStatus');
var _efStatus = theme.loadPreference('efStatus');
if (_eqStatus != '--') {
eqStatus = (_eqStatus.toLowerCase() == 'true') ? true : false;
} else {
eqStatus = false;
}
if (_plStatus != '--') {
plStatus = (_plStatus.toLowerCase() == 'true') ? true : false;
} else {
plStatus = false;
}
if (_vidStatus != '--') {
vidStatus = (_vidStatus.toLowerCase() == 'true') ? true : false;
} else {
vidStatus = false;
}
if (_efStatus != '--') {
efStatus = (_efStatus.toLowerCase() == 'true') ? true : false;
} else {
efStatus = false;
}
if (eqStatus){
show('eq');
}
if (plStatus){
show('playlist');
}
if (vidStatus){
show('vid');
}
if (efStatus){
Elvis_effects.currentEffectType = mediacenter.effectType;
Elvis_effects.currentPreset = mediacenter.effectPreset;
Elvis_fx.visible = "true";
}
}
function OnPlayStateChange()
{
if (player.PlayState == psUndefined || player.PlayState == psPlaying)
{
Play();
}
}
function OnOpenStateChange()
{
switch (player.OpenState)
{
case osUndefined:
break;
Play();
case osMediaOpen:
UpdateMetadata();
Play();
break;
}
}
function OnClose()
{
savePrefs();
}
function UpdateMetadata() {
checkLocality();
}
function Play()
{
if (player.currentMedia.ImageSourceWidth>0){
vidIsRunning=true;
StartVideo();
vidStatus = true;
}
UpdateMetadata();
player.controls.play();
}
function Stop()
{
player.controls.stop();
}
function StartVideo()
{
var i
vidIsVisible = false;
show('vid');
vidIsRunning = true;
}
function EndVideo()
{
vidIsRunning = Elvis_vid.visible = false;
}
function updateProgress()
{
var mins;
var secs;
var pad = '';
var tmp = player.controls.currentPosition
mins = Math.floor(tmp/60)
secs = Math.round(tmp - mins*60)
if (secs==60) {
mins += 1;
secs = 0;
}
if (secs<10) pad='0';
// Update the progress bar and the time display
ElvisProgress.value = player.controls.currentPosition;
ElvisTime.value=mins + ':' + pad + secs;
}
function OnTimerTick()
{
var bw = player.network.bandWidth / 1000;
bw = bw.toString();
var intDecimal = bw.indexOf('.');
bw = bw.substring(0,intDecimal+2)
metadataBandWidth2.value = bw;
checkLocality();
}
/* ------------------------MEDIA SOURCE-------------------------*/
function checkLocality() {
var onColor = "#000000";
var offColor = "#FFFFFF";
var strSourceURL = player.currentMedia.sourceURL;
if (strSourceURL.search(/cd\:/i) != -1) {
tLocal.foregroundColor = offColor;
tCD.foregroundColor = onColor;
tNet.foregroundColor = offColor;
} else if (strSourceURL.search(/\\/i) != -1) {
tLocal.foregroundColor = onColor;
tCD.foregroundColor = offColor;
tNet.foregroundColor = offColor;
} else {
tLocal.foregroundColor = offColor;
tCD.foregroundColor = offColor;
tNet.foregroundColor = onColor;
}
}
function openElvisTray() {
ElvisTray.moveTo(3,60,300);
btnTrayClose.tabStop = true;
}
function closeElvisTray(){
if (ElvisTray.left < 238) {
btnTrayClose.tabStop = false;
Elvis_pl.tabStop = false;
Elvis_playlist.tabStop = false;
vidIsVisible = false;
eqIsVisible = false;
playlistIsVisible = false;
ElvisTray.moveTo(238,60, 300);
plStatus = false;
eqStatus = false;
vidStatus = false;
}
}
function hideTrayItems(){
Elvis_pl.visible = false;
Elvis_playlist.visible = false;
Elvis_eq.visible = false;
Elvis_vid.visible = false;
Elvis_video.visible = false;
}
function onEndPLMove()
{
Elvis_pl.visible = playlistIsVisible;
Elvis_playlist.visible = playlistIsVisible;
Elvis_eq.visible = eqIsVisible;
Elvis_vid.visible = vidIsVisible;
Elvis_video.visible = vidIsVisible;
}
function show(panItem) {
switch (panItem) {
case "playlist":
//if playlist is visible and the tray is out
if (playlistIsVisible) {
hideTrayItems();
closeElvisTray();
} else {
//if tray is closed open and display playlist
if (ElvisTray.left >= 238){
eqIsVisible = false;
vidIsVisible = false;
playlistIsVisible = true;
Elvis_playlist.tabStop = true;
Elvis_pl.tabStop = true;
btnTrayClose.tabStop = true;
openElvisTray();
plStatus = true;
eqStatus = false;
vidStatus = false;
} else
// if tray is open switch to playlist
{
eqIsVisible = false;
vidIsVisible = false;
playlistIsVisible = true;
onEndPLMove();
Elvis_playlist.tabStop = true;
Elvis_pl.tabStop = true;
btnTrayClose.tabStop = true;
plStatus = true;
eqStatus = false;
vidStatus = false;
}
}
break;
case "vid":
//if video is visible and the tray is out
if (vidIsVisible) {
closeElvisTray();
} else
//if tray is closed open and display video
{
if (ElvisTray.left >= 238){ openElvisTray() };
vidIsVisible = true;
playlistIsVisible = false;
eqIsVisible = false;
onEndPLMove();
btnTrayClose.tabStop = true;
Elvis_pl.tabStop = false;
Elvis_playlist.tabStop = false;
eqStatus = false;
plStatus = false;
vidStatus = true;
}
break;
case "eq":
//if eq is visible and the tray is out
if (eqIsVisible) {
closeElvisTray();
} else
//if tray is closed open and display eq
{
if (ElvisTray.left >= 238){ openElvisTray() };
vidIsVisible = false;
playlistIsVisible = false;
eqIsVisible = true;
onEndPLMove();
ElvisTray.tabStop = true;
//Elvis_eq.tabStop = true;
//ElvisEQS.tabStop = true;
btnEQReset.tabStop = true;
btnTrayClose.tabStop = true;
Elvis_pl.tabStop = false;
Elvis_playlist.tabStop = false;
eqStatus = true;
plStatus = false;
vidStatus = false;
}
break;
}
}
function slideVolumeTray() {
if (ElvisVolumeTray.left <238) {
ElvisVolumeTray.moveTo(238, 310, 300);
ElvisVolControl.tabStop = false;
} else {
ElvisVolumeTray.moveTo(121, 310, 300);
ElvisVolControl.tabStop = true;
}
}
function fx()
{
if (Elvis_fx.visible){
Elvis_fx.visible = "false";
efStatus = false;
}
else {
Elvis_fx.visible = "true";
efStatus = true;
}
}