Join server button

This commit is contained in:
Jiiks 2015-10-27 23:43:26 +02:00
parent 303b31f568
commit d2d7d0ca40
1 changed files with 19 additions and 3 deletions

View File

@ -64,7 +64,9 @@ PublicServers.prototype.init = function() {
text: "Language"
})).append($("<th/>", {
text: "Description"
}));
})).append($("<th/>", {
text: "Join"
}));
headers.appendTo(thead);
@ -96,7 +98,7 @@ PublicServers.prototype.init = function() {
};
PublicServers.prototype.addServer = function(name, code, title, language, description) {
var self = this;
var tableBody = $("#bd-ps-tbody");
@ -122,6 +124,11 @@ PublicServers.prototype.addServer = function(name, code, title, language, descri
tr.append($("<td/>", {
text: language
}));
tr.append($("<button/>", {
text: "Join",
click: function() { self.joinServer(code); }
}));
tr.append(desc);
@ -135,4 +142,13 @@ PublicServers.prototype.show = function() {
if(this.getPanel().is(":visible")) {
li.addClass("active");
}
};
};
//Workaround for joining a server
PublicServers.prototype.joinServer = function(code) {
console.log("Code: " + code);
$(".guilds-add").click();
$(".action.join .btn").click();
$(".create-guild-container input").val(code);
$(".form.join-server .btn-primary").click();
}