ImageManager/assets/dialog.js
Summary
No overview generated for 'ImageManager/assets/dialog.js'
Dialog._return = null;
Dialog._modal = null;
Dialog._arguments = null;
Dialog.agt = navigator.userAgent.toLowerCase();
Dialog.is_ie = ((Dialog.agt.indexOf("msie") != -1) && (Dialog.agt.indexOf("opera") == -1));
function Dialog(url, action, init)
{
if (typeof init == "undefined")
{
init = window; // pass this window object by default
}
if (typeof Dialog.arguments[3] != "undefined")
{
Dialog._editor = Dialog.arguments[3];
}
Dialog._geckoOpenModal(url, action, init);
}; // end of Dialog()
Dialog._parentEvent = function(ev)
{
setTimeout(
function()
{
if (Dialog._modal && !Dialog._modal.closed)
{
Dialog._modal.focus()
}
}, 50); // end of setTimeout() call.
if (Dialog._modal && !Dialog._modal.closed)
{
Dialog._stopEvent(ev);
}
}; // end of _parentEvent();
Dialog._geckoOpenModal = function(url, action, init)
{
var myURL = "hadialog"+url;
var regObj = /\W/g;
myURL = myURL.replace(regObj,'_');
var dlg = window.open(url, myURL,
"toolbar=no,menubar=no,personalbar=no,width=10,height=10," +
"scrollbars=no,resizable=yes,modal=yes,dependable=yes");
Dialog._modal = dlg;
Dialog._arguments = init;
function capwin(w)
{
Dialog._addEvent(w, "click", Dialog._parentEvent);
Dialog._addEvent(w, "mousedown", Dialog._parentEvent);
Dialog._addEvent(w, "focus", Dialog._parentEvent);
};
function relwin(w)
{
Dialog._removeEvent(w, "click", Dialog._parentEvent);
Dialog._removeEvent(w, "mousedown", Dialog._parentEvent);
Dialog._removeEvent(w, "focus", Dialog._parentEvent);
};
capwin(window);
for (var i = 0; i < window.frames.length; capwin(window.frames[i++]));
Dialog._return = function (val)
{
if (val && action)
{
action(val);
}
relwin(window);
for (var i = 0; i < window.frames.length; relwin(window.frames[i++]));
Dialog._modal = null;
};
}; // end of Dialog._geckoOpenModal
Dialog._addEvent = function(el, evname, func)
{
if (Dialog.is_ie)
{
el.attachEvent("on" + evname, func);
}
else
{
el.addEventListener(evname, func, true);
}
};
Dialog._removeEvent = function(el, evname, func)
{
if (Dialog.is_ie)
{
el.detachEvent("on" + evname, func);
}
else
{
el.removeEventListener(evname, func, true);
}
};
Dialog._stopEvent = function(ev)
{
if (Dialog.is_ie)
{
ev.cancelBubble = true;
ev.returnValue = false;
}
else
{
ev.preventDefault();
ev.stopPropagation();
}
};
Dialog.hello = function()
{
alert( "HELLO" );
}
Documentation generated by
JSDoc on Sat Dec 31 14:56:56 2005