2021-10-04 22:57:53 +00:00
|
|
|
<html>
|
2021-11-20 21:27:10 +00:00
|
|
|
<head>
|
2021-11-03 03:10:58 +00:00
|
|
|
<link rel="stylesheet" href="../../css/spectre.min.css">
|
2021-11-20 21:27:10 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2021-11-04 23:00:41 +00:00
|
|
|
|
2021-11-20 21:27:10 +00:00
|
|
|
<p>Some text: <input type="text" id="mytext" class="form-input" value="http://espruino.com"></p>
|
|
|
|
<p>Click <button id="upload" class="btn btn-primary">Upload</button></p>
|
|
|
|
|
|
|
|
<script src="../../core/lib/customize.js"></script>
|
2021-11-04 23:00:41 +00:00
|
|
|
|
2021-10-04 22:57:53 +00:00
|
|
|
<script>
|
2021-11-20 21:27:10 +00:00
|
|
|
// When the 'upload' button is clicked...
|
|
|
|
document.getElementById("upload").addEventListener("click", function () {
|
|
|
|
// get the text to add
|
|
|
|
var text = document.getElementById("mytext").value;
|
|
|
|
// build the app's text using a templated String
|
|
|
|
var app = `
|
2021-11-04 23:00:41 +00:00
|
|
|
var txt = ${JSON.stringify(text)};
|
|
|
|
g.clear(1);
|
|
|
|
g.setFontAlign(0,0);
|
|
|
|
g.setFont("6x8");
|
|
|
|
g.drawString(txt,120,120);
|
|
|
|
`;
|
2021-11-20 21:27:10 +00:00
|
|
|
// send finished app (in addition to contents of app.json)
|
|
|
|
sendCustomizedApp({
|
|
|
|
storage: [
|
|
|
|
{ name: "myapp.app.js", url: "app.js", content: app },
|
|
|
|
]
|
|
|
|
});
|
2021-11-03 15:06:50 +00:00
|
|
|
});
|
2021-11-04 23:00:41 +00:00
|
|
|
|
2021-10-04 22:57:53 +00:00
|
|
|
</script>
|
2021-11-20 21:27:10 +00:00
|
|
|
</body>
|
2021-10-04 22:57:53 +00:00
|
|
|
</html>
|