Skip to content

Instantly share code, notes, and snippets.

@indera-shsp
Created December 18, 2019 02:17
Show Gist options
  • Select an option

  • Save indera-shsp/ce89544132a685b4f182a0eb42d524cc to your computer and use it in GitHub Desktop.

Select an option

Save indera-shsp/ce89544132a685b4f182a0eb42d524cc to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title> Example Tracked page with chatbot</title>
<script type="text/javascript">
window.onload = function () {
try {
configureChatbot();
runChatbot();
} catch(ex) {
window.console.log('failed due:', ex);
}
}
function respondToConfigRequest(evt) {
if ('sendMeTheConfig' !== evt.data) {
return;
}
var ssChatbot = document.getElementById('ssChatbot');
if (!ssChatbot) {
return;
}
ssChatbot.contentWindow.postMessage(window.ssChatbot, '*');
}
function respondToResizeRequest(evt) {
var ssChatbot = document.getElementById('ssChatbot');
if (!ssChatbot) {
return;
}
var mainCss = 'border: none; padding: 5px; position: fixed; min-width: 360px; bottom: 10px; ';
var xCss = window.ssChatbot.orientation ? 'right: 0;' : 'left: 0;';
if ('chatbotCollapsed' === evt.data) {
ssChatbot.style = 'height: 60px; ' + mainCss + xCss;
}
if ('chatbotExpanded' === evt.data) {
ssChatbot.style = 'height: 560px; ' + mainCss + xCss;
}
}
function configureChatbot() {
var sampleChatConfig = {
avatar: 'https://image.flaticon.com/icons/svg/188/188987.svg',
color: '#84C340',
// color: '#ff0000',
displayName: 'SharpBot2',
id: '123',
orientation: 1,
welcomeText: "Hi! 👋 I'm here to help.",
};
window.ssChatbot = sampleChatConfig;
if (window.addEventListener) {
window.addEventListener("message", respondToConfigRequest, false);
window.addEventListener("message", respondToResizeRequest, false);
}
}
function runChatbot() {
// @see https://css-tricks.com/fun-viewport-units/
var isDev = window.location.hostname.match(/localhost.com$/);
var devUrl = 'https://app.sharpspring.localhost.com/publicChatbot';
// var prodUrl = 'https://marketingautomation.services/publicChatbot';
var prodUrl = 'https://staging.marketingautomation.services/publicChatbot';
var scout = new URL(location.href).searchParams.get('scout-chatbot-client') || '';
var chatUrl = isDev ? devUrl : prodUrl;
chatUrl += scout ? `?scout-chatbot-client=${scout}` : '';
var chatbotNode = document.createElement("iframe");
chatbotNode.src = chatUrl;
chatbotNode.id = 'ssChatbot';
var mainCss = 'border: none; padding: 5px; position: fixed; min-width: 360px; bottom: 10px; ';
var xCss = window.ssChatbot.orientation ? 'right: 0;' : 'left: 0;';
chatbotNode.style = ' height: 60px;' + mainCss + xCss;
document.body.appendChild(chatbotNode);
}
</script>
</head>
<body>
<table width="100%" bgcolor="#CCF6F6">
<tr><td class="play" align="center">Romeo and Juliet
<tr><td class="nav" align="center">
<a href="/Shakespeare">Shakespeare homepage</A>
| <A href="/romeo_juliet/">Romeo and Juliet</A>
| Entire play
</table>
<H3>ACT I</h3>
<h3>PROLOGUE</h3>
<blockquote>
<A NAME=1.0.1>Two households, both alike in dignity,</A><br>
<A NAME=1.0.2>In fair Verona, where we lay our scene,</A><br>
<A NAME=1.0.3>From ancient grudge break to new mutiny,</A><br>
<A NAME=1.0.4>Where civil blood makes civil hands unclean.</A><br>
<A NAME=1.0.5>From forth the fatal loins of these two foes</A><br>
<A NAME=1.0.6>A pair of star-cross'd lovers take their life;</A><br>
<A NAME=1.0.7>Whose misadventured piteous overthrows</A><br>
<A NAME=1.0.8>Do with their death bury their parents' strife.</A><br>
<A NAME=1.0.9>The fearful passage of their death-mark'd love,</A><br>
<A NAME=1.0.10>And the continuance of their parents' rage,</A><br>
<A NAME=1.0.11>Which, but their children's end, nought could remove,</A><br>
<A NAME=1.0.12>Is now the two hours' traffic of our stage;</A><br>
<A NAME=1.0.13>The which if you with patient ears attend,</A><br>
<A NAME=1.0.14>What here shall miss, our toil shall strive to mend.</A><br>
</blockquote>
<h3>SCENE I. Verona. A public place.</h3>
<p><blockquote>
<i>Enter SAMPSON and GREGORY, of the house of Capulet, armed with swords and bucklers</i>
</blockquote>
<A NAME=speech1><b>SAMPSON</b></a>
<blockquote>
<A NAME=1.1.1>Gregory, o' my word, we'll not carry coals.</A><br>
</blockquote>
<A NAME=speech2><b>GREGORY</b></a>
<blockquote>
<A NAME=1.1.2>No, for then we should be colliers.</A><br>
</blockquote>
<A NAME=speech3><b>SAMPSON</b></a>
<blockquote>
<A NAME=1.1.3>I mean, an we be in choler, we'll draw.</A><br>
</blockquote>
<A NAME=speech4><b>GREGORY</b></a>
<blockquote>
<A NAME=1.1.4>Ay, while you live, draw your neck out o' the collar.</A><br>
</blockquote>
<A NAME=speech5><b>SAMPSON</b></a>
<blockquote>
<A NAME=1.1.5>I strike quickly, being moved.</A><br>
</blockquote>
<A NAME=speech6><b>GREGORY</b></a>
<blockquote>
<A NAME=1.1.6>But thou art not quickly moved to strike.</A><br>
</blockquote>
<A NAME=speech7><b>SAMPSON</b></a>
<blockquote>
<A NAME=1.1.7>A dog of the house of Montague moves me.</A><br>
</blockquote>
<A NAME=speech8><b>GREGORY</b></a>
<blockquote>
<A NAME=1.1.8>To move is to stir; and to be valiant is to stand:</A><br>
<A NAME=1.1.9>therefore, if thou art moved, thou runn'st away.</A><br>
</blockquote>
<A NAME=speech9><b>SAMPSON</b></a>
<blockquote>
<A NAME=1.1.10>A dog of that house shall move me to stand: I will</A><br>
<A NAME=1.1.11>take the wall of any man or maid of Montague's.</A><br>
</blockquote>
<A NAME=speech10><b>GREGORY</b></a>
<blockquote>
<A NAME=1.1.12>That shows thee a weak slave; for the weakest goes</A><br>
<A NAME=1.1.13>to the wall.</A><br>
</blockquote>
<A NAME=speech11><b>SAMPSON</b></a>
<blockquote>
<A NAME=1.1.14>True; and therefore women, being the weaker vessels,</A><br>
<A NAME=1.1.15>are ever thrust to the wall: therefore I will push</A><br>
<A NAME=1.1.16>Montague's men from the wall, and thrust his maids</A><br>
<A NAME=1.1.17>to the wall.</A><br>
</blockquote>
<A NAME=speech12><b>GREGORY</b></a>
<blockquote>
<A NAME=1.1.18>The quarrel is between our masters and us their men.</A><br>
</blockquote>
<A NAME=speech13><b>SAMPSON</b></a>
<blockquote>
<A NAME=1.1.19>'Tis all one, I will show myself a tyrant: when I</A><br>
<A NAME=1.1.20>have fought with the men, I will be cruel with the</A><br>
<A NAME=1.1.21>maids, and cut off their heads.</A><br>
</blockquote>
<A NAME=speech14><b>GREGORY</b></a>
<blockquote>
<A NAME=1.1.22>The heads of the maids?</A><br>
</blockquote>
<A NAME=speech15><b>SAMPSON</b></a>
<blockquote>
<A NAME=1.1.23>Ay, the heads of the maids, or their maidenheads;</A><br>
<A NAME=1.1.24>take it in what sense thou wilt.</A><br>
</blockquote>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment