home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 April / Chip_2003-04_cd1.bin / zkuste / wmakeup / download / XboxLive-Remix.wmz / xlive.js < prev    next >
Text (UTF-16)  |  2003-01-07  |  32KB  |  755 lines

  1. /*
  2.     The Skins Factory
  3.     http://www.theskinsfactory.com
  4.     info@theskinsfactory.com
  5. */
  6.  
  7. function checkMediaOnLoad(){
  8.     if(player){}
  9.     view.width = 0;
  10.     view.height = 0;
  11.     view.backgroundImage = "";
  12.     theme.currentViewID = "mainView";
  13. }
  14.  
  15. var introAnim = true;
  16. var playAnim = false;
  17.  
  18. function introSequence(){
  19.     if(introAnim){
  20.         mainIntro.backgroundImage = "intro_anim.gif";
  21.         checkSoundPref( 'intro.wav' );
  22.         view.timerInterval = 13200;
  23.         introAnim = false;
  24.         playAnim = true;
  25.         if(player.OpenState==13&&(!player.currentMedia.ImageSourceWidth>0)){
  26.             theme.savePreference("vidViewer", "false");
  27.         }
  28.     }else if(playAnim){
  29.         shutterButton.enabled = true;
  30.         playbackAnim.visible = true;
  31.             playAnim = false;
  32.             view.timerInterval = 0;
  33.         if(playAnim&&player.playState==3){
  34.             if(player.OpenState==13&&(!player.currentMedia.ImageSourceWidth>0)){
  35.                 playbackAnim.alphaBlendTo(255,500);
  36.                 visButton.enabled = true;
  37.                 visStatus = 1;
  38.             }
  39.         }
  40.     }
  41. }
  42.  
  43. var visStatus = 1;
  44.  
  45. function toggleVis(){
  46.     if(("false"==theme.loadPreference("visViewer"))&&visStatus==3){
  47.         visStatus = 1;
  48.     }
  49.     switch(visStatus){
  50.         case 1:
  51.             playbackAnim.visible = true;
  52.             playbackAnim.alphaBlendTo(255,500);
  53.             break;
  54.         case 2:
  55.             playbackAnim.alphaBlendTo(0,500);
  56.             toggleView('visView','visViewer');
  57.             break;
  58.         case 3:
  59.             toggleView('visView','visViewer');
  60.             visStatus = 0;
  61.             break;
  62.     }
  63. }
  64.  
  65. var shutterStatus = false;
  66.  
  67. function toggleShutter(){
  68.     if(!shutterStatus){
  69.         mainShutter.backgroundImage = "shutter_close.gif";
  70.         shutterStatic.visible = true;
  71.         volume.visible = seek.visible = playbackAnim.visible = false;
  72.         shutterStatus = !shutterStatus;
  73.     }else{
  74.         mainShutter.backgroundImage = "shutter_open.gif";
  75.         shutterStatic.visible = false;
  76.         volume.visible = seek.visible = playbackAnim.visible = true;
  77.         shutterStatus = !shutterStatus;
  78.     }
  79. }
  80.  
  81. // sound fx
  82.  
  83. function loadSoundPrefValue(){
  84.     var val = theme.loadPreference('soundFX');
  85.     if(val=='--'){
  86.         theme.savePreference("soundFX", "true");
  87.     }
  88. }
  89.  
  90. function checkSoundPref(type){
  91.     if("true"==theme.loadPreference("soundFX")){
  92.         theme.playSound( type );
  93.     }
  94. }
  95.  
  96. // startup
  97.  
  98. function mainStartUp(){
  99.     loadSoundPrefValue();
  100.     volume.value = player.settings.volume;
  101.     loadMainPrefs();
  102.     checkPlayerState();
  103. }
  104.  
  105. /*
  106. if(!introAnim&&(visStatus==1)&&(!shutterStatus)&&(!player.currentMedia.ImageSourceWidth>0)){
  107.                     playbackAnim.alphaBlendTo(255,500);
  108.                     visButton.enabled = true;
  109.                     break;
  110.                 }else if(!introAnim&&(visStatus==1||visStatus==2||visStatus==0)&&(player.currentMedia.ImageSourceWidth>0)){
  111.                     playbackAnim.alphaBlendTo(0,500);
  112.                     visButton.enabled = false;
  113.                     break;
  114.                 }else if(visStatus==2&&(!shutterStatus)&&(!player.currentMedia.ImageSourceWidth>0)){
  115.                     visStatus = 2
  116.                     visButton.enabled = true;
  117.                     break;
  118.                 }else if(!introAnim&&(visStatus==0||visStatus==2)&&(!shutterStatus)&&(!player.currentMedia.ImageSourceWidth>0)){
  119.                     visStatus = 0;
  120.                     toggleVis();
  121.                     visButton.enabled = true;
  122.                     break;
  123.                 }
  124.                 break;
  125. */
  126.  
  127. function checkPlayerState(){
  128.  
  129.     if (player){
  130.         switch (player.playState){
  131.  
  132.             case 3:     //playing
  133.                 if(("false"==theme.loadPreference("vidViewer"))&&player.currentMedia.ImageSourceWidth>0){
  134.                     theme.openView('videoView');
  135.                     theme.openView('remoteView');
  136.                     playbackAnim.alphaBlendTo(0,500);
  137.                     if("true"==theme.loadPreference("visViewer")){
  138.                         theme.savePreference("visViewer", "false");
  139.                         visStatus = visStatus;
  140.                         theme.closeView( "visView" );
  141.                     }
  142.                     break
  143.                 }else if(player.currentMedia.ImageSourceWidth>0){
  144.                     playbackAnim.alphaBlendTo(0,500);
  145.                     visButton.enabled = false;
  146.                     break;
  147.                 }
  148.                 if(!player.currentMedia.ImageSourceWidth>0){
  149.                     if((!introAnim)&&(visStatus==1)&&(!shutterStatus)){
  150.                         playbackAnim.alphaBlendTo(255,500);
  151.                         visButton.enabled = true;
  152.                     }else if((!introAnim)&&(visStatus==2)&&(!shutterStatus)){
  153.                         playbackAnim.alphaBlendTo(0,500);
  154.                         visStatus = 2
  155.                         visButton.enabled = true;
  156.                     }else if((!introAnim)&&(visStatus==0)&&(!shutterStatus)){
  157.                         visStatus = 0;
  158.                         toggleVis();
  159.                         visButton.enabled = true;
  160.                     }else{
  161.                         visStatus = visStatus;
  162.                         visButton.enabled = true;
  163.                     }
  164.                 break;
  165.                 }
  166.             }
  167.         }
  168.  
  169.     if (!player.controls.isAvailable("Stop")) {
  170.         if(playbackAnim.alphaBlend==255){
  171.             playbackAnim.alphaBlendTo(0,500);
  172.         }
  173.         visButton.enabled = false;
  174.         visStatus = visStatus;
  175.  
  176.     }
  177.     updateMetadata();
  178. }
  179.  
  180. // metadata
  181.  
  182. function updateMetadata(){
  183.  
  184.     if(player.openState!=13) return;
  185.  
  186.     metadata.value = player.status;
  187.  
  188.     authorppl = player.currentmedia.getiteminfo("#author");
  189.  
  190.     if (authorppl == "") {
  191.         authorppl = player.currentmedia.getiteminfo("author");
  192.     }
  193.  
  194.     if (authorppl != "") {
  195.         authorppl += " - ";
  196.     }
  197.  
  198.     if (metadata.value != "") {
  199.         metadata.value += " - ";
  200.     }
  201.  
  202.     metadata.value += authorppl;
  203.     metadata.value += player.currentmedia.name;
  204.     metadata.scrolling = (metadata.textWidth>metadata.width);
  205.  
  206. }
  207.  
  208. // button and hotkey definitions
  209.  
  210. // open file
  211. function openFile(){
  212.     var media = theme.openDialog('FILE_OPEN','FILES_ALLMEDIA');
  213.     if (media) {
  214.         player.URL = media;
  215.         player.controls.play();
  216.     }
  217. }
  218.  
  219. function viewHotKeys(){
  220.     switch(event.keycode){
  221.         case 122:
  222.         case 90:
  223.             player.controls.previous();
  224.             break;
  225.         case 120:
  226.         case 88:
  227.             player.controls.play();
  228.             break;
  229.         case 99:
  230.         case 67:
  231.             player.controls.pause();
  232.             break;
  233.         case 118:
  234.         case 86:
  235.             player.controls.stop();
  236.             break;
  237.         case 98:
  238.         case 66:
  239.             player.controls.next();
  240.             break;
  241.         case 108:
  242.         case 76:
  243.             openFile();
  244.             break;
  245.     }
  246. }
  247.  
  248. function viewResizer(event){
  249.     switch(event.keycode){
  250.         case 37:
  251.             view.width-=20;
  252.             break;
  253.         case 38:
  254.             view.height-=20
  255.             break;
  256.         case 39:
  257.             view.width+=20;
  258.             break;
  259.         case 40:
  260.             view.height+=20;
  261.             break;
  262.         }
  263. }
  264.  
  265. function updateToolTip(id,button,tip){
  266.     if("true"==theme.loadPreference( id )){
  267.         eval( button +".upToolTip = locHide" + tip + ".toolTip" );
  268.     }else{
  269.         eval( button +".upToolTip = locShow" + tip + ".toolTip" );
  270.     }
  271. }
  272.  
  273. function updateVolToolTip(){
  274.     volume.toolTip = "";
  275.     volume.toolTip += player.settings.volume;
  276. }
  277.  
  278. function updateShuffRep(){
  279.     if(player.settings.getMode('shuffle')){
  280.         shuffleButton.down = true;
  281.     }else{
  282.         shuffleButton.down = false;
  283.     }
  284.  
  285.     if(player.settings.getMode('loop')){
  286.         repeatButton.down = true;
  287.     }else{
  288.         repeatButton.down = false;
  289.     }
  290. }
  291.  
  292. //
  293.  
  294. function volKey(event){
  295.     switch(event.keycode){
  296.         case 39:
  297.         case 38:
  298.             if(player.settings.volume < 95){
  299.                 player.settings.volume+=5;
  300.             }else{
  301.                 player.settings.volume = 100;
  302.             }
  303.             break;
  304.         case 37:
  305.         case 40:
  306.             if(player.settings.volume > 5){
  307.                 player.settings.volume-=5;
  308.             }else{
  309.                 player.settings.volume = 0;
  310.             }
  311.             break;        
  312.         }
  313.         //mute.down = false;
  314.         player.settings.mute = false;
  315.     }
  316.  
  317. function seekKey(event){
  318.     switch(event.keycode){
  319.         //case 37:
  320.         case 38:
  321.             if(player.controls.currentPosition > 10){
  322.                 player.controls.currentPosition-=10;
  323.             }else{
  324.                 player.controls.currentPosition = 0;
  325.             }
  326.             break;
  327.         //case 39:
  328.         case 40:
  329.             if(player.controls.currentPosition < 900){
  330.                 player.controls.currentPosition+=10;
  331.             }else{
  332.                 player.controls.currentPosition = 1000;
  333.             }
  334.             break;        
  335.         }
  336.     }
  337.  
  338. // view toggle 
  339.  
  340. function toggleView(name,id){
  341.     if("true"==theme.loadPreference(id)){
  342.         theme.savePreference(id, "false");
  343.         theme.closeView( name );
  344.     }else{
  345.         theme.openView( name );
  346.     }
  347. }
  348.  
  349. function closeView(id){
  350.     theme.savePreference(id, "false");
  351.     if( id=="vidViewer" && player.currentMedia.ImageSourceWidth>0 ){
  352.         player.controls.stop();
  353.     }
  354.     view.close();
  355. }
  356.  
  357. function autoSizeView(width,height){
  358.     var viewSize = theme.loadPreference( width );
  359.  
  360.     if( "--" != viewSize )
  361.     {
  362.         view.width = viewSize;
  363.     }else{
  364.         view.width = view.minWidth;
  365.     }
  366.  
  367.     viewSize = theme.loadpreference( height );
  368.  
  369.     if( "--" != viewSize )
  370.     {
  371.         view.height = viewSize;
  372.     }else{
  373.         view.height = view.minHeight;
  374.     }
  375. }
  376.  
  377. function saveViewSize(width,height){
  378.     theme.savepreference( width , view.width );
  379.     theme.savepreference( height , view.height );
  380. }
  381.  
  382. // preferences
  383.  
  384. function loadMainPrefs(){
  385.  
  386.     if ("true"==theme.loadPreference("plViewer")){
  387.         theme.openView( 'plView' );
  388.     }
  389.  
  390.     if ("true"==theme.loadPreference("infoViewer")){
  391.         theme.openView( 'infoView' );
  392.     }
  393.  
  394.     if ("true"==theme.loadPreference("eqViewer")){
  395.         theme.openView( 'eqView' );
  396.     }
  397.  
  398. }
  399.  
  400. function saveMainPrefs() {
  401.     theme.savePreference("visViewer", "false");
  402.     theme.savePreference("vidViewer", "false");
  403. }
  404.  
  405. function mainShutDown(){
  406.     saveMainPrefs();
  407. }
  408.  
  409. // playlist
  410. function loadPlPrefs(){
  411.     theme.savePreference( 'plViewer', "true" );
  412.  
  413.     autoSizeView('plWidth','plHeight');
  414.  
  415.     var index = 0;
  416.  
  417.     playlist1.setColumnResizeMode( index++, "Stretches" );
  418.     playlist1.setColumnResizeMode( index++, "AutosizeHeader" );
  419.     playlist1.setColumnResizeMode( index++, "AutosizeHeader" );
  420.     playlist1.setColumnResizeMode( index++, "AutosizeHeader" );
  421.     playlist1.setColumnResizeMode( index++, "AutosizeHeader" );
  422.  
  423. }
  424.  
  425. function addToPlaylist(){
  426.     var media = theme.openDialog( "FILE_OPEN" , "FILES_ALLMEDIA" );
  427.     if(media){
  428.         newMedia = player.mediaCollection.add( media );
  429.         playlist1.playlist.appendItem( newMedia );
  430.     }
  431. }
  432.  
  433. function delFromPlaylist(){
  434.     playlist1.deleteSelected()
  435. }
  436.  
  437. function savePlPrefs(){
  438.     saveViewSize('plWidth','plHeight');
  439. }
  440.  
  441. // equalizer
  442. function loadEQPrefs(){
  443.     theme.savePreference( 'eqViewer', "true" );
  444.     view.width = view.minWidth;
  445.     view.height = view.minHeight;
  446. }
  447.  
  448. function updateBalToolTip(){
  449.     balance.toolTip = "";
  450.     balance.toolTip += player.settings.balance;
  451. }
  452.  
  453. function toggleSkinFx(){
  454.     if("true"==theme.loadPreference("soundFX")){
  455.         theme.savePreference("soundFX", "false");
  456.     }else{
  457.         theme.savePreference("soundFX", "true");
  458.     }
  459. }
  460.  
  461. function toggleSpeaker(){
  462.     if(eq.speakerSize==2){
  463.         eq.speakerSize = -1;
  464.     }
  465.     eq.speakerSize++
  466. }
  467.  
  468. // visualizations
  469. function loadVisPrefs(){
  470.     theme.savePreference( 'visViewer', "true" );
  471.     visEffects.currentEffectType = mediacenter.effectType;
  472.     visEffects.currentPreset = mediacenter.effectPreset;
  473.  
  474.     autoSizeView('visWidth','visHeight');
  475.  
  476.     checkVisualsPlayerState()
  477. }
  478.  
  479. function saveVisPrefs(){
  480.     mediacenter.effectType = visEffects.currentEffectType;
  481.     mediacenter.effectPreset = visEffects.currentPreset;
  482.     saveViewSize('visWidth','visHeight');
  483. }
  484.  
  485. function checkVisualsPlayerState(){
  486.  
  487.     if (player){
  488.         switch (player.playState){
  489.             case 3:     //playing
  490.                 //visMask.visible = true;
  491.                 break;
  492.  
  493.             }
  494.         }
  495.  
  496.     if (!player.controls.isAvailable("Stop")) {
  497.         //visMask.visible = false;
  498.     }
  499. }
  500.  
  501. function displayVisText(){
  502.     visEffectsText.visible = true;
  503.     visEffectsText.value = visEffects.currentEffectTitle + ": " + visEffects.currentPresetTitle;
  504.     visView.timerInterval = 6000
  505. }
  506.  
  507. function hideVisText(){
  508.     visEffectsText.visible = false;
  509.     visView.timerInterval = 0
  510. }
  511.  
  512.  
  513.  
  514. // video
  515.  
  516. function loadVidPrefs(){
  517.     theme.savePreference( 'vidViewer', "true" );
  518.     checkSnapStatus();
  519.     checkVideoPlayerState();
  520.     updateZoomToolTip();
  521. }
  522.  
  523. function saveVidPrefs(){
  524.  
  525. }
  526.  
  527. function loadVidSize(){
  528.     var vidSizer = theme.loadPreference( "videoWidth" );
  529.  
  530.     if( "--" != vidSizer )
  531.     {
  532.         view.width = vidSizer;
  533.     }
  534.     vidSizer = theme.loadpreference( "videoHeight" );
  535.  
  536.     if( "--" != vidSizer )
  537.     {
  538.         view.height = vidSizer;
  539.     }
  540. }
  541.  
  542. function saveVidSize(){
  543.     theme.savepreference( "videoWidth", view.width );
  544.     theme.savepreference( "videoHeight", view.height );
  545.     theme.savePreference("vidSnapper" , "false");
  546.     vidZoom.upToolTip = vidSetTip.toolTip;
  547.     mediacenter.videoZoom = 50;
  548. }
  549.  
  550. function videoZoom(){
  551.     if("false"==theme.loadPreference("vidSnapper")){
  552.         mediacenter.videoZoom = 50;
  553.     }
  554.     if(mediacenter.videoZoom < 76){
  555.         mediacenter.videoZoom = 100;
  556.     }else if(mediacenter.videoZoom <101){
  557.         mediacenter.videoZoom = 150;
  558.     }else if(mediacenter.videoZoom < 156){
  559.         mediacenter.videoZoom = 200;
  560.     }else{
  561.         mediacenter.videoZoom = 75;
  562.     }
  563.     SnapToVideo();
  564.     updateZoomToolTip();
  565. }
  566.  
  567. function updateZoomToolTip(){
  568.  
  569.     vidZoom.upToolTip = vidZoomIn.toolTip + mediacenter.videoZoom + vidZoomMid.toolTip;
  570.  
  571.     if(mediacenter.videoZoom < 76){
  572.         nextZoom = 100;
  573.     }else if(mediacenter.videoZoom <101){
  574.         nextZoom = 150;
  575.     }else if(mediacenter.videoZoom < 156){
  576.         nextZoom = 200;
  577.     }else{
  578.         nextZoom = 75;
  579.     }
  580.  
  581.     vidZoom.upToolTip += nextZoom + vidZoomOut.toolTip;
  582.     
  583.     if("false"==theme.loadPreference("vidSnapper")){
  584.         vidZoom.upToolTip = vidSetTip.toolTip;
  585.     }
  586. }
  587.  
  588. function SnapToVideo(){
  589.  
  590.     theme.savePreference("vidSnapper" , "true");
  591.  
  592.     var zoom = mediacenter.videoZoom;
  593.     var viewWidth = (player.currentMedia.imageSourceWidth * (zoom/100.00));
  594.     var viewHeight = (player.currentMedia.imageSourceHeight * (zoom/100.00));
  595.  
  596.     view.width = viewWidth + 128;
  597.     view.height = viewHeight + 128;
  598. }
  599.  
  600. function checkSnapStatus(){
  601.     if("false"==theme.loadPreference("vidSnapper")){
  602.         loadVidSize();
  603.     }else{
  604.         SnapToVideo();
  605.     }
  606. }
  607.  
  608. function checkVideoPlayerState(){
  609.     if (player){
  610.         switch (player.playState){
  611.             case 0:        //undefined
  612.                 
  613.                 break;
  614.             case 1:        //stopped
  615.  
  616.                 break;
  617.             case 2:        //paused
  618.  
  619.                 break;
  620.             case 3:     //playing
  621.                 videoFrame.visible = true;
  622.                 if(!player.fullScreen){
  623.                     checkSnapStatus();
  624.                 }
  625.                 if(!player.currentMedia.ImageSourceWidth>0){
  626.                     theme.savePreference('vidViewer', "false");
  627.                     view.close();
  628.                     break;
  629.                 }
  630.                 break;
  631.             case 6:        //buffering
  632.                 
  633.                 break;
  634.             case 7:        //waiting
  635.                 
  636.                 break;
  637.             case 8:        //media ended
  638.                 
  639.                 break;
  640.             case 9:        //Transitioning
  641.                 
  642.                 break;
  643.             case 10:    //Ready
  644.                 
  645.                 break;
  646.             }
  647.             vidResize.enabled = true;
  648.             vidZoom.enabled = true;
  649.             xLiveLogo.alphaBlend = 0;
  650.         }
  651.  
  652.     if (!player.controls.isAvailable("Stop")) {
  653.         videoFrame.visible = false;
  654.         vidResize.enabled = false;
  655.         vidZoom.enabled = false;
  656.         xLiveLogo.alphaBlendTo(255,800);
  657.         view.width = view.minWidth;
  658.         view.height = view.minHeight;
  659.     }
  660. }
  661.  
  662. // vid remote
  663.  
  664. function loadVidRemotePrefs(){
  665.     theme.savePreference( 'remoteViewer', "true" );
  666.     view.width = view.minWidth;
  667.     view.height = view.minHeight;
  668. }
  669.  
  670. function checkVideoRemotePlayerState(){
  671.     if (player){
  672.         switch (player.playState){
  673.             case 3:     //playing
  674.                 if(!player.currentMedia.ImageSourceWidth>0){
  675.                     view.close();
  676.                     break;
  677.                 }
  678.                 break;
  679.             }
  680.         }
  681.  
  682.     if (!player.controls.isAvailable("Stop")) {
  683.  
  684.     }
  685. }
  686.  
  687. function checkParentVid(){
  688.     if("false"==theme.loadPreference("vidViewer")){
  689.         view.close();
  690.     }
  691. }
  692.  
  693. // info / content
  694.  
  695. function loadInfoPrefs(){
  696.     theme.savePreference( 'infoViewer', "true" );
  697.     view.width = view.minWidth;
  698.     view.height = view.minHeight;
  699. }
  700.  
  701. var infoGo = 0;
  702.  
  703. function showInfo(menu,nav,infoGo){
  704.     infoMenuBack.visible = menu;
  705.     infoNavSub.visible = nav;
  706.     switch(infoGo){
  707.         case 0:
  708.             infoSub.backgroundImage = "";
  709.             infoMenuBack.visible = true;
  710.             break;
  711.         case 1:
  712.             infoMode = 1;    // call sections
  713.             navGo = 1;
  714.             navLimit = 2;
  715.             infoNavNext();
  716.             break;
  717.         
  718.     }
  719. }
  720.  
  721. navGo = 1;
  722.  
  723. function infoNavNext(){
  724.     infoSub.backgroundImage = "c_sub_" + infoMode + "_" + navGo + ".jpg";
  725.     navCheck();
  726. }
  727.  
  728. function infoNavPrev(){
  729.     infoSub.backgroundImage = "c_sub_" + infoMode + "_" + navGo + ".jpg";
  730.     navCheck();
  731. }
  732.  
  733. function navCheck(){
  734.     if(navGo==0){
  735.         navPrev.enabled = false;
  736.         navNext.enabled = true;
  737.         showInfo('true','false',0);
  738.     }else if(navGo==navLimit && infoMode==infoMode){    // enable / disable sections
  739.         navNext.enabled = false;
  740.         navPrev.enabled = true;
  741.     }else{
  742.         navNext.enabled = true;
  743.         navPrev.enabled = true;
  744.     }
  745.     if(infoMode==1&&navGo==1){
  746.         link1.visible = true;
  747.         link2.visible = false;
  748.     }else if(infoMode==1&&navGo==2){
  749.         link1.visible = false;
  750.         link2.visible = true;
  751.     }else{
  752.         link1.visible = false;
  753.         link2.visible = false;
  754.     }
  755. }