HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DeepPixel ChatBot</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Droid+Sans:400,700">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/4.0.2/bootstrap-material-design.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="chatbot-dp.css">
</head>
<body>
<div id="center-text">
<h2>Personal Assistant</h2>
<p>Demo Version </p>
</div>
<div id="body">
<!--button-->
<div id="chat-circle" class="btn btn-raised">
<div id="chat-overlay"></div>
<!--<i class="material-icons">android</i>-->
<img class="chat-circle_robot" src="ROBOT.png">
</div>
<!--chat-bot-->
<div class="chat-box">
<div class="chat-box-body">
<!--welcome message-->
<div class="chat-box-welcome__header">
<div class="chat-box__header-text">
<p3 class="chat-box-welcome__company-name">deepPiXEL</p3>
<span class="chat-box-toggle"><i class="material-icons">cancel</i></span>
</div>
<div id="chat-box-welcome__ava">
<!--<i class="material-icons">android</i>-->
<img class="chat-box-welcome_robot" src="ROBOT.png">
</div>
<div class="chat-box-welcome__welcome-text">
<p>Hi! I'm deepPixel IDA, what can I assist you with?</p>
</div>
<!--<div id="chat">
</div>-->
</div>
<!--chat-bot after welcome was toggled-->
<div id="chat-box__wraper">
<div class="chat-box-header">
deepPiXEL
<span class="chat-box-toggle"><i class="material-icons">cancel</i></span>
</div>
<div class="chat-box-overlay">
</div>
<div class="chat-logs">
<div id="cm-msg-0" class="chat-msg bot">
<span class="msg-avatar">
<!--<i class="material-icons">android</i>-->
<img class="chat-box-overlay_robot" src="ROBOT.png">
</span>
<div class="cm-msg-text">
Hi! I'm deepPixel IDA, what can I assist you with?
</div>
</div>
<!--<div class="text-center"><p>loader 1</p><div class="loader1"></div></div>-->
<div class="spin-container">
<div class="spiner">
<div aria-hidden="true"></div>
<div aria-hidden="true"></div>
<div aria-hidden="true"></div>
</div>
</div>
</div>
<!--chat-log-->
</div>
</div>
<div class="chat-input-box">
<form class="chat-input__form">
<input type="text" class="chat-input__text" id="chat-input__text" placeholder="Send a message..." />
<button type="submit" class="chat-submit" id="chat-submit"><i class="material-icons">send</i></button>
</form>
<p6 class="chat-box__sign">powered by deepPiXEL</p6>
</div>
</div>
</div>
<!-- end live-chat -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!--jquery ui-->
<!--<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js" integrity="sha256-eGE6blurk5sHj+rmkfsGYeKyZx3M4bG+ZlFyA7Kns7E=" crossorigin="anonymous"></script>-->
<script src="app.js"></script>
</body>
</html>
@charset "utf-8";
/* ---------- GENERAL ---------- */
html,
body {
background: #efefef;
height: 100%;
font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}
#center-text {
display: flex;
flex: 1;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
}
/* ---------- GENERAL STYLE---------- */
.chat-box-welcome__company-name,
.chat-box__sign {
font-family: 'Roboto', 'Helvetica Neue', "Arial", sans-serif;
position: relative;
}
/*powered by deeppixel*/
.chat-box__sign {
font-size: 9px;
line-height: 20px;
/*color: #a2a2a2;*/
color: #b5b5b5;
}
.chat-input-box {
text-align: center;
position: relative;
}
.btn#my-btn {
background: white;
padding-top: 13px;
padding-bottom: 12px;
border-radius: 45px;
padding-right: 40px;
padding-left: 40px;
color: #5865C3;
}
/*color to change*/
#chat-circle,
.chat-box-welcome__header,
.chat-box-header,
.chat-msg.bot>.msg-avatar {
/*red*/
/*background-image: linear-gradient( to top right, rgba(246, 72, 72, 1), rgba(250, 65, 95, 1));*/
/*pink-blue*/
/*background-image: linear-gradient( to top left, rgba(252, 123, 123, 1), rgba(166, 193, 255, 1));*/
/*pink-red*/
background-image: linear-gradient( to bottom right, rgba(240, 149, 255, 1), rgba(246, 72, 72, 1));
}
.options-btn {
border: 1px solid rgba(246, 72, 72, 1);
}
.spiner > * {
background: rgba(246, 72, 72, 1);
}
/*.options-btn:hover{
background-image: linear-gradient( to bottom right, rgba(240, 149, 255, 1), rgba(246, 72, 72, 1));
color: white;
}*/
/* ---------- chat-bot-button to open chat---------- */
#chat-circle {
position: fixed;
bottom: 50px;
/*right: 50px;*/
right: 50px;
width: 80px;
height: 80px;
border-radius: 50%;
color: white;
padding: 15px;
cursor: pointer;
/*box-shadow: 0px 3px 16px 0px rgba(0, 0, 0, 0.6), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);*/
box-shadow: 0px 3px 16px 0px rgba(246, 72, 72, 0.5), 0 3px 1px -2px rgba(246, 72, 72, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
/*remove display none*/
/*display: none;*/
}
/*#chat-circle .material-icons {
font-size: 36px;
}*/
#chat-overlay {
background: rgba(255, 255, 255, 0.1);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
display: none;
}
.chat-circle_robot {
height: 50px;
}
/*chat-bot-welcome*/
.chat-box-welcome {
/*add display none*/
/* display: none;*/
/*background: #efefef;*/
background: #f8f8f8;
position: fixed;
right: 30px;
bottom: 50px;
width: 350px;
max-width: 85vw;
max-height: 100vh;
border-radius: 3px;
/* box-shadow: 0px 5px 35px 9px #464a92; */
box-shadow: 0px 5px 35px 9px #ccc;
}
.chat-box-welcome__header {
height: 420px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
display: none;
}
.chat-box__header-text {
color: white;
padding-left: 10px;
font-size: 20px;
padding-top: 13px;
}
#chat-box-welcome__ava {
background: rgba(0, 0, 0, 0.38);
border-radius: 50%;
position: absolute;
top: 98px;
left: 124px;
width: 100px;
height: 100px;
border-radius: 50%;
color: white;
padding: 22px;
}
/*#chat-box-welcome__ava .material-icons {
font-size: 64px;
}*/
.chat-box-welcome_robot {
height: 75px;
position: absolute;
top: 12px;
}
.chat-box-welcome__welcome-text {
color: #fff;
text-align: center;
width: 80%;
position: relative;
top: 45%;
left: 50%;
transform: translateX(-50%);
}
.chat-box-welcome__welcome-text p {
font-size: 24px;
}
/*chat-box after welcome was togled*/
#chat-box__wraper {
display: none;
}
.chat-box {
/*add display none*/
display: none;
/*background: #efefef;*/
background: #f8f8f8;
position: fixed;
/* right: 30px;*/
right: 30px;
bottom: 50px;
width: 350px;
max-width: 85vw;
max-height: 100vh;
border-radius: 3px;
/* box-shadow: 0px 5px 35px 9px #464a92; */
box-shadow: 0px 5px 35px 9px #ccc;
}
.chat-box-toggle {
float: right;
margin-right: 15px;
cursor: pointer;
}
.chat-box-header {
position: relative;
height: 50px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
color: white;
padding-left: 10px;
font-size: 20px;
padding-top: 13px;
}
.chat-box-body {
position: relative;
height: 370px;
height: auto;
border-bottom: 1px solid rgba(181, 181, 181, 0.42);
overflow: hidden;
}
.chat-box-body:after {
content: "";
background-color: #F8F8F8;
opacity: 0.1;
top: 0;
left: 0;
bottom: 0;
right: 0;
height: 100%;
position: absolute;
z-index: -1;
}
.chat-input__text {
background: #fff;
width: 95%;
position: relative;
height: 47px;
padding-top: 10px;
padding-right: 50px;
padding-bottom: 10px;
padding-left: 15px;
margin-top: 5px;
resize: none;
outline: none;
border: 1px solid #F2F0F0;
color: #888;
border-radius: 3px;
overflow: hidden;
}
.chat-input-box>form {
margin-bottom: 0;
}
.chat-input__text::-webkit-input-placeholder {
/* Chrome/Opera/Safari */
color: #ccc;
}
.chat-input__text::-moz-placeholder {
/* Firefox 19+ */
color: #ccc;
}
.chat-input__text:-ms-input-placeholder {
/* IE 10+ */
color: #ccc;
}
.chat-input__text:-moz-placeholder {
/* Firefox 18- */
color: #ccc;
}
.chat-submit {
position: absolute;
bottom: 27px;
right: 10px;
background: transparent;
box-shadow: none;
border: none;
border-radius: 50%;
color: rgba(250, 65, 95, 0.99);
width: 35px;
height: 35px;
}
.chat-logs {
padding: 15px;
height: 370px;
overflow-y: scroll;
}
@media only screen and (max-width: 500px) {
.chat-logs {
height: 40vh;
}
}
.chat-msg.bot>.msg-avatar {
width: 45px;
height: 45px;
border-radius: 50%;
float: left;
width: 15%;
padding: 9px;
position: relative;
}
/*.chat-msg.bot>.msg-avatar .material-icons {
color: #fff;
font-size: 25px;
}*/
.chat-box-overlay_robot {
height: 35px;
position: absolute;
top: 5px;
}
/*.chat-msg.self>.msg-avatar img {
width: 45px;
height: 45px;
border-radius: 50%;
float: right;
width: 15%;
}*/
.cm-msg-text {
background: white;
padding: 10px 15px 10px 15px;
color: #666;
max-width: 75%;
float: left;
margin-left: 10px;
position: relative;
margin-bottom: 20px;
border-radius: 3px;
}
.options-btn {
background: white;
padding: 10px 15px 10px 15px;
color: #666;
width: 75%;
margin-left: 55px;
position: relative;
margin-bottom: 20px;
border-radius: 3px;
text-align: center;
}
.chat-msg {
clear: both;
}
.chat-msg.self>.cm-msg-text {
float: right;
background: #efefef;
/*color: white;*/
}
.cm-msg-button>ul>li {
list-style: none;
float: left;
width: 50%;
}
.cm-msg-button {
clear: both;
margin-bottom: 70px;
}
/*loader*/
.spin-container {
/* padding: 0px 15px 0px 15px; */
color: #666;
max-width: 75%;
/* float: left; */
bottom: 4px;
left: 50%;
/* margin-left: 45%; */
position: absolute;
/* margin-bottom: 20px; */
display: none;
}
.spiner {
position: absolute;
left: 50%;
top: 50%;
margin: -10px 0 0 -20px;
display: inline-block;
position: relative;
height: 20px;
width: 40px;
}
.spiner > * {
position: absolute;
top: 5px;
height: 10px;
width: 10px;
border-radius: 50%;
/* background: #0074e4;*/
opacity: 0.6;
-webkit-transform: translateX(0px);
transform: translateX(0px);
}
.spiner > *:nth-child(1) {
left: 0;
-webkit-animation: mymove 1.3s infinite ease-in;
animation: mymove 1.3s infinite ease-in;
}
.spiner > *:nth-child(2) {
left: 12px;
-webkit-animation: mymove 1.3s 0.3s infinite ease-in;
animation: mymove 1.3s 0.3s infinite ease-in;
}
.spiner > *:nth-child(3) {
left: 24px;
-webkit-animation: mymove 1.3s 0.6s infinite ease-in;
animation: mymove 1.3s 0.6s infinite ease-in;
}
@-webkit-keyframes mymove {
0%,
100%,
80% {
opacity: 0.6;
-webkit-transform: scale(0.4);
}
40% {
opacity: 1;
-webkit-transform: scale(1);
}
}
@keyframes mymove {
0%,
100%,
80% {
opacity: 0.6;
transform: scale(0.4);
}
40% {
opacity: 1;
transform: scale(1);
}
}
var botController = (function () {
})();
var uiController = (function () {
})();
var controller = (function (botCntr, uiCntr) {
var $chatCircle,
$chatBox,
$chatBoxClose,
$chatBoxWelcome,
$chatWraper,
$submitBtn,
$chatInput,
$msg;
/*toggle*/
function hideCircle(evt) {
evt.preventDefault();
$chatCircle.hide('scale');
$chatBox.show('scale');
$chatBoxWelcome.show('scale');
}
function chatBoxCl(evt) {
evt.preventDefault();
$chatCircle.show('scale');
$chatBox.hide('scale');
$chatBoxWelcome.hide('scale');
$chatWraper.hide('scale');
}
function chatOpenMessage(evt) {
evt.preventDefault();
$chatBoxWelcome.hide();
$chatWraper.show();
}
//generate messages on submit click
function submitMsg(evt) {
evt.preventDefault();
//1. get input message data
msg = $chatSubmitBtn.val();
//2.if there is no string button send shoudn't work
if (msg.trim() == '') {
return false;
}
//3. add message to bot controller
callbot(msg);
//4. display message to ui controller
generate_message(msg, 'self');
}
function chatSbmBtn(evt) {
if (evt.keyCode === 13 || evt.which === 13) {
console.log("btn pushed");
}
}
/* var input = uiCntr.getInput();*/
/* $chatSubmitBtn.on("click", hideCircle);*/
function init() {
$chatCircle = $("#chat-circle");
$chatBox = $(".chat-box");
$chatBoxClose = $(".chat-box-toggle");
$chatBoxWelcome = $(".chat-box-welcome__header");
$chatWraper = $("#chat-box__wraper");
$chatInput = $("#chat-input__text");
$submitBtn = $("#chat-submit");
//1. call toggle
$chatCircle.on("click", hideCircle);
$chatBoxClose.on("click", chatBoxCl);
$chatInput.on("click", chatOpenMessage);
//2. call wait message from CRM-human
$submitBtn.on("click", chatSbmBtn);
$chatInput.on("keypress", chatSbmBtn);
//6. get message from bot controller-back end
//7. display bot message to ui controller
}
return {
init: init
};
})(botController, uiController);
$(document).ready(controller.init);
Also see: Tab Triggers