forked from Maxluli/TinderPokemon
The app is now officially a PWA
This commit is contained in:
14
assets/JsStuff/manifest.webmanifest
Normal file
14
assets/JsStuff/manifest.webmanifest
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "Tinder for pokemons 2022",
|
||||||
|
"short_name": "Pokinder",
|
||||||
|
"start_url": "/es2-2022-2023/rhmr/PokemonTinder/index.html",
|
||||||
|
"id": "/es2-2022-2023/rhmr/PokemonTinder/index.html",
|
||||||
|
"display": "fullscreen",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "/es2-2022-2023/rhmr/PokemonTinder/assets/img/Icon2.png",
|
||||||
|
"sizes": "144x144",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 1.4 KiB |
3
assets/img/Icon.png:Zone.Identifier
Normal file
3
assets/img/Icon.png:Zone.Identifier
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[ZoneTransfer]
|
||||||
|
ZoneId=3
|
||||||
|
HostUrl=https://www.piskelapp.com/
|
||||||
BIN
assets/img/Icon2.png
Normal file
BIN
assets/img/Icon2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
36
index.html
36
index.html
@@ -19,7 +19,24 @@
|
|||||||
|
|
||||||
<title>Tinder Pokemon</title>
|
<title>Tinder Pokemon</title>
|
||||||
<link rel="icon" type="image/x-icon" href="assets/img/Icon.ico">
|
<link rel="icon" type="image/x-icon" href="assets/img/Icon.ico">
|
||||||
|
<link rel="manifest" href="assets/JsStuff/manifest.webmanifest">
|
||||||
</head>
|
</head>
|
||||||
|
<script>
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
// Register a service worker hosted at the root of the
|
||||||
|
// site using the default scope.
|
||||||
|
navigator.serviceWorker.register('/es2-2022-2023/rhmr/PokemonTinder/sw.js').then(
|
||||||
|
(registration) => {
|
||||||
|
console.log('Service worker registration succeeded:', registration)
|
||||||
|
},
|
||||||
|
/*catch*/(error) => {
|
||||||
|
console.log('Service worker registration failed:', error)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
console.log('Service workers are not supported.')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<body id="main">
|
<body id="main">
|
||||||
<div class="d-grid gap-2 text-center">
|
<div class="d-grid gap-2 text-center">
|
||||||
@@ -30,15 +47,6 @@
|
|||||||
<h2>Home</h2>
|
<h2>Home</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!---
|
|
||||||
<div class="container">
|
|
||||||
<div class="card p-2 text-center">
|
|
||||||
<div class="card-body">
|
|
||||||
This definitely is an AD
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="card p-2">
|
<div class="card p-2">
|
||||||
<img id="pokemonImage" style="image-rendering: pixelated;"
|
<img id="pokemonImage" style="image-rendering: pixelated;"
|
||||||
@@ -161,7 +169,7 @@
|
|||||||
document.getElementById('likeButton').onclick = function () {
|
document.getElementById('likeButton').onclick = function () {
|
||||||
if (LoadedSuccessfully) {
|
if (LoadedSuccessfully) {
|
||||||
//saveToIndexedDB("likes", CurrentPokemon);
|
//saveToIndexedDB("likes", CurrentPokemon);
|
||||||
storeToApi("likes",CurrentPokemon);
|
storeToApi("likes", CurrentPokemon);
|
||||||
loadNewPokemon();
|
loadNewPokemon();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -174,7 +182,7 @@
|
|||||||
document.getElementById('favoriteButton').onclick = function () {
|
document.getElementById('favoriteButton').onclick = function () {
|
||||||
if (LoadedSuccessfully) {
|
if (LoadedSuccessfully) {
|
||||||
//saveToIndexedDB("favorites", CurrentPokemon);
|
//saveToIndexedDB("favorites", CurrentPokemon);
|
||||||
storeToApi("favorites",CurrentPokemon);
|
storeToApi("favorites", CurrentPokemon);
|
||||||
loadNewPokemon();
|
loadNewPokemon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,7 +250,7 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
//This code... you wont believe it... its still not mine HAHAHAHAHA but now its from postman
|
//This code... you wont believe it... its still not mine HAHAHAHAHA but now its from postman
|
||||||
function storeToApi(storeName,pokemon) {
|
function storeToApi(storeName, pokemon) {
|
||||||
var myHeaders = new Headers();
|
var myHeaders = new Headers();
|
||||||
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
|
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
|
||||||
@@ -261,12 +269,12 @@
|
|||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch("https://633bde0df11701a65f69abe8.mockapi.io/api/v1/"+storeName+"/", requestOptions)
|
fetch("https://633bde0df11701a65f69abe8.mockapi.io/api/v1/" + storeName + "/", requestOptions)
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
let addedPokemon = JSON.parse(result);
|
let addedPokemon = JSON.parse(result);
|
||||||
console.log(addedPokemon);
|
console.log(addedPokemon);
|
||||||
saveToIndexedDB(storeName,addedPokemon);
|
saveToIndexedDB(storeName, addedPokemon);
|
||||||
})
|
})
|
||||||
.catch(error => console.log('error', error));
|
.catch(error => console.log('error', error));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user