home *** CD-ROM | disk | FTP | other *** search
/ Kompuutteri Kaikille K-CD 2001 #9 / K-CD_2001-09.iso / Desperados / Web / ie_md8lib.js < prev    next >
Text File  |  2001-02-13  |  5KB  |  204 lines

  1. /******************************************************************************
  2. * File: ie_md8lib.js                                                          *
  3. *                                                                             *
  4. * Copyright MatchWare A/S                                                     *
  5. * Author: Jens ╪. Nielsen                                                     *
  6. ******************************************************************************/
  7.  
  8. function BrowserInit() {
  9. }
  10.  
  11. function GetObjLeft( obj) {
  12.   return obj.style.pixelLeft;
  13. }
  14.  
  15. function GetObjTop( obj) {
  16.   return obj.style.pixelTop;
  17. }
  18.  
  19. function GetObjWidth( obj) {
  20.  if ( obj.style.pixelWidth)
  21.    return obj.style.pixelWidth;
  22.  else
  23.    return obj.clientWidth;
  24. }
  25.  
  26. function GetObjHeight( obj) {
  27.  if ( obj.style.pixelHeight)
  28.    return obj.style.pixelHeight;
  29.  else
  30.    return obj.clientHeight;
  31. }
  32.  
  33. function SetObjPosition( obj,left,top) {
  34.  obj.style.pixelLeft = left;
  35.  obj.style.pixelTop  = top;
  36. }
  37.  
  38. function IsObjVisible( obj) {
  39.  return obj.style.visibility == "visible";
  40. }
  41.  
  42. function ShowObject( obj,visible) {
  43.  obj.style.visibility = visible ? "visible" : "hidden";
  44. }
  45.  
  46. //------------------------------------
  47.  
  48. var PAGE_ACTION_POST_FIX = "_ie.htm";
  49.  
  50. //------------------------------------
  51.  
  52. var effects = new Array();
  53. effects.BoxIn      = 0;
  54. effects.BoxOut     = 1;
  55. effects.CircleIn   = 2;
  56. effects.CircleOut  = 3;
  57. effects.WipeUp     = 4;
  58. effects.WipeDown   = 5;
  59. effects.WipeRight  = 6;
  60. effects.WipeLeft   = 7;
  61. effects.HorzBlinds = 9;
  62. effects.Dissolve        = 12;
  63. effects.SplitVerticalIn = 13;
  64. effects.Normal          = 100;
  65. effects.Fade            = 101;
  66.  
  67. //------------------------------------
  68.  
  69. function HideAction( obj,duration,effecttype) {
  70.  
  71.  this.m_Obj        = obj;
  72.  this.m_Duration   = duration;
  73.  this.m_EffectType = effecttype;
  74.  
  75.  this.Start = HideAction_Start;
  76. }
  77.  
  78.  
  79. function HideAction_Start() {
  80.  
  81.  if ( this.m_Obj.style.visibility == "hidden") return;
  82.  
  83.  switch ( this.m_EffectType) {
  84.   case effects.Normal :
  85.     this.m_Obj.style.visibility = "hidden";
  86.     break;
  87.   case effects.Fade :
  88.     this.m_Obj.style.filter = "blendTrans(duration=" + (this.m_Duration / 1000) + ")";
  89.     this.m_Obj.filters.blendTrans.stop();
  90.     this.m_Obj.filters.blendTrans.apply();
  91.     this.m_Obj.style.visibility="hidden";
  92.     this.m_Obj.filters.blendTrans.play();
  93.     break;
  94.   default :
  95.     this.m_Obj.style.filter = "revealTrans(duration==" + (this.m_Duration / 1000) + ", transition=" + this.m_EffectType + ")";
  96.     this.m_Obj.filters.revealTrans.stop();
  97.     this.m_Obj.filters.revealTrans.apply();
  98.     this.m_Obj.style.visibility="hidden";
  99.     this.m_Obj.filters.revealTrans.play();
  100.     break;
  101.  }
  102. }
  103.  
  104. //------------------------------------
  105.  
  106.  
  107. function ShowAction( obj,duration,effecttype) {
  108.  
  109.  this.m_Obj        = obj;
  110.  this.m_Duration   = duration;
  111.  this.m_EffectType = effecttype;
  112.  
  113.  this.Start = ShowAction_Start;
  114. }
  115.  
  116.  
  117. function ShowAction_Start() {
  118.  
  119.  if ( this.m_Obj.style.visibility == "visible") return;
  120.  
  121.  switch ( this.m_EffectType) {
  122.   case effects.Normal :
  123.     this.m_Obj.style.visibility = "visible";
  124.     break;
  125.   case effects.Fade :
  126.     this.m_Obj.style.filter = "blendTrans(duration=" + (this.m_Duration / 1000) + ")";
  127.     this.m_Obj.filters.blendTrans.stop();
  128.     this.m_Obj.filters.blendTrans.apply();
  129.     this.m_Obj.style.visibility = "visible";
  130.     this.m_Obj.filters.blendTrans.play();
  131.     break;
  132.   default :
  133.     this.m_Obj.style.filter = "revealTrans(duration==" + (this.m_Duration / 1000) + ", transition=" + this.m_EffectType + ")";
  134.     this.m_Obj.filters.revealTrans.stop();
  135.     this.m_Obj.filters.revealTrans.apply();
  136.     this.m_Obj.style.visibility = "visible";
  137.     this.m_Obj.filters.revealTrans.play();
  138.     break;
  139.  }
  140. }
  141.  
  142. //------------------------------------
  143.  
  144. function SoundAction( sound,repeat,cancelmidi,cancelwave) {
  145.  
  146.  var pos = sound.lastIndexOf( ".");
  147.  var ext = sound.substring( pos).toLowerCase();
  148.  
  149.  this.m_Sound      = sound;
  150.  this.m_Repeat     = repeat;
  151.  this.m_CancelMidi = cancelmidi;
  152.  this.m_CancelWave = cancelwave;
  153.  this.m_Midi       = ext == ".mid";
  154.  
  155.  this.Start = SoundAction_Start;
  156. }
  157.  
  158. function SoundAction_Start() {
  159.  
  160.  if ( window.parent == self) return;
  161.  
  162.  if ( this.m_CancelMidi) 
  163.    top.global.mediaplayer1.Stop();
  164.  if ( this.m_CancelWave) 
  165.    top.global.mediaplayer2.Stop();
  166.  
  167.  if ( this.m_Sound == "") return;
  168.  
  169.  var player = this.m_Midi ? top.global.mediaplayer1 : top.global.mediaplayer2;
  170.  if ( player.PlayState == 2) return; // Already playing
  171.  
  172.  player.FileName  = this.m_Sound;
  173.  player.PlayCount = this.m_Repeat ? 0 : 1;
  174.  player.Volume    = 0; // Full volume
  175.  player.Play();
  176. }
  177.  
  178. //------------------------------------
  179.  
  180. function SetCursorAction( type) {
  181.  
  182.  this.m_Type = type;
  183.  
  184.  this.Start = SetCursorAction_Start;
  185. }
  186.  
  187.  
  188. function SetCursorAction_Start() {
  189.  
  190.  var aDivs = document.body.all.tags("DIV");
  191.  if ( ! aDivs) return;
  192.  
  193.  for ( var i=0;i < aDivs.length; i++) 
  194.    aDivs( i).style.cursor = this.m_Type;
  195.  
  196.  aDivs = document.body.all.tags("IMG");
  197.  if ( ! aDivs) return;
  198.  
  199.  for ( var i=0;i < aDivs.length; i++) 
  200.    aDivs( i).style.cursor = this.m_Type;
  201. }
  202.  
  203. //------------------------------------
  204.