mirror of
https://github.com/arx-research/libhalo.git
synced 2026-01-10 05:38:10 -05:00
64 lines
2.3 KiB
HTML
64 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<!--
|
|
LibHaLo - Programmatically interact with HaLo tags from the web browser, mobile application or the desktop.
|
|
Copyright by Arx Research, Inc., a Delaware corporation
|
|
License: MIT
|
|
-->
|
|
<title>LibHaLo Demo</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
|
|
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
|
|
|
|
<script type="text/javascript">
|
|
// ensure the library is always fully reloaded
|
|
document.write('<script src="../dist/libhalo.js?_v=' + (Math.random() + '') + '"></scr' + 'ipt>');
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="container mt-3 mb-5">
|
|
<h1>LibHaLo Demo</h1>
|
|
<div class="mb-4">
|
|
<strong>Graffiti text to store:</strong>
|
|
<input type="text" class="form-control" id="graffiti" value="">
|
|
<p class="text-muted">
|
|
ASCII string containing from 0 to 32 characters, supported charset: <code>[A-Za-z0-9-_.]</code>
|
|
</p>
|
|
</div>
|
|
|
|
<strong>Status text:</strong>
|
|
<pre id="statusText" style="white-space: pre-wrap; word-break: break-all;">Please click on one of the buttons below.</pre>
|
|
|
|
<div class="mt-2">
|
|
<button class="btn btn-secondary" onclick="btnExecuteNFC();">
|
|
Store data
|
|
</button>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
function btnExecuteNFC() {
|
|
let graffitiText = document.getElementById('graffiti').value;
|
|
let command = {
|
|
"name": "store_graffiti",
|
|
"slotNo": 1,
|
|
"data": graffitiText
|
|
}
|
|
|
|
execHaloCmdWeb(command)
|
|
.then((res) => {
|
|
// operation succeeded, display the result to the user
|
|
document.getElementById('statusText').innerText = JSON.stringify(res, null, 4);
|
|
})
|
|
.catch((e) => {
|
|
// the operation has failed, display the reason to the user
|
|
console.error('execHaloCmdWeb error', e);
|
|
document.getElementById('statusText').innerText = e;
|
|
});
|
|
}
|
|
</script>
|
|
</div>
|
|
</body>
|
|
</html>
|