-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>{{ $movie['original_title'] }}</title> | ||
<script> | ||
const movieData = @json($movie); | ||
</script> | ||
<!-- | ||
- favicon | ||
--> | ||
|
@@ -397,65 +400,11 @@ | |
|
||
</div> | ||
</div> | ||
|
||
|
||
|
||
</footer> | ||
|
||
|
||
|
||
|
||
|
||
<!-- | ||
- #GO TO TOP | ||
--> | ||
|
||
<a href="#top" class="go-top" data-go-top> | ||
<ion-icon name="chevron-up"></ion-icon> | ||
</a> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<script> | ||
document.addEventListener('DOMContentLoaded', function() { | ||
// Get the WhatsApp and Facebook share buttons | ||
const whatsappShareButton = document.getElementById('whatsappShare'); | ||
const facebookShareButton = document.getElementById('facebookShare'); | ||
// Retrieve movie data from data-movie attribute | ||
const movieData = JSON.parse(document.body.getAttribute('data-movie')); | ||
// Add a click event listener to the WhatsApp share button | ||
whatsappShareButton.addEventListener('click', function() { | ||
// Generate the sharing message based on the movie details | ||
const shareMessage = | ||
`${movieData.original_title} - ${movieData.overview}\n${window.location.href}`; | ||
// Open the WhatsApp sharing link with the message | ||
const whatsappLink = `https://wa.me/?text=${encodeURIComponent(shareMessage)}`; | ||
window.open(whatsappLink, '_blank'); | ||
}); | ||
// Add a click event listener to the Facebook share button | ||
facebookShareButton.addEventListener('click', function() { | ||
// Generate the sharing link based on the movie details | ||
const shareLink = window.location.href; // You can customize this based on your requirements | ||
// Open the Facebook sharing link | ||
const facebookLink = | ||
`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareLink)}`; | ||
window.open(facebookLink, '_blank'); | ||
}); | ||
}); | ||
</script> | ||
|
||
|
||
<!-- | ||
- ionicon link | ||
--> | ||
@include('frontend.components.sharescript') | ||
<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script> | ||
<script nomodule src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 37 additions & 27 deletions
64
resources/views/frontend/components/sharescript.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,39 @@ | ||
<script> | ||
document.addEventListener('DOMContentLoaded', function() { | ||
// Get the WhatsApp and Facebook share buttons | ||
const whatsappShareButton = document.getElementById('whatsappShare'); | ||
const facebookShareButton = document.getElementById('facebookShare'); | ||
// Add a click event listener to the WhatsApp share button | ||
whatsappShareButton.addEventListener('click', function() { | ||
// Generate the sharing message based on your movie details | ||
const shareMessage = `${$movie['original_title']} - ${$movie['overview']}\n${window.location.href}`; | ||
// Open the WhatsApp sharing link with the message | ||
const whatsappLink = `https://wa.me/?text=${encodeURIComponent(shareMessage)}`; | ||
window.open(whatsappLink, '_blank'); | ||
}); | ||
// Add a click event listener to the Facebook share button | ||
facebookShareButton.addEventListener('click', function() { | ||
// Generate the sharing link based on your movie details | ||
const shareLink = window.location.href; // You can customize this based on your requirements | ||
// Open the Facebook sharing link | ||
const facebookLink = | ||
`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareLink)}`; | ||
window.open(facebookLink, '_blank'); | ||
}); | ||
}); | ||
</script> | ||
// Get the WhatsApp and Facebook share buttons | ||
const whatsappShareButton = document.getElementById('whatsappShare'); | ||
const facebookShareButton = document.getElementById('facebookShare'); | ||
// Check if the WhatsApp share button exists | ||
if (whatsappShareButton) { | ||
// Add a click event listener to the WhatsApp share button | ||
whatsappShareButton.addEventListener('click', function() { | ||
// Generate the sharing message based on movie details | ||
const shareMessage = `${movieData['original_title']} - ${movieData['overview']}\n${window.location.href}`; | ||
// Open the WhatsApp sharing link with the message | ||
const whatsappLink = `https://wa.me/?text=${encodeURIComponent(shareMessage)}`; | ||
// Open the link in a new window | ||
window.open(whatsappLink, '_blank'); | ||
}); | ||
} else { | ||
console.error('WhatsApp share button not found.'); | ||
} | ||
// Check if the Facebook share button exists | ||
if (facebookShareButton) { | ||
// Add a click event listener to the Facebook share button | ||
facebookShareButton.addEventListener('click', function() { | ||
// Generate the sharing link based on your movie details | ||
const shareLink = window.location.href; | ||
// Open the Facebook sharing link in a new window | ||
const facebookLink = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareLink)}`; | ||
window.open(facebookLink, '_blank'); | ||
}); | ||
} else { | ||
console.error('Facebook share button not found.'); | ||
} | ||
}); | ||
</script> |