-
Notifications
You must be signed in to change notification settings - Fork 0
/
controllerHTML.gs
37 lines (30 loc) · 987 Bytes
/
controllerHTML.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function outputHtmlFromFile(file, data) {
var output = outputHtmlFromTemplate(file, data)
return outputHtmlFromPage(output)
}
function outputHtmlFromPage(page) {
page.addMetaTag('viewport', 'width=device-width, initial-scale=1')
if (typeof APPS_NAME !== 'undefined')
page.setTitle(APPS_NAME)
else
page.setTitle('Untitled Ladon Project')
if (typeof FAVICON_URL !== 'undefined')
page.setFaviconUrl(FAVICON_URL)
return page;
}
function outputHtmlFromTemplate(template, data) {
var template = HtmlService.createTemplateFromFile(template)
template.data = data
return template.evaluate()
}
function outputHtmlFromText(text) {
return outputHtmlFromPage(HtmlService.createHtmlOutput(text))
}
function outputJSONFromObject(obj) {
return ContentService
.createTextOutput(JSON.stringify(obj))
.setMimeType(ContentService.MimeType.JAVASCRIPT)
}
function include(filename, data) {
return outputHtmlFromTemplate(filename, data).getContent()
}