home *** CD-ROM | disk | FTP | other *** search
- // ----------------------------------------------------------------------
- // The Stick v2.0 - Windows Media Player Skin
- // Author: R. Al-Rawi, 2004
- // Contact: raada@hotmail.com
- // ----------------------------------------------------------------------
- // TO DO
- //
- // - investigate possible issue with last playlist being an album
- // ----------------------------------------------------------------------
-
-
- // ----------------------------------------------------------------------
- // Set up some things
- // ----------------------------------------------------------------------
- var intOffset = 247; // Offset of right part to left
- var intDiff = 142; // Distance to move
- var intBrakeZone = 10; // Point at which to slow down
- var intNumHelpPages = 7; // Number of help pages
- var intCurrentHelpPage = 1; // Current help page
-
- var strInfoText = "" // Keep track of Info text
- var blnSwitchingSkin = false; // Skin is switching flag
- var blnIsOpen = true; // Player open/closed flag
- var blnPlaylistOpen = false; // Playlist open/closed flag
- var blnOpenPlaylist = false; // open the Playlist view flag
- var blnSettingsOpen = false; // Settings open/closed flag
- var blnOpenSettings = false; // open the Settings view flag
- var blnMiniVisOpen = false; // Mini-Vid/Vis open/closed flag
- var blnOpenMiniVis = false; // Open the Video view flag
- var intSwitchSides = 1; // Player is switching sides flag
- var blnClosePlayer = false; // Player should be opened/closed flag
- var strMins = new String;
- var strSecs = new String;
- var intY = 1; // Y position for settings text
- var intNumMiniEffects = 5; // How many mini-effects do we have
- var strMediaType = "" // Media type
- var blnRepeatMode = true;
- var blnRestoreCrossfade = false // Restore crossFade flag
- var blnResetOSI = true; // Reset (i.e. hide) OSI flag
- var intVidMediaWidth = 0; // video zoom width
- var intVidMediaHeight = 0; // video zoom height
-
- // TitleModes sets the track title mode:
- // A = Auto
- // C = Custom
- // D = Default (Author - Title)
- //
- // Auto mode senses if the track playing belongs to an album, and sets up
- // the track title as: [track#]. [Artist]: [album title] - [track title]
- //
- // Attributes available to custom mode:
- // TN = Track#
- // AT = Album Title
- // TT = Track Title
- // PT = Playlist Title
- // TA = Track Author
- //
- // CustomTitle holds the attributes for a custom title
- strCustomTitle = '["TT","PT","TA","AT","TN"]';
- strCustomTitleShow = '["1","1","1","0","1"]';
-
- arrTitleAttributes = new Array("TN:Track Number", "AT:Album Title", "TT:Track Title", "PT:Playlist Title", "TA:Track Author")
-
- // InfoMode tracks the mode for the track info text:
- // C = Current Position
- // D = Duration Left
- // T = Total Time
- //
-
- var intIndex = 0;
-
- arrInfoModes = new Array();
- arrInfoModes[intIndex++] = new Array("C","#FFFFAA");
- arrInfoModes[intIndex++] = new Array("D","#FFAAAA");
- arrInfoModes[intIndex++] = new Array("T","#AAFFFF");
-
- var intIndex = 0;
-
- arrOpenStates = new Array;
- arrOpenStates[intIndex++] = "Undefined";
- arrOpenStates[intIndex++] = "Changing Playlist";
- arrOpenStates[intIndex++] = "Locating Playlist";
- arrOpenStates[intIndex++] = "Connecting Playlist";
- arrOpenStates[intIndex++] = "Loading Playlist";
- arrOpenStates[intIndex++] = "Opening Playlist";
- arrOpenStates[intIndex++] = "Playlist Open";
- arrOpenStates[intIndex++] = "Playlist Changed";
- arrOpenStates[intIndex++] = "Changing Media";
- arrOpenStates[intIndex++] = "Locating Media";
- arrOpenStates[intIndex++] = "Connecting to Media";
- arrOpenStates[intIndex++] = "Loading Media";
- arrOpenStates[intIndex++] = "Opening Media";
- arrOpenStates[intIndex++] = "Media Open";
- arrOpenStates[intIndex++] = "Starting Codec Acquisition";
- arrOpenStates[intIndex++] = "Finished Codec Acquisition";
- arrOpenStates[intIndex++] = "Starting License Acquisition";
- arrOpenStates[intIndex++] = "Ending License Acquisition";
- arrOpenStates[intIndex++] = "Begin DRM";
- arrOpenStates[intIndex++] = "End DRM";
- arrOpenStates[intIndex++] = "Waiting For Media";
- arrOpenStates[intIndex++] = "Opening URL";
-
- // Set up array for controls affected by different skin images
- var intIndex = 0;
-
- arrVwMainControls = new Array();
-
- // Most important bits first
- arrVwMainControls[intIndex++] = "svwPart1.backgroundImage";
- arrVwMainControls[intIndex++] = "svwPart2.backgroundImage";
- arrVwMainControls[intIndex++] = "btnLeftLight.image";
- arrVwMainControls[intIndex++] = "btnLeftLight.disabledImage";
- arrVwMainControls[intIndex++] = "btnRightLight.image";
- arrVwMainControls[intIndex++] = "btnRightLight.disabledImage";
-
- // Part1 View
- arrVwMainControls[intIndex++] = "btnPlay.image";
- arrVwMainControls[intIndex++] = "btnPlay.hoverImage";
- arrVwMainControls[intIndex++] = "btnPause.image";
- arrVwMainControls[intIndex++] = "btnPause.hoverImage";
- arrVwMainControls[intIndex++] = "btnStop.image";
- arrVwMainControls[intIndex++] = "btnStop.hoverImage";
- arrVwMainControls[intIndex++] = "btnStop.disabledImage";
- arrVwMainControls[intIndex++] = "btnPrev.image";
- arrVwMainControls[intIndex++] = "btnPrev.hoverImage";
- arrVwMainControls[intIndex++] = "btnNext.image";
- arrVwMainControls[intIndex++] = "btnNext.hoverImage";
- arrVwMainControls[intIndex++] = "btnVolKnob.image";
- arrVwMainControls[intIndex++] = "btnVolKnob.hoverImage";
- arrVwMainControls[intIndex++] = "btnSeek.image";
- arrVwMainControls[intIndex++] = "sliSeek.foregroundImage";
- arrVwMainControls[intIndex++] = "sliSeek.backgroundImage";
- arrVwMainControls[intIndex++] = "sliSeek.thumbImage";
- arrVwMainControls[intIndex++] = "btnMute.image";
- arrVwMainControls[intIndex++] = "btnMute.hoverImage";
- arrVwMainControls[intIndex++] = "btnMute.downImage";
- arrVwMainControls[intIndex++] = "sliVolume.foregroundImage";
- arrVwMainControls[intIndex++] = "sliVolume.backgroundImage";
- arrVwMainControls[intIndex++] = "sliVolume.thumbImage";
- arrVwMainControls[intIndex++] = "csliVolume.image";
- arrVwMainControls[intIndex++] = "btnPlaylist.image";
- arrVwMainControls[intIndex++] = "btnPlaylist.hoverImage";
- arrVwMainControls[intIndex++] = "btnDispPlaylist.image";
- arrVwMainControls[intIndex++] = "btnDispPlaylist.hoverImage";
-
- // Part2 View
- arrVwMainControls[intIndex++] = "btnVideo.image";
- arrVwMainControls[intIndex++] = "btnVideo.hoverImage";
- arrVwMainControls[intIndex++] = "btnSettings.image";
- arrVwMainControls[intIndex++] = "btnSettings.hoverImage";
- arrVwMainControls[intIndex++] = "btnInfoBackground.image";
- arrVwMainControls[intIndex++] = "btnInfoBackgroundBG.image";
- arrVwMainControls[intIndex++] = "btnRepeat.image";
- arrVwMainControls[intIndex++] = "btnRepeat.hoverImage";
- arrVwMainControls[intIndex++] = "btnRepeat.downImage";
- arrVwMainControls[intIndex++] = "btnShuffle.image";
- arrVwMainControls[intIndex++] = "btnShuffle.hoverImage";
- arrVwMainControls[intIndex++] = "btnShuffle.downImage";
- arrVwMainControls[intIndex++] = "btnClose.image";
- arrVwMainControls[intIndex++] = "btnClose.hoverImage";
- arrVwMainControls[intIndex++] = "btnFullMode.image";
- arrVwMainControls[intIndex++] = "btnFullMode.hoverImage";
- arrVwMainControls[intIndex++] = "btnOpenClose.image";
- arrVwMainControls[intIndex++] = "btnOpenClose.hoverImage";
-
- // Settings View
- arrVwMainControls[intIndex++] = "svwSettingsL.backgroundImage";
- arrVwMainControls[intIndex++] = "svwSettingsR.backgroundImage";
- arrVwMainControls[intIndex++] = "svwSettingsBL.backgroundImage";
- arrVwMainControls[intIndex++] = "svwSettingsB.backgroundImage";
- arrVwMainControls[intIndex++] = "svwSettingsBR.backgroundImage";
-
- // Mini-Vis View
- arrVwMainControls[intIndex++] = "svwMiniVisL.backgroundImage";
- arrVwMainControls[intIndex++] = "svwMiniVisR.backgroundImage";
- arrVwMainControls[intIndex++] = "svwMiniVisBL.backgroundImage";
- arrVwMainControls[intIndex++] = "svwMiniVisB.backgroundImage";
- arrVwMainControls[intIndex++] = "svwMiniVisBR.backgroundImage";
- arrVwMainControls[intIndex++] = "btnDetachVid.image";
- arrVwMainControls[intIndex++] = "btnDetachVid.hoverImage";
- arrVwMainControls[intIndex++] = "btnCloseVid.image";
- arrVwMainControls[intIndex++] = "btnCloseVid.hoverImage";
-
- // Playlist View
- arrVwMainControls[intIndex++] = "svwPlaylistL.backgroundImage";
- arrVwMainControls[intIndex++] = "svwPlaylistR.backgroundImage";
- arrVwMainControls[intIndex++] = "svwPlaylistBL.backgroundImage";
- arrVwMainControls[intIndex++] = "svwPlaylistB.backgroundImage";
- arrVwMainControls[intIndex++] = "svwPlaylistBR.backgroundImage";
-
-
- // Set up player setting defaults
- blnVideoOpen = 0; // vid/vis open setting : 0 = closed, 1 = open
- blnSaveOnExit = 1; // save settings mode : 0 = don't save settings on exit, 1 = save settings on exit
- blnAutoPlay = 1; // autoplay : 0 = off, 1 = on
- blnRestorePlaylist = 1; // restore last playlist : 0 = no, 1 = yes
-
- strRepeatMode = "N"; // repeat mode : Y = repeat on, N = repeat off, 1 = single track repeat
- strExpandMode = "L"; // expand/shrink side : left [L] or right [R]
- strPlayerMode = "A:O"; // player mode : 2-part - auto [A] or manual [M] : open [O] or closed [C]
- strTitleMode = "M:C"; // title mode : 2-part - auto [A] or manual [M] : custom [C] or default [D]
- strSkinMode = "N"; // skin mode : night [N], day [S]
- strInfoMode = "C"; // track info mode : current position [C], duration left [D], total time [T] or auto [A]
- intCurrentEffect = 1; // current mini-effect : 1-5 = effect, 0 = no effect
- strPlaylist = ""; // current playlist :
- strTextOnEffect = "Y"; // text on mini-effect : Y = on, N = off, A = side-by-side (auto)
- blnTextOverEffect = 1; // text over mini-effect : 0 = no, 1 = yes
-
- strVidMode = "VIS"; // video view mode : display video [VID] or visuals [VIS] by default
- intVidWidth = 350; // video view width :
- intVidHeight = 262; // video view height :
- strDisplayVideo = "A:0"; // video view visible : 2-part - auto [A] or manual [M] : 0 = hidden, 1 = displayed
- blnUseSoundFx = 1; // Sound effects flag : 1 = On, 0 = Off
- blnOnScreenIcons = 0; // On-screen icons flag : 1 = On, 0 = Off
- blnCrossfade = 0; // Crossfade flag : 1 = On, 0 = Off
- intCrossfadeWindow = 6000; // Crossfade window ; size of crossfade window in ms
-
- // ----------------------------------------------------------------------
-
-
- function Startup()
- {
- ReadSettings();
- ApplySettings();
- ConstructTrackInfo(true);
- SetInfoMode();
- InitMainView();
- UpdateMainMetadata();
- OnPlayStateChange();
- toggleMiniEffects(intCurrentEffect);
-
- // load the preset popups
- for (var n = 0; n < eqEqualizer.presetCount; n++) {
- popPreset.appendItem(eqEqualizer.presetTitle(n));
- }
-
- // Start playing if Autoplay is on
- if (blnAutoPlay == 1) {
- player.controls.play();
- }
-
- }
-
- function Shutdown()
- {
- SaveSettings();
- }
-
-
- function ReadSettings()
- {
- // Get settings from registry
- blnSaveOnExit = ((theme.loadPreference("SaveOnExit") != "--") ? parseInt(theme.loadPreference("SaveOnExit"),10) : blnSaveOnExit);
- strTextOnEffect = ((theme.loadPreference("TextOnEffect") != "--") ? theme.loadPreference("TextOnEffect") : strTextOnEffect);
- blnRestorePlaylist = ((theme.loadPreference("RestorePlaylist") != "--") ? parseInt(theme.loadPreference("RestorePlaylist"),10) : blnRestorePlaylist);
- blnAutoPlay = ((theme.loadPreference("AutoPlay") != "--") ? parseInt(theme.loadPreference("AutoPlay"),10) : blnAutoPlay);
- strExpandMode = ((theme.loadPreference("ExpandMode") != "--") ? theme.loadPreference("ExpandMode") : strExpandMode);
- strPlayerMode = ((theme.loadPreference("PlayerMode") != "--") ? theme.loadPreference("PlayerMode") : strPlayerMode);
- strTitleMode = ((theme.loadPreference("TitleMode") != "--") ? theme.loadPreference("TitleMode") : strTitleMode);
-
- strCustomTitle = ((theme.loadPreference("CustomTitle") != "--") ? theme.loadPreference("CustomTitle") : strCustomTitle);
- arrCustomTitle = eval(strCustomTitle);
-
- strCustomTitleShow = ((theme.loadPreference("CustomTitleShow") != "--") ? theme.loadPreference("CustomTitleShow") : strCustomTitleShow);
- arrCustomTitleShow = eval(strCustomTitleShow);
-
- strRepeatMode = ((theme.loadPreference("RepeatMode") != "--") ? theme.loadPreference("RepeatMode") : strRepeatMode);
- strPlaylist = ((theme.loadPreference("Playlist") != "--") ? theme.loadPreference("Playlist") : strPlaylist);
- strSkinMode = ((theme.loadPreference("SkinMode") != "--") ? theme.loadPreference("SkinMode") : strSkinMode);
- strInfoMode = ((theme.loadPreference("InfoMode") != "--") ? theme.loadPreference("InfoMode") : strInfoMode);
- intCurrentEffect = ((theme.loadPreference("CurrentEffect") != "--") ? parseInt(theme.loadPreference("CurrentEffect"),10) : intCurrentEffect);
-
- strVidMode = ((theme.loadPreference("VidMode") != "--") ? theme.loadPreference("VidMode") : strVidMode);
- intVidWidth = ((theme.loadPreference("VidWidth") != "--") ? theme.loadPreference("VidWidth") : intVidWidth);
- intVidHeight = ((theme.loadPreference("VidHeight") != "--") ? theme.loadPreference("VidHeight") : intVidHeight);
- strDisplayVideo = ((theme.loadPreference("DisplayVideo") != "--") ? theme.loadPreference("DisplayVideo") : strDisplayVideo);
- blnUseSoundFx = ((theme.loadPreference("UseSoundFx") != "--") ? parseInt(theme.loadPreference("UseSoundFx"),10) : blnUseSoundFx);
- blnOnScreenIcons = ((theme.loadPreference("OnScreenIcons") != "--") ? parseInt(theme.loadPreference("OnScreenIcons"),10) : blnOnScreenIcons);
- blnCrossfade = ((theme.loadPreference("Crossfade") != "--") ? parseInt(theme.loadPreference("Crossfade"),10) : blnCrossfade);
- intCrossfadeWindow = ((theme.loadPreference("CrossfadeWindow") != "--") ? parseInt(theme.loadPreference("CrossfadeWindow"),10) : intCrossfadeWindow);
- }
-
- function ApplySettings()
- {
- toggleViewSkin('main',strSkinMode);
- toggleSaveOnExit(blnSaveOnExit);
- toggleTextOnEffect(strTextOnEffect);
- toggleDisplayVideo(strDisplayVideo);
- toggleRestorePlaylist(blnRestorePlaylist);
- toggleAutoPlay(blnAutoPlay);
- toggleUseSoundFx(blnUseSoundFx);
- toggleOnScreenIcons(blnOnScreenIcons);
- toggleCrossfade(intCrossfadeWindow);
- toggleRepeatMode(strRepeatMode);
- toggleExpandMode(strExpandMode);
- // We togglePlayerMode(strPlayerMode) after a delay via the main view timer
- toggleTitleMode(strTitleMode);
- // We toggleMiniEffects(intCurrentEffect) after setting the track info, so that the
- // text is set correctly.
- }
-
- function SaveSettings()
- {
- theme.savePreference("SaveOnExit", blnSaveOnExit);
-
- if (blnSaveOnExit) {
- var strTemp = '[';
- var strTemp2 = '[';
-
- //theme.savePreference("DisplayVideo", strDisplayVideo);
- theme.savePreference("TextOnEffect", strTextOnEffect);
- theme.savePreference("RestorePlaylist", blnRestorePlaylist);
- theme.savePreference("AutoPlay", blnAutoPlay);
- theme.savePreference("ExpandMode", strExpandMode);
- theme.savePreference("PlayerMode", strPlayerMode);
- theme.savePreference("SkinMode", strSkinMode);
- theme.savePreference("InfoMode", strInfoMode);
- theme.savePreference("TitleMode", strTitleMode);
- theme.savePreference("Playlist", strPlaylist);
- theme.savePreference("CurrentEffect", intCurrentEffect);
- theme.savePreference("UseSoundFx", blnUseSoundFx);
- theme.savePreference("RepeatMode", strRepeatMode);
- theme.savePreference("Crossfade", blnCrossfade);
- theme.savePreference("CrossfadeWindow", intCrossfadeWindow);
-
- for (var n=0; n < arrCustomTitle.length; n++) {
- strTemp = strTemp + '"' + arrCustomTitle[n] + '",';
- strTemp2 = strTemp2 + '"' + arrCustomTitleShow[n] + '",';
- }
-
- strTemp = strTemp.slice(0, strTemp.length - 1) + ']';
- strTemp2 = strTemp2.slice(0, strTemp2.length - 1) + ']';
-
- theme.savePreference("CustomTitle", strTemp);
- theme.savePreference("CustomTitleShow", strTemp2);
- }
- }
-
-
- function InitMainView()
- {
- // Play startup sound
- Beep("startup");
-
- if (player.settings.autoStart) {
- player.settings.autoStart = false;
- }
-
- intMiniVisOffset = svwMiniVis.height;
- intPlaylistOffset = svwPlaylist.height;
- intSettingsOffset = svwSettings.height;
-
- // Initalise settings display
- toggleSettings(1);
-
- // Set time info mode
- UpdateTrackInfo();
-
- // Display Vid/Vis view
- if (strDisplayVideo == "A:1" || strDisplayVideo == "M:1") {
- theme.openView('vwVideoBig');
- }
-
- // Restore last playlist
- if (blnRestorePlaylist && player.playstate != 3) {
- var strGetPlaylist = player.playlistCollection.getByName(strPlaylist).item(0);
- //player.settings.autostart = false;
- player.currentPlaylist = player.playlistCollection.getByName(strPlaylist).item(0);
- }
-
- }
-
-
- function OnPlayStateChange()
- {
- if (player.playState == 8) {
- RepeatMode();
- }
-
- if (player.PlayState == 3 || player.PlayState == 9) {
- UpdateScrolling('auto');
- btnLeftLight.enabled = true;
- btnRightLight.enabled = true;
- } else {
- btnLeftLight.enabled = false;
- btnRightLight.enabled = false;
- UpdateScrolling(false);
- }
-
- if (player.playstate == 2) {
- //btnRightLight.disabledimage = getControlImage("light-y-r-ani.gif");
- //btnLeftLight.disabledimage = getControlImage("light-y-l-ani.gif");
- btnPlay.image = getControlImage("unpause-ani.gif");
- btnPlay.uptooltip = "Resume Play";
- btnPlay.hoverimage = getControlImage("unpause-hover-ani.gif");
- } else {
- btnPlay.image = getControlImage("play.png");
- //btnRightLight.disabledimage = getControlImage("light-b-r-off.png");
- //btnLeftLight.disabledimage = getControlImage("light-b-l-off.png");
- btnPlay.hoverimage = getControlImage("play-ani.gif");
- btnPlay.uptooltip = "Play";
- }
-
- }
-
-
- function OnOpenStateChange()
- {
- if (player.OpenState == osMediaOpen)
- {
- //UpdateMainMetadata();
- SetMiniVis();
- } else if (player.OpenState == osPlaylistChanged) {
- strPlaylist = player.currentPlaylist.name;
- txtPlaylist.value = strPlaylist;
- } else {
- txtInfo.value = ":" + arrOpenStates[player.OpenState] + ":";
- UpdateScrolling(false);
- }
-
- }
-
-
- function UpdateMainMetadata()
- {
-
- strMediaType = player.currentmedia.getiteminfo("mediatype");
-
- // Set Track Info
- strInfoText = GetMetadata();
-
- if (intCurrentEffect != 0 && blnTextOverEffect == 1) {
- txtInfo.value = strInfoText;
- } else {
- txtInfo.value = strInfoText;
- }
-
- btnInfoBackground.upToolTip = strInfoText;
-
- // Set Playlist Info
- strPlaylist = player.currentPlaylist.name;
- txtPlaylist.value = strPlaylist;
- }
-
-
- function InitVideoView()
- {
- strVidMode = "VIS"; // video view mode : display video [VID] or visuals [VIS] by default
- intVidWidth = 350; // video view width :
- intVidHeight = 262; // video view height :
- strDisplayVideo = "A:0";// video view visible : 2-part - auto [A] or manual [M] : 0 = hidden, 1 = displayed
- strSkinMode = "N"; // skin flag : N = Night, S = Silver (crap I know, but I'm in a hurry!)
-
- // Video View Skin
- var intIndex = 0;
-
- arrVwVideoBigControls = new Array();
-
- arrVwVideoBigControls[intIndex++] = "svwVideoTL.backgroundImage";
- arrVwVideoBigControls[intIndex++] = "svwVideoT.backgroundImage";
- arrVwVideoBigControls[intIndex++] = "svwVideoTR.backgroundImage";
- arrVwVideoBigControls[intIndex++] = "svwVideoTBL.backgroundImage";
- arrVwVideoBigControls[intIndex++] = "svwVideoTBR.backgroundImage";
- arrVwVideoBigControls[intIndex++] = "svwVideoL.backgroundImage";
- arrVwVideoBigControls[intIndex++] = "svwVideoR.backgroundImage";
- arrVwVideoBigControls[intIndex++] = "svwVideoBL.backgroundImage";
- arrVwVideoBigControls[intIndex++] = "svwVideoB.backgroundImage";
- arrVwVideoBigControls[intIndex++] = "svwVideoBR.backgroundImage";
- arrVwVideoBigControls[intIndex++] = "btnResize.image";
- arrVwVideoBigControls[intIndex++] = "btnResize.hoverImage";
- arrVwVideoBigControls[intIndex++] = "btnToggleVidVis.image";
- arrVwVideoBigControls[intIndex++] = "btnToggleVidVis.hoverImage";
- arrVwVideoBigControls[intIndex++] = "btnVisPrev.image";
- arrVwVideoBigControls[intIndex++] = "btnVisPrev.hoverImage";
- arrVwVideoBigControls[intIndex++] = "btnVisNext.image";
- arrVwVideoBigControls[intIndex++] = "btnVisNext.hoverImage";
- arrVwVideoBigControls[intIndex++] = "btnCloseMe.image";
- arrVwVideoBigControls[intIndex++] = "btnCloseMe.hoverImage";
- arrVwVideoBigControls[intIndex++] = "btnMax.image";
- arrVwVideoBigControls[intIndex++] = "btnMax.hoverImage";
- arrVwVideoBigControls[intIndex++] = "btnFS.image";
- arrVwVideoBigControls[intIndex++] = "btnFS.hoverImage";
-
- strTitleMode = ((theme.loadPreference("TitleMode") != "--") ? theme.loadPreference("TitleMode") : strTitleMode);
- strVidMode = ((theme.loadPreference("VidMode") != "--") ? theme.loadPreference("VidMode") : strVidMode);
- intVidWidth = ((theme.loadPreference("VidWidth") != "--") ? parseInt(theme.loadPreference("VidWidth"), 10) : intVidWidth);
- intVidHeight = ((theme.loadPreference("VidHeight") != "--") ? parseInt(theme.loadPreference("VidHeight"), 10) : intVidHeight);
- strSkinMode = ((theme.loadPreference("SkinMode") != "--") ? theme.loadPreference("SkinMode") : strSkinMode);
- //strDisplayVideo = ((theme.loadPreference("DisplayVideo") != "--") ? theme.loadPreference("DisplayVideo") : strDisplayVideo);
-
- // Split the setting, so we can use the actual setting
- // in Auto mode
- var strDisplayVideoType = strDisplayVideo.split(":")[0];
- var strDisplayVideoVal = strDisplayVideo.split(":")[1];
-
- if (strDisplayVideoType == "A") {strDisplayVideo = strDisplayVideoType + ":1";}
-
- // Set the view skin
- toggleViewSkin('video',strSkinMode);
-
- // Show Video or Visuals
- toggleBigVidVis(strVidMode);
-
- // Init the video view width & height;
- vwVideoBig.width = intVidWidth;
- vwVideoBig.height = intVidHeight;
-
- theme.savePreference("VideoOpen", 1);
- }
-
-
- function closePlayer()
- {
- if ((event.ctrlKey != 0) && (event.shiftKey != 0)) {
- Beep();
- vwMain.alphaBlend = ((vwMain.alphaBlend == 126) ? 255 : 126);
- } else {
- Beep('shutdown');
- view.close();
- }
- }
-
-
- function CloseVideoView(self)
- {
- // Split the setting, so we can use the actual setting
- // in Auto mode
- var strDisplayVideoType = strDisplayVideo.split(":")[0];
- var strDisplayVideoVal = strDisplayVideo.split(":")[1];
-
- if (strDisplayVideoType == "A") {strDisplayVideo = strDisplayVideoType + ":0";}
-
- if (self) {
- view.close();
- } else {
- theme.closeView('vwVideoBig');
- }
-
- }
-
-
- function SaveVideoView()
- {
- // Save the video view width & height;
- intVidWidth = vwVideoBig.width;
- intVidHeight = vwVideoBig.height;
-
- theme.savePreference("VidMode", strVidMode);
- theme.savePreference("VidWidth", intVidWidth);
- theme.savePreference("VidHeight", intVidHeight);
- theme.savePreference("DisplayVideo", strDisplayVideo);
- theme.savePreference("VideoOpen", 0);
- }
-
-
- function UpdateScrolling(scroll)
- {
- if (scroll != "auto") {
- txtInfo.scrolling = scroll;
- } else {
- txtInfo.scrolling = (txtInfo.textWidth > txtInfo.width);
- }
- }
-
-
- function GetMetadata()
- {
- var strMetadata = "";
- var strPT = player.currentplaylist.getiteminfo("title");
- var strAlbumID = player.currentmedia.getiteminfo("albumid");
- var strAT = player.currentmedia.getiteminfo("WM/AlbumTitle");
- var strTN = player.currentmedia.getiteminfo("WM/TrackNumber");
- var strTA = player.currentmedia.getiteminfo("author");
- var strTT = player.currentmedia.getiteminfo("title");
-
- // Split the setting, so we can use the actual setting
- // in Auto mode
- var strTitleModeType = strTitleMode.split(":")[0];
- var strTitleModeVal = strTitleMode.split(":")[1];
-
- switch (strTitleModeType)
- {
-
- // Auto mode - use pre-defined layout
- case "A" :
- if (strAlbumID != "") {
- strMetadata = (strTA != "" ? strTA + " ù " : "") + (strAT != "" ? strAT + " : " : "") + (strTN != "" ? strTN + ". " : "") + strTT;
- } else {
- strMetadata = strTA + " ù " + strTT;
- }
- break;
-
- case "M" :
-
- switch (strTitleModeVal)
- {
-
- // Custom mode - use CustomTitle array
- case "C" :
- // Loop through CustomTitle array
- for (var n=0; n < arrCustomTitle.length; n++) {
-
- strCustomType = arrCustomTitle[n].toString();
-
- // Do we show the current item?
- var blnShow = (arrCustomTitleShow[n] == "1");
- blnShowNext = false;
-
- if (n < (arrCustomTitle.length-1)) {
- blnShowNext = (arrCustomTitleShow[n+1] == "1");
- }
-
- // Loop round TitleAttributes array - find match to custom element
- for (var l=0; l < arrTitleAttributes.length; l++) {
-
- // Construct new array from TitleAttributes
- var arrTAType = arrTitleAttributes[l].split(":");
-
- // If we match types, get content and append to metadata
- if (strCustomType == arrTAType[0] && blnShow) {
-
- switch (strCustomType)
- {
-
- case "PT" :
- if (strPT != "") {
-
- if (n == 0) {
- strPT = "[" + strPT + "] ";
- } else if (n == (arrCustomTitle.length-1) || (!blnShowNext && n == (arrCustomTitle.length-2))) {
- strPT = " [" + strPT + "]";
- } else {
- strPT = "[" + strPT + "] ";
- }
- }
- break;
-
- case "AT" :
- if (strAT != "") {
-
- if (n == 0) {
- strAT = strAT + " : ";
- } else if (n == (arrCustomTitle.length-1) || (!blnShowNext && n == (arrCustomTitle.length-2))) {
- strAT = " " + strAT;
- } else {
- strAT = strAT + " : ";
- }
- }
- break;
-
- case "TN" :
- if (strTN != "") {
-
- if (n == 0) {
- strTN = strTN + ".";
- } else if (n == (arrCustomTitle.length-1) || (!blnShowNext && n == (arrCustomTitle.length-2))) {
- strTN = "(" + strTN + ")";
- } else {
- strTN = strTN + ".";
- }
- }
- break;
-
- case "TA" :
- if (strTA != "") {
-
- if (n == 0) {
- strTA = strTA + " ù ";
- } else if (n == (arrCustomTitle.length-1) || (!blnShowNext && n == (arrCustomTitle.length-2))) {
- strTA = " " + strTA;
- } else {
- strTA = strTA + " ù ";
- }
- }
- break;
-
- case "TT" :
- if (strTT != "") {
-
- if (n == 0) {
- strTT = strTT + " | ";
- } else if (n == (arrCustomTitle.length-1) || (!blnShowNext && n == (arrCustomTitle.length-2))) {
- strTT = " " + strTT;
- } else {
- strTT = strTT + " | ";
- }
- }
- break;
-
- }
-
- var strAttribValue = eval("str" + strCustomType);
- strMetadata = strMetadata + strAttribValue;
- }
- }
- }
-
- break;
-
- case "D" :
- strMetadata = strTA + " ù " + strTT;
- break;
- }
-
- break;
- }
-
- return strMetadata;
-
- }
-
-
- function SetInfoMode()
- {
- for (var n=0; n < arrInfoModes.length; n++) {
-
- if (arrInfoModes[n][0] == strInfoMode) {
- intInfoMode = n;
- txtInfoB.foregroundcolor = arrInfoModes[n][1];
- }
- }
-
- }
-
-
- function ToggleTrackInfo()
- {
- if (intInfoMode == (arrInfoModes.length - 1))
- {
- intInfoMode = 0;
- }
- else
- {
- intInfoMode++;
- }
-
- strInfoMode = arrInfoModes[intInfoMode][0];
- txtInfoB.foregroundcolor = arrInfoModes[intInfoMode][1];
-
- UpdateTrackInfo();
- }
-
-
- function UpdateTrackInfo()
- {
- switch (strInfoMode)
- {
- case "C" :
- txtInfoC.visible = true;
- txtInfoD.visible = false;
- txtInfoT.visible = false;
- break;
-
- case "D" :
- txtInfoC.visible = false;
- txtInfoD.visible = true;
- txtInfoT.visible = false;
- break;
-
- case "T" :
- txtInfoC.visible = false;
- txtInfoD.visible = false;
- txtInfoT.visible = true;
- break;
-
- }
-
- }
-
-
- function UpdateTrackMetadata()
- {
- var intSecs = Math.floor(player.currentmedia.duration - player.controls.currentposition);
- var intMins = Math.floor(intSecs / 60);
-
- intSecs = intSecs - (intMins * 60);
-
- if (intMins < 10) {
- strMins = "0" + intMins;
- } else {
- strMins = intMins;
- }
-
- if (intSecs < 10) {
- strSecs = "0" + intSecs;
- } else {
- strSecs = intSecs;
- }
-
- txtInfoD.value = "-" + strMins + ":" + strSecs
- }
-
-
- function UpdatePlaylistScrolling()
- {
- txtPlaylist.scrolling = (!txtPlaylist.scrolling) && (txtPlaylist.textWidth > txtPlaylist.width);
- if (txtPlaylist.scrolling) {
- btnPlaylist.image = getControlImage("playlist-info-hi.png");
- } else {
- btnPlaylist.image = getControlImage("playlist-info.png");
- }
- }
-
-
- function movePlaylist()
- {
- // If settings is open, close it first
- if (blnSettingsOpen) {
- blnOpenPlaylist = true;
- moveSettings();
- return;
- }
-
- blnFinishPlaylistMove = false;
-
- // If the playlist is open, switch the button image, hide the playlist, and start closing
- if (blnPlaylistOpen)
- {
- btnDispPlaylist.image = getControlImage("playlist-btn-closing-ani.gif");
- btnDispPlaylist.hoverimage = getControlImage("playlist-btn-closing-ani.gif");
- svwPlaylist.moveTo(svwPlaylist.left, -(intPlaylistOffset - (18 * 2)), 300);
- plyPlaylist.visible = false;
- }
- else
- {
- btnDispPlaylist.image = getControlImage("playlist-btn-opening-ani.gif");
- btnDispPlaylist.hoverimage = getControlImage("playlist-btn-opening-ani.gif");
- svwPlaylist.moveTo(svwPlaylist.left, 0, 300);
- }
-
- }
-
-
- function finishPlaylistMove()
- {
- // If we have not finished moving, finish the move
- if (!blnFinishPlaylistMove)
- {
- if (blnPlaylistOpen)
- {
- svwPlaylist.moveTo(svwPlaylist.left, -intPlaylistOffset, 1000);
- }
- else
- {
- svwPlaylist.moveTo(svwPlaylist.left, 18, 1000);
- }
-
- blnFinishPlaylistMove = true;
- }
- else
- {
- if (blnPlaylistOpen)
- {
- btnDispPlaylist.image = getControlImage("playlist-btn-open.png");
- btnDispPlaylist.hoverimage = getControlImage("playlist-btn-open-ani.gif");
- blnPlaylistOpen = false;
- }
- else
- {
- btnDispPlaylist.image = getControlImage("playlist-btn-close.png");
- btnDispPlaylist.hoverimage = getControlImage("playlist-btn-close-ani.gif");
- blnPlaylistOpen = true;
- }
-
- plyPlaylist.visible=blnPlaylistOpen;
-
- if (blnOpenSettings)
- {
- blnOpenSettings = false;
- moveSettings();
- }
-
- if (blnClosePlayer)
- {
- blnClosePlayer = false;
- CloseOpen();
- }
-
- }
-
- }
-
-
- function moveSettings()
- {
- // If player is closed
- if (!blnIsOpen) {
- // disable mini-vis button so it can't be opened at the same time :P
- btnVideo.enabled = false;
-
- // If mini-vis is open, close it first
- if (blnMiniVisOpen) {
- blnOpenSettings = true;
- moveMiniVis();
- return;
- }
- }
-
- // If playlist is open, close it first
- if (blnPlaylistOpen) {
- blnOpenSettings = true;
- movePlaylist();
- return;
- }
-
- blnFinishSettingsMove = false;
-
- // If settings is open, disable the button and start closing
- if (blnSettingsOpen)
- {
- btnSettings.enabled = false;
- svwSettings.moveTo(svwSettings.left, -(intSettingsOffset - (18 * 2)), 300);
- }
- else
- {
- btnSettings.image = getControlImage("settings-on.png");
- btnSettings.enabled = false;
- svwSettings.moveTo(svwSettings.left, 0, 300);
- }
-
- }
-
-
- function finishSettingsMove()
- {
- // If we have not finished moving, finish the move
- if (!blnFinishSettingsMove)
- {
- if (blnSettingsOpen)
- {
- svwSettings.moveTo(svwSettings.left, -intSettingsOffset, 1000);
- }
- else
- {
- svwSettings.moveTo(svwSettings.left, 18, 1000);
- }
-
- blnFinishSettingsMove = true;
- }
- else
- // We have finished the move, so set stuff accordingly.
- {
- if (blnSettingsOpen) {
- btnSettings.image = getControlImage("settings.png");
- btnSettings.enabled = true;
- btnSettings.uptooltip = "Show Settings";
- blnSettingsOpen = false;
- } else {
- btnSettings.enabled = true;
- btnSettings.uptooltip = "Hide Settings";
- blnSettingsOpen = true;
- }
-
- if (blnClosePlayer) {
- blnClosePlayer = false;
- blnOpenSettings = true;
- CloseOpen();
- return;
- }
-
- if (blnOpenPlaylist) {
- blnOpenPlaylist = false;
- movePlaylist();
- return;
- }
-
- if (blnOpenMiniVis) {
- blnOpenMiniVis = false;
- moveMiniVis();
- return;
- }
-
- btnVideo.enabled = true;
- Beep("squeak");
- }
-
- }
-
-
- function moveMiniVis()
- {
- if (!blnIsOpen) { btnSettings.enabled = false; }
-
- if (blnSettingsOpen && !blnIsOpen)
- {
- blnOpenMiniVis = true;
- moveSettings();
- return;
- }
-
- blnFinishVideoMove = false;
- btnVideo.enabled = false;
- btnDetachVid.enabled = false;
-
- // If open, close it
- if (blnMiniVisOpen)
- {
- vidVideo.visible = false;
- effVis.visible = false;
- svwMiniVis.moveTo(svwMiniVis.left, -(intMiniVisOffset - (18 * 2)), 300);
- }
- else
- // Otherwise, open.
- {
- btnVideo.image = getControlImage("vis-on.png");
- svwMiniVis.moveTo(svwMiniVis.left, 0, 300);
- }
-
- }
-
-
- function finishVideoMove()
- {
- // If we have not finished moving, finish the move
- if (!blnFinishVideoMove)
- {
- if (blnMiniVisOpen)
- {
- svwMiniVis.moveTo(svwMiniVis.left, -intMiniVisOffset, 1000);
- }
- else
- {
- svwMiniVis.moveTo(svwMiniVis.left, 18, 1000);
- }
-
- blnFinishVideoMove = true;
- }
- else
- // We have finished the move, so set stuff accordingly.
- {
- // If we were open, we must be closed now.
- if (blnMiniVisOpen)
- {
- btnVideo.image = getControlImage("vis.png");
- btnVideo.uptooltip="Show Mini-Vid/Vis Screen"
- blnMiniVisOpen = false;
- }
- else
- {
- btnVideo.uptooltip="Hide Mini-Vid/Vis Screen"
- blnMiniVisOpen = true;
- }
-
- btnVideo.enabled = true;
- btnDetachVid.enabled = true;
-
- SetMiniVis();
-
- if (blnClosePlayer)
- {
- blnClosePlayer = false;
- blnOpenMiniVis = true;
- CloseOpen();
- return;
- }
-
- if (blnOpenSettings) {
- blnOpenSettings = false;
- moveSettings();
- return;
- }
-
- btnSettings.enabled = true;
- Beep("squeak");
- }
-
- }
-
-
- function SetMiniVis()
- {
- if (strMediaType == "video" ) {
- txtMiniVisTitle.value = "Video";
- vidVideo.visible = blnMiniVisOpen;
- effVis.visible = false;
-
- // Get video dimensions & save them
- intVidMediaWidth = player.currentMedia.ImageSourceWidth;
- intVidMediaHeight = player.currentMedia.ImageSourceHeight;
- theme.savePreference("VidZoomWidth", intVidMediaWidth);
- theme.savePreference("VidZoomHeight", intVidMediaHeight);
-
-
- } else {
- txtMiniVisTitle.value = "Visuals";
- vidVideo.visible = false;
- effVis.visible = blnMiniVisOpen;
- }
-
- }
-
-
- function CloseOpen()
- {
- // If both settings and mini-vis are open, but we are closing
- // set only the mini-vis to re-open
- if (blnOpenSettings && blnOpenMiniVis && blnIsOpen) {
- blnOpenSettings = false;
- }
-
- if (blnPlaylistOpen) {
- blnClosePlayer = true;
- movePlaylist();
- return;
- }
-
- if (blnMiniVisOpen) {
- blnClosePlayer = true;
- moveMiniVis();
- return;
- }
-
- if (blnSettingsOpen) {
- blnClosePlayer = true;
- moveSettings();
- return;
- }
-
- blnFinishCloseOpen = false;
-
- // If we are open, animate the close arrow, set the offset, and start closing
- if (blnIsOpen) {
-
- intOffset = intOffset - intDiff;
-
- if (strExpandMode == "R") {
- btnOpenClose.image = getControlImage("expand-move-ani.gif");
- btnOpenClose.enabled = false;
- svwPart2.moveto(intOffset + intBrakeZone, 0, 300);
- } else {
- btnOpenClose.image = getControlImage("shrink-move-ani.gif");
- btnOpenClose.enabled = false;
- svwPart1.moveto(intDiff - intBrakeZone, 0, 300);
- }
- } else {
- // animate the open arrow, switch controls for open player and start opening
- btnVolKnob.visible = false;
- txtVolume.visible = false;
- csliVolume.visible = false;
-
- btnSeek.visible = true;
- sliSeek.visible = true;
- btnMute.visible = true;
- sliVolume.visible = true;
- btnPlaylist.visible = true;
- txtPlaylist.visible = true;
- btnDispPlaylist.visible = true;
-
- intOffset = intOffset + intDiff;
-
- if (strExpandMode == "R") {
- btnOpenClose.image = getControlImage("shrink-move-ani.gif");
- btnOpenClose.enabled = false;
- svwPart2.moveto(intOffset - intBrakeZone, 0, 300);
- } else {
- btnOpenClose.image = getControlImage("expand-move-ani.gif");
- btnOpenClose.enabled = false;
- svwPart1.moveto(0 + intBrakeZone, 0, 300);
- }
- }
-
- blnIsOpen = !blnIsOpen
-
- }
-
-
- function finishCloseOpen()
- {
- // We have not finished the move, so switch stuff and finish the move
- if (!blnFinishCloseOpen) {
-
- // If we are closing, switch controls for closed player and finish closing
- // We need to adjust the mini-video view, if we are moving the LHS part
- if (!blnIsOpen) {
- btnVolKnob.visible = true;
- txtVolume.visible=true;
- csliVolume.visible=true;
-
- btnSeek.visible = false;
- sliSeek.visible=false;
- btnMute.visible = false;
- sliVolume.visible=false;
- btnPlaylist.visible=false;
- txtPlaylist.visible=false;
- btnDispPlaylist.visible=false;
-
- if (strExpandMode == "R") {
- svwPart2.moveTo(intOffset, 0, 1000);
- } else {
- svwPart1.moveTo(intDiff, 0, 1000);
- svwMiniVis.left = svwMiniVis.left + intDiff;
- }
-
- } else {
-
- if (strExpandMode == "R") {
- svwPart2.moveTo(intOffset, 0, 1000);
- } else {
- svwPart1.moveTo(0, 0, 1000);
- svwMiniVis.left = svwMiniVis.left - intDiff;
- }
- }
-
- blnFinishCloseOpen = true;
-
- } else {
-
- // We are finishing the move, so finish up
-
- // Split the setting, so we can use the actual setting
- // in Auto mode
- var strPlayerModeType = strPlayerMode.split(":")[0];
- var strPlayerModeVal = strPlayerMode.split(":")[1];
-
- // We have closed, so set stuff accordingly
- if (!blnIsOpen) {
-
- if (strPlayerModeType == "A") {strPlayerMode = strPlayerModeType + ":C";}
-
- if (strExpandMode == "R") {
- btnOpenClose.image = getControlImage("shrink.png");
- btnOpenClose.hoverimage = getControlImage("shrink-ani.gif");
- btnOpenClose.enabled = true;
- svwSettings.left = btnPlay.left;
- } else {
- btnOpenClose.image = getControlImage("expand.png");
- btnOpenClose.hoverimage = getControlImage("expand-ani.gif");
- btnOpenClose.enabled = true;
- svwSettings.left = btnPlaylist.left + 13;
- }
-
- btnOpenClose.uptooltip="Expand Player";
-
- } else {
- // We have opened
- if (strPlayerModeType == "A") {strPlayerMode = strPlayerModeType + ":O";}
-
- if (strExpandMode == "R") {
- btnOpenClose.image = getControlImage("expand.png");
- btnOpenClose.hoverimage = getControlImage("expand-ani.gif");
- btnOpenClose.enabled = true;
- } else {
- btnOpenClose.image = getControlImage("shrink.png");
- btnOpenClose.hoverimage = getControlImage("shrink-ani.gif");
- btnOpenClose.enabled = true;
- }
-
- svwSettings.left = btnPlaylist.left + 13;
- btnOpenClose.uptooltip="Shrink Player";
- }
-
- if (blnOpenMiniVis) {
- blnOpenMiniVis = false;
- moveMiniVis();
- }
-
- if (blnOpenSettings && intSwitchSides > 0) {
- blnOpenSettings = false;
- moveSettings();
- }
-
- if (intSwitchSides < 0) {
- intSwitchSides++;
- toggleExpandMode();
- }
-
- }
-
- }
-
-
- function SwitchToFullScreen()
- {
- if (effVisuals.visible) {
- effVisuals.fullscreen = true;
- } else if (vidVideoBig.visible) {
- vidVideoBig.fullscreen = true;
- }
-
- }
-
-
- function toggleSaveOnExit(value)
- {
- if (value == undefined) {
- blnSaveOnExit = Math.abs(blnSaveOnExit - 1);
- } else {
- blnSaveOnExit = value;
- }
-
- btnSaveSettings.image = (blnSaveOnExit ? "on.png" : "off.png");
- txtSaveSettingsV.value = (blnSaveOnExit ? "on" : "off");
- btnSaveSettings.upTooltip = (blnSaveOnExit ? "settings will be saved" : "settings will NOT be saved");
- txtSettingMessage.value = btnSaveSettings.upTooltip;
- }
-
-
- function toggleUseSoundFx(value)
- {
- if (value == undefined) {
- blnUseSoundFx = Math.abs(blnUseSoundFx - 1);
- } else {
- blnUseSoundFx = value;
- }
-
- btnUseSoundFx.image = (blnUseSoundFx ? "on.png" : "off.png");
- txtUseSoundFxV.value = (blnUseSoundFx ? "on" : "off");
- btnUseSoundFx.upTooltip = (blnUseSoundFx ? "sound effects are on" : "sound effects are off");
- txtSettingMessage.value = btnUseSoundFx.upTooltip;
- }
-
-
- function toggleAutoPlay(value)
- {
- if (value == undefined) {
- blnAutoPlay = Math.abs(blnAutoPlay - 1);
- } else {
- blnAutoPlay = value;
- }
-
- btnAutoPlay.image = (blnAutoPlay ? "on.png" : "off.png");
- txtAutoPlayV.value = (blnAutoPlay ? "on" : "off");
- btnAutoPlay.upTooltip = (blnAutoPlay ? "autoplay is on" : "autoplay is off");
- txtSettingMessage.value = btnAutoPlay.upTooltip;
- }
-
-
- function toggleRestorePlaylist(value)
- {
- if (value == undefined) {
- blnRestorePlaylist = Math.abs(blnRestorePlaylist - 1);
- } else {
- blnRestorePlaylist = value;
- }
-
- btnRestorePlaylist.image = (blnRestorePlaylist ? "on.png" : "off.png");
- btnRestorePlaylist.upTooltip = (blnRestorePlaylist ? "playlist will be restored" : "playlist will NOT be restored");
- txtRestorePlaylistV.value = (blnRestorePlaylist ? "on" : "off");
- txtSettingMessage.value = btnRestorePlaylist.upTooltip;
- }
-
-
- function toggleExpandMode(side)
- {
- // If the player is closed, we need to open it before
- // switching sides.
- if (!blnIsOpen) {
- intSwitchSides = -1;
- CloseOpen();
- return;
- }
-
- // If no value supplied for side, we are toggling,
- // otherwise, set side explicitly.
- if (side == undefined) {
-
- if (strExpandMode == "L") {
- strExpandMode = "R"
- } else {
- strExpandMode = "L"
- }
- } else {
- strExpandMode = side;
- }
-
- btnExpandMode.image = ((strExpandMode == "L") ? "left.png" : "right.png");
- btnExpandMode.upTooltip = ((strExpandMode == "L") ? "player expands on left" : "player expands on right");
- txtExpandModeV.value = ((strExpandMode == "L") ? "left" : "right");
- txtSettingMessage.value = btnExpandMode.upTooltip;
-
- // Switch sides flag is set, so close up again
- if (intSwitchSides == 0) {
- intSwitchSides++;
- CloseOpen();
- return;
- }
-
- }
-
-
- function toggleTitleMode(value)
- {
- // Split the setting, so we can use the actual setting
- // in Auto mode
- var strTitleModeType = strTitleMode.split(":")[0];
- var strTitleModeVal = strTitleMode.split(":")[1];
-
- // If we don't have a value, we are being called
- // from the settings panel, so toggle the setting
- if (value == undefined) {
-
- switch (strTitleModeType)
- {
- case "M" :
-
- switch (strTitleModeVal)
- {
- case "C" :
- strTitleMode = "M:D";
- break;
-
- case "D" :
- strTitleMode = "A:" + strTitleModeVal;
- break;
- }
-
- break;
-
- case "A" :
- strTitleMode = "M:C";
- break;
- }
-
- } else {
- strTitleMode = value;
- }
-
- strTitleModeType = strTitleMode.split(":")[0];
- strTitleModeVal = strTitleMode.split(":")[1];
-
- switch (strTitleModeType)
- {
- case "M" :
- switch (strTitleModeVal)
- {
- case "C" :
- btnTrackInfoMode.image = "on.png";
- btnTrackInfoMode.upTooltip = "custom configuration used";
- txtTrackInfoModeV.value = "custom";
- break;
-
- case "D" :
- btnTrackInfoMode.image = "off.png";
- btnTrackInfoMode.upTooltip = "default configuration used (artist - title)";
- txtTrackInfoModeV.value = "default";
- break;
- }
-
- break;
-
- case "A" :
- btnTrackInfoMode.image = "auto.png";
- btnTrackInfoMode.upTooltip = "auto configuration used";
- txtTrackInfoModeV.value = "auto";
- break;
- }
-
- if (value == undefined) {
- UpdateMainMetadata();
- }
- }
-
-
- function switchPlayerMode()
- {
- // Split the setting, so we can use the actual setting
- // in Auto mode
- var strPlayerModeType = strPlayerMode.split(":")[0];
- var strPlayerModeVal = strPlayerMode.split(":")[1];
-
- switch (strPlayerModeType)
- {
- case "M" :
-
- switch (strPlayerModeVal)
- {
-
- case "C" :
- strPlayerMode = "A:O";
- break;
- }
-
- togglePlayerMode()
- break;
-
- case "A" :
- CloseOpen();
- break;
- }
-
- }
-
-
- function togglePlayerMode(value)
- {
- // Split the setting, so we can use the actual setting
- // in Auto mode
- var strPlayerModeType = strPlayerMode.split(":")[0];
- var strPlayerModeVal = strPlayerMode.split(":")[1];
-
- // If we don't have a value, we are being called
- // from the settings panel, so toggle the setting
- if (value == undefined) {
-
- switch (strPlayerModeType)
- {
- case "M" :
-
- switch (strPlayerModeVal)
- {
- case "O" :
- strPlayerMode = "M:C";
- break;
-
- case "C" :
- strPlayerMode = "A:" + (blnIsOpen ? "O" : "C");
- break;
- }
- break;
-
- case "A" :
- strPlayerMode = "M:O";
- break;
- }
-
- } else {
- strPlayerMode = value;
- }
-
- strPlayerModeType = strPlayerMode.split(":")[0];
- strPlayerModeVal = strPlayerMode.split(":")[1];
-
- switch (strPlayerModeType)
- {
- case "M" :
- btnPlayerMode.left = txtPlayerMode.left + txtPlayerMode.width - 3;
-
- switch (strPlayerModeVal)
- {
- case "O" :
- btnPlayerMode.image = "open.png";
- txtPlayerModeV.value = "open";
- btnPlayerMode.upTooltip = "player mode is open";
- break;
-
- case "C" :
- btnPlayerMode.image = "shrnk.png";
- txtPlayerModeV.value = "closed";
- btnPlayerMode.upTooltip = "player mode is closed";
- break;
- }
-
- break;
-
- case "A" :
- btnPlayerMode.left = txtPlayerMode.left + txtPlayerMode.width + 1;
- btnPlayerMode.image = "auto.png";
- txtPlayerModeV.value = "auto";
- btnPlayerMode.upTooltip = "player mode is set as current";
- break;
- }
-
- txtSettingMessage.value = btnPlayerMode.upTooltip;
-
- // Close player if necessary
-
- if (value != undefined) {
-
- // We are setting the state, based on a value passed in (usually on startup)
- // If state is closed, execute CloseOpen, as player always starts out open
- // - blnIsOpen is set to true
- if (strPlayerMode == "A:C" || strPlayerMode == "M:C") {
- CloseOpen();
- }
-
- }
-
- }
-
-
- function toggleDisplayVideo(value)
- {
- // Split the setting, so we can use the actual setting
- // in Auto mode
- var strDisplayVideoType = strDisplayVideo.split(":")[0];
- var strDisplayVideoVal = strDisplayVideo.split(":")[1];
-
- // If we don't have a value, we are being called
- // from the settings panel, so toggle the setting
- if (value == undefined) {
-
- switch (strDisplayVideoType)
- {
- case "M" :
-
- switch (strDisplayVideoVal)
- {
- case "0" :
- strDisplayVideo = "M:1";
- break;
-
- case "1" :
- strDisplayVideo = "A:" + strDisplayVideoVal;
- break;
- }
- break;
-
- case "A" :
- strDisplayVideo = "M:0";
- break;
- }
-
- } else {
- strDisplayVideo = value;
- }
-
- strDisplayVideoType = strDisplayVideo.split(":")[0];
- strDisplayVideoVal = strDisplayVideo.split(":")[1];
-
- switch (strDisplayVideoType)
- {
- case "M" :
- switch (strDisplayVideoVal)
- {
- case "0" :
- btnDisplayVideo.image = "off.png";
- txtDisplayVideoV.value = "off";
- btnDisplayVideo.upTooltip = "video/visuals view is always hidden";
- break;
-
- case "1" :
- btnDisplayVideo.image = "on.png";
- txtDisplayVideoV.value = "on";
- btnDisplayVideo.upTooltip = "video/visuals view is always displayed";
- break;
- }
- break;
-
- case "A" :
- btnDisplayVideo.image = "auto.png";
- txtDisplayVideoV.value = "auto";
- btnDisplayVideo.upTooltip = "video/visuals view is set as current";
- break;
- }
-
- txtSettingMessage.value = btnDisplayVideo.upTooltip;
- theme.savePreference("DisplayVideo", strDisplayVideo);
-
- }
-
-
- function toggleMiniEffects(value)
- {
- // The mini-effect range is 0 to intNumMiniEffects
- // with 0 being off - so we need to go to zero, when
- // we reach intNumMiniEffects
-
- var strInfo = strInfoText;
- // Setting which mini-effect is displayed
- var intValue = parseInt(value,10);
-
- // Hack to set mini-effect explicitly (we need to be in the right position)
- if (value != undefined) {
-
- if (intValue != 0) {
- intCurrentEffect = intValue - 1;
- } else {
- intCurrentEffect = intNumMiniEffects;
- }
-
- }
-
- // Turn off current effect (if applicable - it might be 0)
- if (intCurrentEffect != 0) {
- eval('effBg' + intCurrentEffect + '.visible=false');
- }
-
- // Increment current effect
- if (intCurrentEffect < intNumMiniEffects) {
- intCurrentEffect = intCurrentEffect + 1;
- } else {
- // If we are in TextOnEffect mode, go to zero
- if (blnTextOverEffect == 1) {
- intCurrentEffect = 0;
- } else {
- // Otherwise go to 1, skipping 'no effect'
- intCurrentEffect = 1;
- }
- }
-
- // Turn on current effect (if applicable - it might be 0)
- if (intCurrentEffect != 0) {
- if (blnTextOverEffect == 1) { strInfo = strInfoText + " "; }
- eval('effBg' + intCurrentEffect + '.visible=true');
- }
-
- switch (intCurrentEffect)
- {
- case 0 :
- btnMiniEffect.image = "off.png";
- txtMiniEffectV.value = "off";
- btnMiniEffect.upTooltip = "mini-effect is off";
- break;
-
- case 1 :
- btnMiniEffect.image = "on.png";
- txtMiniEffectV.value = "noise";
- btnMiniEffect.upTooltip = "mini-effect: " + txtMiniEffectV.value;
- break;
-
- case 2 :
- btnMiniEffect.image = "on.png";
- txtMiniEffectV.value = "matrix";
- btnMiniEffect.upTooltip = "mini-effect: " + txtMiniEffectV.value;
- break;
-
- case 3 :
- btnMiniEffect.image = "on.png";
- txtMiniEffectV.value = "bars";
- btnMiniEffect.upTooltip = "mini-effect: " + txtMiniEffectV.value;
- break;
-
- case 4 :
- btnMiniEffect.image = "on.png";
- txtMiniEffectV.value = "lightning";
- btnMiniEffect.upTooltip = "mini-effect: " + txtMiniEffectV.value;
- break;
-
- case 5 :
- btnMiniEffect.image = "on.png";
- txtMiniEffectV.value = "electricity";
- btnMiniEffect.upTooltip = "mini-effect: " + txtMiniEffectV.value;
- break;
- }
-
- txtSettingMessage.value = btnMiniEffect.upTooltip;
- txtInfo.value = strInfo;
- }
-
-
- function ConstructTrackInfo(move)
- {
- // move dictates if we need to update the position of elements
- // true => update pos & enable
- // false => update enable only
- // we need this cause this routine deals with both enable/disable
- // and move, and it's more efficient to leave out moving stuff if
- // all we are doing is enabling/disabling!
-
- // Loop through CustomTitle array
- for (var n=0; n < arrCustomTitle.length; n++) {
-
- var strCustomType = arrCustomTitle[n];
- var strCustomTitleShow = arrCustomTitleShow[n];
-
- if (move) {
- eval("txt" + strCustomType + ".top=" + (txtTrackInfoMode.top + 12 + (n*9)));
- eval("btn" + strCustomType + "Up.top=txt" + strCustomType + ".top - 1");
- eval("btn" + strCustomType + "Down.top=txt" + strCustomType + ".top - 1");
- eval("btn" + strCustomType + "Show.top=txt" + strCustomType + ".top - 1");
-
- // If we are on the first item, disable move Up
- if (n == 0) {
- eval("btn" + strCustomType + "Up.enabled=false");
- } else {
- eval("btn" + strCustomType + "Up.enabled=true");
- }
-
- // If we are on the last item, disable move Down
- if (n == (arrCustomTitle.length-1)) {
- eval("btn" + strCustomType + "Down.enabled=false");
- } else {
- eval("btn" + strCustomType + "Down.enabled=true");
- }
- }
-
- if (strCustomTitleShow == "1") {
- eval("btn" + strCustomType + "Show.image='on.png'");
- eval("txt" + strCustomType + ".enabled=true");
- } else {
- eval("btn" + strCustomType + "Show.image='off.png'");
- eval("txt" + strCustomType + ".enabled=false");
- }
-
- }
-
- }
-
-
- function MoveTrackInfoItem()
- {
- var strSE = event.srcElement.id;
- var strDirection = strSE.slice(5);
- var strType = strSE.slice(3,5);
- var intPos = 0;
- var intNewPos = 0;
-
- // Loop round TitleAttributes array - find match to custom element
- for (var n=0; n < arrCustomTitle.length; n++) {
-
- var strCustomType = arrCustomTitle[n]
-
- // If we match types, set the position
- if (strCustomType == strType) {
- intPos = n;
- break;
- }
- }
-
- if (strDirection == "Up" ) {
- intNewPos = intPos - 1;
- } else {
- intNewPos = intPos + 1;
- }
-
- // Now we need to swap array elements
- // First remove element
- var strRemoved = arrCustomTitle.splice(intPos, 1);
- var strShowRemoved = arrCustomTitleShow.splice(intPos, 1);
-
- // Then replace it in the new position
- arrCustomTitle.splice(intNewPos, 0, strRemoved);
- arrCustomTitleShow.splice(intNewPos, 0, strShowRemoved);
-
- // Finally, call construct routine to refresh display
- ConstructTrackInfo(true);
- UpdateMainMetadata();
- }
-
-
- function ToggleTrackInfoItem()
- {
- var strSE = event.srcElement.id;
- var strType = strSE.slice(3,5);
-
- // Loop round TitleAttributes array - find match to custom element
- for (var n=0; n < arrCustomTitle.length; n++) {
-
- // If we match types, toggle the visibility
- if (arrCustomTitle[n] == strType) {
- arrCustomTitleShow[n] = Math.abs(arrCustomTitleShow[n] - 1);
- break;
- }
- }
-
- // Call construct routine to refresh display
- ConstructTrackInfo();
- UpdateMainMetadata();
- }
-
-
- function toggleTextOverEffect(value)
- {
- // Toggle value if we are not setting explicitly
- if (value == undefined) {
- blnTextOverEffect = Math.abs(blnTextOverEffect - 1);
- } else {
- blnTextOverEffect = value;
- }
-
- // Initial setting is on, and we call this when we restore settings
- // so only act if we are doing this and the setting is OFF
- // (if it's on we don't want to do anything), OR we are toggling
- // if ((value != undefined && value != "1") || value == undefined) {
-
- if (blnTextOverEffect == 1) {
-
- // It's on, so must have been off, so expand text
- txtInfo.moveto(txtInfo.left - 41, txtInfo.top, 1000);
- txtInfoShadow.moveto(txtInfoShadow.left - 41, txtInfo.top, 1000);
- txtInfo.width = txtInfo.width + 41;
-
- // and expand effects
- for (var n=1; n <= intNumMiniEffects; n++)
- {
- eval("effBg" + n + ".width = effBg" + n + ".width + 80");
- }
-
- } else {
- // It's off, so must have been on, so contract
- // unless we are on mini-effect zero (none)
- // in which case, switch to mini-effect 1 first
- if (intCurrentEffect == 0) {
- toggleMiniEffects();
- }
- txtInfo.moveto(txtInfo.left + 41, txtInfo.top, 1000);
- txtInfoShadow.moveto(txtInfoShadow.left + 41, txtInfo.top, 1000);
- txtInfo.width = txtInfo.width - 41;
-
- // and contract effects
- for (var n=1; n <= intNumMiniEffects; n++)
- {
- eval("effBg" + n + ".width = effBg" + n + ".width - 80");
- }
-
- }
-
- // Set the effect to the current effect, to set the text correctly
- toggleMiniEffects(intCurrentEffect);
- //}
-
- }
-
-
- function toggleViewSkin(view, value)
- {
- blnVideoOpen = ((theme.loadPreference("VideoOpen") != "--") ? parseInt(theme.loadPreference("VideoOpen"),10) : blnVideoOpen);
-
- if (blnVideoOpen) {
- CloseVideoView();
- }
-
- // Toggle value if we are not setting explicitly
- if (value == undefined) {
-
- if (strSkinMode =="N") {
- var strMorphImage="NS-ani.gif";
- strSkinMode = "S"
- } else {
- strSkinMode = "N"
- var strMorphImage="SN-ani.gif";
- }
-
- } else {
- strSkinMode = value;
- }
-
- if (view == undefined || view == "main") {
- var strViewArray = "arrVwMainControls";
-
- if (value == undefined) {
- svwSkinMorph.backgroundimage = strMorphImage;
- svwPart1.visible = false;
- svwPart2.visible = false;
- blnSwitchingSkin = true;
- vwMain.timerInterval = 1250;
- }
-
- } else {
- var strViewArray = "arrVwVideoBigControls";
- }
-
- var strControlImage = "";
- var intViewArrayLength = eval(strViewArray + ".length");
-
- // Loop round controls - set images accordingly.
- for (var n=0; n < intViewArrayLength; n++)
- {
- var strCurrentControlImage = eval(eval(strViewArray + "[n]"));
- var strViewArrayControl = eval(strViewArray + "[n]");
-
- if(strSkinMode == "S"){
- strControlImage = strViewArrayControl + " = 's-" + strCurrentControlImage + "'";
- } else {
-
- // If we are toggling, we need to remove the first 2 chars, to revert image names
- // to default night ones.
- if (value == undefined) {
- strControlImage = strViewArrayControl + " = '" + strCurrentControlImage.slice(2) + "'";
- } else {
- // If we are switching to night skin, but not toggling (i.e. setting from startup)
- // just use the current image.
- strControlImage = strViewArrayControl + " = '" + strCurrentControlImage + "'";
- }
- }
-
- eval(strControlImage);
- }
-
- // Set various text colors & stuff accordingly
- if (strViewArray == "arrVwMainControls") {
-
- // We are changing the main view
- if(strSkinMode == "S"){
- txtPlaylist.foregroundColor = "#333333";
- txtPlaylistShadow.foregroundColor = "#778899";
- txtVolume.foregroundColor = "#000000";
- csliVolume.transparencyColor="#FFFFFF";
- btnPlayerSkin.image = "silver.png";
- txtPlayerSkinV.value = "silver";
- svwPlaylistBody.backgroundcolor="#CCCCCC";
- plyPlaylist.foregroundColor="#222222";
- plyPlaylist.backgroundColor="#AAAAAA";
- plyPlaylist.itemPlayingBackgroundColor="#222222";
- plyPlaylist.itemPlayingColor="#FFFFFF";
- plyPlaylist.statusColor="#888888";
- svwMiniVisBody.backgroundColor="#CCCCCC";
- txtMiniVisTitle.foregroundColor="#000000";
- } else {
- txtPlaylist.foregroundColor = "#000000";
- txtPlaylistShadow.foregroundColor = "#778899";
- txtVolume.foregroundColor = "#FFFFFF";
- csliVolume.transparencyColor="#000000";
- btnPlayerSkin.image = "night.png";
- txtPlayerSkinV.value = "night";
- svwPlaylistBody.backgroundcolor="#000000";
- plyPlaylist.foregroundColor="#88DDFF";
- plyPlaylist.backgroundColor="#001133";
- plyPlaylist.itemPlayingBackgroundColor="#88DDFF";
- plyPlaylist.itemPlayingColor="#000000";
- plyPlaylist.statusColor="#223355";
- svwMiniVisBody.backgroundColor="#000000";
- txtMiniVisTitle.foregroundColor="#FFFFFF";
- }
-
- } else {
-
- // We are displaying the video/vis view
- if(strSkinMode == "S"){
- svwVideoTopBar.backgroundcolor="#DDDDDD";
- txtVisTitle.foregroundColor="#000000";
- txtVidTitle.foregroundColor="#000000";
- svwVideoMiddle.backgroundcolor="#DDDDDD";
- svwVideoBig.backgroundcolor="#DDDDDD";
- svwVisBig.backgroundcolor="#DDDDDD";
- } else {
- svwVideoTopBar.backgroundcolor="#000000";
- txtVisTitle.foregroundColor="#FFFFFF";
- txtVidTitle.foregroundColor="#FFFFFF";
- svwVideoMiddle.backgroundcolor="#000000";
- svwVideoBig.backgroundcolor="#000000";
- svwVisBig.backgroundcolor="#000000";
- }
-
- }
-
- theme.savePreference("SkinMode", strSkinMode);
-
- if (blnVideoOpen) {
- theme.openView('vwVideoBig');
- }
-
- }
-
-
- function getControlImage(image)
- {
- var strNewControlImage = "";
-
- if(strSkinMode == "N"){
- strNewControlImage = image;
- } else {
- strNewControlImage = "s-" + image;
- }
-
- return strNewControlImage;
- }
-
-
-
- function Beep(sound)
- {
- // Default sound
- if (sound == undefined) { sound = "beep"; }
-
- sound = sound + ".wav";
-
- if (blnUseSoundFx == 1) {
- theme.playsound(sound);
- }
-
- }
-
-
- function toggleSettings(page)
- {
- for (var n=1; n <=3; n++) {
-
- if (n == page) {
- var intZindex = 1;
- var blnEnabled = false;
- var strBackground = "#001133";
- } else {
- var intZindex = 0;
- var blnEnabled = true;
- var strBackground = "#000000";
- }
-
- eval("svwSettings" + n + ".zindex=" + intZindex);
- eval("btnSettings" + n + ".enabled=" + blnEnabled);
- }
-
- }
-
-
- function toggleBigVidVis(mode)
- {
- // If no mode supplied, we are toggling
- if (mode == undefined || mode == "" || mode == null) {
-
- if (strVidMode == "VID") {
- strVidMode = "VIS";
- } else {
- strVidMode = "VID";
- }
-
- } else {
- strVidMode = mode;
- }
-
- // If mode is Video, it was Visuals, so set Video on
- if (strVidMode == "VID") {
- var strMetadata = "";
- var strPT = player.currentplaylist.getiteminfo("title");
- var strAlbumID = player.currentmedia.getiteminfo("albumid");
- var strAT = player.currentmedia.getiteminfo("WM/AlbumTitle");
- var strTN = player.currentmedia.getiteminfo("WM/TrackNumber");
- var strTA = player.currentmedia.getiteminfo("author");
- var strTT = player.currentmedia.getiteminfo("title");
-
- if (strAlbumID != "") {
- strMetadata = (strTA != "" ? strTA + " ù " : "") + (strAT != "" ? strAT + " : " : "") + (strTN != "" ? strTN + ". " : "") + strTT;
- } else {
- strMetadata = strTA + " ù " + strTT;
- }
-
- txtVidTitle.value = strMetadata;
- svwVisBig.visible = false;
- txtVisTitle.visible = false;
- txtVidTitle.visible = true;
- svwVideoBig.visible = true;
- btnToggleVidVis.image = getControlImage("btn-vis.png");
- btnToggleVidVis.hoverImage = getControlImage("btn-vis-hi.png");
- btnToggleVidVis.upTooltip = "show visuals";
- } else {
- svwVisBig.visible = true;
- txtVisTitle.visible = true;
- svwVideoBig.visible = false;
- txtVidTitle.visible = false;
- btnToggleVidVis.image = getControlImage("btn-vid.png");
- btnToggleVidVis.hoverImage = getControlImage("btn-vid-hi.png");
- btnToggleVidVis.upTooltip = "show video";
- }
-
- }
-
-
- function toggleTextOnEffect(value)
- {
- // Toggle value if we are not setting explicitly
- if (value == undefined) {
-
- switch (strTextOnEffect)
- {
- case "Y" :
- strTextOnEffect = "A";
- break;
-
- case "N" :
- strTextOnEffect = "Y";
- break;
-
- case "A" :
- strTextOnEffect = "N";
- break;
- }
-
- } else {
- strTextOnEffect = value;
- }
-
- switch (strTextOnEffect)
- {
- case "Y" :
- //if (value == undefined) { toggleTextOverEffect(1); }
- txtInfo.visible = "true";
- txtInfoShadow.visible = "true";
- btnShowTextOnMiniVis.image = "on.png";
- btnShowTextOnMiniVis.upTooltip = "track text is displayed";
- txtShowTextOnMiniVisV.value = "on";
- break;
-
- case "N" :
- if (value == undefined) { toggleTextOverEffect(1); }
- txtInfo.visible = "false";
- txtInfoShadow.visible = "false";
- btnShowTextOnMiniVis.image = "off.png";
- btnShowTextOnMiniVis.upTooltip = "track text is NOT displayed";
- txtShowTextOnMiniVisV.value = "off";
- break;
-
- case "A" :
- txtInfo.visible = "true";
- txtInfoShadow.visible = "true";
- toggleTextOverEffect(0);
- btnShowTextOnMiniVis.image = "auto.png";
- btnShowTextOnMiniVis.upTooltip = "side-by-side mode";
- txtShowTextOnMiniVisV.value = "auto";
- break;
- }
-
- txtSettingMessage.value = btnShowTextOnMiniVis.upTooltip;
- }
-
-
- function ViewTimer()
- {
- if (blnSwitchingSkin) {
- svwPart1.visible = true;
- svwPart2.visible = true;
- svwSkinMorph.backgroundimage = "";
- blnSwitchingSkin = false;
- } else {
- togglePlayerMode(strPlayerMode);
- }
-
- view.timerInterval = 0;
- }
-
-
- function FadeSettingMessage(fader)
- {
- eval("btnFader" + fader + ".image=''");
- eval("btnFader" + fader + ".image='dissolve-ani.gif'");
- }
-
-
- function RepeatMode()
- {
- // If the repeat mode is single-track repeat, go to the previous track
- // We will have moved on by this time, as this function is called when
- // a playstate of 8 is detected (MediaEnded)
-
- if (strRepeatMode == "1" && blnRepeatMode) {
- blnRepeatMode = false;
-
- // If we want to repeat the first track in the playlist, we are now
- // on the second track, we can go back but the player sometimes stops
- // (don't know why this happens!!) - we may have to pick things
- // up later (onopenstatechange) and start the player via a flag
- //var objFirstTrack = player.currentPlaylist.item(0);
-
- //if (player.currentMedia.isIdentical(objFirstTrack)) {
- // player.controls.previous();
- // blnRepeatTrigger = true;
- //} else {
- player.controls.previous();
- //}
-
- }
-
- blnRepeatMode = true;
-
- }
-
-
- function toggleRepeatMode(mode)
- {
- if (mode == undefined ) {
-
- switch (strRepeatMode)
- {
- case "Y" :
- strRepeatMode = "N";
- break;
-
- case "1" :
- strRepeatMode = "Y";
- break;
-
- case "N" :
- strRepeatMode = "1";
- break;
- }
-
- } else {
- strRepeatMode = mode;
- }
-
- // Activate repeat mode
- switch (strRepeatMode)
- {
-
- case "Y" :
- // Restore crossfade
- if (blnRestoreCrossfade && (!eqEqualizer.crossFade)) {
- toggleCrossfade();
- eqEqualizer.crossFadeWindow = intRestoreCrossfadeWindow;
- blnRestoreCrossfade = false;
- }
-
- player.settings.setMode("loop", true)
- btnRepeat.downImage = getControlImage("repeat-on.png");
- btnRepeat.downTooltip = "Repeat Mode is On";
- btnRepeat.down = true;
- break;
-
- case "1" :
- // We need to turn off crossfade, because it doesn't sound nice
- // when doing a single track repeat.
- if (eqEqualizer.crossFade) {
- blnRestoreCrossfade = true;
- intRestoreCrossfadeWindow = eqEqualizer.crossFadeWindow;
- toggleCrossfade();
- }
-
- player.settings.setMode("loop", true)
- btnRepeat.downImage = getControlImage("repeat-1.png");
- btnRepeat.downTooltip = "Repeat Mode is Single Track";
- btnRepeat.down = true;
- break;
-
- case "N" :
- // Restore crossfade
- if (blnRestoreCrossfade && (!eqEqualizer.crossFade)) {
- toggleCrossfade();
- eqEqualizer.crossFadeWindow = intRestoreCrossfadeWindow;
- }
-
- player.settings.setMode("loop", false)
- btnRepeat.downImage = getControlImage("repeat-on.png");
- btnRepeat.downTooltip = "Repeat Mode is On";
- btnRepeat.down = false;
- break;
- }
-
- }
-
-
- function toggleEqualizer()
- {
- eqEqualizer.bypass = !eqEqualizer.bypass;
- btnEqualizer.down = !eqEqualizer.bypass;
- txtEqualizerV.value = (eqEqualizer.bypass ? 'off' : 'on');
- }
-
-
- function toggleSRS()
- {
- eqEqualizer.enhancedAudio = !eqEqualizer.enhancedAudio;
- btnSRSEffects.down = eqEqualizer.enhancedAudio;
- txtSRSEffectsV.value = (eqEqualizer.enhancedAudio ? 'on' : 'off');
- }
-
-
- function toggleCrossfade(value)
- {
- // if no value, we are toggling
- if (value == undefined) {
- eqEqualizer.crossFade = !eqEqualizer.crossFade;
- eqEqualizer.crossFadeWindow = intCrossfadeWindow;
- } else {
- // We are setting crossfade explicitly, plus we set the crossfade window
- eqEqualizer.crossFade = ((blnCrossfade == 1) ? true : false);
- intCrossfadeWindow = value;
- sliCrossfadeWindow.value = (intCrossfadeWindow / 1000);
- CrossfadeWindow();
- }
-
- blnCrossfade = (eqEqualizer.crossFade ? 1 : 0);
- btnCrossfade.down = eqEqualizer.crossFade;
- txtCrossfadeV.value = (eqEqualizer.crossFade ? 'on' : 'off');
- }
-
-
- function CrossfadeWindow()
- {
- var intCFW = (Math.floor(sliCrossfadeWindow.value) * 1000);
- var strCFW = " secs";
-
- if (intCFW < 2000) { strCFW = " sec";}
-
- strCFW = ((intCFW/1000) + strCFW);
-
- eqEqualizer.crossFadeWindow = intCFW;
- intCrossfadeWindow = intCFW;
- sliCrossfadeWindow.toolTip = strCFW;
- }
-
-
- function toggleOnScreenIcons(value)
- {
- if (value == undefined) {
- blnOnScreenIcons = Math.abs(blnOnScreenIcons - 1);
- } else {
- blnOnScreenIcons = value;
- }
-
- btnOnScreenIcons.image = (blnOnScreenIcons ? "on.png" : "off.png");
- txtOnScreenIconsV.value = (blnOnScreenIcons ? "on" : "off");
- btnOnScreenIcons.upTooltip = (blnOnScreenIcons ? "on-screen icons are shown" : "on-screen icons are NOT shown");
- txtSettingMessage.value = btnOnScreenIcons.upTooltip;
-
- theme.savePreference("OnScreenIcons", blnOnScreenIcons);
- }
-
-
- function ZoomVideo(pct)
- {
- // default the vid view max height & width
- vwVideoBig.maxWidth = 800;
- vwVideoBig.maxHeight = 600;
-
- switch (pct) {
-
- case 0 :
- vwVideoBig.width = intVidWidth;
- vwVideoBig.height = intVidHeight;
- break;
-
- case -1 :
- var intScreenWidth = event.screenWidth;
- var intScreenHeight = event.screenHeight;
-
- vwVideoBig.maxWidth = intScreenWidth;
- vwVideoBig.maxHeight = intScreenHeight;
- vwVideoBig.width = intScreenWidth;
- vwVideoBig.height = intScreenHeight;
- break;
-
- default :
-
- // get media dimensions
- intVidMediaWidth = ((theme.loadPreference("VidZoomWidth") != "--") ? parseInt(theme.loadPreference("VidZoomWidth"), 10) : intVidWidth);
- intVidMediaHeight = ((theme.loadPreference("VidZoomHeight") != "--") ? parseInt(theme.loadPreference("VidZoomHeight"), 10) : intVidHeight);
-
- // calculate aspect ratio
- var intVidRatio = intVidMediaHeight/intVidMediaWidth;
- // calculate new width based on %zoom (net)
- var intVidZoomWidth = intVidMediaWidth * (pct/100);
- // calculate new height based on ratio (net)
- var intVidZoomHeight = intVidZoomWidth * intVidRatio;
-
- // calculate new width (gross)
- intVidZoomWidth = intVidZoomWidth + (2 * svwVideoTL.width);
-
- // calculate new height (gross)
- intVidZoomHeight = intVidZoomHeight + svwVideoTop.height + svwVideoTopBar.height + svwVideoBottom.height;
-
- // set new view dimensions
- vwVideoBig.width = intVidZoomWidth;
- vwVideoBig.height = intVidZoomHeight;
-
- break;
-
- }
- }
-
-
- function VideoKeyUp()
- {
-
- var strOSI = "";
- var imgOSI = "";
-
- var strKeyModifier = (event.ctrlKey != 0 ? "C" : "N");
- var intKeyCode = event.keyCode;
-
- if (strKeyModifier == "N") { strKeyModifier = (event.altKey != 0 ? "A" : "N"); }
-
- switch (strKeyModifier) {
-
- // alt modified keys
- case "A" :
-
- switch (intKeyCode) {
-
- // alt-0 - reset
- case 48 :
- strOSI = "reset zoom";
- imgOSI = "";
- ZoomVideo(0);
- break;
-
- // alt-1 - zoom to 50%
- case 49 :
- strOSI = "zoom 50%";
- imgOSI = "";
- ZoomVideo(50);
- break;
-
- // alt-2 - zoom to 100%
- case 50 :
- strOSI = "zoom 100%";
- imgOSI = "";
- ZoomVideo(100);
- break;
-
- // alt-3 - zoom to 200%
- case 51 :
- strOSI = "zoom 200%";
- imgOSI = "";
- ZoomVideo(200);
- break;
- }
-
- break;
-
- case "C" :
-
- switch (intKeyCode) {
-
- // ctrl-p - pause
- case 80 :
-
- if (player.playState == 2) {
- strOSI = "paused";
- imgOSI = "osi-pause-ani.gif";
- blnResetOSI = false;
- } else {
- strOSI = "resumed";
- imgOSI = "osi-play.png";
- blnResetOSI = true;
- }
-
- break;
-
- // ctrl-s - stop
- case 83 :
- strOSI = "stopped";
- imgOSI = "osi-stop.png";
- break;
- }
-
- break;
-
- // normal keys
- default :
-
- switch (intKeyCode) {
-
- // F8 - mute
- case 119 :
-
- if (player.settings.mute) {
- strOSI = "mute on";
- imgOSI = "osi-mute.png";
- blnResetOSI = false;
- } else {
- strOSI = "mute off";
- imgOSI = "osi-unmute.png";
- blnResetOSI = true;
- }
-
- break;
-
- // F9 - vol down
- case 120 :
- strOSI = "vol- (" + player.settings.volume + ")";
- imgOSI = "osi-unmute.png";
- break;
-
- // F10 - vol up
- case 121 :
- strOSI = "vol+ (" + player.settings.volume + ")";
- imgOSI = "osi-unmute.png";
- break;
-
- }
-
- break;
-
- }
-
- // Set and display the OSI if appropriate
- if (strOSI != "") {
-
- // switch video windowless mode as appropriate
- blnOnScreenIcons = ((theme.loadPreference("OnScreenIcons") != "--") ? parseInt(theme.loadPreference("OnScreenIcons"),10) : blnOnScreenIcons);
-
- if (blnOnScreenIcons == 1 && !vidVideoBig.windowless) {
- vidVideoBig.visible = false;
- vidVideoBig.windowless = true;
- vidVideoBig.visible = true;
- } else if (blnOnScreenIcons == 0 && vidVideoBig.windowless) {
- vidVideoBig.visible = false;
- vidVideoBig.windowless = false;
- vidVideoBig.visible = true;
- }
-
- txtOSI.value = strOSI;
- btnOSI.image = imgOSI;
- vwVideoBig.timerInterval = 0;
- vwVideoBig.timerInterval = 3000;
- svwVideoOSI.visible = "true";
- }
-
- }
-
-
- function checkPage()
- {
- var strPageImage = "btnInfoText.image";
- var strImage = "'e.gif'";
- eval(strPageImage + " = " + strImage);
- }
-
-
- function VideoViewTimer()
- {
- // Disable the timer, and hide the OSI (unless it's a permanent one)
- vwVideoBig.timerInterval = 0;
- if (blnResetOSI) { svwVideoOSI.visible = "false"; }
- blnResetOSI = true;
- }
-
-
- function SwitchPage(direction)
- {
- eval("btnHelp" + intCurrentHelpPage + ".visible='false'");
-
- if (direction == "F") {
- // We are trying next page
- if (intCurrentHelpPage < intNumHelpPages) { intCurrentHelpPage++; }
-
- if (intCurrentHelpPage == intNumHelpPages) {
- btnNextPage.visible="false";
- } else {
- btnNextPage.visible="true";
- }
-
- btnPrevPage.visible="true";
-
- } else {
- // Trying for previous page
- if (intCurrentHelpPage > 1) { intCurrentHelpPage--; }
-
- if (intCurrentHelpPage == 1) {
- btnPrevPage.visible="false";
- } else {
- btnPrevPage.visible="true";
- }
-
- btnNextPage.visible="true";
- }
-
- btnInfoText.image = "help" + intCurrentHelpPage + ".png";
- txtPage.value = "Page " + intCurrentHelpPage + "/" + intNumHelpPages;
- eval("btnHelp" + intCurrentHelpPage + ".visible='true'");
- }
-