home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beginning Direct3D Game Programming
/
Direct3D.iso
/
directx
/
dxf
/
extras
/
documentation
/
directx7
/
directx7.chm
/
dxmedia
/
foundation
/
d3drm
/
js
/
glossary.js
< prev
next >
Wrap
Text File
|
2000-09-22
|
3KB
|
112 lines
window.self.document.writeln('<DIV ID="bufferGLS" STYLE="DISPLAY: none"><OBJECT ID="objectGLS" STYLE="width:1; height:1;" TYPE=TEXT/X-SCRIPTLET></OBJECT></DIV>');
window.self.document.writeln('<SCR' + 'IPT LANGUAGE="JSCRIPT" FOR="objectGLS" EVENT="onscriptletevent(event, obj)">if (event == "evt_DocComplete") GetHTMLData(); </SCR' + 'IPT>')
window.self.document.writeln('<DIV ID="displayGLS" STYLE="z-index:100; position:absolute; display:none ; width:400px; padding:3px; background-color:lemonchiffon; border-style: inset; border-left-width: 1; border-top-width: 1; border-right-width: 2; border-bottom-width: 2; border-right-color: black; border-bottom-color: black; font:8pt Tahoma; line-height:8pt;"></DIV>');
function GlossaryObject(sFileName,sDataID,oSrc, sWordEntry){
this.sFileName = sFileName;
this.sDataID = sDataID;
this.oSrc = oSrc;
this.sWordEntry = sWordEntry;
}
var glbGlossary = new GlossaryObject();
function Glossary(oSrc){
glbGlossary.oSrc = oSrc;
glbGlossary.sDataID = oSrc.DATAID;
SetGlossaryPositionToClientPos();
if(glbGlossary.sFileName != oSrc.FILENAME){
var sObject = '<OBJECT ID=\"objectGLS" TYPE="text/x-scriptlet" STYLE="DISPLAY: none; WIDTH : 0 ; HEIGHT: 0 ">\n';
sObject += '<PARAM NAME="url" VALUE="' + oSrc.FILENAME + '">\n';
sObject += '</OBJECT>\n';
bufferGLS.innerHTML = sObject;
}
else
GetHTMLData();
glbGlossary.sFileName = oSrc.FILENAME;
}
function GetHTMLData(){
if(glbGlossary.oSrc.DSPTITLE){
var str = glbGlossary.oSrc.DSPTITLE;
}
else{
var str = ReplaceCh(glbGlossary.sDataID, '_', ' ');
};
glbGlossary.sWordEntry = '<B>' + str + '</B><BR>' + objectGLS.getInnerHTML('GLS_' + glbGlossary.sDataID);
SetGlossaryDisplay(1);
}
function ReplaceCh(str, ch_old, ch_new){
var i;
var str_new = '';
var ch;
for(i=0; i<str.length; i++){
ch = str.charAt(i);
if (ch == ch_old)
str_new += ch_new;
else
str_new += ch;
}
return str_new;
}
function SetGlossaryPositionToClientPos(){
var offSetLeft = window.event.clientX + document.body.scrollLeft + 10 ;
var offSetTop = window.event.clientY + document.body.scrollTop + 10;
// avoid runing to the right of the screen
if (((offSetLeft + 430) > document.body.offsetWidth) && (document.body.offsetWidth > 430 )) {
//offSetLeft = document.body.offsetWidth - 430; displayGLS
offSetLeft = document.body.offsetWidth - parseInt(displayGLS.style.width) - 34 ;
//alert(displayGLS.style.width);
}
displayGLS.style.left = offSetLeft;
displayGLS.style.top = offSetTop;
}
function SetGlossaryDisplay(nState){
if(nState == 0){
displayGLS.style.display = "none";
}
if(nState == 1){
displayGLS.innerHTML = glbGlossary.sWordEntry;
displayGLS.style.display = "";
//displayGLS.focus();
ClearBuffer();
}
}
function ClearBuffer(){
if(bufferGLS.innerHTML != "<BR>"){
setTimeout("bufferGLS.innerHTML = '<BR>'", 100)
glbGlossary.sFileName = " ";
}
}
function SetGlossary(){
ClearBuffer();
}
function window.document.onclick(){
if( typeof(bufferGLS) != "undefined" && window.event.srcElement.className != "Glossary" )
SetGlossaryDisplay(0);
}
function glossOnResize(){
if( typeof(bufferGLS) != "undefined")
SetGlossaryDisplay(0);
}