home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / zkuste / wmakeup / download / itunes.wmz / itune.js < prev    next >
Text File  |  2002-08-17  |  5KB  |  313 lines

  1. var frmmaximized = false;
  2. var tmpWidth = 0;
  3. var tmpHeight = 0;
  4.  
  5. var constMinWidth = 339;
  6. var constMinHeight = 120;
  7.  
  8. var g_fExpectingSizeChange  = false;
  9. var g_fUserHasSized         = false;
  10.  
  11. var videoVis = false;
  12. var efectVis = false;
  13.  
  14.  
  15. function OnLoad()
  16. {
  17.     
  18.     OnOpenStateChange();
  19.     OnPlayStateChange();
  20.     mediacenter.videoStretchToFit=false;
  21.     play.visible=true;
  22.     
  23.     tmpWidth = parseInt(theme.loadPreference("tmpWidth"));
  24.     tmpHeight = parseInt(theme.loadPreference("tmpHeight"));
  25.     if (tmpWidth > 0)
  26.     {
  27.         
  28.         view.width = tmpWidth;
  29.         
  30.     }
  31.     
  32.     if (tmpHeight > 0)
  33.     {
  34.         
  35.         view.height = tmpHeight;
  36.         
  37.     }
  38.     
  39. }
  40. function OnClose()
  41. {
  42.     
  43.     theme.savePreference("tmpWidth",view.width);
  44.     theme.savePreference("tmpHeight",view.height);
  45.     
  46. }
  47.  
  48.  
  49. function SizeChange()
  50. {
  51.     
  52.     if (!g_fExpectingSizeChange)
  53.     {
  54.         g_fUserHasSized = true;
  55.     }
  56.     tmpWidth = view.width;
  57.     tmpHeight = view.height;
  58.     
  59. }
  60.  
  61.  
  62. function OnPlay()
  63. {
  64.     
  65.     //view.width = player.currentMedia.imageSourceWidth+12;
  66.     //view.height = player.currentMedia.imageSourceHeight + constMinHeight;
  67.  
  68. }
  69.  
  70.  
  71. function OnOpenStateChange()
  72. {
  73.     
  74.     
  75.     if(player.OpenState == osMediaOpen)
  76.     {
  77.         UpdateMetadata();
  78.         StartPlaying();
  79.     }
  80.     
  81. }
  82.  
  83.  
  84. function OnURLChange()
  85. {
  86.     
  87.     //view.width = player.currentMedia.imageSourceWidth+12;
  88.     //view.height = player.currentMedia.imageSourceHeight + constMinHeight;
  89.     
  90. }
  91.  
  92. function OnPlayStateChange()
  93. {
  94.  
  95. switch(player.PlayState)
  96. {
  97.  
  98. case psStopped:
  99. StopPlaying();
  100. break;
  101. case psPlaying:
  102. StartPlaying();
  103. break;
  104. case psMediaEnded:
  105. StopPlaying();
  106. break;
  107. case psReady:
  108. StopPlaying();
  109. break;
  110. default:
  111. break;
  112.  
  113. }
  114.  
  115. }
  116.  
  117.  
  118.  
  119.  
  120. function StartPlaying()
  121. {
  122.     
  123.     if (player.currentMedia.ImageSourceWidth == 0)
  124.     {
  125.         
  126.         bigvis.visible =true;
  127.         video.visible =false;
  128.         wmlogo.visible =false;
  129.         
  130.     }
  131.     else
  132.     {
  133.         bigvis.visible = false;
  134.         video.visible = true;
  135.         wmlogo.visible = false;
  136.         
  137.         if ((!g_fUserHasSized && mediacenter.videoStretchToFit) || !mediacenter.videoStretchToFit)
  138.         {
  139.             
  140.             var zoom = mediacenter.videoStretchToFit ? 100 : mediacenter.videoZoom;
  141.             
  142.             var x = (player.currentMedia.imageSourceWidth * (zoom / 100.0));
  143.             if (x < 320) 
  144.             {
  145.                 
  146.                 x = 320;
  147.                 
  148.             }
  149.             var y = (player.currentMedia.imageSourceHeight * (zoom / 100.0));
  150.             
  151.             g_fExpectingSizeChange = true;
  152.             view.width = x + 8;
  153.             view.height = y + constMinHeight;
  154.             g_fExpectingSizeChange = false;
  155.             SizeChange();
  156.             
  157.         }
  158.         else
  159.         {
  160.             
  161.             if (view.height == constMinHeight)
  162.             {
  163.                 
  164.                 view.width = player.currentMedia.imageSourceWidth + 8;
  165.                 view.height = player.currentMedia.imageSourceHeight + constMinHeight;
  166.                 SizeChange();
  167.                 
  168.             }
  169.             
  170.         }
  171.         
  172.     }
  173.     
  174.     videoVis = video.visible;
  175.     efectVis = bigvis.visible;
  176.     
  177.     UpdateMetadata();
  178.     
  179. }
  180.  
  181.  
  182. function StopPlaying()
  183. {
  184.     
  185.     bigvis.visible = false;
  186.     video.visible = false;
  187.     wmlogo.visible = true;
  188.     infos.value = " ";
  189.     
  190. }
  191.  
  192.  
  193. function OnSizer()
  194. {
  195.     
  196.     mediacenter.videoStretchToFit=true;
  197.     view.size('bottomright');
  198.     
  199. }
  200.  
  201.  
  202. function UpdateMetadata()
  203. {
  204.     var tmp1 = player.currentplaylist.getiteminfo("title");
  205.     if(tmp1 == "")
  206.         tmp1 = player.currentmedia.getiteminfo("Album");
  207.     var tmp2 = player.currentmedia.getiteminfo("title");
  208.     if(tmp2 == "")
  209.         tmp2 = player.currentmedia.name;
  210.     var tmp3 = player.currentmedia.getiteminfo("author");
  211.     
  212.     infos.value = "Show:" + tmp1 + " / Clip:" + tmp2 + " / Author:" + tmp3;
  213.     
  214.     play.visible=false;
  215.     
  216. }
  217.  
  218.  
  219. function formMaximize()
  220. {
  221.     
  222.     if (button_tile.visible)
  223.     {
  224.         
  225.         if (frmmaximized)
  226.         {
  227.             
  228.             sizer.visible=true;
  229.             view.restore();
  230.             frmmaximized=false;
  231.             
  232.         }
  233.         else
  234.         {
  235.             
  236.             sizer.visible=false;
  237.             view.maximize();
  238.             frmmaximized=true;
  239.             
  240.         }
  241.     }
  242.     
  243. }
  244.  
  245.  
  246. function RollUpDown()
  247. {
  248.     
  249.     if (button_tile.visible)
  250.     {
  251.         
  252.         videoVis = video.visible;
  253.         efectVis = bigvis.visible;
  254.         
  255.         button_tile.visible = false;
  256.         bottom_right.visible = false;
  257.         bottom_left.visible = false;
  258.         bottom_tile.visible = false;
  259.         bottom_view.visible = false;
  260.         video.visible = false;
  261.         bigvis.visible = false;
  262.         videoborder_right.visible = false;
  263.         videoborder_left.visible = false;
  264.         videoview.visible = false;
  265.         work_view.visible = false;
  266.         
  267.     }
  268.     else
  269.     {
  270.         
  271.         videoview.visible = true;
  272.         work_view.visible = true;
  273.         videoborder_right.visible = true;
  274.         videoborder_left.visible = true;
  275.         video.visible = videoVis;
  276.         bigvis.visible = efectVis;
  277.         bottom_view.visible = true;
  278.         bottom_tile.visible = true;
  279.         bottom_right.visible = true;
  280.         bottom_left.visible = true;
  281.         button_tile.visible = true;
  282.         
  283.     }
  284.     
  285. }
  286.  
  287. function mute() {
  288. player.settings.mute = !player.settings.mute;
  289.  
  290. function playlistr()
  291. {
  292.      if (pl.visible)
  293. {
  294.      pl.visible=false;
  295.      visbutt.visible=true;
  296.      wmpeffects.visible=true;
  297. }
  298. else
  299.  
  300. {
  301. pl.visible=true;
  302. visbutt.visible=false;
  303. wmpeffects.visible=false;      
  304.      
  305.   }
  306. }
  307.  
  308. function miniview()
  309. {
  310. theme.itunemain.visible=false;
  311.       
  312.   }