From d2ff618a248532969f398072d84914f2733c21b4 Mon Sep 17 00:00:00 2001 From: Bijay Jiwrajka Date: Sun, 7 Jan 2024 11:04:27 +0530 Subject: [PATCH] add: social media sharing options --- Dark/end.html | 26 ++++++++++++++++++++++++++ Dark/end.js | 13 ++++++++++++- Dark/style.css | 11 ++--------- Light/end.html | 26 ++++++++++++++++++++++++++ Light/end.js | 13 ++++++++++++- Light/style.css | 11 ++--------- 6 files changed, 80 insertions(+), 20 deletions(-) diff --git a/Dark/end.html b/Dark/end.html index 369bb3c..79855dc 100644 --- a/Dark/end.html +++ b/Dark/end.html @@ -32,6 +32,32 @@

Go Home Change Theme +
+ + + + + + + + + +
diff --git a/Dark/end.js b/Dark/end.js index b59002f..468f311 100644 --- a/Dark/end.js +++ b/Dark/end.js @@ -26,4 +26,15 @@ saveHighScore = (e) => { localStorage.setItem('highScores', JSON.stringify(highScores)); window.location.assign('index.html'); -}; \ No newline at end of file +}; + +function shareOnFacebook() { + var urlToShare = "https://cpvalor.netlify.app"; + window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(urlToShare), "_blank"); +} + +function shareOnTwitter() { + var textToShare = "I scored high in the game! Check it out!"; + var urlToShare = "https://cpvalor.netlify.app"; + window.open("https://twitter.com/intent/tweet?text=" + encodeURIComponent(textToShare) + "&url=" + encodeURIComponent(urlToShare), "_blank"); +} \ No newline at end of file diff --git a/Dark/style.css b/Dark/style.css index 1dcfc6a..ad71f4c 100644 --- a/Dark/style.css +++ b/Dark/style.css @@ -49,23 +49,16 @@ h3 { } /* UTILITIES */ - .container { width: 100vw; height: 100vh; display: flex; justify-content: center; align-items: center; - max-width: 80rem; - margin: 0 auto; - padding: 0rem; - padding-left: 1rem; - padding-right: 1rem; + flex-direction: column; + gap: 1rem; } -.container > * { - width: 100%; -} .flex-column { display: flex; diff --git a/Light/end.html b/Light/end.html index d1cf334..f03f118 100644 --- a/Light/end.html +++ b/Light/end.html @@ -32,6 +32,32 @@

Go Home Change Theme +
+ + + + + + + + + +
diff --git a/Light/end.js b/Light/end.js index b59002f..468f311 100644 --- a/Light/end.js +++ b/Light/end.js @@ -26,4 +26,15 @@ saveHighScore = (e) => { localStorage.setItem('highScores', JSON.stringify(highScores)); window.location.assign('index.html'); -}; \ No newline at end of file +}; + +function shareOnFacebook() { + var urlToShare = "https://cpvalor.netlify.app"; + window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(urlToShare), "_blank"); +} + +function shareOnTwitter() { + var textToShare = "I scored high in the game! Check it out!"; + var urlToShare = "https://cpvalor.netlify.app"; + window.open("https://twitter.com/intent/tweet?text=" + encodeURIComponent(textToShare) + "&url=" + encodeURIComponent(urlToShare), "_blank"); +} \ No newline at end of file diff --git a/Light/style.css b/Light/style.css index b3faf15..1ef9e57 100644 --- a/Light/style.css +++ b/Light/style.css @@ -56,15 +56,8 @@ h3 { display: flex; justify-content: center; align-items: center; - max-width: 80rem; - margin: 0 auto; - padding: 0rem; - padding-left: 1rem; - padding-right: 1rem; -} - -.container > * { - width: 100%; + flex-direction: column; + gap: 1rem; }