diff --git a/dad-jokes/README.md b/dad-jokes/README.md new file mode 100644 index 00000000..4b586c3c --- /dev/null +++ b/dad-jokes/README.md @@ -0,0 +1,2 @@ +# Dad jokes +fetches random dad joke from icanhazdadjoke api diff --git a/dad-jokes/imgs/left-removebg-preview.png b/dad-jokes/imgs/left-removebg-preview.png new file mode 100644 index 00000000..f36f7925 Binary files /dev/null and b/dad-jokes/imgs/left-removebg-preview.png differ diff --git a/dad-jokes/imgs/right-removebg-preview.png b/dad-jokes/imgs/right-removebg-preview.png new file mode 100644 index 00000000..2b2f9d5b Binary files /dev/null and b/dad-jokes/imgs/right-removebg-preview.png differ diff --git a/dad-jokes/index.html b/dad-jokes/index.html new file mode 100644 index 00000000..718d6b48 --- /dev/null +++ b/dad-jokes/index.html @@ -0,0 +1,38 @@ + + + + + + dad hehe + + + + + + + + + +
+ +
+ +
+
+ +
+ Here you shall see magik +
+ +
+
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/dad-jokes/script.js b/dad-jokes/script.js new file mode 100644 index 00000000..22292149 --- /dev/null +++ b/dad-jokes/script.js @@ -0,0 +1,20 @@ + + +const dadjoke = async () =>{ + try{ + const head = {headers:{Accept:'application/json'}}; + const response = await axios.get('https://icanhazdadjoke.com/',head); + return response.data.joke; + } catch(e){ + alert("ERROR, no joke/or wrong api/ "+e); + return ('NO jokes available..') + } +} + +const displayBox = document.querySelector('#box'); +const btn = document.querySelector('button'); + +btn.addEventListener('click',async ()=>{ + const joke = await dadjoke(); + displayBox.innerHTML = `

${joke}

`; +}) \ No newline at end of file diff --git a/dad-jokes/style.css b/dad-jokes/style.css new file mode 100644 index 00000000..b7df5aa3 --- /dev/null +++ b/dad-jokes/style.css @@ -0,0 +1,15 @@ +body{ + background-color: rgb(196, 183, 183) !important; +} +img { + width: 100%; + height: auto; + max-width: 1000px; +} +#box{ + background-color: whitesmoke !important; + border: 2px solid black; + border-radius: 20px; + padding-top: 1vh; + padding-bottom: 1vh; +} \ No newline at end of file