ASNMTAP
view release on metacpan or search on metacpan
applications/htmlroot/overlib_shadow.js view on Meta::CPAN
if (o3_x < left || o3_x > right || o3_y < top || o3_y > bottom) return true;
return false;
}
// Pre-hide processing to clean-up.
function checkShadowPreHide() {
if (o3_shadow && o3_shadowopacity) cleanUpShadowEffects();
if (o3_shadow && (olIe4 && isMac) ) over.style.pixelWidth=over.style.pixelHeight = 0;
}
// Funciton that creates the actual shadow
function generateShadow(content) {
var wd, ht, X = 0, Y = 0, zIdx = 0, txt, dpObj, puObj, bS= '', aPos, posStr=new Array();
if (!o3_shadow || (o3_shadowx == 0 && o3_shadowy == 0)) return;
X = Math.abs(o3_shadowx);
Y = Math.abs(o3_shadowy);
wd = parseInt(o3_width);
ht = (olNs4) ? over.clip.height : over.offsetHeight;
if (o3_shadowx == 0) {
if (o3_shadowy < 0) {
posStr[0]=' left:0; top: 0';
posStr[1]=' left:0; top: '+Y+'px';
} else if (o3_shadowy > 0) {
posStr[0]=' left:0; top: '+Y+'px';
posStr[1]=' left:0; top:0';
}
} else if (o3_shadowy == 0) {
if (o3_shadowx < 0) {
posStr[0]=' left:0; top: 0';
posStr[1]=' left: '+X+'px';
} else if (o3_shadowx > 0) {
posStr[0]=' left: '+ X+'px; top: 0';
posStr[1]=' left:0; top:0';
}
} else if (o3_shadowx > 0) {
if (o3_shadowy > 0) {
posStr[0]=' left:'+ X+'px; top:'+Y+'px';
posStr[1]=' left:0; top:0';
} else if (o3_shadowy < 0) {
posStr[0]=' left:'+X+'px; top:0';
posStr[1]=' left:0; top: '+Y+'px';
}
} else if (o3_shadowx < 0) {
if (o3_shadowy > 0) {
posStr[0]=' left:0; top:'+Y+'px';
posStr[1]=' left:'+X+'px; top:0';
} else if (o3_shadowy < 0) {
posStr[0]=' left:0; top:0';
posStr[1]=' left:'+X+'px; top:'+Y+'px';
}
}
txt = (olNs4) ? '<div id="backdrop"></div>' : ((olIe55&&olHideForm) ? backDropSource(wd+X,ht+Y,zIdx++) : '') + '<div id="backdrop" style="position: absolute;'+posStr[0]+'; width: '+wd+'px; height: '+ht+'px; z-index: ' + (zIdx++) + '; ';
if (o3_shadowimage) {
bS='background-image: url('+o3_shadowimage+');';
if (olNs4) bkSet=1;
} else {
bS='background-color: '+o3_shadowcolor +';';
if (olNs4) bkSet=2;
}
if (olNs4) {
txt += '<div id="PUContent">'+content+'</div>';
} else {
txt += bS+'"></div><div id="PUContent" style="position: absolute;'+posStr[1]+'; width: '+ wd+'px; z-index: '+(zIdx++)+';">'+content+'</div>';
}
layerWrite(txt);
if (olNs4 && bkSet) {
dpObj = over.document.layers['backdrop'];
if (typeof dpObj == 'undefined') return; // if shadow layer not found, then content layer won't be either
puObj = over.document.layers['PUContent'];
wd = puObj.clip.width;
ht = puObj.clip.height;
aPos = posStr[0].split(';');
dpObj.clip.width = wd;
dpObj.clip.height = ht;
dpObj.left = parseInt(aPos[0].split(':')[1]);
dpObj.top = parseInt(aPos[1].split(':')[1]);
dpObj.bgColor = (bkSet == 1) ? null : o3_shadowcolor;
dpObj.background.src = (bkSet==2) ? null : o3_shadowimage;
dpObj.zIndex = 0;
aPos = posStr[1].split(';');
puObj.left = parseInt(aPos[0].split(':')[1]);
puObj.top = parseInt(aPos[1].split(':')[1]);
puObj.zIndex = 1;
} else {
puObj = (olIe4 ? o3_frame.document.all['PUContent'] : o3_frame.document.getElementById('PUContent'));
dpObj = (olIe4 ? o3_frame.document.all['backdrop'] : o3_frame.document.getElementById('backdrop'));
ht = puObj.offsetHeight;
dpObj.style.height = ht + 'px';
if (o3_shadowopacity) {
var op = o3_shadowopacity;
op = (op <= 100 ? op : 100);
setBrowserOpacity(op,dpObj);
}
}
// Set popup's new width and height values here so they are available in placeLayer()
o3_width = wd+X;
o3_aboveheight = ht+Y;
}
////////
// SUPPORT FUNCTIONS
////////
// Cleans up opacity settings if any.
function cleanUpShadowEffects() {
if (olNs4 || olOp) return;
var dpObj=(olIe4 ? o3_frame.document.all['backdrop'] : o3_frame.document.getElementById('backdrop'));
cleanUpBrowserOpacity(dpObj);
}
// multi browser opacity support
function setBrowserOpacity(op,lyr){
if (olNs4||!op) return; // if Ns4.x or opacity not given return;
lyr=(lyr) ? lyr : over;
if (olIe4&&typeof lyr.filters != 'undefined') {
lyr.style.filter='Alpha(Opacity='+op+')';
lyr.filters.alpha.enabled=true;
} else {
var sOp=(typeof(lyr.style.MozOpacity)!='undefined') ? 'MozOpacity' : (typeof(lyr.style.KhtmlOpacity)!='undefined' ? 'KhtmlOpacity' : (typeof(lyr.style.opacity)!='undefined' ? 'opacity' : ''));
if (sOp) eval('lyr.style.'+sOp+'=op/100');
}
}
// multi-browser Opacity cleanup
function cleanUpBrowserOpacity(lyr) {
if (olNs4) return;
lyr=(lyr) ? lyr : over;
if (olIe4&&(typeof lyr.filters != 'undefined'&&lyr.filters.alpha.enabled)) {
lyr.style.filter='Alpha(Opacity=100)';
lyr.filters.alpha.enabled=false;
} else {
var sOp=(typeof(lyr.style.MozOpacity)!='undefined') ? 'MozOpacity' : (typeof(lyr.style.KhtmlOpacity)!='undefined' ? 'KhtmlOpacity' : (typeof(lyr.style.opacity)!='undefined' ? 'opacity' : ''));
( run in 1.308 second using v1.01-cache-2.11-cpan-d8267643d1d )