home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 January / Chip_2004-01_cd1.bin / opsys / wmakeup / download / orbit.wmz / orbit.js < prev    next >
Encoding:
JavaScript  |  2003-01-04  |  4.8 KB  |  196 lines

  1. // script cobbled together from bits of other people's skin code with my changes and ammendments
  2. // it's ok! - I know it yours!
  3.  
  4. var vidplay=false;
  5. var visopen=false;
  6. var eqopen=false;
  7. var plopen=false;
  8. var visopen=false;
  9.  
  10. function init() {
  11.     text_upd();
  12.     viseffects.visible=false;
  13.     visfg.visible=false;
  14.     vidplay=(player.OpenState == osMediaOpen) && (player.currentMedia.ImageSourceWidth>0);
  15.     vidplay ? vid_start() : vid_end();
  16.     if (!player.controls.isAvailable("Stop")) { vid_end(); }
  17. }
  18.  
  19. function state_change() {
  20.     text_upd();
  21.     vidplay=(player.OpenState == osMediaOpen) && (player.currentMedia.ImageSourceWidth>0);
  22.     if (!player.controls.isAvailable("Stop")) { vid_end(); }
  23.     vidplay ? vid_start() : vid_end();
  24. }
  25.  
  26. function toggle_vis() {
  27.   if (vis_bg.visible) {
  28.     vis_bg.visible=false;
  29.     trk_bg2.visible=false;
  30.         viseffects.visible=false;
  31.         visfg.visible=false;
  32.   } else {
  33.     vis_bg.visible=true;
  34.     trk_bg2.visible=true;
  35.         viseffects.visible=true;
  36.     visfg.visible=true;
  37.   }
  38. }
  39.  
  40. function openvis()    {
  41.   if (visopen==false)    {
  42.     orbit_vis_bg.moveTo(144,2,500);
  43.     visopen=true;
  44.   } else {
  45.     visfg.visible=false;
  46.     viseffects.visible=false;
  47.     orbit_vis_bg.moveTo(4,2,500);
  48.     visopen=false;
  49.   }
  50. }
  51.  
  52. function plon() {
  53.   if (visopen) {
  54.     visfg.visible=true;
  55.     viseffects.visible=true;
  56.   } else {
  57.     visfg.visible=false;
  58.     viseffects.visible=false;
  59.   }
  60. }
  61.  
  62. function openeq()    {
  63.   if (eqopen)    {
  64.       theme.closeView('body_eq');
  65.     eqopen=false;
  66.   } else {
  67.       theme.openView('body_eq');
  68.     eqopen=true;
  69.   }
  70. }
  71.  
  72. function openpl()    {
  73.   if (plopen)    {
  74.       theme.closeView('body_pl');
  75.     plopen=false;
  76.   } else {
  77.       theme.openView('body_pl');
  78.     plopen=true;
  79.   }
  80. }
  81.  
  82. function vol_dn() {
  83.     volumeSet = player.settings.volume;
  84.  
  85.     if (volumeSet > 7) {
  86.         volup.enabled=true;
  87.         voldn.enabled=true;
  88.         volumeSet-=7;
  89.     } else {
  90.         volup.enabled=true;
  91.         voldn.enabled=false;
  92.         volumeSet=0;
  93.     }
  94.  
  95.     player.settings.volume = volumeSet;
  96.     player.settings.mute = false;
  97. }
  98.  
  99. function vol_up() {
  100.     volumeSet = player.settings.volume;
  101.  
  102.     if (volumeSet < 93) {
  103.         volup.enabled=true;
  104.         voldn.enabled=true;
  105.         volumeSet+=7;
  106.     } else {
  107.         volup.enabled=false;
  108.         voldn.enabled=true;
  109.         volumeSet=100;
  110.     }
  111.  
  112.     player.settings.volume = volumeSet;
  113.     player.settings.mute = false;
  114. }
  115.  
  116. function chkDecVol() {
  117. return !(player.settings.volume == 0);
  118. }
  119. function chkIncVol() {
  120. return !(player.settings.volume == 100);
  121. }
  122.  
  123. function vid_check() {
  124.     return (player.OpenState == osMediaOpen) && (player.currentMedia.ImageSourceWidth>0);
  125. }
  126.  
  127. function vid_start() {
  128.     vidplay=true;
  129.   viseffects.visible=false;
  130.     theme.openview('body_video');
  131. }
  132.  
  133. function vid_end() {
  134.     vidplay=false;
  135. }
  136.  
  137. function text_upd(){
  138.     metadata.value = "  ";
  139.     artistname = player.currentmedia.getiteminfo("#author");
  140.     if (artistname == "") { artistname = player.currentmedia.getiteminfo("author"); }
  141.     if (artistname != "") { artistname += " - "; }
  142.     rate = player.currentmedia.getiteminfo("#bitrate").substring(0,player.currentmedia.getiteminfo("#bitrate").length-3);
  143.     if (rate == "") { rate = player.currentmedia.getiteminfo("bitrate").substring(0,player.currentmedia.getiteminfo("bitrate").length-3); }
  144.     rate += (rate) ? " kbps" : " ñ";
  145.     metadata.value += artistname;
  146.     metadata.value += player.currentmedia.name;
  147.   if (rate != "") {
  148.     metadata.value += " - ";
  149.       metadata.value += rate; 
  150.   }
  151.   metadata.value += "  ";
  152.     metadata.scrolling = (metadata.textWidth>metadata.width);
  153. }
  154.  
  155.  
  156. // 'borrowed' from the winamp converter .js and xml
  157. function OnLoadVideo() {
  158.   SnapToVideo();
  159. }
  160. function AllowResizeVideo() {
  161.     mediacenter.videoStretchToFit=true;
  162.     mediacenter.videoShrinkToFit=true; 
  163.     return;
  164. }
  165. function ZoomVideo() {
  166.     g_fUserHasSized = true;
  167.     mediacenter.videoStretchToFit = false;
  168.     mediacenter.videoShrinkToFit = false;
  169.     if( mediacenter.videoZoom < 51 ) {
  170.         mediacenter.videoZoom = 100;
  171.     } else if( mediacenter.videoZoom < 101 ) {
  172.         mediacenter.videoZoom = 200;
  173.     } else {
  174.         mediacenter.videoZoom = 50;
  175.     }
  176.     SnapToVideo();
  177. }
  178. function SnapToVideo() {
  179.     if( (!g_fUserHasSized && mediacenter.videoStretchToFit) || !mediacenter.videoStretchToFit) {
  180.         var zoom = mediacenter.videoStretchToFit ? 100 : mediacenter.videoZoom;
  181.         var x = (player.currentMedia.imageSourceWidth * (zoom / 100.0));
  182.         var y = (player.currentMedia.imageSourceHeight * (zoom / 100.0));
  183.         g_fExpectingSizeChange = true;
  184.         view.width = x + 16;
  185.         view.height = y + 113;
  186.         g_fExpectingSizeChange = false;
  187.     } else {
  188.         view.height= player.currentMedia.imageSourceHeight + 113;
  189.         view.width= player.currentMedia.imageSourceWidth + 16;
  190.     }
  191.     vidinfo.value = "Zoom: " + mediacenter.videoZoom + "%";
  192. }
  193. function OnCloseVideo() {
  194.   body_video.close();
  195. }
  196.