<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://twitter.github.io/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://twitter.github.io/bootstrap/assets/js/bootstrap.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div id="chatHeader">
<h4>Chat with a Librarian</h4>
</div>
<div id="chatWindow">
<div class="chat-bubble-librarian">
<div class="chat-bubble-glare-librarian"></div>
<p>Thank you for contacting the help line how can I help you?</p>
<div class="chat-bubble-arrow-border-librarian"></div>
<div class="chat-bubble-arrow-librarian"></div>
</div>
<div class="chat-bubble-user">
<div class="chat-bubble-glare-user"></div>
<p>I have a question about kittens?</p>
<div class="chat-bubble-arrow-border-user"></div>
<div class="chat-bubble-arrow-user"></div>
</div>
<div class="chat-bubble-librarian">
<div class="chat-bubble-glare-librarian"></div>
<p>Thats Awesome!</p>
<div class="chat-bubble-arrow-border-librarian"></div>
<div class="chat-bubble-arrow-librarian"></div>
</div>
</div>
<div id="inputArea">
<div id="textInputRow" class="row">
<textarea id="textInput"></textarea>
<button id="sendButton" class="btn btn-primary">Send</button>
</div>
</div>
</body>
</html>
body{
padding-top:30px
}
#chatHeader{
background-color:#f1f1f1;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-radius-topleft: 10px;
border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-top:1px solid #C1C1C1;
border-right:1px solid #C1C1C1;
border-left:1px solid #C1C1C1;
}
#chatHeader h4{
margin-left:20px;
margin-bottom:0px;
padding-bottom:5px;
padding-top:5px;
}
#chatWindow{
overflow-y:auto;
height:250px;
background-color:#f1f1f1;
border-bottom:1px solid #C1C1C1;
border-right:1px solid #C1C1C1;
border-left:1px solid #C1C1C1;
}
#inputArea{
background-color:#222222;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
border-radius-bottomright: 10px;
border-radius-bottomleft: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
}
#textInputRow{
padding-top:10px;
padding-left:10px;
}
#sendButton{
height:50px;
vertical-align:top;
float:right;
margin-right:15px
}
.chat-bubble-librarian {
font-size:14px;
font-weight: 800;
line-height:1.3em;
text-align:left;
margin:6px;
padding:6px;
margin-bottom:10px;
position:relative;
width:150px;
background:gradient(linear, left top, left bottom, color-stop(0, rgb(90,150,40)), color-stop(0.28, rgb(160,215,60)), color-stop(1, rgb(165,255,69)));
background:linear-gradient(center top, rgb(90,150,40) 0%, rgb(160,215,60) 28%, rgb(165,255,69) 100%);
border:1px solid #38691a;
border-radius:10px;
border-radius:10px;
border-radius: 10px;
box-shadow: rgba(160, 215, 60, 0.7) 2px 4px 5px;
box-shadow: rgba(160, 215, 60, 0.7) 2px 4px 5px; /* FF 3.5+ */
box-shadow: rgba(160, 215, 60, 0.7) 2px 4px 5px;
}
.chat-bubble-librarian p {
padding-top:10px
}
.chat-bubble-glare-librarian {
position: absolute;
top: 0px;
left: 4px;
height: 6px;
width: 154px;
padding: 6px 0;
border-radius: 10px;
border-radius: 10px;
border-radius: 10px;
background: linear-gradient(top, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
background: gradient(linear, 0% 0%, 0% 95%, from(rgba(255, 255, 255, 0.9)), to(rgba(255, 255, 255, 0)));
}
.chat-bubble-arrow-librarian {
border-color: transparent #a5ff45 transparent transparent;
border-style: solid;
border-width: 6px;
height:0;
width:0;
position:absolute;
bottom:-1px;
left:-3px;
transform: rotate(70deg);
transform: rotate(70deg);
transform: rotate(70deg);
}
.chat-bubble-arrow-border-librarian {
border-color: transparent #38691a transparent transparent;
border-style: solid;
border-width: 6px;
height:0;
width:0;
position:absolute;
bottom:-3px;
left:-5px;
transform: rotate(70deg);
transform: rotate(70deg);
}
.chat-bubble-user {
font-size:14px;
font-weight: 800;
line-height:1.3em;
margin:6px;
padding:6px;
margin-bottom:10px;
position:relative;
width:150px;
background:gradient(linear, left top, left bottom, color-stop(0, rgb(90,150,40)), color-stop(0.28, rgb(160,215,60)), color-stop(1, rgb(165,255,69)));
background:linear-gradient(center top, rgb(90,150,40) 0%, rgb(160,215,60) 28%, rgb(165,255,69) 100%);
border:1px solid #38691a;
border-radius:10px;
border-radius:10px;
border-radius: 10px;
box-shadow: rgba(160, 215, 60, 0.7) 2px 4px 5px;
box-shadow: rgba(160, 215, 60, 0.7) 2px 4px 5px; /* FF 3.5+ */
box-shadow: rgba(160, 215, 60, 0.7) 2px 4px 5px;
}
.chat-bubble-user p {
padding-top:10px
}
.chat-bubble-glare-user {
position: absolute;
top: 0px;
left: 4px;
height: 6px;
width: 154px;
padding: 6px 0;
border-radius: 10px;
border-radius: 10px;
border-radius: 10px;
background: linear-gradient(top, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
background: gradient(linear, 0% 0%, 0% 95%, from(rgba(255, 255, 255, 0.9)), to(rgba(255, 255, 255, 0)));
}
.chat-bubble-arrow-user {
border-color: transparent #a5ff45 transparent transparent;
border-style: solid;
border-width: 6px;
height:0;
width:0;
position:absolute;
bottom:-1px;
left:-3px;
transform: rotate(70deg);
transform: rotate(70deg);
transform: rotate(70deg);
}
.chat-bubble-arrow-border-user {
border-color: transparent #38691a transparent transparent;
border-style: solid;
border-width: 6px;
height:0;
width:0;
position:absolute;
bottom:-3px;
left:-5px;
transform: rotate(70deg);
transform: rotate(70deg);
}
var self = this;
$('#sendButton').click(function(){
self.addText($('#textInput').val());
$('#textInput').val("");
});
self.addText = function(text){
var content =
"<div class='chat-bubble-user'>"+"<div class='chat-bubble-glare-user'></div><p>"+text+"</p><div class='chat-bubble-arrow-border-user'></div><div class='chat-bubble-arrow-user'></div></div>";
$('#chatWindow').append(content);
};
$('#textInput').keypress(function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '13'){
self.addText($('#textInput').val());
$('#textInput').val("");
}
});
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |