Skip to content

Instantly share code, notes, and snippets.

@dileephell
Created May 16, 2018 06:32
Show Gist options
  • Save dileephell/059722403525842137a4889652cc80ff to your computer and use it in GitHub Desktop.
Save dileephell/059722403525842137a4889652cc80ff to your computer and use it in GitHub Desktop.
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" media="all" href="index.css">
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<link rel="stylesheet" href="popupS.css">
<script src="popupS.js"></script>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-5">
<div class="panel panel-primary" id="panel-body" style="height: 550px;width:435px">
<div class="panel-heading">
<span class="glyphicon glyphicon-comment"></span> Chat
<div class="btn-group pull-right">
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
<span class="glyphicon glyphicon-chevron-down"></span>
</button>
</div>
</div>
<div class="panel-body " >
<ul class="chat" id="chat">
<li class="left clearfix"><span class="chat-img pull-left">
<img src="http://placehold.it/50/55C1E7/fff&text=U" alt="User Avatar" class="img-circle" />
</span>
<div class="chat-body clearfix">
<div class="header">
<strong class="primary-font">Data Chain</strong>
<small class="pull-right text-muted">
<span class="glyphicon glyphicon-time"></span>
<span id="mainDate">
<script> document.write(new Date().toLocaleTimeString()) </script>
</span>
</small>
</div>
<p>
Hi , Welcome to bot, <br/> How can i help you today ?
</p>
</div>
</li>
</ul>
</div>
<div class="panel-footer">
<div class="input-group">
<input id="btn-input" type="text" class="form-control input-sm" onKeyDown="if(event.keyCode==13) appendText();" placeholder="Type your message here..." autofocus/>
<span class="input-group-btn">
<button class="btn btn-warning btn-sm" id="btn-chat">
Send</button>
<button class="btn btn-warning btn-sm" id="clr-chat" onclick="clearChat()">
Clear</button>
</span>
</div>
</div>
<form id="upload" action="/upload" method="POST" enctype="multipart/form-data">
<fieldset>
<input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE" value="300000" />
<div>
<label for="fileselect">Files to upload:</label>
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" />
<div id="filedrag">or drop files here</div>
<input type="submit" />
</div>
<div id="submitbutton">
<button type="submit">Upload Files</button>
</div>
</fieldset>
</form>
<div id="messages">
<p>Status Messages</p>
</div>
<script>
function appendText() {
var txt1 = ' <li class="right clearfix"><span class="chat-img pull-right"><img src="http://placehold.it/50/FA6F57/fff&text=ME" alt="User Avatar" class="img-circle" /></span><div class="chat-body clearfix"><div class="header"><small class="text-muted"><span class="glyphicon glyphicon-time"></span>'+new Date().toLocaleTimeString()+'</small><strong class="pull-right primary-font">Me</strong> </div><p>Message</p></div></li>'; // Create text with HTML
txt1=txt1.replace("Message",$('#btn-input').val());
inp = $('#btn-input').val();
$("#chat").append(txt1);
//document.getElementById('chat').scrollTop = (document.getElementById('panel-body').offsetHeight)*10;
$('#btn-input').val("");
$.get("/dat?input1="+inp, function(data,status){
var txt2 = '<li class="left clearfix"><span class="chat-img pull-left"><img src="xperience.jpg" width="50" height="50" alt="User Avatar" class="img-circle" /></span><div class="chat-body clearfix"><div class="header"><strong class="primary-font">Data Chain</strong><small class="pull-right text-muted"><span class="glyphicon glyphicon-time"></span>'+new Date().toLocaleTimeString()+'</small></div><p>Response</p></div></li>';
txt2=txt2.replace("Response",data);
$("#chat").append(txt2);
document.getElementById('chat').scrollTop = (document.getElementById('panel-body').offsetHeight)*10;
});
}
function clearChat(){
window.location.href='/';
}
</script>
</div>
</div>
</div>
</div>
<script type = "text/javascript" src="filedrag.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment