ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/documentation/presentation/i-scream-web_files/script.js
Revision: 1.1
Committed: Wed Oct 25 23:37:25 2000 UTC (23 years, 6 months ago) by tdb
Content type: application/javascript
Branch: MAIN
CVS Tags: PROJECT_COMPLETION, HEAD
Log Message:
Files for the HTML version of the project presentation.

File Contents

# Content
1
2 function LoadSld( slideId )
3 {
4 if( !g_supportsPPTHTML ) return
5 if( slideId )
6 parent.SldUpdated(slideId)
7 g_origSz=parseInt(SlideObj.style.fontSize)
8 g_origH=SlideObj.style.posHeight
9 g_origW=SlideObj.style.posWidth
10 g_scaleHyperlinks=(document.all.tags("AREA").length>0)
11 if( g_scaleHyperlinks )
12 InitHLinkArray()
13 if( g_scaleInFrame||(IsWin("PPTSld") && parent.IsFullScrMode() ) )
14 document.body.scroll="no"
15 _RSW()
16 if( IsWin("PPTSld") && parent.IsFullScrMode() ) {
17 document.oncontextmenu=parent._CM;
18 self.focus()
19 }
20 }
21 function MakeSldVis( fTrans )
22 {
23 fTrans=fTrans && g_showAnimation
24 if( fTrans )
25 {
26 if( g_bgSound ) {
27 idx=g_bgSound.indexOf(",");
28 pptSound.src=g_bgSound.substr( 0, idx );
29 pptSound.loop= -(parseInt(g_bgSound.substr(idx+1)));
30 }
31 SlideObj.filters.revealtrans.Apply()
32 }
33 SlideObj.style.visibility="visible"
34 if( fTrans )
35 SlideObj.filters.revealtrans.Play()
36 }
37 function MakeNotesVis()
38 {
39 if( !IsNts() ) return false
40 SlideObj.style.display="none"
41 nObj = document.all.item("NotesObj")
42 parent.SetHasNts(0)
43 if( nObj ) {
44 nObj.style.display=""
45 parent.SetHasNts(1)
46 }
47 return 1
48 }
49 function Redirect( frmId,sId )
50 {
51 var str=document.location.hash,idx=str.indexOf('#')
52 if(idx>=0) str=str.substr(1);
53 if( window.name != frmId && ( sId != str) ) {
54 obj = document.all.item("Main-File")
55 window.location.href=obj.href+"#"+sId
56 return 1
57 }
58 return 0
59 }
60 function HideMenu() { if( frames["PPTSld"] && PPTSld.document.all.item("ctxtmenu") && PPTSld.ctxtmenu.style.display!="none" ) { PPTSld.ctxtmenu.style.display='none'; return true } return false }
61 function IsWin( name ) { return window.name == name }
62 function IsNts() { return IsWin("PPTNts") }
63 function IsSldOrNts() { return( IsWin("PPTSld")||IsWin("PPTNts") ) }
64 function SupportsPPTAnimation() { return( navigator.platform == "Win32" && navigator.appVersion.indexOf("Windows")>0 ) }
65 function SupportsPPTHTML()
66 {
67 var appVer=navigator.appVersion, msie=appVer.indexOf("MSIE "), ver=0
68 if( msie >= 0 )
69 ver=parseFloat( appVer.substring( msie+5, appVer.indexOf(";",msie) ) )
70 else
71 ver=parseInt(appVer)
72
73 return( ver >= 4 && msie >= 0 )
74 }
75 var MHTMLPrefix = CalculateMHTMLPrefix();
76 function CalculateMHTMLPrefix()
77 {
78 if ( document.location.protocol == 'mhtml:') {
79 href=new String(document.location.href)
80 Start=href.indexOf('!')+1
81 End=href.lastIndexOf('/')+1
82 if (End < Start)
83 return href.substring(0, Start)
84 else
85 return href.substring(0, End)
86 }
87 return '';
88 }
89
90 function _RSW()
91 {
92 if( !g_supportsPPTHTML || IsNts() ||
93 ( !g_scaleInFrame && (( window.name != "PPTSld" ) || !parent.IsFullScrMode()) ) )
94 return
95
96 cltWidth=document.body.clientWidth
97 cltHeight=document.body.clientHeight
98 factor=(1.0*cltWidth)/g_origW
99 if( cltHeight < g_origH*factor )
100 factor=(1.0*cltHeight)/g_origH
101
102 newSize = g_origSz * factor
103 if( newSize < 1 ) newSize=1
104
105 s=SlideObj.style
106 s.fontSize=newSize+"px"
107 s.posWidth=g_origW*factor
108 s.posHeight=g_origH*factor
109 s.posLeft=(cltWidth-s.posWidth)/2
110 s.posTop=(cltHeight-s.posHeight)/2
111
112 if( g_scaleHyperlinks )
113 ScaleHyperlinks( factor )
114 }
115
116 function _KPH()
117 {
118 if( IsNts() ) return;
119
120 if( !parent.IsFramesMode() && event.keyCode == 27 && !parent.HideMenu() )
121 parent.window.close( self );
122 else if( event.keyCode == 32 )
123 {
124 if( window.name == "PPTSld" )
125 parent.PPTSld.DocumentOnClick();
126 else
127 parent.GoToNextSld();
128 }
129 }
130
131 function DocumentOnClick()
132 {
133 if( IsNts() || parent.HideMenu() ) return;
134 if( ( g_allowAdvOnClick && !parent.IsFramesMode() ) ||
135 (event && (event.keyCode==32) ) )
136 parent.GoToNextSld();
137 }
138
139
140
141 var g_supportsPPTHTML = SupportsPPTHTML(), g_scaleInFrame = true, gId="", g_bgSound="",
142 g_scaleHyperlinks = false, g_allowAdvOnClick = true, g_showInBrowser = false;
143 var g_showAnimation = g_supportsPPTHTML && SupportsPPTAnimation() && ( (window.name=="PPTSld" && !parent.IsFramesMode()) || g_showInBrowser );var g_hasTrans = false, g_autoTrans = false, g_transSecs = 0;
144 var g_animManager = null;
145
146 var ENDSHOW_MESG="End of slide show, click to exit.", SCREEN_MODE="Frames", gIsEndShow=0, NUM_VIS_SLDS=10, SCRIPT_HREF="script.js", FULLSCR_HREF="fullscreen.htm";
147 var gCurSld = gPrevSld = 1, g_offset = 0, gNtsOpen = gHasNts = gOtlTxtExp = gNarrationPaused = false, gOtlOpen = true
148 window.gPPTHTML=SupportsPPTHTML()
149
150 function UpdNtsPane(){ PPTNts.location.replace( MHTMLPrefix+GetHrefObj( gCurSld ).mNtsHref ) }
151 function UpdNavPane( sldIndex ){ if(gNavLoaded) PPTNav.UpdNav() }
152 function UpdOtNavPane(){ if(gOtlNavLoaded) PPTOtlNav.UpdOtlNav() }
153 function UpdOtlPane(){ if(gOtlLoaded) PPTOtl.UpdOtl() }
154 function SetHasNts( fVal )
155 {
156 if( gHasNts != fVal ) {
157 gHasNts=fVal
158 UpdNavPane()
159 }
160 }
161 function ToggleOtlText()
162 {
163 gOtlTxtExp=!gOtlTxtExp
164 UpdOtlPane()
165 }
166 function ToggleOtlPane()
167 {
168 frmset=document.all("PPTHorizAdjust")
169 frm=document.all("PPTOtl")
170
171 if( gOtlOpen )
172 frmset.cols="*,100%"
173 else
174 frmset.cols="20%,80%"
175
176 gOtlOpen=!gOtlOpen
177 frm.noResize=!frm.noResize
178 UpdOtNavPane()
179 }
180 function ToggleNtsPane()
181 {
182 frmset=document.all("PPTVertAdjust")
183 frm=document.all("PPTNts")
184
185 if( gNtsOpen )
186 frmset.rows="100%,*"
187 else
188 frmset.rows="80%,20%"
189
190 gNtsOpen=!gNtsOpen
191 UpdNtsPane()
192 }
193 function FullScreen(){ window.open( MHTMLPrefix+FULLSCR_HREF,null,"fullscreen=yes" ) }
194 function ToggleVNarration()
195 {
196 rObj=PPTSld.document.all("NSPlay")
197 if( rObj ) {
198 if( gNarrationPaused )
199 rObj.Play()
200 else
201 rObj.Pause()
202
203 gNarrationPaused=!gNarrationPaused
204 }
205 }
206 function GetCurSldNum()
207 {
208 obj=GetHrefObj(gCurSld)
209 if( obj.mOrigVis == 1 )
210 return obj.mSldIdx
211 else
212 return gCurSld
213 }
214 function GetNumSlds()
215 {
216 if( GetHrefObj(gCurSld).mOrigVis == 1 )
217 return NUM_VIS_SLDS
218 else
219 return gDocTable.length
220 }
221 function GetSldNum( href )
222 {
223 for(ii=0; ii<gDocTable.length; ii++) {
224 if ( gDocTable[ii].mSldHref == href )
225 return ii+1
226 }
227 return 1
228 }
229 function GetHrefObj( sldIdx ){ return gDocTable[sldIdx-1] }
230 function IsFramesMode(){ return ( SCREEN_MODE == "Frames" ) }
231 function IsFullScrMode(){ return ( SCREEN_MODE == "FullScreen" ) }
232 function GoToNextSld()
233 {
234 ii=gCurSld + 1
235 if( GetHrefObj( ii-1 ).mOrigVis == 0 ) {
236 if( ii<=gDocTable.length ) {
237 obj=GetHrefObj(ii)
238 obj.mVis=1
239 GoToSld(obj.mSldHref)
240 return
241 }
242 }
243 else {
244 obj=GetHrefObj( ii )
245 while ( obj && ( obj.mOrigVis == 0 ) )
246 obj=GetHrefObj(ii++)
247 if( obj && obj.mOrigVis ) {
248 GoToSld(obj.mSldHref)
249 return
250 }
251 }
252 if( !IsFramesMode() ) EndShow()
253 }
254 function GoToPrevSld()
255 {
256 ii=gCurSld-1
257 if( ii > 0 ) {
258 obj=GetHrefObj(ii)
259 while ( ( obj.mVis == 0 ) && ( ii>0 ) )
260 obj=GetHrefObj(ii--)
261 GoToSld(obj.mSldHref)
262 }
263 }
264 function GoToFirst(){ GoToSld( GetHrefObj(1).mSldHref ) }
265 function GoToLast()
266 {
267 ii=gDocTable.length
268 if( ii != gCurSld )
269 GoToSld( GetHrefObj(ii).mSldHref )
270 }
271 function GoToSld( href )
272 {
273 if( PPTSld.event ) PPTSld.event.cancelBubble=true
274 GetHrefObj( GetSldNum(href) ).mVis=1
275 PPTSld.location.href=MHTMLPrefix+href
276 }
277 function SldUpdated( id )
278 {
279 if( id == GetHrefObj(gCurSld).mSldHref ) return
280 gPrevSld=gCurSld
281 gCurSld=GetSldNum(id)
282 if( IsFramesMode() ) {
283 UpdNavPane(); UpdOtlPane(); UpdNtsPane()
284 }
285 }
286
287 function PrevSldViewed(){ GoToSld( GetHrefObj(gPrevSld).mSldHref ) }
288 function HasPrevSld() { return ( gIsEndShow || ( gCurSld != 1 && GetHrefObj( gCurSld-1 ).mVis == 1 )||( GetCurSldNum() > 1 ) ) }
289 function HasNextSld() { return (GetCurSldNum() != GetNumSlds()) }
290 function EndShow()
291 {
292 if( PPTSld.event ) PPTSld.event.cancelBubble=true
293
294 doc=PPTSld.document
295 doc.open()
296 doc.writeln('<html><head><script defer>function CloseWindow(){ if( parent.HideMenu() ) return; if( !parent.IsFramesMode() && event && (event.keyCode==27 || event.keyCode==32 || event.type=="click" ) ) parent.window.close( self ); } function Unload() { parent.gIsEndShow=0; } function SetupEndShow() { parent.gIsEndShow=1; document.body.scroll="no"; document.onkeypress=CloseWindow; document.onclick=CloseWindow; document.oncontextmenu=parent._CM; }</script></head><body bgcolor=black onload=SetupEndShow() onunload=Unload()><center><p><font face=Tahoma color=white size=2><br><b>' + ENDSHOW_MESG + '</b></font></p></center></body></html>')
297 doc.close()
298 }
299 function SetSldVisited(){ gDocTable[gCurSld-1].mVisited=true }
300 function IsSldVisited(){ return gDocTable[gCurSld-1].mVisited }
301 function hrefList( sldHref, visible, sldIdx )
302 {
303 this.mSldHref= this.mNtsHref = sldHref
304 this.mSldIdx = sldIdx
305 this.mOrigVis= this.mVis = visible
306 this.mVisited= false
307 }
308 var gDocTable = new Array(
309 new hrefList("slide0001.htm", 1, 1),
310 new hrefList("slide0002.htm", 1, 2),
311 new hrefList("slide0003.htm", 1, 3),
312 new hrefList("slide0004.htm", 1, 4),
313 new hrefList("slide0010.htm", 1, 5),
314 new hrefList("slide0009.htm", 1, 6),
315 new hrefList("slide0006.htm", 1, 7),
316 new hrefList("slide0007.htm", 1, 8),
317 new hrefList("slide0002.htm", 1, 9),
318 new hrefList("slide0001.htm", 1, 10)
319 );
320
321 function ImgBtn( oId,bId,w,action )
322 {
323 var t=this
324 t.Perform = _IBP
325 t.SetActive = _IBSetA
326 t.SetInactive= _IBSetI
327 t.SetPressed = _IBSetP
328 t.SetDisabled= _IBSetD
329 t.Enabled = _IBSetE
330 t.ChangeIcon = null
331 t.UserAction = action
332 t.ChgState = _IBUI
333 t.mObjId = oId
334 t.mBorderId= bId
335 t.mWidth = w
336 t.mIsOn = t.mCurState = 0
337 }
338 function _IBSetA()
339 {
340 if( this.mIsOn ) {
341 obj=this.ChgState( gHiliteClr,gShadowClr,2 )
342 obj.style.posTop=0
343 }
344 }
345 function _IBSetI()
346 {
347 if( this.mIsOn ) {
348 obj=this.ChgState( gFaceClr,gFaceClr,1 )
349 obj.style.posTop=0
350 }
351 }
352 function _IBSetP()
353 {
354 if( this.mIsOn ) {
355 obj=this.ChgState( gShadowClr,gHiliteClr,2 )
356 obj.style.posLeft+=1; obj.style.posTop+=1
357 }
358 }
359 function _IBSetD()
360 {
361 obj=this.ChgState( gFaceClr,gFaceClr,0 )
362 obj.style.posTop=0
363 }
364 function _IBSetE( state )
365 {
366 var t=this
367 GetObj( t.mBorderId ).style.visibility="visible"
368 if( state != t.mIsOn ) {
369 t.mIsOn=state
370 if( state )
371 t.SetInactive()
372 else
373 t.SetDisabled()
374 }
375 }
376 function _IBP()
377 {
378 var t=this
379 if( t.mIsOn ) {
380 if( t.UserAction != null )
381 t.UserAction()
382 if( t.ChangeIcon ) {
383 obj=GetObj(t.mObjId)
384 if( t.ChangeIcon() )
385 obj.style.posLeft=obj.style.posLeft+(t.mCurState-4)*t.mWidth
386 else
387 obj.style.posLeft=obj.style.posLeft+(t.mCurState-0)*t.mWidth
388 }
389 t.SetActive()
390 }
391 }
392 function _IBUI( clr1,clr2,nextState )
393 {
394 var t=this
395 SetBorder( GetObj( t.mBorderId ),clr1,clr2 )
396 obj=GetObj( t.mObjId )
397 obj.style.posLeft=obj.style.posLeft+(t.mCurState-nextState)*t.mWidth-obj.style.posTop
398 t.mCurState=nextState
399 return obj
400 }
401 function TxtBtn( oId,oeId,action,chkState )
402 {
403 var t=this
404 t.Perform = _TBP
405 t.SetActive = _TBSetA
406 t.SetInactive= _TBSetI
407 t.SetPressed = _TBSetP
408 t.SetDisabled= _TBSetD
409 t.SetEnabled = _TBSetE
410 t.GetState = chkState
411 t.UserAction = action
412 t.ChgState = _TBUI
413 t.mObjId = oId
414 t.m_elementsId= oeId
415 t.mIsOn = 1
416 }
417 function _TBSetA()
418 {
419 var t=this
420 if( t.mIsOn && !t.GetState() )
421 t.ChgState( gHiliteClr,gShadowClr,0,0 )
422 }
423 function _TBSetI()
424 {
425 var t=this
426 if( t.mIsOn && !t.GetState() )
427 t.ChgState( gFaceClr,gFaceClr,0,0 )
428 }
429 function _TBSetP()
430 {
431 if( this.mIsOn )
432 this.ChgState( gShadowClr,gHiliteClr,1,1 )
433 }
434 function _TBSetD()
435 {
436 this.ChgState( gFaceClr,gFaceClr,0,0 )
437 this.mIsOn = 0
438 }
439 function _TBSetE()
440 {
441 var t=this
442 if( !t.GetState() )
443 t.ChgState( gFaceClr,gFaceClr,0,0 )
444 else
445 t.ChgState( gShadowClr,gHiliteClr,1,1 )
446 t.mIsOn = 1
447 }
448 function _TBP()
449 {
450 var t=this
451 if( t.mIsOn ) {
452 if( t.UserAction != null )
453 t.UserAction()
454 if( t.GetState() )
455 t.SetPressed()
456 else
457 t.SetActive()
458 }
459 }
460 function _TBUI( clr1,clr2,lOffset,tOffset )
461 {
462 SetBorder( GetObj( this.mObjId ),clr1,clr2 )
463 Offset( GetObj( this.m_elementsId ),lOffset,tOffset )
464 }
465 function GetObj( objId ){ return document.all.item( objId ) }
466 function Offset( obj, top, left ){ obj.style.top=top; obj.style.left=left }
467 function SetBorder( obj, upperLeft, lowerRight )
468 {
469 s=obj.style;
470 s.borderStyle = "solid"
471 s.borderWidth = 1
472 s.borderLeftColor = s.borderTopColor = upperLeft
473 s.borderBottomColor= s.borderRightColor = lowerRight
474 }
475 function GetBtnObj(){ return gBtnArr[window.event.srcElement.id] }
476 function BtnOnOver(){ b=GetBtnObj(); if( b != null ) b.SetActive() }
477 function BtnOnDown(){ b=GetBtnObj(); if( b != null ) b.SetPressed() }
478 function BtnOnOut(){ b=GetBtnObj(); if( b != null ) b.SetInactive() }
479 function BtnOnUp()
480 {
481 b=GetBtnObj()
482 if( b != null )
483 b.Perform()
484 else
485 Upd()
486 }
487 function GetNtsState(){ return parent.gNtsOpen }
488 function GetOtlState(){ return parent.gOtlOpen }
489 function GetOtlTxtState(){ return parent.gOtlTxtExp }
490 function NtsBtnSetFlag( fVal )
491 {
492 s=document.all.item( this.m_flagId ).style
493 s.display="none"
494 if( fVal )
495 s.display=""
496 else
497 s.display="none"
498 }
499
500 var gHiliteClr="THREEDHIGHLIGHT",gShadowClr="THREEDSHADOW",gFaceClr="THREEDFACE"
501 var gBtnArr = new Array()
502 gBtnArr["nb_otl"] = new TxtBtn( "nb_otl","nb_otlElem",parent.ToggleOtlPane,GetOtlState )
503 gBtnArr["nb_nts"] = new TxtBtn( "nb_nts","nb_ntsElem",parent.ToggleNtsPane,GetNtsState )
504 gBtnArr["nb_prev"]= new ImgBtn( "nb_prev","nb_prevBorder",30,parent.GoToPrevSld )
505 gBtnArr["nb_next"]= new ImgBtn( "nb_next","nb_nextBorder",30,parent.GoToNextSld )
506 gBtnArr["nb_sldshw"]= new ImgBtn( "nb_sldshw","nb_sldshwBorder",18,parent.FullScreen )
507 gBtnArr["nb_voice"] = new ImgBtn( "nb_voice","nb_voiceBorder",18,parent.ToggleVNarration )
508 gBtnArr["nb_otlTxt"]= new ImgBtn( "nb_otlTxt","nb_otlTxtBorder",23,parent.ToggleOtlText )
509 gBtnArr["nb_nts"].m_flagId= "notes_flag"
510 gBtnArr["nb_nts"].SetFlag = NtsBtnSetFlag
511 gBtnArr["nb_otlTxt"].ChangeIcon= GetOtlTxtState
512 var sNext="Next",sPrev="Previous",sEnd="End Show",sFont="Arial"
513 function ShowMenu()
514 {
515 BuildMenu();
516 var doc=PPTSld.document.body,x=PPTSld.event.clientX+doc.scrollLeft,y=PPTSld.event.clientY+doc.scrollTop
517
518 m = PPTSld.document.all.item("ctxtmenu")
519 m.style.pixelLeft=x
520 if( (x+m.scrollWidth > doc.clientWidth)&&(x-m.scrollWidth > 0) )
521 m.style.pixelLeft=x-m.scrollWidth
522
523 m.style.pixelTop=y
524 if( (y+m.scrollHeight > doc.clientHeight)&&(y-m.scrollHeight > 0) )
525 m.style.pixelTop=y-m.scrollHeight
526
527 m.style.display=""
528 }
529 function _CM()
530 {
531 if( !parent.IsFullScrMode() ) return;
532 if(!PPTSld.event.ctrlKey) {
533 ShowMenu()
534 return false
535 } else
536 HideMenu()
537 }
538 function BuildMenu()
539 {
540 if( PPTSld.document.all.item("ctxtmenu") ) return
541
542 var mObj=CreateItem( PPTSld.document.body )
543 mObj.id="ctxtmenu"
544 var s=mObj.style
545 s.position="absolute"
546 s.cursor="default"
547 s.width="100px"
548 SetCMBorder(mObj,"menu","black")
549
550 var iObj=CreateItem( mObj )
551 SetCMBorder( iObj, "threedhighlight","threedshadow" )
552 iObj.style.padding=2
553 CreateMenuItem( iObj,sNext,M_GoNextSld,M_True )
554 CreateMenuItem( iObj,sPrev,M_GoPrevSld,M_HasPrevSld )
555 var sObj=CreateItem( iObj )
556 SetCMBorder(sObj,"menu","menu")
557 var s=sObj.style
558 s.borderTopColor="threedshadow"
559 s.borderBottomColor="threedhighlight"
560 s.height=1
561 s.fontSize="0px"
562 CreateMenuItem( iObj,sEnd,M_End,M_True )
563 }
564 function Highlight() { ChangeClr("activecaption","threedhighlight") }
565 function Deselect() { ChangeClr("threedface","menutext") }
566 function Perform()
567 {
568 e=PPTSld.event.srcElement
569 if( e.type=="menuitem" && e.IsActive() )
570 e.Action()
571 else
572 PPTSld.event.cancelBubble=true
573 }
574 function ChangeClr( bg,clr )
575 {
576 e=PPTSld.event.srcElement
577 if( e.type=="menuitem" && e.IsActive() ) {
578 e.style.backgroundColor=bg
579 e.style.color=clr
580 }
581 }
582
583 function M_HasPrevSld() { return( parent.HasPrevSld() ) }
584 function M_GoNextSld() { if( gIsEndShow ) M_End(); else GoToNextSld() }
585 function M_GoPrevSld() { if( gIsEndShow ) { history.back(); PPTSld.event.cancelBubble=true; } else GoToPrevSld() }
586 function M_True() { return true }
587 function M_End() { window.close( self ) }
588 function CreateMenuItem( node,text,action,eval )
589 {
590 var e=CreateItem( node )
591 e.type="menuitem"
592 e.Action=action
593 e.IsActive=eval
594 e.innerHTML=text
595
596 if( !e.IsActive() )
597 e.style.color="threedshadow"
598 e.onclick=Perform
599 e.onmouseover=Highlight
600 e.onmouseout=Deselect
601 s=e.style;
602 s.fontFamily=sFont
603 s.fontSize="8pt"
604 s.paddingLeft=2
605 }
606 function CreateItem( node )
607 {
608 var elem=PPTSld.document.createElement("DIV")
609 node.insertBefore( elem )
610 return elem
611 }
612 function SetCMBorder( o,ltClr,rbClr )
613 {
614 var s=o.style
615 s.backgroundColor="menu"
616 s.borderStyle="solid"
617 s.borderWidth=1
618 s.borderColor=ltClr+" "+rbClr+" "+rbClr+" "+ltClr
619 }