home *** CD-ROM | disk | FTP | other *** search
- // Windows Media Player - Copyright 2000 Microsoft Corporation.
- //<script>
-
- var g_buyNowURL="";
- var btnCoverArtType = "";
- var currentVisualStyle = "";
-
- function OnLoad()
- {
- OnStateChange();
- if(player.dvd.isAvailable('dvd'))
- {
- UpdateMenuButton(player.dvd.domain);
- }
- InitVisualizations();
- }
-
- function InitVisualizations()
- {
- if (osMediaOpen == player.openState)
- {
- if(player.currentMedia.ImageSourceWidth == 0 && mediacenter.showEffects == true)
- {
- if(mediacenter.showAlbumArt == true)
- {
- SetVisualStyle("AlbumArt");
- }
- else
- {
- SetVisualStyle("viz");
- }
- }
- else
- {
- SetVisualStyle("none");
- if(player.currentMedia.ImageSourceWidth > 0)
- {
- video1.visible=true;
- }
- }
- }
- else
- {
- SetVisualStyle("none");
- }
- }
-
-
- function SetAlbumArt()
- {
- if (!player.currentMedia) return;
- if(player.currentMedia.ImageSourceWidth == 0 && mediacenter.showAlbumArt == true)
- {
- if(svCoverArt.width < 200 || svCoverArt.height < 200)
- {
- if(btnCoverArtType != "WMPImage_AlbumArtSmall")
- {
- btnCoverArtType = "WMPImage_AlbumArtSmall";
- btnCoverArt.image = "WMPImage_AlbumArtSmall";
- }
- }
- else
- {
- if(btnCoverArtType != "WMPImage_AlbumArtLarge")
- {
- btnCoverArtType = "WMPImage_AlbumArtLarge";
- btnCoverArt.image="WMPImage_AlbumArtLarge";
- }
- }
- g_buyNowURL = player.currentMedia.getItemInfo("BuyNow");
- }
- }
-
- function UpdateMetadata()
- {
- if (!player.currentMedia) return;
- if(player.currentMedia.ImageSourceWidth == 0 && mediacenter.showEffects == true && mediacenter.showAlbumArt == true)
- {
- SetAlbumArt();
- }
- }
-
- function OnCurrentPreset()
- {
- if (!player.currentMedia) return;
- if (player.currentMedia.ImageSourceWidth == 0 && true == mediacenter.showEffects && false == mediacenter.showAlbumArt)
- {
- SetVisualStyle("viz");
-
- VizTitle.value = myeffect.currentEffectTitle + ": " + myeffect.currentPresetTitle;
- if (": " == VizTitle.value)
- VizTitle.value = "";
- }
- }
-
-
- function OnShowTitles()
- {
- UpdateTitles();
- SizeViz();
- }
-
- function OnShowEffects()
- {
- if( (player.currentMedia) && (player.currentMedia.ImageSourceWidth == 0 && mediacenter.showEffects == true))
- {
- if(mediacenter.showAlbumArt == true)
- {
- SetVisualStyle("AlbumArt");
- }
- else
- {
- SetVisualStyle("viz");
- }
- }
- else
- {
- SetVisualStyle("none");
- }
- }
-
-
-
- function SizeViz()
- {
- var top = 1;
- if(mediacenter.showtitles == true)
- {
- top = 50
- }
-
- if(currentVisualStyle == "AlbumArt")
- {
- svCoverArt.top = top;
- svCoverArt.height = svScreen.height - svCoverArt.top - 24;
- }
- else
- {
- myeffect.top = top;
- myeffect.height = svScreen.height - myeffect.top - 24;
- }
- }
-
-
- function UpdateTitles()
- {
- if (!player.currentMedia) return;
- trackname.visible = mediacenter.showTitles && (player.currentMedia.imageSourceHeight==0);
- playlistArtist.value = player.currentMedia.getItemInfo('artist');
- trackname.value = player.currentMedia.name;
- SizeViz();
- UpdateRating();
- }
-
-
- function SetVisualStyle(style)
- {
- currentVisualStyle = style;
-
- if(style == "AlbumArt")
- {
- View1.timerInterval="1000"
-
- btnCoverArtType = "";
- SetAlbumArt();
- btnCoverArt.visible = true;
- if (player.currentMedia) g_buyNowURL = player.currentMedia.getItemInfo("BuyNow");
- UpdateTitles();
- myeffect.visible = false;
- VizTitle.visible = false;
- FullScreenButtonSub.visible = false;
- SwitchViz.visible = true;
- }
- else if(style == "viz")
- {
- View1.timerInterval="0"
- myeffect.visible = true;
- btnCoverArt.visible = false;
- SizeViz();
- SwitchViz.visible = true;
- VizTitle.visible = true;
- FullScreenButtonSub.visible = true;
- UpdateTitles();
- }
- else if(style == "none")
- {
- View1.timerInterval="0"
- myeffect.visible = false;
- btnCoverArt.visible = false;
- VizTitle.visible = false;
- FullScreenButtonSub.visible = true;
- SwitchViz.visible = false;
- UpdateTitles();
- }
- }
-
- function OnCoverArtMouseOver()
- {
- if ("" == g_buyNowURL)
- {
- btnCoverArt.cursor = "system";
- }
- else
- {
- btnCoverArt.cursor = "hand";
- }
- }
-
- function OnClickCoverArt()
- {
- if (''!=g_buyNowURL)
- player.launchURL(g_buyNowURL);
- }
-
-
- function OnDownloadingMediaViz(bstrItemName)
- {
- if (bstrItemName=="WMPImage_AdBanner")
- {
- AdBanner.image=bstrItemName;
- var strToolTip = player.currentmedia.getItemInfo("BannerAbstract");
- AdBanner.upToolTip = strToolTip;
- }
- if (bstrItemName == "WMPImage_AlbumArtSmall" || bstrItemName == "WMPImage_AlbumArtLarge")
- {
- btnCoverArtType = "";
- SetAlbumArt();
- }
- }
-
- function OnBannerClick()
- {
- var strTargetURL = player.currentmedia.getItemInfo("BannerInfoURL");
- if ( strTargetURL != "")
- {
- player.launchURL(strTargetURL);
- }
- }
-
- function OnBannerMouseOver()
- {
- if (!player.currentMedia) return;
-
- var strToolTip = player.currentmedia.getItemInfo("BannerAbstract");
- AdBanner.upToolTip = strToolTip;
-
- if ( player.currentmedia.getItemInfo("BannerInfoURL") != "")
- {
- AdBanner.cursor = "hand";
- }
- else
- {
- AdBanner.cursor = "system";
- }
- }
-
- function VizPrev()
- {
- if (event.shiftKey)
- {
- myeffect.previousEffect();
- }
- else
- {
- myeffect.previous();
- }
- SynchVis();
- }
-
- function VizNext()
- {
- if (event.shiftKey)
- {
- myeffect.nextEffect();
- }
- else
- {
- myeffect.next();
- }
- SynchVis();
- }
-
- function OnStateChange()
- {
- var osState = player.OpenState;
-
- if (osMediaOpen == player.OpenState)
- {
- InitVisualizations();
- UpdateTitles();
- if (player.currentmedia.getItemInfo("BannerURL") != "")
- {
- ShowBanner(true);
- }
- else
- {
- ShowBanner(false);
- }
-
- if (player.currentMedia.ImageSourceWidth > 0)
- {
- ShowVisualizations(false);
- video1.visible=true;
- }
- else
- {
- btnCoverArtType = "";
- ShowVisualizations(true);
- video1.visible=false;
- }
- }
- UpdateFullscreenButtonEnabled();
- }
-
- function ShowVisualizations(state)
- {
- if(true == state)
- {
- if (true == mediacenter.showAlbumArt)
- {
- SetVisualStyle("AlbumArt");
- SizeViz();
- }
- else if (true == mediacenter.showEffects)
- {
- SetVisualStyle("viz");
- SizeViz();
- }
- }
- else
- {
- SetVisualStyle("None");
- }
- }
-
- function myOnVideoStart()
- {
- ShowVisualizations(false);
- video1.visible=true;
- }
-
- function ShowBanner(state)
- {
- if (state != svBanner.visible)
- {
- svBanner.visible = state;
-
- if (state == true)
- {
- svBanner.visible = true;
- svScreen.height -= svBanner.height;
- }
- else
- {
- svBanner.visible = false;
- svScreen.height += svBanner.height;
- }
- }
- }
-
- function UpdateFullscreenButtonEnabled()
- {
- FullScreenBtn.enabled = FullScreenAvailable();
- }
-
- function FullScreenAvailable()
- {
- var pstate = player.playState;
- if ( (player.currentMedia) && ((pstate==psPlaying) || (pstate==psPaused)) )
- {
- if (player.currentMedia.imageSourceHeight == 0)
- {
- return myeffect.effectCanGoFullscreen;
- }
- else
- {
- return true;
- }
- }
- else
- {
- return false;
- }
- }
-
- function UpdateMenuButton(domain)
- {
- Menu.visible = ("videoManagerMenu" != domain) && ("videoTitleSetMenu" != domain);
- }
-
- function VizPopupSelect(index)
- {
- if(index == 0)
- {
- mediacenter.showAlbumArt = true;
- }
- else
- {
- mediacenter.showAlbumArt = false;
- mediacenter.showEffects = true;
-
- var effectType = myeffect.effectType(index - 1);
- myeffect.currentEffectType = effectType;
- }
- SynchVis();
- }
-
- function SynchVis()
- {
- var nPreset = myeffect.currentPreset;
- mediacenter.effectType = myeffect.currentEffectType;
- mediacenter.effectPreset = nPreset;
- }
-
- function InitVizSelectPopup()
- {
- var ec = myeffect.effectCount;
- if (VizSelectPopup.itemCount != ec)
- {
- VizSelectPopup.deleteAll();
-
- var szAlbumArt = theme.loadString("res://wmploc.dll/RT_STRING/#209");
- VizSelectPopup.appendItem(szAlbumArt);
-
- var vizName = "";
- for (var index=0; index<ec; index++)
- {
- vizName = myeffect.effectTitle(index);
- if (""!=vizName)
- {
- VizSelectPopup.appendItem(vizName);
- }
- }
- }
- }
-
-
-
- function OnClickRatingButton()
- {
- if (player.currentMedia)
- {
- var nrating = Math.floor(event.x / 16) + 1;
-
- if (nrating == 1)
- nrating = 1;
- else if (nrating == 2)
- nrating = 25;
- else if (nrating == 3)
- nrating = 50;
- else if (nrating == 4)
- nrating = 75;
- else if (nrating == 5)
- nrating = 99;
-
- player.currentMedia.setItemInfo( "UserRating", nrating );
-
- UpdateRating();
- }
- }
-
- function UpdateRating()
- {
- if (player.currentMedia)
- {
- var srating = player.currentMedia.getItemInfo( "UserRating" );
- var nrating = parseInt( srating );
-
- if (nrating <= 0)
- nrating = 0;
- else if (nrating < 25)
- nrating = 1;
- else if (nrating < 50)
- nrating = 2;
- else if (nrating < 75)
- nrating = 3;
- else if (nrating < 99)
- nrating = 4;
- else
- nrating = 5;
-
- ratingbutton.left = -(80*nrating);
- }
- }
-