home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 February / Chip_2003-02_cd1.bin / zkuste / wmakeup / download / MechAssaultWMPSkin.wmz / mech.js < prev    next >
Text (UTF-16)  |  2002-10-21  |  25KB  |  622 lines

  1. /*
  2.     http://www.theskinsfactory.com
  3.     info@theskinsfactory.com
  4. */
  5.  
  6. // variables
  7.  
  8. var shutterStatus = false;
  9.  
  10. function shutterToggle(){
  11.     if(!shutterStatus){
  12.         shutterSub.backgroundImage = "shutter_close.gif";
  13.         leftAnim.backgroundImage = "m_left_anim_rev.gif";
  14.         rightAnim.backgroundImage = "m_right_anim_rev.gif";
  15.         leftAnimSub.visible = true;
  16.         rightAnimSub.visible = true;
  17.         shutterStatic.visible = true;
  18.         seek.tabStop = false;
  19.         volume.tabStop = false;
  20.         shutterStatus = !shutterStatus;
  21.     }else{
  22.         shutterSub.backgroundImage = "shutter_open.gif";
  23.         leftAnim.backgroundImage = "m_left_anim.gif";
  24.         rightAnim.backgroundImage = "m_right_anim.gif";
  25.         leftAnimSub.visible = false;
  26.         rightAnimSub.visible = false;
  27.         shutterStatic.visible = false;
  28.         seek.tabStop = true;
  29.         volume.tabStop = true;
  30.         shutterStatus = !shutterStatus;
  31.     }
  32. }
  33.  
  34. function mainStartUp(){
  35.     volume.value = player.settings.volume;
  36.     loadMainPrefs();
  37.     checkPlayerState();
  38. }
  39.  
  40. function checkPlayerState(){
  41.  
  42.     if (player){
  43.         switch (player.playState){
  44.             case 0:        //undefined
  45.                 
  46.                 break;
  47.             case 1:        //stopped
  48.  
  49.                 break;
  50.             case 2:        //paused
  51.                 pauseAnim.visible = true;
  52.                 playAnim.visible = false;
  53.                 break;
  54.             case 3:     //playing
  55.                 if(player.currentMedia.ImageSourceWidth>0){
  56.                     theme.openView('videoView');
  57.                     if("true"==theme.loadPreference("visViewer")){
  58.                         theme.savePreference("visViewer", "false");
  59.                         theme.closeView( "visView" );
  60.                     }
  61.                     break
  62.                 }
  63.                 playAnim.visible = true;
  64.                 pauseAnim.visible = false;
  65.                 break;
  66.             case 6:        //buffering
  67.                 
  68.                 break;
  69.             case 7:        //waiting
  70.                 
  71.                 break;
  72.             case 8:        //media ended
  73.                 
  74.                 break;
  75.             case 9:        //Transitioning
  76.                 
  77.                 break;
  78.             case 10:    //Ready
  79.                 
  80.                 break;
  81.             }
  82.             
  83.         }
  84.  
  85.     if (!player.controls.isAvailable("Stop")) {
  86.         playAnim.visible = false;
  87.         pauseAnim.visible = false;
  88.     }
  89.     updateMetadata();
  90. }
  91.  
  92. // metadata
  93.  
  94. function updateMetadata(){
  95.  
  96.     if(player.openState!=13) return;
  97.  
  98.     metadata.value = player.status;
  99.  
  100.     authorppl = player.currentmedia.getiteminfo("#author");
  101.  
  102.     if (authorppl == "") {
  103.         authorppl = player.currentmedia.getiteminfo("author");
  104.     }
  105.  
  106.     if (authorppl != "") {
  107.         authorppl += " - ";
  108.     }
  109.  
  110.     if (metadata.value != "") {
  111.         metadata.value += " - ";
  112.     }
  113.  
  114.     metadata.value += authorppl;
  115.     metadata.value += player.currentmedia.name;
  116.     metadata.scrolling = (metadata.textWidth>metadata.width);
  117.     
  118. }
  119.  
  120. // button and hotkey definitions
  121.  
  122. // open file
  123. function openFile(){
  124.     var media = theme.openDialog('FILE_OPEN','FILES_ALLMEDIA');
  125.     if (media) {
  126.         player.URL = media;
  127.         player.controls.play();
  128.     }
  129. }
  130.  
  131. function viewHotKeys(){
  132.     switch(event.keycode){
  133.         case 122:
  134.         case 90:
  135.             player.controls.previous();
  136.             break;
  137.         case 120:
  138.         case 88:
  139.             player.controls.play();
  140.             break;
  141.         case 99:
  142.         case 67:
  143.             player.controls.pause();
  144.             break;
  145.         case 118:
  146.         case 86:
  147.             player.controls.stop();
  148.             break;
  149.         case 98:
  150.         case 66:
  151.             player.controls.next();
  152.             break;
  153.         case 108:
  154.         case 76:
  155.             openFile();
  156.             break;
  157.         case 80:
  158.         case 102:
  159.         case 70:
  160.  
  161.             break;
  162.  
  163.     }
  164. }
  165.  
  166. function viewResizer(event){
  167.     switch(event.keycode){
  168.         case 37:
  169.             view.width-=20;
  170.             break;
  171.         case 38:
  172.             view.height-=20
  173.             break;
  174.         case 39:
  175.             view.width+=20;
  176.             break;
  177.         case 40:
  178.             view.height+=20;
  179.             break;
  180.         }
  181. }
  182.  
  183. function volKey(event){
  184.     switch(event.keycode){
  185.         case 39:
  186.         case 38:
  187.             if(player.settings.volume < 95){
  188.                 player.settings.volume+=5;
  189.             }else{
  190.                 player.settings.volume = 100;
  191.             }
  192.             break;
  193.         case 37:
  194.         case 40:
  195.             if(player.settings.volume > 5){
  196.                 player.settings.volume-=5;
  197.             }else{
  198.                 player.settings.volume = 0;
  199.             }
  200.             break;        
  201.         }
  202.         mute.down = false;
  203.         player.settings.mute = false;
  204.     }
  205.  
  206. function updateToolTip(id,button,tip){
  207.     if("true"==theme.loadPreference( id )){
  208.         eval( button +".upToolTip = 'Hide " + tip + "'" );
  209.     }else{
  210.         eval( button +".upToolTip = 'Show " + tip + "'" );
  211.     }
  212. }
  213.  
  214. function updateVolToolTip(){
  215.     volume.toolTip = "";
  216.     volume.toolTip += player.settings.volume;
  217. }
  218.  
  219. function updateShuffRep(){
  220.     if(player.settings.getMode('shuffle')){
  221.         shuffleButton.down = true;
  222.     }else{
  223.         shuffleButton.down = false;
  224.     }
  225.  
  226.     if(player.settings.getMode('loop')){
  227.         loopButton.down = true;
  228.     }else{
  229.         loopButton.down = false;
  230.     }
  231. }
  232.  
  233. // view toggle 
  234.  
  235. function toggleView(name,id){
  236.     if("true"==theme.loadPreference(id)){
  237.         theme.savePreference(id, "false");
  238.         theme.closeView( name );
  239.     }else{
  240.         theme.openView( name );
  241.     }
  242. }
  243.  
  244. function closeView(id){
  245.     theme.savePreference(id, "false");
  246.     if( id=="vidViewer" && player.currentMedia.ImageSourceWidth>0 ){
  247.         player.controls.stop();
  248.     }
  249.     view.close();
  250. }
  251.  
  252. // preferences
  253.  
  254. function loadMainPrefs(){
  255.  
  256.     if ("true"==theme.loadPreference("plViewer")){
  257.         theme.openView( 'plView' );
  258.     }
  259.  
  260.     if ("true"==theme.loadPreference("visViewer")){
  261.         theme.openView( 'visView' );
  262.     }
  263.  
  264.     if ("true"==theme.loadPreference("eqViewer")){
  265.         theme.openView( 'eqView' );
  266.     }
  267.  
  268.     if ("true"==theme.loadPreference("infoViewer")){
  269.         theme.openView( 'infoView' );
  270.     }
  271. }
  272.  
  273. function saveMainPrefs() {
  274.  
  275. }
  276.  
  277. function mainShutDown(){
  278.     saveMainPrefs();
  279. }
  280.  
  281. // playlist
  282. function loadPlPrefs(){
  283.     theme.savePreference( 'plViewer', "true" );
  284.  
  285.     var dwScale = theme.loadPreference( "PlaylistWidth" );
  286.  
  287.     if( "--" != dwScale )
  288.     {
  289.         plView.width = dwScale;
  290.     }
  291.     dwScale = theme.loadpreference( "PlaylistHeight" );
  292.  
  293.     if( "--" != dwScale )
  294.     {
  295.         plView.height = dwScale;
  296.     }
  297.  
  298.     plFrame.setColumnResizeMode( 0, "stretches" );
  299.     plFrame.setColumnResizeMode( 1, "autosizedata" );
  300.     plFrame.setColumnResizeMode( 2, "autosizedata" );
  301.     plFrame.setColumnResizeMode( 3, "autosizedata" );
  302.  
  303. }
  304.  
  305. function savePlPrefs(){
  306.     theme.savepreference( "PlaylistWidth", plView.width );
  307.     theme.savepreference( "PlaylistHeight", plView.height );
  308. }
  309.  
  310. // equalizer
  311. function loadEQPrefs(){
  312.     theme.savePreference( 'eqViewer', "true" );
  313. }
  314.  
  315. // visualizations
  316. function loadVisPrefs(){
  317.     theme.savePreference( 'visViewer', "true" );
  318.     visEffects.currentEffectType = mediacenter.effectType;
  319.     visEffects.currentPreset = mediacenter.effectPreset;
  320.  
  321.     var dwScale = theme.loadPreference( "visWidth" );
  322.  
  323.     if( "--" != dwScale )
  324.     {
  325.         visView.width = dwScale;
  326.     }else{
  327.         viewView.width = 263;
  328.     }
  329.     dwScale = theme.loadpreference( "visHeight" );
  330.  
  331.     if( "--" != dwScale )
  332.     {
  333.         visView.height = dwScale;
  334.     }else{
  335.         visView.height = 330;
  336.     }
  337.     
  338.     checkVisualsPlayerState()
  339. }
  340.  
  341. function saveVisPrefs(){
  342.     mediacenter.effectType = visEffects.currentEffectType;
  343.     mediacenter.effectPreset = visEffects.currentPreset;
  344.     theme.savepreference( "visWidth", visView.width );
  345.     theme.savepreference( "visHeight", visView.height );
  346. }
  347.  
  348. function checkVisualsPlayerState(){
  349.  
  350.     if (player){
  351.         switch (player.playState){
  352.             case 0:        //undefined
  353.                 
  354.                 break;
  355.             case 1:        //stopped
  356.  
  357.                 break;
  358.             case 2:        //paused
  359.  
  360.                 break;
  361.             case 3:     //playing
  362.                 //visMask.visible = true;
  363.                 break;
  364.             case 6:        //buffering
  365.                 
  366.                 break;
  367.             case 7:        //waiting
  368.                 
  369.                 break;
  370.             case 8:        //media ended
  371.                 
  372.                 break;
  373.             case 9:        //Transitioning
  374.                 
  375.                 break;
  376.             case 10:    //Ready
  377.                 
  378.                 break;
  379.             }
  380.         }
  381.  
  382.     if (!player.controls.isAvailable("Stop")) {
  383.         //visMask.visible = false;
  384.     }
  385. }
  386.  
  387. function displayVisText(){
  388.     visEffectsText.visible = true;
  389.     visEffectsText.value = visEffects.currentEffectTitle + ": " + visEffects.currentPresetTitle;
  390.     visView.timerInterval = 6000
  391. }
  392.  
  393. function hideVisText(){
  394.     visEffectsText.visible = false;
  395.     visView.timerInterval = 0
  396. }
  397.  
  398. // video
  399.  
  400. function loadVidPrefs(){
  401.     var _drawerStatus = theme.loadPreference('drawerStatus');
  402.  
  403.     if (_drawerStatus != '--') {
  404.         drawerStatus = (_drawerStatus.toLowerCase() == 'true') ? false : true;
  405.     } else {
  406.         drawerStatus = true;
  407.     }
  408.  
  409.     checkVideoPlayerState();
  410.     toggleVidDrawer();
  411.     updateZoomToolTip();
  412. }
  413.  
  414. function saveVidPrefs(){
  415.     theme.savePreference('drawerStatus',drawerStatus);
  416.     //theme.savePreference('vidSnapper',vidSnapper);
  417. }
  418.  
  419. function loadVidSize(){
  420.     var vidSizer = theme.loadPreference( "videoWidth" );
  421.  
  422.     if( "--" != vidSizer )
  423.     {
  424.         view.width = vidSizer;
  425.     }
  426.     vidSizer = theme.loadpreference( "videoHeight" );
  427.  
  428.     if( "--" != vidSizer )
  429.     {
  430.         view.height = vidSizer;
  431.     }
  432. }
  433.  
  434. function saveVidSize(){
  435.     theme.savepreference( "videoWidth", view.width );
  436.     theme.savepreference( "videoHeight", view.height );
  437.     theme.savePreference("vidSnapper" , "false");
  438.     vidZoom.upToolTip = "Click To Set Video Size";
  439.     mediacenter.videoZoom = 50;
  440. }
  441.  
  442. function videoZoom(){
  443.     if("false"==theme.loadPreference("vidSnapper")){
  444.         mediacenter.videoZoom = 50;
  445.     }
  446.     if(mediacenter.videoZoom < 76){
  447.         mediacenter.videoZoom = 100;
  448.     }else if(mediacenter.videoZoom <101){
  449.         mediacenter.videoZoom = 150;
  450.     }else if(mediacenter.videoZoom < 156){
  451.         mediacenter.videoZoom = 200;
  452.     }else{
  453.         mediacenter.videoZoom = 75;
  454.     }
  455.     SnapToVideo();
  456.     updateZoomToolTip();
  457. }
  458.  
  459. function updateZoomToolTip(){
  460.  
  461.     vidZoom.upToolTip = "Video Size - [current: " + mediacenter.videoZoom + "%] - [next: ";
  462.  
  463.     if(mediacenter.videoZoom < 76){
  464.         nextZoom = 100;
  465.     }else if(mediacenter.videoZoom <101){
  466.         nextZoom = 150;
  467.     }else if(mediacenter.videoZoom < 156){
  468.         nextZoom = 200;
  469.     }else{
  470.         nextZoom = 75;
  471.     }
  472.  
  473.     vidZoom.upToolTip += nextZoom + "%]";
  474.     
  475.     if("false"==theme.loadPreference("vidSnapper")){
  476.         vidZoom.upToolTip = "Click To Set Video Size";
  477.     }
  478. }
  479.  
  480. function SnapToVideo(){
  481.  
  482.     theme.savePreference("vidSnapper" , "true");
  483.  
  484.     var zoom = mediacenter.videoZoom;
  485.     var viewWidth = (player.currentMedia.imageSourceWidth * (zoom/100.00));
  486.     var viewHeight = (player.currentMedia.imageSourceHeight * (zoom/100.00));
  487.  
  488.     view.width = viewWidth + 40;
  489.     view.height = viewHeight + 148;
  490. }
  491.  
  492. function checkSnapStatus(){
  493.     if("false"==theme.loadPreference("vidSnapper")){
  494.         loadVidSize();
  495.     }else{
  496.         SnapToVideo();
  497.     }
  498. }
  499.  
  500. function checkVideoPlayerState(){
  501.     if (player){
  502.         switch (player.playState){
  503.             case 0:        //undefined
  504.                 
  505.                 break;
  506.             case 1:        //stopped
  507.  
  508.                 break;
  509.             case 2:        //paused
  510.  
  511.                 break;
  512.             case 3:     //playing
  513.                 centerBox.visible = true;
  514.                 checkSnapStatus();
  515.                 if(!player.currentMedia.ImageSourceWidth>0){
  516.                     view.close();
  517.                     break;
  518.                 }
  519.                 break;
  520.             case 6:        //buffering
  521.                 
  522.                 break;
  523.             case 7:        //waiting
  524.                 
  525.                 break;
  526.             case 8:        //media ended
  527.                 
  528.                 break;
  529.             case 9:        //Transitioning
  530.                 
  531.                 break;
  532.             case 10:    //Ready
  533.                 
  534.                 break;
  535.             }
  536.             
  537.         }
  538.  
  539.     if (!player.controls.isAvailable("Stop")) {
  540.         centerBox.visible = false;
  541.         
  542.     }
  543. }
  544.  
  545. var drawerStatus = false;
  546.  
  547. function toggleVidDrawer(){
  548.     if(!drawerStatus){
  549.         vidDrawer.moveTo(0,view.height-124,500);
  550.         vidDrawerButton.down = true;
  551.         vidDrawerSub.visible = true;
  552.         drawerStatus = !drawerStatus;
  553.     }else{
  554.         vidDrawer.moveTo(0,view.height-236,500);
  555.         drawerStatus = !drawerStatus;
  556.     }    
  557. }
  558.  
  559. function checkSliderStatus(){
  560.     drawerStatus = drawerStatus;
  561.     vidDrawerSub.visible = drawerStatus;
  562. }
  563.  
  564. // info / content
  565.  
  566. function loadInfoPrefs(){
  567.     theme.savePreference( 'infoViewer', "true" );
  568. }
  569.  
  570. var infoGo = 0;
  571.  
  572. function showInfo(menu,nav,infoGo){
  573.     infoMenuBack.visible = menu;
  574.     infoNavBack.visible = nav;
  575.     switch(infoGo){
  576.         case 0:
  577.             infoSub.backgroundImage = "";
  578.             break;
  579.         case 1:
  580.             infoSub.backgroundImage = "c_sub_1.jpg";
  581.             break;
  582.         case 2:
  583.             infoMode = 2;    // call sections
  584.             navGo = 1;
  585.             navLimit = 5;
  586.             infoNavNext();
  587.             break;
  588.         case 3:
  589.             infoMode = 3;
  590.             navGo = 1;
  591.             navLimit = 6;
  592.             infoNavNext();
  593.             break;
  594.     }
  595. }
  596.  
  597. navGo = 1;
  598.  
  599. function infoNavNext(){
  600.     infoSub.backgroundImage = "c_sub_" + infoMode + "_" + navGo + ".jpg";
  601.     navCheck();
  602. }
  603.  
  604. function infoNavPrev(){
  605.     infoSub.backgroundImage = "c_sub_" + infoMode + "_" + navGo + ".jpg";
  606.     navCheck();
  607. }
  608.  
  609. function navCheck(){
  610.     if(navGo==1){
  611.         navPrev.enabled = false;
  612.         navNext.enabled = true;
  613.     }else if(navGo==navLimit && infoMode==infoMode){    // enable / disable sections
  614.         navNext.enabled = false;
  615.         navPrev.enabled = true;
  616.     }else{
  617.         navNext.enabled = true;
  618.         navPrev.enabled = true;
  619.     }
  620. }
  621.  
  622.