I'm working on a spreadsheet which opens a modal dialogue when a script begins to execute. Inside it plays a google-style "working" animation made with CSS:
If I could remove the close button so that the user has to sit at this dialogue box until the script finishes, I would. I don't want the user to be able to edit the spreadsheet while the script runs, but my understanding is that I can't remove it.
So, is it instead possible to register when the user clicks the close button so that I can cancel execution of the script?
This is the code that generates the Modal Dialogue:
Code.gs
function createpage()
{
var output=HtmlService.createTemplateFromFile('Page').evaluate();
SpreadsheetApp.getUi().showModalDialog(output, 'Generating... please wait');
}
function getContent(filename) {
return HtmlService.createTemplateFromFile(filename).getRawContent();
}
Page.html
<html>
<head>
<base target="_top">
<?!= getContent("CSS") ?>
</head>
<body>
<h1>
</h1>
<p>To cancel, click the close button.</p>
<div class="google-loader">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</body>
</html>
There is also a CSS.HTML
file that is pulled into Page.HTML
by <?!= getContent("CSS") ?>
.