In the continuation of the discussion at "Making Site Opaque -- This
Strategy Feasible?" and my comment at
I have realized that despite suggestions to use DHTML-based modal
dialogs are very common? there is not a single fully functional
reliable copyright-free cross-browser alternative to say MsgBox
(VBScript) or showModalDialog (IE). This way such suggestions up to
date are bearing rather a lot of hypocrisy by suggesting to use
something non-existing instead of something existing.
I am proposing to make TransModal library under MIT license to have a
good alternative to suggest. I also would like to have this library
novice-friendly for code studying, as I said before.
I am proposing the current v. 0.0.3 beta for criticism and for bug fix
in cope that it may be interesting for anyone to donate their time to
participate.
The whole package can be obtained at
The package contains:
0_0_3_Compat.ht ml - testing page in Compatibility (BackCompat) mode
0_0_3_Strict.ht ml - testing page in Strict (CSS1Compat) mode
TransModal.js - the version 0.0.3 beta itself
The TransModal.js code is also posted below. Usenet post formatting
specifics forced me to make line breaks in some long statements where
I would not do them otherwise. If still some lines get broken so
rendering the code non-functioning or hard to read then I have nothing
to say but my apologies. Use the source from the linked package
instead then.
/*************** *************** **************
* ATTENTION!
* This version TransModal 0.0.3 is intended
* for testing and debugging purpose only.
* It is NOT intended for a practical use.
*************** *************** **************/
function TransModal() {
/* Enforcing TransModal to be a singleton:
* other words do not allow to create new
* instances of TransModal class.
*
*? Objections?
*/
if (this instanceof TransModal) {
return TransModal;
}
/* Checking if not some weird environment
* where window host object is not available.
* It is here mostly to pacify some c.l.j.
* regulars - but who knows, it may come useful
* someday somewhere.
*
* "window" identifier is reserved for the host
* object. This way if typeof window == 'object'
* guarantees that either 1) host object is here
* or 2) it is not here but someone is
* emulating it. In the latter case it is not
* our concern how good or bad such emulation is.
*/
if (typeof window != 'object') {
return null;
}
/* Check if DOM manipualtions are available:
* other words if the document is loaded.
* If not then postpone the execution till
* after window load event.
* TransModal.isIE flag is preset on conditional
* compilation outside of the TransModal body:
* look at the end of this code.
*/
if (document.body == null) {
if (TransModal.isI E) {
window.attachEv ent('onload', TransModal);
}
else {
window.addEvent Listener('load' , TransModal, false);
}
return null;
}
/* If TransModal was already once executed
* then do not repeat the initialization.
*/
if (TransModal.isE xecuted) {
return null;
}
else {
TransModal.isEx ecuted = true;
}
/* If "modal" identifier is not already in use,
* then set it as a shortcut alias for TransModal.
* This way TransModal.dial og() and modal.dialog()
* calls will be equivalent.
*/
if (typeof modal == 'undefined') {
modal = TransModal;
}
/* Prototype.js compatibility.
* If global $() function is already defined
* then do not override it. Otherwise making
* a lightweight replacement of it.
*
* We don't want a parasite closure in here,
* so we are using Function constructor.
*/
if (typeof $ != 'function') {
$ = new Function('id',
'return document.getEle mentById(id)');
}
/* It would be nice to have button labels on
* user's preferred language and not English
* only.
* navigator.userL anguage (IE) and
* navigator.langu age (some other UAs) values
* may have different meanings: OS language,
* or browser interface language, or the preferred
* language in the browser settings. Either way
* IMHO it still allows to make a good guess what
* language the current user would like to see.
* If the detected language is not implemented yet
* then English is used by default.
* For such basic lexicon as "Yes", "No", "Cancel" etc.
* we may disregard country-specific variations, so we
* are taking only two first letters from the language
* code - so say "en", "en_US", "en_GB" will be "en".
*
*? Objections?
*/
if ('userLanguage' in navigator) {
var lang = navigator.userL anguage.substri ng(0,2);
}
else if ('language' in navigator) {
var lang = navigator.langu age.substring(0 ,2);
}
else {
var lang = 'en';
}
TransModal.lang = (lang in TransModal.butt onLabelSet) ?
lang : 'en';
/* Creating and adding dialog window template.
* Additional dialog styling may be applied
* over DIV#TransModalD ialog CSS rule set.
*/
var wndDialog = document.create Element('DIV');
wndDialog.id = 'TransModalDial og';
/* Some complex styling of a completely empty element
* may make IE to act strange. To avoid that we are
* setting the default content to NO-BREAK SPACE
*/
wndDialog.inner HTML = '<span>\u00A0</span>';
with (wndDialog.styl e) {
position = 'absolute';
zIndex = '1002';
left = '0px';
top = '0px';
cursor = 'default';
visibility = 'hidden';
}
document.body.a ppendChild(wndD ialog);
/* Creating and adding the cover sheet.
* The cover sheet is NOT supposed to
* be styled by external CSS rules. All
* what it needs is being made by script.
*/
var wndCover = document.create Element('DIV');
wndCover.id = 'TransModalVeil ';
wndCover.innerH TML = '<span>\u00A0</span>';
with (wndCover.style ) {
position = 'absolute';
zIndex = '1001';
left = '0px';
top = '0px';
margin = '0px 0px';
padding = '0px 0px';
borderStyle = 'none';
cursor = 'not-allowed';
visibility = 'hidden';
}
/* Pre-apply alpha filter for IE.
*/
if (TransModal.isI E) {
wndCover.style. filter = ''.concat(
'progid:DXImage Transform.Micro soft.Alpha(Opac ity=',
Math.floor(Tran sModal.coverOpa city * 100), ',Style=0)');
}
document.body.a ppendChild(wndC over);
}
/************** TransModal methods **************/
/* TransModal.dial og() method that
* takes four optional arguments:
*
* dlgPrompt : prompt HTML code
* dlgButtonSet : button set
* dlgDefaultButto n : default focus
* dlgListener : function to call
*/
TransModal.dial og = function(dlgPro mpt,
dlgButtonSet,
dlgDefaultButto n,
dlgListener) {
/* Setting defaults for missing arguments.
*/
if (typeof dlgPrompt != 'string') {
dlgPrompt = '<p>TransModal v.'.concat(
TransModal.repo rtVersion(), '</p>');
}
if (typeof dlgButtonSet != 'number') {
dlgButtonSet = 0;
}
if ((typeof dlgDefaultButto n != 'number') ||
(dlgDefaultButt on >= TransModal.
buttonSet[dlgButtonSet].length)) {
dlgDefaultButto n = 0;
}
if (typeof dlgListener != 'function') {
TransModal.noti fyObserver = TransModal.loop Hole;
}
else {
TransModal.noti fyObserver = dlgListener;
}
/* Intermediary variables to store
* clientWidth and clientHeight values.
*/
var w = document.docume ntElement.clien tWidth;
var h = document.docume ntElement.clien tHeight;
/* Setting the cover.
*/
var cover = $('TransModalVe il');
/* BUG bug 1
*
* We need a reliable algorithm to cover
* entire body, not just visible part of it
* like this current primitive does.
*/
cover.style.wid th = w + 'px';
cover.style.hei ght = h + 'px';
cover.style.bac kgroundColor = TransModal.cove rColor;
/* Working around different opacity models
* of IE and other browsers.
*/
if (TransModal.isI E) {
cover.filters.i tem('DXImageTra nsform.Microsof t.Alpha').
Opacity = Math.floor(Tran sModal.coverOpa city * 100);
}
else {
/* Safari requires opacity to be a string and it
* ignores numeric arguments.
* Other browsers accept either.
*/
cover.style.
opacity = '' + TransModal.cove rOpacity;
}
/* Preparing the dialog.
*/
var dialog = $('TransModalDi alog');
/* How many buttons in the selected set.
*/
var len = TransModal.butt onSet[dlgButtonSet].length;
/* We want all buttons in one row.
*/
var buttons = '<div style="white-space:nowrap !important">';
/* BUG bug 2
* Clicking outside of dialog makes current button
* to loose focus.
*/
/* BUG bug 3
* Navigating by TAB press goes away from the
* rightmost button to the document body.
* Must be switching to the leftmost button
* instead.
*/
/* BUG bug 4
* Arrow keys navigation doesn't work.
*/
for (var i=0; i<len; i++) {
var label = TransModal.butt onLabelSet[TransModal.lang][
TransModal.butt onSet[dlgButtonSet][i]];
buttons+= ''.concat(
'<button type="button" ',
'hidefocus ', // removes dotted focus from IE button labels
'onclick="Trans Modal.dismiss(\ '',
TransModal.butt onSet[dlgButtonSet][i], '\')">', label, '</button>
');
}
buttons+= '</div>';
dialog.innerHTM L = dlgPrompt + buttons;
/* BUG bug 5
* Scroll position is not accounted.
*/
dialog.style.le ft = Math.floor((w-dialog.offsetWi dth)/2) + 'px';
dialog.style.to p = Math.floor((h-dialog.offsetHe ight)/2) + 'px';
/* IE6 or older "Super Z of form elements" quirk fix.
* Until IE7 form controls were external DirectX objects
* drawn on a separate graphics layer after the whole
* page is drawn. That led to impossibility to cover
* some form controls (particularly SELECT) by a higher
* z-index DOM elements: form controls remained visible
* and accessible (hence the term; sometimes also
* referred as "firing through").
* As a partial and not perfect remedy we are disabling
* all form controls for IE6 or older.
* For extra large or multiple forms it may have
* a productivity impact.
* It also doesn't eliminate the risk of the dialog placed
* right over a form element thus partically overdrawn.
*/
/* BUG bug 6
* Doesn't account if some form controls are already
* disabled for some other purpose. This way on restoring
* their state will be overriden.
*/
if (TransModal.isO ldIE) {
for (var i=0; i<document.form s.length; i++) {
var len = document.forms[i].length;
for (var j=0; j<len; j++) {
/* IE considers links located within FORM as form
* controls, so it disables them as well.
* No extra check for links is added though to
* speed up the loop.
*
*? You think?
*/
document.forms[i].elements[j].disabled = true;
}
}
}
/* Display both the cover and the dialog.
*/
cover.style.vis ibility = 'visible';
dialog.style.vi sibility = 'visible';
/* Setting focus to the default button.
*/
window.setTimeo ut("$('TransMod alDialog')." +
"getElementsByT agName('BUTTON' )[" +
dlgDefaultButto n + "].focus()", 100);
};
/*** END OF TransModal.dial og FUNCTION ***/
TransModal.dism iss = function(presse dButtonSysName) {
$('TransModalDi alog').style.vi sibility = 'hidden';
$('TransModalVe il').style.visi bility = 'hidden';
if (TransModal.isO ldIE) {
for (var i=0; i<document.form s.length; i++) {
var len = document.forms[i].length;
for (var j=0; j<len; j++) {
/* see bug 6 */
document.forms[i].elements[j].disabled = false;
}
}
}
TransModal.noti fyObserver(pres sedButtonSysNam e);
}
/*** END OF TransModal.dism iss FUNCTION ***/
/* Library versioning
*/
TransModal.Majo rVersion = 0;
TransModal.Mino rVersion = 0;
TransModal.Buil dVersion = 3;
TransModal.repo rtVersion = function() {
return ''.concat(
TransModal.Majo rVersion,
'.', TransModal.Mino rVersion,
'.', TransModal.Buil dVersion);
}
/* "If TransModal initialized" flag
*/
TransModal.isEx ecuted = false;
/* A dummy function for testing and for NOOPs.
*/
TransModal.loop Hole = function() {
window.alert(ar guments[0] || 'no arguments');
}
/* Current cover color (black by default).
*/
TransModal.cove rColor = 'rgb(0,0,0)';
/* Current cover opacity (0.0 - 1.0)
* 0 - fully transparent
* 1 - fully opaque
*/
TransModal.cove rOpacity = 0.4;
/* In the future may be used to set
* cover appearence effects:
* 'none' - no effect
* 'fade' - fading
* 'flood' - flooding
*
* Not currently implemented.
*/
TransModal.cove rEffect = 'none';
/* Button labels by language codes.
*
* For the best interoperabilit y
* all characters above US-ASCII
* should be represented by Unicode
* escape sequences \uXXXX
*
* Currently only English is presented.
*/
TransModal.butt onLabelSet = {
'en' : {
'OK' : 'OK'
,'Cancel' : 'Cancel'
,'Abort' : 'Abort'
,'Retry' : 'Retry'
,'Ignore' : 'Ignore'
,'Yes' : 'Yes'
,'No' : 'No'
}
};
/* Available button sets. The sets
* are going by VB's MsgBox schema.
* These are system label names and
* they DON'T need to be translated.
*/
TransModal.butt onSet = [
['OK']
,['OK', 'Cancel']
,['Abort','Retry' ,'Ignore']
,['Yes','No','Can cel']
,['Yes','No']
,['Retry','Cancel ']
];
/* Conditional compilation.
* We all hate browser sniffing, do we ? :-)
*/
/*@cc_on @*/
/*@if (@_jscript)
TransModal.isIE = true;
TransModal.isOl dIE = ''.concat(
ScriptEngineMaj orVersion(), '.',
ScriptEngineMin orVersion(), '.',
ScriptEngineBui ldVersion()) <= '5.6.8834';
@else @*/
TransModal.isIE = false;
TransModal.isOl dIE = false;
/*@end @*/
/* Attempting to execute TransModal function.
*/
TransModal();
/* BUG bug 7
* The whole script is completely
* broken for IE in BackCompat mode.
*/
Strategy Feasible?" and my comment at
I have realized that despite suggestions to use DHTML-based modal
dialogs are very common? there is not a single fully functional
reliable copyright-free cross-browser alternative to say MsgBox
(VBScript) or showModalDialog (IE). This way such suggestions up to
date are bearing rather a lot of hypocrisy by suggesting to use
something non-existing instead of something existing.
I am proposing to make TransModal library under MIT license to have a
good alternative to suggest. I also would like to have this library
novice-friendly for code studying, as I said before.
I am proposing the current v. 0.0.3 beta for criticism and for bug fix
in cope that it may be interesting for anyone to donate their time to
participate.
The whole package can be obtained at
The package contains:
0_0_3_Compat.ht ml - testing page in Compatibility (BackCompat) mode
0_0_3_Strict.ht ml - testing page in Strict (CSS1Compat) mode
TransModal.js - the version 0.0.3 beta itself
The TransModal.js code is also posted below. Usenet post formatting
specifics forced me to make line breaks in some long statements where
I would not do them otherwise. If still some lines get broken so
rendering the code non-functioning or hard to read then I have nothing
to say but my apologies. Use the source from the linked package
instead then.
/*************** *************** **************
* ATTENTION!
* This version TransModal 0.0.3 is intended
* for testing and debugging purpose only.
* It is NOT intended for a practical use.
*************** *************** **************/
function TransModal() {
/* Enforcing TransModal to be a singleton:
* other words do not allow to create new
* instances of TransModal class.
*
*? Objections?
*/
if (this instanceof TransModal) {
return TransModal;
}
/* Checking if not some weird environment
* where window host object is not available.
* It is here mostly to pacify some c.l.j.
* regulars - but who knows, it may come useful
* someday somewhere.
*
* "window" identifier is reserved for the host
* object. This way if typeof window == 'object'
* guarantees that either 1) host object is here
* or 2) it is not here but someone is
* emulating it. In the latter case it is not
* our concern how good or bad such emulation is.
*/
if (typeof window != 'object') {
return null;
}
/* Check if DOM manipualtions are available:
* other words if the document is loaded.
* If not then postpone the execution till
* after window load event.
* TransModal.isIE flag is preset on conditional
* compilation outside of the TransModal body:
* look at the end of this code.
*/
if (document.body == null) {
if (TransModal.isI E) {
window.attachEv ent('onload', TransModal);
}
else {
window.addEvent Listener('load' , TransModal, false);
}
return null;
}
/* If TransModal was already once executed
* then do not repeat the initialization.
*/
if (TransModal.isE xecuted) {
return null;
}
else {
TransModal.isEx ecuted = true;
}
/* If "modal" identifier is not already in use,
* then set it as a shortcut alias for TransModal.
* This way TransModal.dial og() and modal.dialog()
* calls will be equivalent.
*/
if (typeof modal == 'undefined') {
modal = TransModal;
}
/* Prototype.js compatibility.
* If global $() function is already defined
* then do not override it. Otherwise making
* a lightweight replacement of it.
*
* We don't want a parasite closure in here,
* so we are using Function constructor.
*/
if (typeof $ != 'function') {
$ = new Function('id',
'return document.getEle mentById(id)');
}
/* It would be nice to have button labels on
* user's preferred language and not English
* only.
* navigator.userL anguage (IE) and
* navigator.langu age (some other UAs) values
* may have different meanings: OS language,
* or browser interface language, or the preferred
* language in the browser settings. Either way
* IMHO it still allows to make a good guess what
* language the current user would like to see.
* If the detected language is not implemented yet
* then English is used by default.
* For such basic lexicon as "Yes", "No", "Cancel" etc.
* we may disregard country-specific variations, so we
* are taking only two first letters from the language
* code - so say "en", "en_US", "en_GB" will be "en".
*
*? Objections?
*/
if ('userLanguage' in navigator) {
var lang = navigator.userL anguage.substri ng(0,2);
}
else if ('language' in navigator) {
var lang = navigator.langu age.substring(0 ,2);
}
else {
var lang = 'en';
}
TransModal.lang = (lang in TransModal.butt onLabelSet) ?
lang : 'en';
/* Creating and adding dialog window template.
* Additional dialog styling may be applied
* over DIV#TransModalD ialog CSS rule set.
*/
var wndDialog = document.create Element('DIV');
wndDialog.id = 'TransModalDial og';
/* Some complex styling of a completely empty element
* may make IE to act strange. To avoid that we are
* setting the default content to NO-BREAK SPACE
*/
wndDialog.inner HTML = '<span>\u00A0</span>';
with (wndDialog.styl e) {
position = 'absolute';
zIndex = '1002';
left = '0px';
top = '0px';
cursor = 'default';
visibility = 'hidden';
}
document.body.a ppendChild(wndD ialog);
/* Creating and adding the cover sheet.
* The cover sheet is NOT supposed to
* be styled by external CSS rules. All
* what it needs is being made by script.
*/
var wndCover = document.create Element('DIV');
wndCover.id = 'TransModalVeil ';
wndCover.innerH TML = '<span>\u00A0</span>';
with (wndCover.style ) {
position = 'absolute';
zIndex = '1001';
left = '0px';
top = '0px';
margin = '0px 0px';
padding = '0px 0px';
borderStyle = 'none';
cursor = 'not-allowed';
visibility = 'hidden';
}
/* Pre-apply alpha filter for IE.
*/
if (TransModal.isI E) {
wndCover.style. filter = ''.concat(
'progid:DXImage Transform.Micro soft.Alpha(Opac ity=',
Math.floor(Tran sModal.coverOpa city * 100), ',Style=0)');
}
document.body.a ppendChild(wndC over);
}
/************** TransModal methods **************/
/* TransModal.dial og() method that
* takes four optional arguments:
*
* dlgPrompt : prompt HTML code
* dlgButtonSet : button set
* dlgDefaultButto n : default focus
* dlgListener : function to call
*/
TransModal.dial og = function(dlgPro mpt,
dlgButtonSet,
dlgDefaultButto n,
dlgListener) {
/* Setting defaults for missing arguments.
*/
if (typeof dlgPrompt != 'string') {
dlgPrompt = '<p>TransModal v.'.concat(
TransModal.repo rtVersion(), '</p>');
}
if (typeof dlgButtonSet != 'number') {
dlgButtonSet = 0;
}
if ((typeof dlgDefaultButto n != 'number') ||
(dlgDefaultButt on >= TransModal.
buttonSet[dlgButtonSet].length)) {
dlgDefaultButto n = 0;
}
if (typeof dlgListener != 'function') {
TransModal.noti fyObserver = TransModal.loop Hole;
}
else {
TransModal.noti fyObserver = dlgListener;
}
/* Intermediary variables to store
* clientWidth and clientHeight values.
*/
var w = document.docume ntElement.clien tWidth;
var h = document.docume ntElement.clien tHeight;
/* Setting the cover.
*/
var cover = $('TransModalVe il');
/* BUG bug 1
*
* We need a reliable algorithm to cover
* entire body, not just visible part of it
* like this current primitive does.
*/
cover.style.wid th = w + 'px';
cover.style.hei ght = h + 'px';
cover.style.bac kgroundColor = TransModal.cove rColor;
/* Working around different opacity models
* of IE and other browsers.
*/
if (TransModal.isI E) {
cover.filters.i tem('DXImageTra nsform.Microsof t.Alpha').
Opacity = Math.floor(Tran sModal.coverOpa city * 100);
}
else {
/* Safari requires opacity to be a string and it
* ignores numeric arguments.
* Other browsers accept either.
*/
cover.style.
opacity = '' + TransModal.cove rOpacity;
}
/* Preparing the dialog.
*/
var dialog = $('TransModalDi alog');
/* How many buttons in the selected set.
*/
var len = TransModal.butt onSet[dlgButtonSet].length;
/* We want all buttons in one row.
*/
var buttons = '<div style="white-space:nowrap !important">';
/* BUG bug 2
* Clicking outside of dialog makes current button
* to loose focus.
*/
/* BUG bug 3
* Navigating by TAB press goes away from the
* rightmost button to the document body.
* Must be switching to the leftmost button
* instead.
*/
/* BUG bug 4
* Arrow keys navigation doesn't work.
*/
for (var i=0; i<len; i++) {
var label = TransModal.butt onLabelSet[TransModal.lang][
TransModal.butt onSet[dlgButtonSet][i]];
buttons+= ''.concat(
'<button type="button" ',
'hidefocus ', // removes dotted focus from IE button labels
'onclick="Trans Modal.dismiss(\ '',
TransModal.butt onSet[dlgButtonSet][i], '\')">', label, '</button>
');
}
buttons+= '</div>';
dialog.innerHTM L = dlgPrompt + buttons;
/* BUG bug 5
* Scroll position is not accounted.
*/
dialog.style.le ft = Math.floor((w-dialog.offsetWi dth)/2) + 'px';
dialog.style.to p = Math.floor((h-dialog.offsetHe ight)/2) + 'px';
/* IE6 or older "Super Z of form elements" quirk fix.
* Until IE7 form controls were external DirectX objects
* drawn on a separate graphics layer after the whole
* page is drawn. That led to impossibility to cover
* some form controls (particularly SELECT) by a higher
* z-index DOM elements: form controls remained visible
* and accessible (hence the term; sometimes also
* referred as "firing through").
* As a partial and not perfect remedy we are disabling
* all form controls for IE6 or older.
* For extra large or multiple forms it may have
* a productivity impact.
* It also doesn't eliminate the risk of the dialog placed
* right over a form element thus partically overdrawn.
*/
/* BUG bug 6
* Doesn't account if some form controls are already
* disabled for some other purpose. This way on restoring
* their state will be overriden.
*/
if (TransModal.isO ldIE) {
for (var i=0; i<document.form s.length; i++) {
var len = document.forms[i].length;
for (var j=0; j<len; j++) {
/* IE considers links located within FORM as form
* controls, so it disables them as well.
* No extra check for links is added though to
* speed up the loop.
*
*? You think?
*/
document.forms[i].elements[j].disabled = true;
}
}
}
/* Display both the cover and the dialog.
*/
cover.style.vis ibility = 'visible';
dialog.style.vi sibility = 'visible';
/* Setting focus to the default button.
*/
window.setTimeo ut("$('TransMod alDialog')." +
"getElementsByT agName('BUTTON' )[" +
dlgDefaultButto n + "].focus()", 100);
};
/*** END OF TransModal.dial og FUNCTION ***/
TransModal.dism iss = function(presse dButtonSysName) {
$('TransModalDi alog').style.vi sibility = 'hidden';
$('TransModalVe il').style.visi bility = 'hidden';
if (TransModal.isO ldIE) {
for (var i=0; i<document.form s.length; i++) {
var len = document.forms[i].length;
for (var j=0; j<len; j++) {
/* see bug 6 */
document.forms[i].elements[j].disabled = false;
}
}
}
TransModal.noti fyObserver(pres sedButtonSysNam e);
}
/*** END OF TransModal.dism iss FUNCTION ***/
/* Library versioning
*/
TransModal.Majo rVersion = 0;
TransModal.Mino rVersion = 0;
TransModal.Buil dVersion = 3;
TransModal.repo rtVersion = function() {
return ''.concat(
TransModal.Majo rVersion,
'.', TransModal.Mino rVersion,
'.', TransModal.Buil dVersion);
}
/* "If TransModal initialized" flag
*/
TransModal.isEx ecuted = false;
/* A dummy function for testing and for NOOPs.
*/
TransModal.loop Hole = function() {
window.alert(ar guments[0] || 'no arguments');
}
/* Current cover color (black by default).
*/
TransModal.cove rColor = 'rgb(0,0,0)';
/* Current cover opacity (0.0 - 1.0)
* 0 - fully transparent
* 1 - fully opaque
*/
TransModal.cove rOpacity = 0.4;
/* In the future may be used to set
* cover appearence effects:
* 'none' - no effect
* 'fade' - fading
* 'flood' - flooding
*
* Not currently implemented.
*/
TransModal.cove rEffect = 'none';
/* Button labels by language codes.
*
* For the best interoperabilit y
* all characters above US-ASCII
* should be represented by Unicode
* escape sequences \uXXXX
*
* Currently only English is presented.
*/
TransModal.butt onLabelSet = {
'en' : {
'OK' : 'OK'
,'Cancel' : 'Cancel'
,'Abort' : 'Abort'
,'Retry' : 'Retry'
,'Ignore' : 'Ignore'
,'Yes' : 'Yes'
,'No' : 'No'
}
};
/* Available button sets. The sets
* are going by VB's MsgBox schema.
* These are system label names and
* they DON'T need to be translated.
*/
TransModal.butt onSet = [
['OK']
,['OK', 'Cancel']
,['Abort','Retry' ,'Ignore']
,['Yes','No','Can cel']
,['Yes','No']
,['Retry','Cancel ']
];
/* Conditional compilation.
* We all hate browser sniffing, do we ? :-)
*/
/*@cc_on @*/
/*@if (@_jscript)
TransModal.isIE = true;
TransModal.isOl dIE = ''.concat(
ScriptEngineMaj orVersion(), '.',
ScriptEngineMin orVersion(), '.',
ScriptEngineBui ldVersion()) <= '5.6.8834';
@else @*/
TransModal.isIE = false;
TransModal.isOl dIE = false;
/*@end @*/
/* Attempting to execute TransModal function.
*/
TransModal();
/* BUG bug 7
* The whole script is completely
* broken for IE in BackCompat mode.
*/
Comment