=== Build ================================================================== --- Build (revision 14414) +++ Build (local) @@ -11,7 +11,7 @@ open FH, '_build/magicnum' or return 0; my $filenum = ; close FH; - return $filenum == 403552; + return $filenum == 591784; } my $progname; === _build/magicnum ================================================================== --- _build/magicnum (revision 14414) +++ _build/magicnum (local) @@ -1 +1 @@ -403552 \ No newline at end of file +591784 \ No newline at end of file === lib/Widget/Lightbox.js ================================================================== --- lib/Widget/Lightbox.js (revision 14414) +++ lib/Widget/Lightbox.js (local) @@ -15,11 +15,11 @@ (function(){ var ua = navigator.userAgent; - Widget.Lightbox.Browser = { - IE: !!(window.attachEvent && !window.opera), - Opera: !!window.opera, - WebKit: ua.indexOf('AppleWebKit/') > -1, - Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') == -1 + Widget.Lightbox.Browser = { + IE: !!(window.attachEvent && !window.opera), + Opera: !!window.opera, + WebKit: ua.indexOf('AppleWebKit/') > -1, + Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') == -1 }; Widget.Lightbox.prototype.browser = Widget.Lightbox.Browser })(); @@ -51,7 +51,7 @@ if ( param ) { if ( param.content ) this.content(param.content); - + if ( param.divs ) { this.divs(param.divs); this.div = this._divs.wrapper; @@ -63,6 +63,17 @@ if ( param.callbacks ) { this.callbacks(param.callbacks) } + if (param.wrapperClassName) { + this.wrapperClassName = param.wrapperClassName; + } + else + this.wrapperClassName = 'jsan-widget-lightbox-content-wrapper'; + + if (param.contentClassName) { + this.contentClassName = param.contentClassName; + } + else + this.contentClassName = 'jsan-widget-lightbox-content'; } return this; } @@ -72,7 +83,7 @@ return; } Widget.Lightbox.showing++; - + var div = this.create(); if ( this.div.style.display== "none" ) this.div.style.display="block"; @@ -86,6 +97,10 @@ } } +Widget.Lightbox.prototype.release = function() { + this.divs.wrapper.parentNode.removeChild(this.divs.wrapper); +} + Widget.Lightbox.prototype.hide = function() { if (this.div.parentNode) { this.div.style.display="none"; @@ -131,12 +146,19 @@ if (typeof this.div != 'undefined') { return this.div; } - + var wrapperDiv = this.doc.createElement("div"); wrapperDiv.className = "jsan-widget-lightbox"; var contentDiv = this.doc.createElement("div"); - contentDiv.className = "jsan-widget-lightbox-content"; + if (this.contentClassName) { + contentDiv.className = this.contentClassName; + } + else { + contentDiv.className = "jsan-widget-lightbox-content"; + } + + if ( typeof this._content == 'object' ) { if ( this._content.nodeType && this._content.nodeType == 1 ) { contentDiv.appendChild( this._content ); @@ -147,8 +169,14 @@ } var contentWrapperDiv = this.doc.createElement("div"); - contentWrapperDiv.className = "jsan-widget-lightbox-content-wrapper"; + if (this.wrapperClassName) { + contentWrapperDiv.className = this.wrapperClassName; + } + else { + contentWrapperDiv.className = "jsan-widget-lightbox-content-wrapper"; + } + var bgDiv = this.doc.createElement("div"); bgDiv.className = "jsan-widget-lightbox-background"; @@ -156,7 +184,7 @@ wrapperDiv.appendChild(bgDiv); wrapperDiv.appendChild(contentWrapperDiv); - + this.div = wrapperDiv; this._divs = { wrapper: wrapperDiv, @@ -205,33 +233,37 @@ padding=0; margin=0; } - with(divs.contentWrapper.style) { - zIndex=baseZ + 1; - background='#fff'; - padding=0; - margin=this.config.margin; - width=this.config.width; - border="1px outset #555"; - if ( this.browser.IE ) { - position='absolute'; - top=0; - left=0; + if ( this.browser.IE ) { + divs.contentWrapper.style.position='absolute'; + divs.contentWrapper.style.top=0; + divs.contentWrapper.style.left=0; + } + else { + position='fixed'; + } + if ( this.wrapperClassName ) { + divs.contentWrapper.className = this.wrapperClassName; + } else { + with(divs.contentWrapper.style) { + zIndex=baseZ + 1; + background='#fff'; + padding=0; + margin=this.config.margin; + width=this.config.width; + border="1px outset #555"; } - else { - position='fixed'; - } } with(divs.content.style) { margin='5px'; } - + var win_height = document.body.clientHeight; var win_width = document.body.clientWidth; var my_width = divs.content.offsetWidth; var my_left = (win_width - my_width) /2; my_left = (my_left < 0)? 0 : my_left + "px"; - + divs.contentWrapper.style.left = my_left; if( this.browser.IE ) { document.body.scroll="no"; @@ -300,10 +332,11 @@ } } for (var i=1; i< 5; i++) { + var opacity = this.backgroundOpacity - 0.3; Effect.RoundedCorners._Styles.push([ ".rounded-corners-" + i, - "opacity: 0.7", - "filter: alpha(opacity=70)" + "opacity: " + opacity, + "filter: alpha(opacity="+ opacity * 100 +")" ]); } @@ -327,7 +360,7 @@ return function() { if ( ! this._divs ) { return; } if ( typeof Effect[effect] == 'undefined' ) { return; } - if (effect != 'Shake') + if (effect != 'Shake') this._divs.contentWrapper.style.display="none"; Effect[effect](this._divs.contentWrapper, { duration: 2.0 }); } @@ -335,6 +368,7 @@ } })(); + /** =head1 NAME @@ -359,7 +393,7 @@ 'divs': divs, 'effects': ['RoundedCorners'] }); - + # OO-style var box = new Widget.Lightbox; box.content(contentHTML); @@ -496,7 +530,7 @@ 'divs': divs, 'effects': ['RoundedCorners'] }); - + C takes a parameter hash. 'divs' key refers to a divs hash, 'effects' key refer to a array of effects. You need to get the element object of each divs first. Four divs are required: @@ -511,7 +545,7 @@ - + You need to layout your divs like this to let effects and style be applied correctly. @@ -538,7 +572,7 @@ =item content( HTML ) -Set the box content. +Set the box content. =item divs( {...} )