Skip to content
This repository was archived by the owner on Oct 9, 2021. It is now read-only.

Commit 69aed4c

Browse files
committed
Updated web files
1 parent 9cd06ae commit 69aed4c

File tree

12 files changed

+377
-0
lines changed

12 files changed

+377
-0
lines changed

S3WebApp/app/app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
var myApp = angular.module('chatApp', ['ngResource']);
3+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
myApp.controller('chatMessageCtrl', ['$scope', '$rootScope', '$resource', function($scope, $rootScope, $resource) {
2+
3+
$rootScope.$on("chatting", function() {
4+
document.getElementById('chat-message-input').placeholder = "Enter a message and save humanity";
5+
});
6+
$rootScope.$on("not chatting", function() {
7+
document.getElementById('chat-message-input').value = null;
8+
document.getElementById('chat-message-input').placeholder = "Save your brains, enter your user name";
9+
});
10+
11+
$scope.lastTalking = new Date;
12+
13+
$scope.chatMessageKeyPressed = function(keyEvent) {
14+
if (keyEvent.which === 13) {
15+
$scope.posting = true;
16+
console.log('Sending Message: ' + $scope.chatMessage);
17+
var PostMessages = $resource(MESSAGES_ENDPOINT);
18+
var message = {
19+
channel: 'default',
20+
name: document.getElementById('name-input').value,
21+
message: $scope.chatMessage
22+
};
23+
24+
PostMessages.save(message, function() {
25+
$scope.chatMessage = null;
26+
$scope.posting = false;
27+
})
28+
} else {
29+
var diff = Date.now() - $scope.lastTalking;
30+
console.log(diff);
31+
32+
// send talking update at max every .5 seconds
33+
if (diff < 500) {
34+
return;
35+
}
36+
37+
var PostTalkers = $resource(MESSAGES_ENDPOINT.replace("/message", "/talkers"))
38+
39+
var message = {
40+
channel: 'default',
41+
name: document.getElementById('name-input').value
42+
};
43+
44+
console.log('Posting to talkers.');
45+
PostTalkers.save(message, function() {
46+
$scope.lastTalking = new Date;
47+
});
48+
}
49+
};
50+
51+
}]);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
myApp.controller('chatPanelCtrl', ['$scope', '$rootScope', '$resource', '$timeout', function($scope, $rootScope, $resource, $timeout) {
3+
4+
$rootScope.$on("chatting", function() {
5+
var Messages = $resource(MESSAGES_ENDPOINT);
6+
7+
var poll = function()
8+
{
9+
$timeout(function() {
10+
if($rootScope.chatting)
11+
{
12+
console.log('Retrieving Messages from Server');
13+
Messages.get(null, function(messages) {
14+
if($rootScope.chatting)
15+
{
16+
$scope.messages = messages.messages;
17+
}
18+
else
19+
{
20+
//just in case, for cleanup
21+
$scope.messages = null;
22+
}
23+
});
24+
poll();
25+
}
26+
}, 2000);
27+
};
28+
poll();
29+
});
30+
$rootScope.$on("not chatting", function() {
31+
//clear our model, which will clear out the messages from the panel
32+
$scope.messages = null;
33+
});
34+
35+
}]);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
myApp.controller('usernameSectionCtrl', ['$scope', '$rootScope', function($scope, $rootScope) {
2+
$scope.userName = 'Enter UserName';
3+
4+
$scope.toggleChatting = function() {
5+
if($rootScope.chatting)
6+
{
7+
$scope.logoff();
8+
}
9+
else
10+
{
11+
$scope.login();
12+
}
13+
};
14+
15+
$scope.login = function() {
16+
$rootScope.chatting = true;
17+
$rootScope.$emit('chatting');
18+
//document.getElementById('name-input').disabled = true;
19+
document.getElementById('chat-toggle').value = "Stop Chatting";
20+
};
21+
22+
$scope.logoff = function() {
23+
document.getElementById('chat-toggle').value = "Start Chatting";
24+
//document.getElementById('name-input').disabled = false;
25+
$rootScope.chatting = false;
26+
$rootScope.$emit('not chatting');
27+
};
28+
}]);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
myApp.controller('talkersPanelCtrl', ['$scope', '$rootScope', '$resource', '$timeout', function($scope, $rootScope, $resource, $timeout) {
3+
4+
$rootScope.$on("chatting", function() {
5+
var Talkers = $resource(MESSAGES_ENDPOINT.replace("/message", "/talkers"));
6+
7+
var poll = function()
8+
{
9+
$timeout(function() {
10+
if($rootScope.chatting)
11+
{
12+
console.log('Retrieving Talkers from Server');
13+
Talkers.get(null, function(talkers) {
14+
console.log(talkers.Talkers);
15+
if($rootScope.chatting)
16+
{
17+
$scope.talkers = talkers.Talkers;
18+
}
19+
else
20+
{
21+
//just in case, for cleanup
22+
$scope.talkers = null;
23+
}
24+
});
25+
poll();
26+
}
27+
}, 1000);
28+
};
29+
poll();
30+
});
31+
$rootScope.$on("not chatting", function() {
32+
//clear our model, which will clear out the messages from the panel
33+
$scope.talkers = null;
34+
});
35+
36+
}]);

