home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2003 April
/
Chip_2003-04_cd1.bin
/
zkuste
/
wmakeup
/
download
/
TweakMP.EXE
/
RCDATA
/
CABINET
/
tweak.wmz
/
Customizer.js
next >
Wrap
Text File
|
2003-01-07
|
10KB
|
481 lines
////
// Microsoft Windows Media Technologies
// Copyright (C) Microsoft Corporation. All Rights Reserved.
////
// main view
var g_kMainViewHeight = 220;
var g_kMainViewWidth = 435;
var g_kMainViewTop = 62;
var g_kMainViewLeft = 0;
var g_NowPlayingTopBase = 83;
var g_NowPlayingLeftBase = 30;
var g_GeneralTopBase = 15;
var g_GeneralLeftBase = 15;
var g_CDTopBase = 30;
var g_CDLeftBase = 10;
var g_purpose; // purpose of active modal message
var imageMappings = new Array();
var downImageMappings = new Array();
var g_kFontSize = 8;
var g_kOKLeft = 115;
var g_kCancelLeft = 305;
function KeyPressed(keycode)
{
switch(keycode)
{
// Left arrow / Page up
case 37: // fallthrough
case 33:
{
TabLeft();
}
break;
// Right arrow / Page down
case 39:
case 34:
{
TabRight();
}
break;
}
}
function CenterTextOnButton( text, button )
{
text.left = (button.left + (button.width/2 - text.width/2) );
text.top = (button.top + (button.height/2 - text.height/2))-1 ;
}
function UpdateNormalizationCheck()
{
if( !fsplugin.enableNormalize )
{
NormalizeText.foregroundColor="#cccccc"
NormalizeAudio.enabled = false;
NormalizeExtraText.value = strNormalizeExtraText.value;
}
}
function CenterGeneralButtons()
{
CenterTextOnButton( ResetText, ResetButton );
CenterTextOnButton( RestoreText, RestoreButton );
}
function TabRight()
{
if ( GeneralTab.down )
{
ShowCD();
}
else if ( CDTab.down )
{
ShowNowPlaying();
}
else if ( NowPlayingTab.down )
{
ShowGeneral();
}
}
function GetFSToolTip ( value )
{
if ( value == 0 )
{
return strHideControls.value + strInstantly.value;
}
else if ( Math.round((1.0/value)*10.0) / 10.0 == 1)
{
return strHideControls.value + strNormal.value;
}
else if ( value > 1 )
{
return strHideControls.value + value + strSlowerNormal.value;
}
else if ( value < 1 )
{
return strHideControls.value + ( Math.round((1.0/value)*10.0) / 10.0) + strFasterNormal.value;
}
}
function GetCursorToolTip( value )
{
if ( value == 0 )
{
return strHideCursor.value + strInstantly.value;
}
else if ( Math.round((1.0/value)*10.0) / 10.0 == 1 )
{
return strHideCursor.value + strNormal.value;
}
else if ( value > 1 )
{
return strHideCursor.value + value + strSlowerNormal.value;
}
else if ( value < 1 )
{
return strHideCursor.value + ( Math.round((1.0/value)*10.0) / 10.0) + strFasterNormal.value;
}
}
function TabLeft()
{
if ( GeneralTab.down )
{
ShowNowPlaying();
}
else if ( CDTab.down )
{
ShowGeneral();
}
else if ( NowPlayingTab.down )
{
ShowCD();
}
}
// change state of element to hover
function HoverElement ( element )
{
imageMappings[element.id] = element.image;
downImageMappings[element.id] = element.downImage;
element.image = element.hoverImage;
element.downImage = element.hoverDownImage;
}
// change state of element to "normal"
function UnHoverElement(element)
{
element.image = imageMappings[element.id];
element.downImage = downImageMappings[element.id];
}
function FadeOut(element)
{
if (element.visible)
{
element.alphaBlendTo(0,200);
element.visible = false;
}
}
function FadeIn(element)
{
if (!element.visible)
{
element.alphaBlendTo(0,0);
element.visible = true;
element.alphaBlendTo(255,200);
}
}
// converts characters not valid for path/filenames
function ConvertInvalidChars(str)
{
return str.replace(/[/\\:?\*"<>|]/g , '-');
}
function ConvertSpaces(str)
{
return str.replace(/ /g, strSpace.value);
}
function UpdateFS(start, end, value)
{
fsplugin.CDRecordFileSeparator = ConvertInvalidChars(value);
}
function ShowNowPlaying()
{
FadeOut(GeneralView);
FadeOut(CDView);
FadeIn(NowPlayingView);
NowPlaying.ForegroundColor = "#C3FF3E";
NowPlayingTab.down = true;
CD.ForegroundColor = "#FFFFFF";
CDTab.down = false;
General.ForegroundColor = "#FFFFFF";
GeneralTab.down = false;
}
function ShowGeneral()
{
FadeOut(NowPlayingView)
FadeOut(CDView )
FadeIn(GeneralView);
General.ForegroundColor = "#C3FF3E";
GeneralTab.down = true;
CD.ForegroundColor ="#FFFFFF";
CDTab.down = false;
NowPlaying.ForegroundColor = "#FFFFFF";
NowPlayingTab.down = false;
}
function ShowCD()
{
FadeOut(NowPlayingView);
FadeOut(GeneralView);
FadeIn(CDView);
CD.ForegroundColor = "#C3FF3E";
CDTab.down = true;
General.ForegroundColor = "#FFFFFF";
GeneralTab.down = false;
NowPlaying.ForegroundColor = "#FFFFFF";
NowPlayingTab.down = false;
}
function GetDoubleClickPlaylistText()
{
if ( fsplugin.DoubleClickPlay == 0 )
{
return strShiftDoubleClick.value;
}
else
{
return strDoubleClick.value;
}
}
// re-enable tabs
function EnableTabs()
{
NowPlaying.enabled = true;
CD.enabled = true;
General.enabled = true;
NowPlayingTab.enabled = true;
CDTab.enabled = true;
GeneralTab.enabled = true;
}
// disable tabs, used to prevent changing tabs
// during a modal message
function DisableTabs(textException, tabException)
{
NowPlaying.enabled = false;
CD.enabled = false;
General.enabled = false;
NowPlayingTab.enabled = false;
CDTab.enabled = false;
GeneralTab.enabled = false;
textException.enabled = true;
tabException.enabled = true;
}
function ResetPreferences()
{
fsplugin.ResetPreferences();
RestoreText.enabled = fsplugin.canRestorePreferences;
RestoreButton.enabled = fsplugin.canRestorePreferences;
fsplugin.SetWindowSize(686, 536);
fsplugin.ClosePlayer();
}
function RestorePreferences()
{
fsplugin.RestorePreferences();
RestoreText.enabled = fsplugin.canRestorePreferences;
RestoreButton.enabled = fsplugin.canRestorePreferences;
fsplugin.SetWindowSize(fsplugin.WindowWidth, fsplugin.WindowHeight);
fsplugin.ClosePlayer();
}
function ResetModalView()
{
FileSeparatorEdit.value = "";
FileSeparatorEdit.visible = false;
ModalTitle.accDescription = "";
ModalText.accDescription = "";
ModalTitle.left = 11;
ModalWarning.left = 38;
ModalWarning.top = 108;
ModalImage.visible = false;
ModalTitle.value = " ";
ModalText.value = " ";
ModalWarning.value = " ";
ModalFSText.visible = false;
OK.visible = false;
OK.value = strOK.value;
Cancel.visible = false;
Cancel.value = strCancel.value;
CenterTextOnButton( OK, OKButton );
CenterTextOnButton( Cancel, CancelButton );
}
function ModalMessage(purpose)
{
ResetModalView();
g_purpose = purpose;
OK.visible = true;
OKButton.visible = true;
Cancel.visible = true;
CancelButton.visible = true;
switch (purpose)
{
case 'reset':
{
FadeOut(GeneralView);
if (!fsplugin.canRestorePreferences)
{
ModalTitle.value = strResetDefaultTitle.value;
ModalText.value = strResetDefault.value;
ModalWarning.value = strResetWarning.value;
ModalWarning.top = 83;
ModalTitle.left = 78;
ModalImage.visible = true;
}
else
{
ModalTitle.value = strOverwritingTitle.value;
ModalText.value = strOverwritingMessage.value;
ModalWarning.value = strOverwriteWarning.value;
ModalWarning.top = 96;
ModalTitle.left = 78;
ModalImage.visible = true;
}
FadeIn(ModalView);
DisableTabs(General, GeneralTab);
OK.value = strYes.value;
Cancel.value = strNo.value;
OK.left = g_kOKLeft-4;
Cancel.left = g_kCancelLeft+10;
CenterTextOnButton( OK, OKButton );
CenterTextOnButton( Cancel, CancelButton );
}
break;
case 'restore':
{
FadeOut(GeneralView);
ModalTitle.value = strRestoreTitle.value;
ModalText.value = strRestoreSettings.value;
ModalWarning.value = strRestoreWarning.value;
FadeIn(ModalView);
DisableTabs(General, GeneralTab);
OK.value = strYes.value;
Cancel.value = strNo.value;
OK.left = g_kOKLeft-4;
Cancel.left = g_kCancelLeft+10;
CenterTextOnButton( OK, OKButton );
CenterTextOnButton( Cancel, CancelButton );
ModalTitle.left = 78;
ModalImage.visible = true;
ModalWarning.top = 83;
}
break;
case 'separator':
{
FadeOut(CDView);
ModalTitle.value = strChooseSeparator.value;
ModalText.value = strConfirmSeparator.value + "\n\n" + strConfirmSeparatorLine2.value;
FileSeparatorEdit.visible = true;
FadeIn(ModalView);
DisableTabs(CD, CDTab);
ModalFSText.visible = true;
}
default:
{
}
}
ModalTitle.accDescription=ModalTitle.value;
ModalText.accDescription=ModalText.value;
}
function ExitModal(bSaveSettings)
{
FadeOut(ModalView);
EnableTabs(true);
switch (g_purpose)
{
case 'reset':
{
FadeIn(GeneralView);
if (bSaveSettings)
{
ResetPreferences();
}
CDTab.enabled = true;
NowPlayingTab.enabled = true;
}
break;
case 'restore':
{
FadeIn(GeneralView);
if (bSaveSettings)
{
RestorePreferences();
}
CDTab.enabled = true;
NowPlayingTab.enabled = true;
}
break;
case 'separator':
{
if (bSaveSettings)
{
var convertedValue = ConvertInvalidChars(FileSeparatorEdit.value);
fsplugin.CDRecordFileSeparator = convertedValue;
FileSeparator.value = ConvertSpaces(convertedValue);
}
FadeIn(CDView);
GeneralTab.enabled = true;
NowPlayingTab.enabled = true;
}
break;
default:
{
return;
}
}
}