astro.js allow to document.getElementById(station).addEventListener(click, homeAstroportStation);

This commit is contained in:
fred 2023-03-10 17:33:56 +01:00
parent b4215a550a
commit ad57993444
4 changed files with 49 additions and 12 deletions

View File

@ -30,17 +30,22 @@ TYPE=$WHAT
mkdir -p ~/.zen/tmp/${MOATS}/
if [[ ${QRCODE} == "station" ]]; then
## GENERATE PLAYER G1 TO ZEN ACCOUNTING
ISTATION=$($MY_PATH/../tools/make_image_ipfs_index_carousel.sh | tail -n 1)
echo $ISTATION > ~/.zen/ISTATION ## STATION G1WALLET CAROUSEL
if [[ ! -s ~/.zen/tmp/WSTATION ]]; then
## GENERATE PLAYER G1 TO ZEN ACCOUNTING
ISTATION=$($MY_PATH/../tools/make_image_ipfs_index_carousel.sh | tail -n 1)
echo $ISTATION > ~/.zen/ISTATION ## STATION G1WALLET CAROUSEL
## SHOW G1PALPAY FRONT
sed "s~_STATION_~${myIPFS}${ISTATION}/~g" $MY_PATH/../www/G1PalPay/index.html > ~/.zen/tmp/${MOATS}/index.htm
sed -i "s~http://127.0.0.1:8080~${myIPFS}~g" ~/.zen/tmp/${MOATS}/index.htm
WSTATION="/ipfs/$(ipfs add -q ~/.zen/tmp/${MOATS}/index.htm)"
echo "NEW WSTATION ${myIPFS}${WSTATION}"
## SHOW G1PALPAY FRONT
sed "s~_STATION_~${myIPFS}${ISTATION}/~g" $MY_PATH/../www/G1PalPay/index.html > ~/.zen/tmp/${MOATS}/index.htm
sed -i "s~http://127.0.0.1:8080~${myIPFS}~g" ~/.zen/tmp/${MOATS}/index.htm
WSTATION="/ipfs/$(ipfs add -q ~/.zen/tmp/${MOATS}/index.htm)"
echo "NEW WSTATION ${myIPFS}${WSTATION}"
echo $WSTATION > ~/.zen/tmp/WSTATION
else
WSTATION=$(cat ~/.zen/tmp/WSTATION)
echo "WSTATION ${myIPFS}${WSTATION}"
fi
## SEND TO WSTATION PAGE
sed "s~_TWLINK_~${myIPFS}${WSTATION}/~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/${MOATS}/index.redirect
echo "url='"${myIPFS}${WSTATION}"'" >> ~/.zen/tmp/${MOATS}/index.redirect

22
templates/astro.js Normal file
View File

@ -0,0 +1,22 @@
<!-- homeAstroportStation function API Twist -->
async function homeAstroportStation() {
try {
let one = await fetch('http://127.0.0.1:1234/?qrcode=station'); // Gets a promise
var doc = await one.text();
var regex = /url='([^']+)/i; // Get response PORT
var redirectURL = doc.match(regex)[1]
console.log(redirectURL)
setTimeout(function() {
// let two = await fetch(redirectURL);
// document.mydiv.innerHTML = await two.text(); // Replaces body with response
window.location.href = redirectURL
// window.open( redirectURL, "AstroTab");
}, 15000);
} catch (err) {
console.log('Fetch error:' + err); // Error handling
}
}

View File

@ -33,16 +33,26 @@ header {
position: absolute;
top: 33%;
left: 66%;
width: 18%;
visibility: hidden;
}
</style>
<!-- Typed text animation -->
<script src="http://127.0.0.1:8080/ipfs/QmYyJmAT3cUbjk4vVWQG7LdpY3HkFH9phFD1VzzetHrgpa"></script>
<script src="http://127.0.0.1:8080/ipfs/QmVQNVGEbhMjWp6Jur8B4HxfPSupPHR4KRDPn1z3nyq6ad/astro.js"></script>
</head>
<body>
<header>
<h6>
/ipfs/<span>Station</span>(<a href="/?qrcode=station"></a>)
(<a href="javascript:homeAstroportStation()"></a>)<span>BOX</span>
<p id="station">Click me.</p>
<script>
document.getElementById("station").addEventListener("click", homeAstroportStation);
</script>
</h6>
</header>

View File

@ -139,7 +139,7 @@ a {
// let two = await fetch(redirectURL);
// document.mydiv.innerHTML = await two.text(); // Replaces body with response
window.open( redirectURL, "AstroTab");
}, 15000);
}, 15123);
} catch (err) {
console.log('Fetch error:' + err); // Error handling
@ -185,7 +185,7 @@ a {
</script>
<div id="yellow" >
<iframe src="_STATION_" width="100%" height="220px"></iframe>
<iframe id="inframe" src="_STATION_" width="100%" height="250px"></iframe>
</div>
<script>