home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 August / CHIP_CD_2005-08.iso / bonus / srew / files / WMBonusXP.exe / RCDATA / CABINET / TDK.wmz / TDK.js < prev    next >
Text File  |  2001-11-30  |  15KB  |  603 lines

  1. // BEGIN TDK Script
  2.  
  3. var rippleStatus = 0;
  4. var vidIsPlaying = false;
  5. var playlistStatus = 1;
  6. var eqTop = 0, eqLeft = 0;
  7. var videoWinOpen = false, theviddrawerisOpen=false;
  8. var visOn = true;
  9. var eqStatus = infoStatus = plStatus = false;
  10.  
  11.  
  12. function decVol() {
  13.     volumeSet = player.settings.volume;
  14.  
  15.     if (volumeSet > 7) {
  16.         vol_plus.enabled=true;
  17.         vol_minus.enabled=true;
  18.         volumeSet-=7;
  19.     } else {
  20.         vol_plus.enabled=true;
  21.         vol_minus.enabled=false;
  22.         volumeSet=0;
  23.     }
  24.  
  25.     player.settings.volume = volumeSet;
  26.     player.settings.mute = false;
  27.     vol_mute.down=false;
  28. }
  29.  
  30. function incVol() {
  31.     volumeSet = player.settings.volume;
  32.  
  33.     if (volumeSet < 93) {
  34.         vol_plus.enabled=true;
  35.         vol_minus.enabled=true;
  36.         volumeSet+=7;
  37.     } else {
  38.         vol_plus.enabled=false;
  39.         vol_minus.enabled=true;
  40.         volumeSet=100;
  41.     }
  42.  
  43.     player.settings.volume = volumeSet;
  44.     player.settings.mute = false;
  45.     vol_mute.down=false;
  46. }
  47.  
  48. function mute() {
  49. player.settings.mute = !player.settings.mute;
  50. }
  51. function chkDecVol() {
  52. return !(player.settings.volume == 0);
  53. }
  54. function chkIncVol() {
  55. return !(player.settings.volume == 100);
  56. }
  57.  
  58. function toggleRipple() {
  59.     rippleStatus++;
  60.  
  61.     switch (rippleStatus) {
  62.         case 1:
  63.             ripple_button.visible    = true;
  64.             vis.visible        = false;
  65.             visbuttons.visible    = false;
  66.         break;
  67.  
  68.  
  69.         case 2:
  70.             ripple_button.visible    = false;
  71.             vis.visible        = true;
  72.             visbuttons.visible    = true;
  73.         break;
  74.  
  75.  
  76.         case 3:
  77.             ripple_button.visible    = false;
  78.             vis.visible        = false;
  79.             visbuttons.visible    = false;
  80.             rippleStatus        = 0;
  81.         break;
  82.     }
  83. }
  84.  
  85. function init() {
  86.     theme.closeView('module_video');
  87.  
  88.     loadPrefs();
  89.  
  90.     volume_slider.value = player.settings.volume;
  91.  
  92.     updateMetadata();
  93.  
  94.     vidIsPlaying = (player.OpenState == osMediaOpen) && (player.currentMedia.ImageSourceWidth>0);
  95.     vidIsPlaying ? startVideo() : endVideo();
  96.  
  97.     if (!player.controls.isAvailable("Stop")) {
  98.         endVideo();
  99.     }
  100.  
  101.     playlist_frame.setColumnResizeMode( 1, "AutoSizeData" );
  102.     playlist_frame.setColumnResizeMode( 0, "Stretches" );
  103. }
  104.  
  105. function shutdown() {
  106.     savePrefs();
  107. }
  108.  
  109. function onPlayStateChange() {
  110.     vidIsPlaying = (player.OpenState == osMediaOpen) && (player.currentMedia.ImageSourceWidth>0);
  111.  
  112.     if (!player.controls.isAvailable("Stop")) {
  113.         endVideo();
  114.     }
  115.  
  116.     vidIsPlaying ? startVideo() : endVideo();
  117.  
  118.     updateMetadata();
  119.     detVis();
  120. }
  121.  
  122. function checkVid() {
  123.     return (player.OpenState == osMediaOpen) && (player.currentMedia.ImageSourceWidth>0);
  124. }
  125.  
  126. function detVis(override) {
  127.     if (visOn && (player.controls.isAvailable("Stop") || override)) {
  128.         viseffects.visible=true;
  129.     } else {
  130.         viseffects.visible=false;
  131.     }
  132. }
  133.  
  134. function toggleControls() {
  135.     if(theviddrawerisOpen){
  136.         vidcontrols.moveTo(view.width-316,view.height-96,200);
  137.         theviddrawerisOpen = false;
  138.     } else {
  139.         vidcontrols.moveTo(view.width-316,view.height-62,200);
  140.         theviddrawerisOpen = true;
  141.     }
  142.  
  143.     drawerbutton.down = theviddrawerisOpen;
  144. }
  145.  
  146.  
  147.  
  148. // shamelessly 'borrowed' from the winamp converter .js and xml
  149. function OnLoadVideo()
  150. {
  151.     SnapToVideo();
  152.     loadVideoPrefs();
  153. }
  154. // makes sure that the video stretches along with your resizing == this could be
  155. // done within the <video/> tags...
  156. function AllowResizeVideo()
  157. {
  158.     mediacenter.videoStretchToFit=true;
  159.     mediacenter.videoShrinkToFit=true; 
  160.     return;
  161. }
  162. // zooms your video window onClick
  163. function ZoomVideo()
  164. {
  165.     g_fUserHasSized = true;
  166.  
  167.     mediacenter.videoStretchToFit = false;
  168.     mediacenter.videoShrinkToFit = false;
  169.  
  170.     if( mediacenter.videoZoom < 51 )
  171.     {
  172.         mediacenter.videoZoom = 100;
  173.     }
  174.     else if( mediacenter.videoZoom < 101 )
  175.     {
  176.         mediacenter.videoZoom = 200;
  177.     }
  178.     else
  179.     {
  180.         mediacenter.videoZoom = 50;
  181.     }
  182.  
  183.     SnapToVideo();
  184. }
  185. // resizes the window to the video width & height
  186. function SnapToVideo()
  187. {
  188.     if( (!g_fUserHasSized && mediacenter.videoStretchToFit) || !mediacenter.videoStretchToFit)
  189.     {
  190.         var zoom = mediacenter.videoStretchToFit ? 100 : mediacenter.videoZoom;
  191.         var x = (player.currentMedia.imageSourceWidth * (zoom / 100.0));
  192.         var y = (player.currentMedia.imageSourceHeight * (zoom / 100.0));
  193.  
  194.         g_fExpectingSizeChange = true;
  195.         view.width = x + 16;
  196.         view.height = y + 113;
  197.         g_fExpectingSizeChange = false;
  198.     }
  199.     else
  200.     {
  201.         view.height= player.currentMedia.imageSourceHeight + 113;
  202.         view.width= player.currentMedia.imageSourceWidth + 16;
  203.     }
  204.  
  205.     vidinfo.value = "Zoom: " + mediacenter.videoZoom + "%";
  206. }
  207. // stops and closes your video 
  208. function OnCloseVideo()
  209. {
  210.     module_video.close();
  211.     saveVideoPrefs();
  212. }
  213. // end caption
  214.  
  215.  
  216.  
  217. function startVideo() {
  218.     vidIsPlaying = true;
  219.     visOn = false;
  220.     detVis();
  221.     ringanim.visible = false;
  222.     theme.openview('module_video');
  223. }
  224.  
  225. function endVideo() {
  226.     vidIsPlaying = false;
  227. }
  228.  
  229.  
  230. function launchInfo() {
  231.         if (infoStatus) {
  232.             infoStatus = false;
  233.             if (theme.closeview('module_info')) {
  234.                 launchInfo();
  235.             }
  236.         } else {
  237.             infoStatus = true;
  238.             theme.openview('module_info');
  239.         }
  240. }
  241.  
  242. function launchPlaylist() {
  243.         if (plStatus) {
  244.             theme.closeview('module_pl');
  245.             plStatus = false;
  246.         } else {
  247.             theme.openview('module_pl');
  248.             plStatus = true;
  249.         }
  250. }
  251.  
  252. function showEq() {
  253.     if (!eqStatus) {
  254.         eq.moveTo(316,260,200);
  255.     } else {
  256.         eq.moveTo(30,80,200);
  257.     }
  258. }
  259.  
  260. function chkEq() {
  261.     eqStatus = !eqStatus;
  262.     eq_sub.visible = eqStatus;
  263. }
  264.  
  265. function infoModuleInit() {
  266.     showPage(1);
  267. }
  268.  
  269. function updateMetadata() {
  270.     metadata.value = player.currentmedia.getiteminfo("#author");
  271.  
  272.     if (metadata.value == "") {
  273.         metadata.value = player.currentmedia.getiteminfo("author");
  274.     }
  275.  
  276.     if (metadata.value != "") {
  277.         metadata.value += " - ";
  278.     }
  279.  
  280.     metadata.value += player.currentmedia.name;
  281.     metadata.scrolling = (metadata.textWidth>metadata.width);
  282.     metadata.value += (metadata.scrolling) ? "          " : "";
  283. /*
  284.     bitrate.value = player.currentmedia.getiteminfo("#bitrate").substring(0,player.currentmedia.getiteminfo("#bitrate").length-3);
  285.  
  286.     if (bitrate.value == "") {
  287.         bitrate.value = player.currentmedia.getiteminfo("bitrate").substring(0,player.currentmedia.getiteminfo("bitrate").length-3);
  288.     }
  289.  
  290.     bitrate.value += (bitrate.value) ? "kbps" : "0kbps";
  291. */
  292. }
  293.  
  294. function repeatClick() {
  295.     if (player.Settings.getMode('loop')) {
  296.         player.Settings.setMode('loop','false');
  297.     } else {
  298.         player.Settings.setMode('loop','true');
  299.     }
  300. }
  301.  
  302. function shuffleClick() {
  303.     if (player.Settings.getMode('shuffle')) {
  304.         player.Settings.setMode('shuffle','false');
  305.     } else {
  306.         player.Settings.setMode('shuffle','true');
  307.     }
  308. }
  309.  
  310. function loadPrefs() {
  311.     var _eqStatus    = theme.loadPreference('eqStatus');
  312.     var _plStatus    = theme.loadPreference('plStatus');
  313.     var _infoStatus    = theme.loadPreference('infoStatus');
  314.  
  315.     if (_eqStatus != '--') {
  316.         eqStatus = (_eqStatus.toLowerCase() == 'true') ? false : true;
  317.     } else {
  318.         eqStatus = true;
  319.     }
  320.  
  321.     if (_plStatus != '--') {
  322.         plStatus = (_plStatus.toLowerCase() == 'true') ? false : true;
  323.     } else {
  324.         plStatus = true;
  325.     }
  326.  
  327.     if (_infoStatus != '--') {
  328.         infoStatus = (_infoStatus.toLowerCase() == 'true') ? false : true;
  329.     } else {
  330.         infoStatus = true;
  331.     }
  332.  
  333.     showEq();
  334.     launchPlaylist();
  335.     launchInfo();
  336.  
  337.     viseffects.currentEffectType = mediacenter.effectType;
  338.     viseffects.currentPreset = mediacenter.effectPreset;
  339. }
  340.  
  341. function savePrefs() {
  342.     theme.savePreference('eqStatus',eqStatus);
  343.     theme.savePreference('plStatus',plStatus);
  344.     theme.savePreference('infoStatus',infoStatus);
  345.  
  346.     mediacenter.effectType = viseffects.currentEffectType;
  347.     mediacenter.effectPreset = viseffects.currentPreset;
  348. }
  349.  
  350. function loadVideoPrefs() {
  351.     var _videoStatus = theme.loadPreference('videoStatus');
  352.  
  353.     if (_videoStatus != '--') {
  354.         theviddrawerisOpen = (_videoStatus.toLowerCase() == 'true') ? false : true;
  355.     } else {
  356.         theviddrawerisOpen = true;
  357.     }
  358.  
  359.     toggleControls();
  360. }
  361.  
  362. function saveVideoPrefs() {
  363.     theme.savePreference('videoStatus',theviddrawerisOpen);
  364. }
  365.  
  366. // CONTENT SCRIPT
  367.  
  368. var OVERVIEWOFFSET = 1;
  369. var PRODUCTOFFSET = OVERVIEWOFFSET + 1;
  370. var REVIEWSOFFSET = PRODUCTOFFSET + 1;
  371. var CONTACTOFFSET = REVIEWSOFFSET + 4;
  372. var CONTENTLENGTH = CONTACTOFFSET + 1;
  373.  
  374. // order: overview, products, reviews, contact
  375. var     OVERVIEWPG = 2,
  376.     PRODUCTSPG = OVERVIEWPG + 1,
  377.     REVIEWSPG = PRODUCTSPG + 1,
  378.     CONTACTPG = REVIEWSPG + 4;
  379.  
  380. var currentPage = 1;
  381.  
  382. var pageArray = new Array
  383.     (
  384.         ""
  385.  
  386.         ,
  387.  
  388.  
  389.         "TDK Electronics Corporation was established in 1965 to market magnetic recording media in North, Central, and South America.  Headquartered in New York, the company is today a world leader in digital media and consumer hardware solutions."
  390.  
  391.         ,
  392.  
  393.         "TDK Electronics Corporation develops and markets high-performance electronics and media, including a full line of veloCD Rewritable drives, Tremor multimedia speakers, MOJO CD-MP3 Digital Jukeboxes, 100% Certified CD-R/RW media and recordable DVD media."
  394.  
  395.         ,
  396.  
  397.         "\n\n\n\n\n\n\n\n\"Got the shakes? You will after hooking up TDK's Tremor multimedia speakers.\""
  398.  
  399.         ,
  400.  
  401.  
  402.         "\n\n\n\n\n\n\n\"Tremor sounds like a $1,000 investment in hi-fi sound for a fraction of the cost.\"\n"
  403.  
  404.         ,
  405.  
  406.  
  407.         "\n\n\n\n\n\n\" à one of the best in the field based on performance, price, service and support, and other factors affecting overall value.\"\n"
  408.  
  409.         ,
  410.  
  411.         ""
  412.  
  413.         ,
  414.  
  415.         "\nwww.tdk.com" +
  416.         "\n\n\nwww.tdkestore.com"
  417.  
  418.         ,
  419.  
  420.         "\n1.800.835.8273\n\n\n1.800.835.8326" +
  421.  
  422.         "\n\nTDK Electronics Corporation" +
  423.         "\n901 Franklin Avenue" +
  424.         "\nGarden City, NY 11530"
  425.  
  426.         ,
  427.  
  428.  
  429.         "\n\nIlmari Heikkinen\n\n\n\nJeff Schader"
  430.     );
  431.  
  432.  
  433. var titleArray = new Array
  434.     (
  435.         "Menu"
  436.         ,
  437.         "Overview"
  438.         ,
  439.         "Products"
  440.         ,
  441.         "Reviews"
  442.         ,
  443.         "Reviews"
  444.         ,
  445.         "Reviews"
  446.         ,
  447.         "Reviews"
  448.         ,
  449.         "Links"
  450.         ,
  451.         "Contact Info"
  452.         ,
  453.         "Credits"
  454.     );
  455.  
  456.  
  457. var bigTextArray = new Array(pageArray.length);
  458. bigTextArray[0] = "General:\n\n\n\nReviews:\n\n\n\nContact:";
  459. bigTextArray[REVIEWSOFFSET] = "\n\n\n\n\n\n\nTremor Multimedia Speakers:\n\n\n\n--Sound & Vision\n";
  460. bigTextArray[REVIEWSOFFSET+1] = "\n\n\n\n\n\n\n\n\n\n--The Oregonian";
  461. bigTextArray[REVIEWSOFFSET+2] = "\n\n\n\n\nveloCD:\n\n\n\n\n\n--PC World";
  462. bigTextArray[CONTACTOFFSET] = "Main TDK Web Site:\n\n\nTDK eStore:";
  463. bigTextArray[CONTACTOFFSET+1] = "Customer Service:\n\n\nTechnical Support:";
  464. bigTextArray[CONTACTOFFSET+2] = "Skin Graphics And Programming:\n\n\nCreative Input And\nCracking The Whip:\n\n\nAnd a great big thank you to Roman, L÷wenadler and Kinwashi, you guys rock.";
  465.  
  466. var linkTextArray = new Array(pageArray.length);
  467. linkTextArray[0] = "\nCompany Overview\nProducts\n\n\nTremor Multimedia Speakers\nveloCD\n\n\nLinks\nContact Information\nCredits";
  468. linkTextArray[CONTACTOFFSET] = "\nwww.tdk.com\n\n\nwww.tdkestore.com";
  469.  
  470. var hexTable = new Array(0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F');
  471.  
  472.  
  473. var currentLinks = new Array(16);
  474.  
  475.  
  476. var linkURLArray = new Array(pageArray.length);
  477. linkURLArray[0] = new Array(16);
  478. linkURLArray[0][1] = "subpage:2";
  479. linkURLArray[0][2] = "subpage:3";
  480. linkURLArray[0][5] = "subpage:4";
  481. linkURLArray[0][6] = "subpage:6";
  482. linkURLArray[0][9] = "subpage:8";
  483. linkURLArray[0][10] = "subpage:9";
  484. linkURLArray[0][11] = "subpage:10";
  485.  
  486. linkURLArray[CONTACTOFFSET] = new Array(16);
  487. linkURLArray[CONTACTOFFSET][1] = "http://www.tdk.com";
  488. linkURLArray[CONTACTOFFSET][4] = "http://www.tdkestore.com";
  489.  
  490. linkURLArray[CONTACTOFFSET+2] = new Array(16);
  491. linkURLArray[CONTACTOFFSET+2][11] = "http://www.theskinsfactory.com";
  492. linkURLArray[CONTACTOFFSET+2][12] = "http://www.theskinsfactory.com";
  493.  
  494.  
  495. var imageArray = new Array(pageArray.length);
  496. imageArray[REVIEWSOFFSET] = new Array();
  497. imageArray[REVIEWSOFFSET]["name"] = "info_pics_tremor.gif";
  498. imageArray[REVIEWSOFFSET]["width"] = 125;
  499. imageArray[REVIEWSOFFSET]["height"] = 86;
  500.  
  501. imageArray[REVIEWSOFFSET+1] = imageArray[REVIEWSOFFSET];
  502.  
  503. imageArray[REVIEWSOFFSET+2] = new Array();
  504. imageArray[REVIEWSOFFSET+2]["name"] = "info_pics_fwvelocd.gif";
  505. imageArray[REVIEWSOFFSET+2]["width"] = 125;
  506. imageArray[REVIEWSOFFSET+2]["height"] = 58;
  507.  
  508. imageArray[REVIEWSOFFSET+3] = new Array();
  509. imageArray[REVIEWSOFFSET+3]["name"] = "info_pics_velocdbox.gif";
  510. imageArray[REVIEWSOFFSET+3]["width"] = 125;
  511. imageArray[REVIEWSOFFSET+3]["height"] = 155;
  512.  
  513. imageArray[CONTACTOFFSET+2] = new Array();
  514. imageArray[CONTACTOFFSET+2]["name"] = "info_pics_kigsig.gif";
  515. imageArray[CONTACTOFFSET+2]["width"] = 125;
  516. imageArray[CONTACTOFFSET+2]["height"] = 155;
  517.  
  518. function makeLinks(pagenum) {
  519.     if (linkURLArray[pagenum]) {
  520.         currentLinks = linkURLArray[pagenum];
  521.  
  522.         for (var i=0; i<16; i++) {
  523.             eval("var linkHandle = link_" + hexTable[i]);
  524.  
  525.             if (linkURLArray[pagenum][i]) {
  526.                 linkHandle.enabled    = true;
  527.                 linkHandle.cursor    = "hand";
  528.             } else {
  529.                 linkHandle.enabled    = false;
  530.                 linkHandle.cursor    = "system";
  531.             }
  532.         }
  533.     } else {
  534.         clearLinks();
  535.     }
  536. }
  537.  
  538. function clearLinks() {
  539.     currentLinks = new Array(16);
  540.  
  541.     for (var i=0; i<16; i++) {
  542.         eval("var linkHandle = link_" + hexTable[i]);
  543.         linkHandle.enabled    = false;
  544.         linkHandle.cursor    = "system";
  545.     }
  546. }
  547.  
  548. function launchLink(linknum) {
  549.     if (currentLinks[linknum].substring(0,8)=="subpage:") {
  550.         showPage(currentLinks[linknum].substring(8,currentLinks[linknum].length));
  551.     } else {
  552.         player.launchURL(currentLinks[linknum]);
  553.     }
  554. }
  555.  
  556. function showPage(pagenum) {
  557.     currentPage = pagenum;
  558.  
  559.     content_text.value     = pageArray[(currentPage-1)];
  560.     content_title_white.value = titleArray[(currentPage-1)];
  561.     content_big.value    = bigTextArray[(currentPage-1)];
  562.     content_links.value    = linkTextArray[(currentPage-1)];
  563.     makeLinks((currentPage-1));
  564.     makeImage((currentPage-1));
  565. }
  566.  
  567. function nextPage() {
  568.     if (currentPage < pageArray.length) {
  569.         currentPage++;
  570.         showPage(currentPage);
  571.     } else {
  572.         currentPage = 1;
  573.         showPage(currentPage);
  574.     }
  575. }
  576.  
  577. function prevPage() {
  578.     if (currentPage > 1) {
  579.         currentPage--;
  580.         showPage(currentPage);
  581.     } else {
  582.         currentPage = pageArray.length;
  583.         showPage(currentPage);
  584.     }
  585. }
  586.  
  587.  
  588. function makeImage(pagenum) {
  589.     if (imageArray[pagenum]) {
  590.         content_image.width    = imageArray[pagenum]["width"];
  591.         content_image.height    = imageArray[pagenum]["height"];
  592.  
  593.         content_image.left    = 8;
  594.         content_image.top    = 23;
  595.  
  596.         content_image.backgroundImage = imageArray[pagenum]["name"];
  597.         content_image.visible = true;
  598.     } else {
  599.         content_image.visible = false;
  600.     }
  601. }
  602.  
  603. // END TDK Script