Skip to content
Snippets Groups Projects
Commit e6b9bc06 authored by Azzahid Adhitya's avatar Azzahid Adhitya
Browse files

display bisa dibilang fixed

parent 5c1c0bf3
Branches
No related merge requests found
...@@ -200,27 +200,26 @@ ...@@ -200,27 +200,26 @@
} }
} }
%> %>
<h1>Client Server</h1>
<input type="hidden" value="<%out.print(username);%>" id="username"> <input type="hidden" value="<%out.print(username);%>" id="username">
<div></div>
<!-- Container for the Table of content --> <!-- Container for the Table of content -->
<div class="mdl-card mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-cell--12-col-tablet mdl-cell--12-col-desktop"> <div class="mdl-card mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-cell--12-col-tablet mdl-cell--12-col-desktop">
<div class="mdl-card__supporting-text mdl-color-text--grey-600"> <div class="mdl-card__supporting-text mdl-color-text--grey-600">
<h3>Messages</h3> <!--<h3>Messages</h3>-->
<div id="messages"></div> <div id="messages"></div>
<h3>Online Users</h3> <h3>Online Users</h3>
<div id="onlineUsers"></div> <div id="onlineUsers"></div>
<div ng-app="clientApp" ng-controller="clientController"> <div ng-app="clientApp" ng-controller="clientController">
<ul> <ul style="position:fixed; right:0;bottom:0">
<li ng-repeat="x in onlineUsers"> <li ng-repeat="x in onlineUsers">
<input type="checkbox" ng-model="x.show"> <div style="border-style: solid; border-width:1px; width:25 0px; height:{{x.show ? '300px' : '30px'}};position:relative;right:0;bottom:0;">
{{ x.show+ x.username + '('+x.token+')' }} <button ng-click="toggleShow(x);" style="width:250px;">{{x.username}}</button>
<div ng-show="x.show"> <div ng-show="x.show">
<form> <form>
<div id="box-{{x.username}}"></div> <div id="box-{{x.username}}" style="border-style:solid; height:240px;overflow:scroll;"></div>
<input ng-model="x.message" id="message-{{x.username}}"> <input ng-model="x.message" id="message-{{x.username}}">
<button ng-click="sendChat(x.token, x.message, x.username)">send</button> <button ng-click="sendChat(x.token, x.message, x.username)">send</button>
</form> </form>
</div>
</div> </div>
</li> </li>
</ul> </ul>
...@@ -256,7 +255,10 @@ ...@@ -256,7 +255,10 @@
}); });
$scope.sendChat = function(token, message, username) { $scope.sendChat = function(token, message, username) {
$('#box-'+username).append("You: "+message); var dataElement2 = document.createElement('p');
dataElement2.textContent = "You: "+message;
dataElement2.style.cssText = "position:center"
$("#box-"+username).append(dataElement2);
$('#message-'+username).val(""); $('#message-'+username).val("");
console.log('sending message...'); console.log('sending message...');
$.getJSON('http://localhost:8083/chat-server.php?callback=?',{ $.getJSON('http://localhost:8083/chat-server.php?callback=?',{
...@@ -269,6 +271,15 @@ ...@@ -269,6 +271,15 @@
}); });
}; };
$scope.toggleShow = function(x) {
if(x.show) {
x.show = false;
}
else {
x.show = true;
}
};
$scope.updateOnlineUsers = function() { $scope.updateOnlineUsers = function() {
console.log('updating online users'); console.log('updating online users');
$.getJSON('http://localhost:8083/chat-server.php?callback=?',{ $.getJSON('http://localhost:8083/chat-server.php?callback=?',{
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment