Skip to content

Commit

Permalink
ok for first step guide from https://developer.ayoba.me/documentation…
Browse files Browse the repository at this point in the history
  • Loading branch information
eelaix committed Dec 30, 2023
1 parent 32e75a1 commit 56cd07d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# charge
charge
This ia a charge Microapp for ayoba

17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
img {
display: block;
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body style="background-color:#1565c0;">
<script src="../lib/microapp.js"></script>
<script>sayHello()</script>
<img src="logo.png" style="width:72px;"/>
</body>
</html>
25 changes: 25 additions & 0 deletions lib/microapp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var Ayoba = getAyoba()

/**
* Determine the mobile operating system and returns the
* proper javascript interface
*/
function getAyoba() {
var userAgent = navigator.userAgent || navigator.vendor || window.opera;

// Windows Phone must come first because its UA also contains "Android"
if (/windows phone/i.test(userAgent)) {
return null;
}

if (/android/i.test(userAgent)) {
return Android;
}

// iOS detection from: http://stackoverflow.com/a/9039885/177710
if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
return null; // todo
}

return "unknown";
}

0 comments on commit 56cd07d

Please sign in to comment.