Skip to content

Commit 4556c8e

Browse files
author
jg
committed
API Buttons, Chat Connection
1 parent 393ec83 commit 4556c8e

File tree

15 files changed

+5267
-184
lines changed

15 files changed

+5267
-184
lines changed

gui/css/main.css

+4,897-2
Large diffs are not rendered by default.

gui/index.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
</a>
1717
</div>
1818
<div class="interactive-status" style="display:none">
19-
Disconnected
19+
Interactive
20+
</div>
21+
<div class="chat-status" style="display:none">
22+
Chat
2023
</div>
2124
<div class="updated-version" style="display:none">
2225
<a href="#" data="updates" class="nav">Update Available</a>
@@ -75,7 +78,7 @@ <h3>General Settings</h3>
7578
<select title="Choose type of controls for the button" class="tooltip">
7679
<option value="Game Controls" data="game-controls">Game Control</option>
7780
<option value="Sound" data="sound-buttons">Sound</option>
78-
<option value="Api Buttons" data="api-buttons" disabled>API Button</option>
81+
<option value="Api Buttons" data="api-buttons">API Button</option>
7982
<option value="Chat Currency" data="chat-currency-buttons" disabled>Chat Currency</option>
8083
<option value="Clicker Boss" data="clickerboss-buttons" disabled>Clicker Boss</option>
8184
<option value="Nothing" data="nothing">Nothing</option>
@@ -112,7 +115,6 @@ <h3>Type Specific</h3>
112115
<label>Type</label>
113116
<select>
114117
<option value="Advice">Advice</option>
115-
<option value="TTS Quotes">TTS Quotes</option>
116118
<option value="Cat Picture">Cat Picture</option>
117119
<option value="Cat Fact">Cat Fact</option>
118120
<option value="Dog Picture">Dog Picture</option>

gui/js/form-validation.js

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ function buttonMenuValidate(){
1919
required: true
2020
},
2121
cooldownButtons:{
22-
required: true,
2322
commaNumbers: true
2423
},
2524
cooldownLength:{

gui/js/global.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ function pageNavigation(){
2828

2929
// If the selected page is
3030
if (nextup !== "start" && nextup !== "login" && nextup !== "updates"){
31-
$('.interactive-status').fadeIn('fast');
31+
$('.interactive-status, .chat-status').fadeIn('fast');
3232
} else {
33-
$('.interactive-status').fadeOut('fast');
33+
$('.interactive-status, .chat-status').fadeOut('fast');
3434
}
3535

3636
return false;

gui/js/interactive/interactive-board.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ function buttonSubmission(){
122122
var fileVolume = $('.sound-volume input').val();
123123
var typeSettings = { "filePath": filePath, "volume": fileVolume}
124124

125+
} else if (buttonType == "Api Buttons"){
126+
var apiType = $('.api-select select option:selected').val();
127+
var typeSettings = { "apiType": apiType,}
125128
} else if (buttonType == "Nothing"){
126129
var typeSettings = {};
127130
}
@@ -299,16 +302,24 @@ function connectFlipper(status){
299302
if(status == "disconnected"){
300303
$('.disconnect-interactive').fadeOut('fast', function(){
301304
$('.launch-interactive').fadeIn('fast');
302-
$('.interactive-status').removeClass('online').text('Disconnected');
305+
$('.interactive-status').removeClass('online');
306+
$('.chat-status').removeClass('online');
303307
});
304308
} else if (status == "connected"){
305309
$('.launch-interactive').fadeOut('fast', function(){
306310
$('.disconnect-interactive').fadeIn('fast');
307-
$('.interactive-status').addClass('online').text('Connected');
311+
$('.interactive-status').addClass('online');
312+
$('.chat-status').addClass('online');
308313
});
309314
}
310315
};
311316

317+
// Disconnected for chat
318+
// Changes chat ui element if it disconnects or errors out.
319+
function chatDisconnected(status){
320+
$('.chat-status').removeClass('online');
321+
};
322+
312323
///////////
313324
// Events
314325
//////////
@@ -409,6 +420,12 @@ ipcRenderer.on('beamInteractive', function (event, status){
409420
connectFlipper(status);
410421
})
411422

423+
// Chat Disconnect
424+
// Flips ui elements if chat disconnects due to error.
425+
ipcRenderer.on('chat-disconnect', function (event, status){
426+
chatDisconnected();
427+
})
428+
412429
// Kill Switch Toggle
413430
// This recieves an event from the global killswitch in beam-connect.js, then sends an event back to confirm.
414431
ipcRenderer.on('killSwitch', function (event, status){

gui/js/login.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function requestBeamData(token, streamOrBot) {
2323
var data = JSON.parse(res.body);
2424

2525
//Load up avatar and such on login page.
26-
login(streamOrBot, data.channel.id, data.username, token, data.avatarUrl);
26+
login(streamOrBot, data.id, data.channel.id, data.username, token, data.avatarUrl);
2727

2828
// Close auth window
2929
ipcRenderer.send('auth-close');
@@ -33,12 +33,12 @@ function requestBeamData(token, streamOrBot) {
3333

3434
// Log in
3535
// This takes the saved login info and puts things onto the login page such as the user avatar.
36-
function login(streamOrBot, channelID, username, token, avatar){
36+
function login(streamOrBot, userID, channelID, username, token, avatar){
3737

3838
if (streamOrBot == "streamer"){
39-
dbAuth.push('/streamer', { "channelID": channelID, "username": username, "token": token, "avatarUrl": avatar });
39+
dbAuth.push('/streamer', { "channelID": channelID, "userID":userID, "username": username, "token": token, "avatarUrl": avatar });
4040
} else if (streamOrBot == "bot") {
41-
dbAuth.push('/bot', { "channelID": channelID, "username": username, "token": token, "avatarUrl": avatar });
41+
dbAuth.push('/bot', { "channelID": channelID, "userID":userID, "username": username, "token": token, "avatarUrl": avatar });
4242
}
4343

4444
if(streamOrBot == "streamer"){

gui/scss/_global.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ textarea {
147147
font-size:1.5em;
148148
}
149149

150-
.interactive-status{
150+
.interactive-status, .chat-status{
151151
float:right;
152152
display:inline-block;
153153
background-color: $status-offline-color;
@@ -156,8 +156,8 @@ textarea {
156156
border-radius: 10px;
157157
text-transform: uppercase;
158158
font-family: $font-primary;
159-
margin:1%;
160-
padding:4px;
159+
margin:10px;
160+
padding:4px 10px;
161161
font-size: .75em;
162162
&.online{
163163
background-color: $status-online-color;

lib/interactive/api-buttons/api.js

-158
This file was deleted.

0 commit comments

Comments
 (0)