S3WebApp/assets/css/zombie.css

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
2+
body{
3+
width:100%;
4+
height:800px;
5+
position:static;
6+
background-repeat: no-repeat;
7+
background: #272727;
8+
background: -webkit-linear-gradient( #414141, #1c1b1b);
9+
background: -moz-linear-gradient( #414141, #1c1b1b);
10+
background: linear-gradient( #414141, #1c1b1b);
11+
font-family: arial;
12+
color:gray;
13+
min-width:895px;
14+
}
15+
16+
#square {
17+
position:absolute;
18+
z-index:-1;
19+
width:100%;
20+
background-color:black;
21+
height:80px;
22+
}
23+
24+
#zombie-logo {
25+
float:left;
26+
padding-top:4px;}
27+
28+
#main-header {
29+
text-align:left;
30+
color:red;
31+
font-size: 2.6em;
32+
padding-top:12px;
33+
display:inline;
34+
width:60%;
35+
float:left;}
36+
37+
#logo {
38+
padding-top:15px;
39+
padding-right:10%;
40+
float:right;
41+
}
42+
43+
#wrapper {
44+
padding-left: 3em;
45+
padding-right:3em;}
46+
47+
#chat-toggle{
48+
border:none;
49+
background-color:rgb(102,0,0);
50+
color:white;
51+
font-style:normal;
52+
display:inline;
53+
}
54+
55+
56+
#chat-body {
57+
overflow-y: scroll;
58+
height:400px;
59+
background-color:#2a2a2a;
60+
border-style:solid;
61+
border-width: 1px;
62+
border-color:#414141;
63+
font-style:normal;
64+
65+
}
66+
67+
#talkers-body {
68+
background-color:#2a2a2a;
69+
border-style:solid;
70+
border-width: 1px;
71+
border-color:#414141;
72+
font-style:normal;
73+
}
74+
75+
#name-input {
76+
background-color:#2a2a2a;
77+
border-style:solid;
78+
border-width: 1px;
79+
border-color:#414141;
80+
}
81+
82+
p {display:inline;}
83+
84+
#username {
85+
float:none;
86+
clear:both;
87+
padding-top:3em;
88+
Padding-left:1em;
89+
padding-bottom:1.5em;
90+
}
91+
92+
.form-group { padding: 1em;}
93+
94+
.panel-footer {
95+
background-color:transparent;}
96+
97+
#chat-message-input {
98+
background-color:#2a2a2a;
99+
border-style:solid;
100+
border-width: 1px;
101+
border-color:#414141;
102+
}
103+
104+
#chat-message-input::-webkit-input-placeholder {
105+
font-style:italic;
106+
}
107+
108+
::-webkit-scrollbar {
109+
background-color:#2a2a2a;
110+
}
111+
112+
#name-input::-webkit-input-placeholder {
113+
font-style:italic;
114+
}
115+
116+
.mainLoginInput:-moz-placeholder {
117+
font-style:italic;
118+
}
119+
120+
input::-webkit-input-placeholder {
121+
background-color:#2a2a2a;
122+
}

S3WebApp/assets/images/aws-logo.png

2.23 KB
Loading

S3WebApp/assets/images/title.png

15 KB
Loading

S3WebApp/assets/images/username.png

1.23 KB
Loading
1.63 KB
Loading

0 commit comments

Comments
 (0)