AttributionsTogether: 1
IDependOn-Set: 1
IDependOn-Set: 102
IDependOn-Set: 110
IDependOn-Set: 111
IDependOn-Set: 112
IDependOn-Set: 98
LastModifiedSecs: 1006808797
Parent: 110
SequenceNumber: 13
Title: confirm_flexible.js
Part: 0
Author-Set: sauer@cloudmaster.com
LastModifiedSecs: 1006808710
Type:
Lines: 1
The newer, more flexible version. I didn't finish the local:// URL support, but that should be pretty trivial. I just didn't need it. Someday...
EndPart: 0
Part: 1
Author-Set: sauer@cloudmaster.com
LastModifiedSecs: 1006808765
Type: html
Lines: 2
demo - http://www.cloudmaster.com/~sauer/demos/confirm_flexible.html
source - http://www.cloudmaster.com/~sauer/demos/confirm_flexible.js
EndPart: 1
Part: 2
Author-Set: sauer@cloudmaster.com
LastModifiedSecs: 1006808797
Type: monospaced
Lines: 151
// JavaScript functions to replace "confirm" with an arbitrary
// web page
//
// usage: promptem("message")
// display message box with the preformatted message included.
// promptem("http://site.com/page.htm")
// display message box with the remote URL included
// promptem("local://path/to/page.htm")
// display message box with the relative URL included
//
// promptem("arg1", "height", "width")
// specify a height and width after the first argument optionally
// you can change these defaults
var title = "Confirmation";
var h = 200; // default height
var w = 250; // default width
// you can change the "false"s to "true"s and vice-versa if need be.
function setParams(){
var p = "";
p += "toolbar=false";
p += ",location=false";
p += ",directories=false";
p += ",status=false";
p += ",menubar=false";
p += ",scrollbars=false";
p += ",resizable=false";
p += ",copyhistory=false";
return(p);
}
/******************************************************************************/
// don't screw with stuff after this line
/******************************************************************************/
var returned = false;
var retVal = false;
var out;
var i=0;
function promptem(){
window.name = "lenny";
var text = arguments[0];
var params = setParams();
if(arguments.length > 1){
h = arguments[1];
w = arguments[2];
}
params += ",height=" + h + ",width=" + w;
out = window.open('', 'out', params);
out.document.close();
writeWindow(out);
writeContent(text, out.frames['content']);
writeConfirm(out.frames['bottom']);
out.focus();
returned = false;
while(! returned){
setTimeout(waitForClick, 50);
}
alert(i);
waitForClick();
return(retVal);
}
// bah.
function waitForClick(){
i++;
// alert(i);
// if(! returned){
// setTimeout(waitForClick, 50);
// }
}
// generates the frameset
function writeWindow(win){
win.document.open();
win.document.writeln("