function editbufferonload(){
x=(Math.round(top.display.document.forms[0].editbuffer.value.length/100))/10;
top.display.document.forms[0].editbuffer.defaultvalue=top.display.document.forms[0].editbuffer.value
top.display.document.forms[0].editbuffer.focus();
if (top.info.document.forms[0]){
top.info.document.forms[0].info.value="OK " + x + " kilobytes.";
// if (x>29.99){
// alert("Filesize greater than 30 KB see readme.htm");
// }
}
return true;
}
function submitted(mybutton,myform){
top.info.document.forms[0].info.value="Please wait.";
switch (mybutton){
case "Go":
case "Save":
if(myform.editbuffer.value.length < 1){
top.info.document.forms[0].info.value="Click the OK button.";
alert("Edit buffer is empty!");
top.info.document.forms[0].info.value="Buffer was empty.";
return false;
}
if ((myform.filename.value=='untitled')||(myform.filename.value.length < 1)){
myform.filename.value=prompt ('Save as:','example.php3');
if ((myform.filename.value=='null')||(myform.filename.value.length < 1)){
myform.filename.value='untitled';
top.info.document.forms[0].info.value="Save cancelled.";
return false;
}
}
if ((myform.editbuffer.value==myform.editbuffer.defaultvalue)&&(mybutton=="Save")){
if (confirm('No changes detected. Please confirm this save.')){
// OK, carry on.
}else{
top.info.document.forms[0].info.value="OK";
return false;
}
}
myform.target="info";
myform.mysubmit.value=mybutton;
myform.submit();
return true;
case "Delete":
top.info.document.forms[0].info.value="Are you sure you're sure?";
if (confirm('Delete this file?')){
myform.editbuffer.value="";
myform.target="info";
myform.mysubmit.value=mybutton
myform.submit();
return true;
}
top.info.document.forms[0].info.value="Deletion cancelled.";
return false;
case "Load":
i=top.display.document.forms[0].myopenfile.selectedIndex;
if (i){
top.display.document.forms[0].target="display";
top.display.document.forms[0].filename.value=top.display.document.forms[0].myopenfile.options[i].text;
myform.editbuffer.value="";
myform.mysubmit.value=mybutton
myform.submit();
return true;
}else{
top.info.document.forms[0].info.value="File open failed";
return false;
}
default:
alert("Problem, made it through the case statements!");
top.info.document.forms[0].info.value="Problem :(";
return false;
}
}
|