This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
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
5 changed files
with
97 additions
and
118 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
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
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
32 changes: 16 additions & 16 deletions
32
Magento2/app/code/Werules/Chatbot/view/frontend/templates/chatbox/facebook_js_sdk.phtml
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,19 +1,19 @@ | ||
<script> | ||
// Facebook SDK for JavaScript | ||
window.fbAsyncInit = function() { | ||
FB.init({ | ||
appId : 'your-app-id', | ||
autoLogAppEvents : true, | ||
xfbml : true, | ||
version : 'v2.11' | ||
}); | ||
}; | ||
// Facebook SDK for JavaScript | ||
window.fbAsyncInit = function() { | ||
FB.init({ | ||
appId : <?php echo $this->getFacebookAppId() ?>, | ||
autoLogAppEvents : true, | ||
xfbml : true, | ||
version : 'v2.11' | ||
}); | ||
}; | ||
|
||
(function(d, s, id){ | ||
var js, fjs = d.getElementsByTagName(s)[0]; | ||
if (d.getElementById(id)) {return;} | ||
js = d.createElement(s); js.id = id; | ||
js.src = "https://connect.facebook.net/en_US/sdk.js"; | ||
fjs.parentNode.insertBefore(js, fjs); | ||
}(document, 'script', 'facebook-jssdk')); | ||
(function(d, s, id){ | ||
var js, fjs = d.getElementsByTagName(s)[0]; | ||
if (d.getElementById(id)) {return;} | ||
js = d.createElement(s); js.id = id; | ||
js.src = "https://connect.facebook.net/en_US/sdk.js"; | ||
fjs.parentNode.insertBefore(js, fjs); | ||
}(document, 'script', 'facebook-jssdk')); | ||
</script> |
78 changes: 5 additions & 73 deletions
78
Magento2/app/code/Werules/Chatbot/view/frontend/templates/chatbox/messenger.phtml
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,73 +1,5 @@ | ||
<style> | ||
#werules-messenger-box { | ||
position: fixed; | ||
display: block; | ||
z-index: 999; | ||
bottom: 20px; | ||
right: 30px; | ||
cursor: pointer; | ||
} | ||
|
||
#werules-messenger-box:hover .werules-messenger-icon img{ | ||
transform:scale(1.1, 1.1); | ||
-webkit-transform:scale(1.1, 1.1); | ||
-moz-transform:scale(1.1, 1.1); | ||
} | ||
|
||
.werules-messenger-icon img { | ||
width: 60px; | ||
filter: drop-shadow(2px 6px 4px rgba(0,0,0,.3)); | ||
-webkit-filter: drop-shadow(2px 6px 4px rgba(0,0,0,.3)); | ||
} | ||
|
||
.werules-tiptext{ | ||
width: 120px; | ||
background-color: white; | ||
color: #2c2c2c; ; | ||
text-align: center; | ||
padding: 5px 0; | ||
border: 1px solid #eeeeee; | ||
border-radius: 6px; | ||
position: fixed; | ||
bottom: 30px; | ||
right: 100px; | ||
text-transform: uppercase; | ||
filter: drop-shadow(2px 6px 4px rgba(0,0,0,.3)); | ||
-webkit-filter: drop-shadow(2px 6px 4px rgba(0,0,0,.3)); | ||
} | ||
|
||
.werules-tiptext:after{ | ||
content: ""; | ||
position: absolute; | ||
top: 50%; | ||
left: 100%; | ||
margin-top: -5px; | ||
border-width: 5px; | ||
border-style: solid; | ||
border-color: transparent transparent transparent #eeeeee; | ||
} | ||
|
||
@media (max-width: 480px) | ||
{ | ||
.werules-mobilehidden{ | ||
display: none; | ||
} | ||
} | ||
</style> | ||
<?php $fbChatUrl = "http://messenger.com"; ?> | ||
<div id="werules-messenger-box"> | ||
<!-- code from https://gist.github.com/tomcritchlow/493774b09b02e31d1184d7cda926c659 --> | ||
<a href="<?php echo $fbChatUrl; ?>" target="_blank" onclick="OpenChatInNewTab();"> | ||
<div class="werules-messenger-icon"> | ||
<img src="<?php echo $this->getViewFileUrl('Werules_Chatbot::image/messenger-icon.png'); ?>"/> | ||
<span class="werules-tiptext werules-mobilehidden"><?php echo __("Message us"); ?></span> | ||
</div> | ||
</a> | ||
</div> | ||
<script> | ||
function OpenChatInNewTab() { | ||
var screenwidth = screen.width; | ||
var screenheight = window.innerHeight; | ||
window.open('<?php echo $fbChatUrl; ?>', '_blank', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=' + screenheight + ',left=' + (screenwidth - 500)); | ||
} | ||
</script> | ||
<?php $this->getFacebookPageId(); ?> | ||
<div class="fb-customerchat" | ||
page_id="<PAGE_ID>" | ||
ref="<OPTIONAL_WEBHOOK_PARAM>" | ||
</div> |