mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-11 22:24:24 +00:00
IPC GUI Update Nr.3 (#747)
* Added error handling for config changer * Added error handling for log * Added prepareBotConfigForSaving function * Misc * Misc * prepareBotConfigForSaving is now dynamic * Misc * Misc * Add quick example for new skin * Added new skin "teal" Prepare for nightmode * Cleanup new skin * Added nightmode support * Misc * Added basic nightmode theme * Misc * Misc * Remove light skins * for testing purposes * Misc * [Global] Fix loading animation 'overlay' (broke w/ font-awesome 5 upgrade) * [Global] Add updated font-awesome values from AdminLTE.css to app.css * Update nightmode * Misc * Added loading animation for bot box * Changed design of checkbox in sidebar * Changed design of checkboxes on commands page and bots page * Fixed commands dropdown and bots dropdown on commands page being cut off * Cleanup * Fixed loading animation showing on expanding box * Latest nightmode changes * Fix * Misc * Misc * Misc * fix * Added basic multi select for bots Misc Updated nightmode theme * Fix for description of commands * Added new design for scrollbars, thx JourneyOver * Misc * Fix * Misc * Misc
This commit is contained in:
committed by
Łukasz Domeradzki
parent
47158e0275
commit
fe5764a877
1
ArchiSteamFarm/www/css/_all-skins.min.css
vendored
Normal file
1
ArchiSteamFarm/www/css/_all-skins.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
ArchiSteamFarm/www/css/_nightmode.min.css
vendored
Normal file
1
ArchiSteamFarm/www/css/_nightmode.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -6,7 +6,6 @@
|
||||
width: auto;
|
||||
height: 400px;
|
||||
padding: 6px 12px;
|
||||
overflow-y: scroll;
|
||||
white-space: pre-line;
|
||||
border-color: rgb(221, 221, 221);
|
||||
border-style: solid;
|
||||
@@ -18,26 +17,22 @@
|
||||
width: auto;
|
||||
height: 400px;
|
||||
padding: 6px 12px;
|
||||
overflow-y: scroll;
|
||||
white-space: pre-line;
|
||||
border-color: rgb(221, 221, 221);
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
background-color: rgb(255, 255, 255);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.bg-gray {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#commandReply {
|
||||
font-family: monospace, monospace;
|
||||
color: rgb(255, 255, 255);
|
||||
font-size: 14px;
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
.bg-gray {
|
||||
color: rgb(255, 255, 255);
|
||||
background-color: #bfc3cb !important;
|
||||
}
|
||||
|
||||
#commandSent {
|
||||
font-family: monospace, monospace;
|
||||
font-size: 12px;
|
||||
@@ -122,7 +117,59 @@ button.bot-resumed:hover {
|
||||
}
|
||||
}
|
||||
|
||||
input[type=checkbox].dropdown-checkbox {
|
||||
margin-left: 10px;
|
||||
margin-right: 5px;
|
||||
.btn-badge {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
text-align: center;
|
||||
padding: 6px 0;
|
||||
font-size: 12px;
|
||||
line-height: 1.42;
|
||||
border-radius: .25em;
|
||||
}
|
||||
|
||||
.btn-badge-active {
|
||||
border-color: white;
|
||||
}
|
||||
|
||||
.box .overlay, .overlay-wrapper .overlay {
|
||||
background: none;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-left: -15px;
|
||||
margin-top: -15px;
|
||||
font-size: 30px
|
||||
}
|
||||
|
||||
.box .overlay, .overlay-wrapper .overlay .bot-box-loading {
|
||||
font-size: 20px
|
||||
}
|
||||
|
||||
.main-header .sidebar-toggle:before {
|
||||
content: none;
|
||||
}
|
||||
|
||||
.form-group-config {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
-webkit-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
background: rgb(167, 167, 167);
|
||||
}
|
||||
|
||||
#botRow .ui-selecting {
|
||||
background: #FECA40;
|
||||
}
|
||||
|
||||
#botRow .ui-selected {
|
||||
background: #F39814;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
//#region Utils
|
||||
if (typeof jQuery === 'undefined') {
|
||||
throw new Error('ASF App requires jQuery');
|
||||
}
|
||||
if (typeof jQuery === 'undefined') throw new Error('ASF App requires jQuery');
|
||||
|
||||
function get(name) {
|
||||
if (typeof Storage !== 'undefined') {
|
||||
@@ -41,21 +39,12 @@ function getIPCPassword() {
|
||||
title: "Success!",
|
||||
text: "Your IPC password has been saved.",
|
||||
type: "success"
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
}, function () { location.reload(); });
|
||||
});
|
||||
}
|
||||
|
||||
var IPCPassword = get('IPCPassword');
|
||||
|
||||
if (IPCPassword) {
|
||||
$.ajaxSetup({
|
||||
beforeSend: function (jqXHR) {
|
||||
jqXHR.setRequestHeader('Authentication', IPCPassword);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (IPCPassword) $.ajaxSetup({ beforeSend: function (jqXHR) { jqXHR.setRequestHeader('Authentication', IPCPassword); } });
|
||||
//#endregion Utils
|
||||
|
||||
//#region Footer
|
||||
@@ -63,20 +52,13 @@ $('.main-footer').ready(function () {
|
||||
$.ajax({
|
||||
url: "/Api/ASF",
|
||||
type: "GET",
|
||||
statusCode: {
|
||||
401: function () {
|
||||
getIPCPassword();
|
||||
}
|
||||
},
|
||||
statusCode: { 401: function () { getIPCPassword(); } },
|
||||
success: function (data) {
|
||||
var obj = data["Result"].Version,
|
||||
version = obj.Major + '.' + obj.Minor + '.' + obj.Build + '.' + obj.Revision;
|
||||
|
||||
// Add version to footer
|
||||
|
||||
$("#version").html('<b>Version</b> ' + version);
|
||||
|
||||
// Change changelog link according to currently running version
|
||||
document.getElementById("changelog").href = "https://github.com/JustArchi/ArchiSteamFarm/releases/tag/" + version;
|
||||
$('#changelog').attr('href', 'https://github.com/JustArchi/ArchiSteamFarm/releases/tag/' + version);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -102,71 +84,56 @@ $('.bot-status').ready(function () {
|
||||
|
||||
if (KeepRunning === false) {
|
||||
offlineBots++;
|
||||
$("#offlineBots").text(offlineBots);
|
||||
} else {
|
||||
if (TimeRemaining === "00:00:00") {
|
||||
idleBots++;
|
||||
$("#idleBots").text(idleBots);
|
||||
} else {
|
||||
activeBots++;
|
||||
$("#activeBots").text(activeBots);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#offlineBots").text(offlineBots);
|
||||
$("#idleBots").text(idleBots);
|
||||
$("#activeBots").text(activeBots);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
displayBotStatus();
|
||||
|
||||
window.setInterval(function () {
|
||||
displayBotStatus();
|
||||
}, 5000);
|
||||
window.setInterval(function () { displayBotStatus(); }, 5000);
|
||||
});
|
||||
//#endregion Bot Status Buttons
|
||||
|
||||
//#region ASF Information
|
||||
$('.info-overview').ready(function () {
|
||||
// Display RAM usage
|
||||
function displayRAMUsage() {
|
||||
$.ajax({
|
||||
url: "/Api/ASF",
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
$("#ramUsage").html((data["Result"].MemoryUsage / 1024).toFixed(2) + " MB");
|
||||
}
|
||||
success: function (data) { $("#ramUsage").html((data["Result"].MemoryUsage / 1024).toFixed(2) + " MB"); }
|
||||
});
|
||||
}
|
||||
|
||||
displayRAMUsage();
|
||||
|
||||
window.setInterval(function () {
|
||||
displayRAMUsage();
|
||||
}, 10000);
|
||||
|
||||
// Display uptime
|
||||
window.setInterval(function () { displayRAMUsage(); }, 10000);
|
||||
|
||||
function displayUptime() {
|
||||
$.ajax({
|
||||
url: "/Api/ASF",
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
$("#uptime").html(uptimeToString(data["Result"].ProcessStartTime));
|
||||
}
|
||||
success: function (data) { $("#uptime").html(uptimeToString(data["Result"].ProcessStartTime)); }
|
||||
});
|
||||
}
|
||||
|
||||
displayUptime();
|
||||
|
||||
window.setInterval(function () {
|
||||
displayUptime();
|
||||
}, 60000);
|
||||
window.setInterval(function () { displayUptime(); }, 60000);
|
||||
});
|
||||
|
||||
function uptimeToString(startTime) {
|
||||
var processStartTime = new Date(startTime);
|
||||
var currentDate = new Date();
|
||||
|
||||
var diff = currentDate.getTime() - processStartTime.getTime();
|
||||
var processStartTime = new Date(startTime),
|
||||
currentDate = new Date(),
|
||||
diff = currentDate.getTime() - processStartTime.getTime();
|
||||
|
||||
var days = Math.floor(diff / (1000 * 60 * 60 * 24));
|
||||
diff -= days * (1000 * 60 * 60 * 24);
|
||||
@@ -184,15 +151,9 @@ function uptimeToString(startTime) {
|
||||
//#endregion ASF Information
|
||||
|
||||
//#region Command Page
|
||||
var cmdInput = document.getElementById('commandInput');
|
||||
|
||||
function fillCommand(cmd) {
|
||||
cmdInput.value = cmd;
|
||||
}
|
||||
|
||||
function fillBots(bot) {
|
||||
cmdInput.value = cmdInput.value + " " + bot;
|
||||
}
|
||||
var $cmdInput = $('#commandInput');
|
||||
function fillCommand(cmd) { $cmdInput.val(cmd); }
|
||||
function fillBots(bot) { $cmdInput.val($cmdInput.val() + ' ' + bot); }
|
||||
|
||||
function getDateAndTime() {
|
||||
var currentdate = new Date();
|
||||
@@ -219,13 +180,11 @@ function logCommand(state, cmd) {
|
||||
}
|
||||
|
||||
function sendCommand() {
|
||||
var command = cmdInput.value,
|
||||
var command = $cmdInput.val(),
|
||||
requestURL = "/Api/Command/" + command,
|
||||
tmpAutoClear = get('autoClear');
|
||||
|
||||
if (command === "") {
|
||||
return;
|
||||
}
|
||||
if (command === "") return;
|
||||
|
||||
logCommand(true, command);
|
||||
|
||||
@@ -240,7 +199,7 @@ function sendCommand() {
|
||||
$(".box-content-command").text(getDateAndTime() + ' Waiting for response...');
|
||||
}
|
||||
|
||||
$("#commandReply").append('<div class="overlay"><i class="fas fa-sync fa-spin" style="color:white"></i></div>');
|
||||
$(".box-content-command").append('<div class="overlay"><i class="fas fa-sync fa-spin" style="color:white"></i></div>');
|
||||
|
||||
$.ajax({
|
||||
url: requestURL,
|
||||
@@ -255,85 +214,179 @@ function sendCommand() {
|
||||
}
|
||||
});
|
||||
|
||||
if (tmpAutoClear !== 'false') {
|
||||
cmdInput.value = "";
|
||||
}
|
||||
if (tmpAutoClear !== 'false') $cmdInput.val('');
|
||||
}
|
||||
//#endregion Command Page
|
||||
|
||||
//#region Config Changer Page
|
||||
var infoMessageHTML = '<div class="callout callout-warning margin">'
|
||||
+ '<h4><i class="icon fas fa-exclamation-triangle"></i> Under development</h4>'
|
||||
+ '<p>This feature is currently being developed.</p>'
|
||||
+ '</div>';
|
||||
|
||||
//#region New stuff
|
||||
//const cachedTypeDefinitions = new Map();
|
||||
//const cachedStructureDefinitions = new Map();
|
||||
|
||||
//function request(method, url, data) {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// $.ajax(url, { method, data })
|
||||
// .done(resolve)
|
||||
// .fail(reject);
|
||||
// });
|
||||
//}
|
||||
|
||||
//function extract(key) {
|
||||
// return obj => obj[key];
|
||||
//}
|
||||
|
||||
//const API = {
|
||||
// get: (endpoint, data) => request('GET', `/Api/${endpoint}`, data).then(extract('Result')),
|
||||
// post: (endpoint, data) => request('POST', `/Api/${endpoint}`, data).then(extract('Result'))
|
||||
//};
|
||||
|
||||
//const subtypeRegex = /\[[^\]]+\]/g;
|
||||
|
||||
//function resolveSubtypes(type) {
|
||||
// return type.match(subtypeRegex).map(subtype => subtype.slice(1, subtype.length - 1));
|
||||
//}
|
||||
|
||||
//async function getStructureDefinition(type) {
|
||||
// if (cachedStructureDefinitions.has(type)) return cachedStructureDefinitions.get(type);
|
||||
|
||||
// const structureDefinition = API.get(`Structure/${encodeURIComponent(type)}`);
|
||||
// cachedStructureDefinitions.set(type, structureDefinition);
|
||||
|
||||
// return structureDefinition;
|
||||
//}
|
||||
|
||||
//async function getTypeDefinition(type) {
|
||||
// if (cachedTypeDefinitions.has(type)) return cachedTypeDefinitions.get(type);
|
||||
|
||||
// const typeDefinition = API.get(`Type/${encodeURIComponent(type)}`);
|
||||
// cachedTypeDefinitions.set(type, typeDefinition);
|
||||
|
||||
// return typeDefinition;
|
||||
//}
|
||||
|
||||
//async function resolveType(type) {
|
||||
// switch (type.split('`')[0]) {
|
||||
// case 'System.Boolean':
|
||||
// return { type: 'boolean' };
|
||||
// case 'System.String':
|
||||
// return { type: 'string' };
|
||||
// case 'System.Byte':
|
||||
// return { type: 'smallNumber' };
|
||||
// case 'System.UInt32':
|
||||
// return { type: 'number' };
|
||||
// case 'System.Collections.Generic.HashSet':
|
||||
// const [subtype] = resolveSubtypes(type);
|
||||
// return { type: 'hashSet', values: await resolveType(subtype) };
|
||||
// case 'System.UInt64':
|
||||
// return { type: 'bigNumber' };
|
||||
// case 'System.Collections.Generic.Dictionary':
|
||||
// const subtypes = resolveSubtypes(type);
|
||||
// return { type: 'dictionary', key: await resolveType(subtypes[0]), value: await resolveType(subtypes[1]) };
|
||||
// default: // Complex type
|
||||
// return unwindType(type);
|
||||
// }
|
||||
//}
|
||||
|
||||
//async function unwindObject(type, typeDefinition) {
|
||||
// const resolvedStructure = {
|
||||
// type: 'object',
|
||||
// body: {}
|
||||
// };
|
||||
|
||||
// const [structureDefinition, resolvedTypes] = await Promise.all([
|
||||
// getStructureDefinition(type),
|
||||
// Promise.all(Object.keys(typeDefinition.Body).map(async param => ({ param, type: await resolveType(typeDefinition.Body[param]) })))
|
||||
// ]);
|
||||
|
||||
// for (const { param, type } of resolvedTypes) {
|
||||
// const paramName = typeDefinition.Body[param] !== 'System.UInt64' ? param : `s_${param}`;
|
||||
|
||||
// resolvedStructure.body[param] = {
|
||||
// defaultValue: structureDefinition[param],
|
||||
// paramName,
|
||||
// ...type
|
||||
// };
|
||||
// }
|
||||
|
||||
// return resolvedStructure;
|
||||
//}
|
||||
|
||||
//async function unwindType(type) {
|
||||
// if (type === 'ArchiSteamFarm.BotConfig') getStructureDefinition(type); // Dirty trick, but 30% is 30%
|
||||
// const typeDefinition = await getTypeDefinition(type);
|
||||
|
||||
// switch (typeDefinition.Properties.BaseType) {
|
||||
// case 'System.Object':
|
||||
// return unwindObject(type, typeDefinition);
|
||||
// case 'System.Enum':
|
||||
// return { type: (typeDefinition.Properties.CustomAttributes || []).includes('System.FlagsAttribute') ? 'flag' : 'enum', values: typeDefinition.Body };
|
||||
// default:
|
||||
// const structureDefinition = await getStructureDefinition(type);
|
||||
// return { type: 'unknown', typeDefinition, structureDefinition };
|
||||
// }
|
||||
//}
|
||||
//#endregion New stuff
|
||||
|
||||
function generateConfigChangerHTML() {
|
||||
$.ajax({
|
||||
url: "/Api/Type/ArchiSteamFarm.BotConfig",
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
var obj = data["Result"];
|
||||
var boxBodyHTML = "";
|
||||
var textBoxes = '';
|
||||
var checkBoxes = '';
|
||||
var numberBoxes = '';
|
||||
var defaultBoxes = '';
|
||||
var obj = data["Result"],
|
||||
objBody = obj["Body"],
|
||||
boxBodyHTML = "",
|
||||
textBoxes = '',
|
||||
checkBoxes = '',
|
||||
numberBoxes = '',
|
||||
defaultBoxes = '',
|
||||
textAreas = '';
|
||||
|
||||
//console.log(obj)
|
||||
|
||||
for (var key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
var value = obj[key];
|
||||
var keyOne = key.replace(/([A-Z])/g, ' $1').trim();
|
||||
var keyWithSpace = keyOne.replace(/([A-Z])\s(?=[A-Z])/g, '$1');
|
||||
for (var key in objBody) {
|
||||
if (objBody.hasOwnProperty(key)) {
|
||||
var value = objBody[key],
|
||||
noSpaceKey = key.replace(/([A-Z])/g, ' $1').trim(),
|
||||
readableKey = noSpaceKey.replace(/([A-Z])\s(?=[A-Z])/g, '$1');
|
||||
|
||||
switch (value) {
|
||||
case 'System.Boolean':
|
||||
// Add checkbox
|
||||
checkBoxes += '<div class="checkbox">'
|
||||
+ '<label for="' + key + '">'
|
||||
+ '<input type="checkbox" id="' + key + '">'
|
||||
+ keyWithSpace
|
||||
+ '</label>'
|
||||
+ '</div>';
|
||||
break;
|
||||
case 'System.Byte':
|
||||
// Add textbox
|
||||
numberBoxes += '<div class="form-group">'
|
||||
+ '<label for="' + key + '">' + keyWithSpace + '</label>'
|
||||
+ '<input type="number" id="' + key + '" class="form-control">'
|
||||
checkBoxes += '<div class="">'
|
||||
+ '<button title="Toggle ' + key + '" type="button" data-type="' + value + '" class="btn btn-box-tool text-grey" id="' + key + '"><i id="ico' + key + '" class="fas fa-toggle-on fa-2x fa-fw fa-rotate-180"></i></button>'
|
||||
+ readableKey
|
||||
+ '</div>';
|
||||
break;
|
||||
case 'System.String':
|
||||
// Add textbox
|
||||
textBoxes += '<div class="form-group">'
|
||||
+ '<label for="' + key + '">' + keyWithSpace + '</label>'
|
||||
+ '<input type="text" id="' + key + '" class="form-control">'
|
||||
textBoxes += '<div class="form-group-config">'
|
||||
+ '<label for="' + key + '">' + readableKey + '</label>'
|
||||
+ '<input type="text" id="' + key + '" class="form-control" data-type="' + value + '">'
|
||||
+ '</div>';
|
||||
break;
|
||||
case 'System.Byte':
|
||||
numberBoxes += '<div class="form-group-config">'
|
||||
+ '<label for="' + key + '">' + readableKey + '</label>'
|
||||
+ '<input type="number" id="' + key + '" class="form-control" data-type="' + value + '">'
|
||||
+ '</div>';
|
||||
break;
|
||||
case 'System.Collections.Generic.Dictionary`2[System.UInt64][ArchiSteamFarm.BotConfig+EPermission]':
|
||||
// Add textarea
|
||||
textBoxes += '<div class="form-group">'
|
||||
+ '<label for="' + key + '">' + keyWithSpace + '</label>'
|
||||
+ '<textarea id="' + key + '" class="form-control"></textarea>'
|
||||
textAreas += '<div class="form-group-config">'
|
||||
+ '<label for="' + key + '">' + readableKey + '</label>'
|
||||
+ '<textarea id="' + key + '" class="form-control" data-type="' + value + '" rows="3"></textarea>'
|
||||
+ '</div>';
|
||||
break;
|
||||
default:
|
||||
// Default use textbox
|
||||
defaultBoxes += '<div class="form-group">'
|
||||
+ '<label for="' + key + '">' + keyWithSpace + '</label>'
|
||||
+ '<input type="text" id="' + key + '" class="form-control">'
|
||||
defaultBoxes += '<div class="form-group-config">'
|
||||
+ '<label for="' + key + '">' + readableKey + '</label>'
|
||||
+ '<input type="text" id="' + key + '" class="form-control" data-type="' + value + '">'
|
||||
+ '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
boxBodyHTML = '<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">' + defaultBoxes + '</div>'
|
||||
+ '<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">' + textBoxes + numberBoxes + '</div>'
|
||||
+ '<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">' + checkBoxes + '</div>';
|
||||
+ '<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">' + checkBoxes + textAreas + '</div>';
|
||||
}
|
||||
|
||||
$('#configChangerTab').html(infoMessageHTML
|
||||
+ '<div class="box-header with-border">'
|
||||
$('#configChangerTab').html('<div class="box-header with-border">'
|
||||
+ '<h3 class="box-title"></h3>'
|
||||
+ '<div class="box-tools pull-right">'
|
||||
+ '<div class="btn-group">'
|
||||
@@ -348,41 +401,79 @@ function generateConfigChangerHTML() {
|
||||
+ '<div class="box-body">'
|
||||
+ boxBodyHTML
|
||||
+ '</div>');
|
||||
|
||||
createClickFunction();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createClickFunction() {
|
||||
var myNodeList = document.querySelectorAll('[data-type="System.Boolean"]');
|
||||
|
||||
for (i = 0; i < myNodeList.length; i++) {
|
||||
var myID = myNodeList[i].id;
|
||||
|
||||
$('#' + myID).bind("click", function () {
|
||||
var $key = $('#' + this.id);
|
||||
|
||||
if ($key.hasClass('text-grey')) {
|
||||
$key.removeClass('text-grey');
|
||||
$key.addClass('text-olive');
|
||||
$('#ico' + this.id).removeClass('fa-rotate-180');
|
||||
$key.blur();
|
||||
} else {
|
||||
$key.removeClass('text-olive');
|
||||
$key.addClass('text-grey');
|
||||
$('#ico' + this.id).addClass('fa-rotate-180');
|
||||
$key.blur();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var globalBotConfig = {};
|
||||
|
||||
function loadConfigValuesForBot(botName) {
|
||||
$.ajax({
|
||||
url: "/Api/Bot/" + encodeURIComponent(botName),
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
var obj = data["Result"];
|
||||
var objBot = obj[0];
|
||||
var BotConfig = objBot.BotConfig;
|
||||
var obj = data["Result"],
|
||||
objBot = obj[0],
|
||||
BotConfig = objBot.BotConfig;
|
||||
|
||||
//console.log(BotConfig)
|
||||
globalBotConfig = BotConfig;
|
||||
|
||||
for (var key in BotConfig) {
|
||||
if (BotConfig.hasOwnProperty(key)) {
|
||||
var value = BotConfig[key];
|
||||
var value = BotConfig[key],
|
||||
$key = $('#' + key),
|
||||
keyObj = $key[0];
|
||||
|
||||
var $key = $('#' + key);
|
||||
var keyObj = $key[0];
|
||||
var inputType = keyObj.type;
|
||||
if (typeof keyObj === 'undefined') continue;
|
||||
|
||||
//console.log(key + ' - ' + inputType)
|
||||
var inputType = keyObj.dataset.type;
|
||||
|
||||
switch (inputType) {
|
||||
case 'checkbox':
|
||||
$key.prop('checked', value);
|
||||
case 'System.Boolean':
|
||||
if (value) {
|
||||
$key.removeClass('text-grey');
|
||||
$key.addClass('text-olive');
|
||||
$('#ico' + key).removeClass('fa-rotate-180');
|
||||
} else {
|
||||
$key.removeClass('text-olive');
|
||||
$key.addClass('text-grey');
|
||||
$('#ico' + key).addClass('fa-rotate-180');
|
||||
}
|
||||
break;
|
||||
case 'textarea':
|
||||
for (var key in value) {
|
||||
if (value.hasOwnProperty(key)) {
|
||||
var value = value[key];
|
||||
$key.append(key + ':' + value);
|
||||
}
|
||||
case 'System.UInt64':
|
||||
$key.val(BotConfig['s_' + key]);
|
||||
break;
|
||||
case 'System.Collections.Generic.Dictionary`2[System.UInt64][ArchiSteamFarm.BotConfig+EPermission]':
|
||||
$key.text(''); // Reset textarea before filling
|
||||
|
||||
for (var steamID64 in value) {
|
||||
if (value.hasOwnProperty(steamID64)) $key.append(steamID64 + ':' + value[steamID64] + '\n');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -390,44 +481,104 @@ function loadConfigValuesForBot(botName) {
|
||||
}
|
||||
}
|
||||
}
|
||||
//setDefaultValues();
|
||||
|
||||
|
||||
loadBotsDropDown(botName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//function setDefaultValues() {
|
||||
// $.ajax({
|
||||
// url: "/Api/Structure/ArchiSteamFarm.BotConfig",
|
||||
// type: "GET",
|
||||
// success: function (data) {
|
||||
// botConfigStructure = data["Result"];
|
||||
// console.log(botConfigStructure)
|
||||
function prepareBotConfigForSaving() {
|
||||
var botName = $("#saveButton").data("BotName"),
|
||||
BotConfig = globalBotConfig;
|
||||
|
||||
// for (var key in botConfigStructure) {
|
||||
// if (botConfigStructure.hasOwnProperty(key)) {
|
||||
// var value = botConfigStructure[key];
|
||||
for (var key in BotConfig) {
|
||||
if (BotConfig.hasOwnProperty(key)) {
|
||||
var value = BotConfig[key],
|
||||
$key = $('#' + key),
|
||||
keyObj = $key[0];
|
||||
|
||||
// console.log(key + ' - ' + value)
|
||||
if (typeof keyObj === 'undefined') continue;
|
||||
|
||||
// var $key = $('#' + key);
|
||||
// var keyObj = $key[0];
|
||||
// var inputType = keyObj.type;
|
||||
var inputType = keyObj.dataset.type,
|
||||
$keyValue = $key.val();
|
||||
|
||||
// switch (inputType) {
|
||||
// case 'checkbox':
|
||||
// break;
|
||||
// default:
|
||||
// if ($key.val() === '') {
|
||||
// $key.val(value);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
switch (inputType) {
|
||||
case 'System.Boolean':
|
||||
var $keyState = $('#ico' + key).hasClass('fa-rotate-180') ? false : true;
|
||||
if ($keyState !== value) BotConfig[key] = $keyState;
|
||||
break;
|
||||
|
||||
case 'System.String':
|
||||
if ($keyValue === '') $keyValue = null;
|
||||
if ($keyValue !== value) BotConfig[key] = $keyValue;
|
||||
break;
|
||||
case 'System.UInt64':
|
||||
if ($keyValue !== BotConfig['s_' + key]) {
|
||||
delete BotConfig[key];
|
||||
BotConfig['s_' + key] = $keyValue;
|
||||
}
|
||||
break;
|
||||
case 'System.Collections.Generic.HashSet`1[System.UInt32]':
|
||||
var items = $keyValue.split(',');
|
||||
if (items.map(Number) !== value) BotConfig[key] = items.map(Number);
|
||||
break;
|
||||
|
||||
case 'System.Collections.Generic.Dictionary`2[System.UInt64][ArchiSteamFarm.BotConfig+EPermission]':
|
||||
var steamUserPermissions = {},
|
||||
permissions = [],
|
||||
lines = $key.val().split('\n');
|
||||
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
if (lines[i] !== '') permissions.push(lines[i].split(':'));
|
||||
}
|
||||
|
||||
for (var j = 0; j < permissions.length; j++) {
|
||||
var obj = permissions[j];
|
||||
steamUserPermissions[obj[0]] = parseInt(obj[1]);
|
||||
}
|
||||
|
||||
if (steamUserPermissions !== value) BotConfig[key] = steamUserPermissions;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (typeof value === 'object') {
|
||||
var objItems = $keyValue.split(',');
|
||||
if (objItems.map(Number) !== value) BotConfig[key] = objItems.map(Number);
|
||||
} else if (typeof value === 'number') {
|
||||
var number = Number($keyValue);
|
||||
if (number !== value) BotConfig[key] = number;
|
||||
} else {
|
||||
if ($keyValue !== value) BotConfig[key] = $keyValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
saveConfig(botName, { BotConfig });
|
||||
}
|
||||
|
||||
function saveConfig(botName, config) {
|
||||
$.ajax({
|
||||
url: "/Api/Bot/" + encodeURIComponent(botName),
|
||||
type: "POST",
|
||||
data: JSON.stringify(config),
|
||||
contentType: "application/json",
|
||||
success: function (data) {
|
||||
swal({
|
||||
title: "Success!",
|
||||
text: "<" + botName + "> and its config file got updated.",
|
||||
type: "success"
|
||||
}, function () { location.reload(); });
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
swal({
|
||||
title: "Error!",
|
||||
text: jqXHR.status + ' - ' + errorThrown,
|
||||
type: "error"
|
||||
}, function () { location.reload(); });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadBotsDropDown(botName) {
|
||||
var botsDropDownHTML = '';
|
||||
@@ -442,13 +593,13 @@ function loadBotsDropDown(botName) {
|
||||
var currentBot = obj[i],
|
||||
currentBotName = currentBot.BotName;
|
||||
|
||||
if (botName !== currentBotName) {
|
||||
botsDropDownHTML += '<li><a href="#" onclick="loadConfigValuesForBot(\'' + currentBotName + '\')">' + currentBotName + '</a></li>';
|
||||
}
|
||||
if (botName === currentBotName) continue;
|
||||
|
||||
botsDropDownHTML += '<li><a href="javascript:void(0)" onclick="loadConfigValuesForBot(\'' + currentBotName + '\')">' + currentBotName + '</a></li>';
|
||||
}
|
||||
|
||||
$(".box-title").html("Currently editing: <b>" + botName + "</b>");
|
||||
$("#saveConfig").data("BotName", botName);
|
||||
$("#saveButton").data("BotName", botName);
|
||||
$("#botsDropDown").html(botsDropDownHTML);
|
||||
}
|
||||
});
|
||||
@@ -461,45 +612,26 @@ $(function () {
|
||||
|
||||
var mySkins = [
|
||||
'skin-blue',
|
||||
'skin-teal',
|
||||
'skin-black',
|
||||
'skin-red',
|
||||
'skin-yellow',
|
||||
'skin-purple',
|
||||
'skin-green',
|
||||
'skin-blue-light',
|
||||
'skin-black-light',
|
||||
'skin-red-light',
|
||||
'skin-yellow-light',
|
||||
'skin-purple-light',
|
||||
'skin-green-light'
|
||||
'skin-green'
|
||||
];
|
||||
|
||||
function changeSkin(cls) {
|
||||
$.each(mySkins, function (i) {
|
||||
$('body').removeClass(mySkins[i]);
|
||||
$('[data-skin="' + mySkins[i] + '"]').removeClass('btn-badge-active');
|
||||
});
|
||||
|
||||
$('body').addClass(cls);
|
||||
changeSidebarSkin(cls);
|
||||
$('[data-skin="' + cls + '"]').addClass('btn-badge-active');
|
||||
store('skin', cls);
|
||||
return false;
|
||||
}
|
||||
|
||||
function changeSidebarSkin(cls) {
|
||||
var $sidebar = $('.control-sidebar');
|
||||
if (cls.includes("-light")) {
|
||||
if ($sidebar.hasClass('control-sidebar-dark')) {
|
||||
$sidebar.removeClass('control-sidebar-dark');
|
||||
$sidebar.addClass('control-sidebar-light');
|
||||
}
|
||||
} else {
|
||||
if ($sidebar.hasClass('control-sidebar-light')) {
|
||||
$sidebar.removeClass('control-sidebar-light');
|
||||
$sidebar.addClass('control-sidebar-dark');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeSetting() {
|
||||
swal({
|
||||
title: "Are you sure?",
|
||||
@@ -515,9 +647,7 @@ $(function () {
|
||||
title: "Success!",
|
||||
text: "Your IPC password has been reset.",
|
||||
type: "success"
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
}, function () { location.reload(); });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -526,6 +656,9 @@ $(function () {
|
||||
if ($('body').hasClass('fixed')) {
|
||||
$('body').removeClass('fixed');
|
||||
$('body').addClass('layout-boxed');
|
||||
$('#toggleBoxed').removeClass('text-grey');
|
||||
$('#toggleBoxed').addClass('text-olive');
|
||||
$('#iconBoxed').removeClass('fa-rotate-180');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -534,64 +667,75 @@ $(function () {
|
||||
if ($('body').hasClass('fixed')) {
|
||||
$('body').removeClass('fixed');
|
||||
$('body').addClass('layout-boxed');
|
||||
$('#toggleBoxed').removeClass('text-grey');
|
||||
$('#toggleBoxed').addClass('text-olive');
|
||||
$('#iconBoxed').removeClass('fa-rotate-180');
|
||||
$('#toggleBoxed').blur();
|
||||
store('layoutState', 'layout-boxed');
|
||||
} else {
|
||||
$('body').removeClass('layout-boxed');
|
||||
$('body').addClass('fixed');
|
||||
$('#toggleBoxed').removeClass('text-olive');
|
||||
$('#toggleBoxed').addClass('text-grey');
|
||||
$('#iconBoxed').addClass('fa-rotate-180');
|
||||
$('#toggleBoxed').blur();
|
||||
store('layoutState', 'fixed');
|
||||
}
|
||||
}
|
||||
|
||||
function saveLeftSidebarState() {
|
||||
if ($('body').hasClass('sidebar-collapse')) {
|
||||
store('leftSidebarState', 'normal');
|
||||
} else {
|
||||
store('leftSidebarState', 'sidebar-collapse');
|
||||
function changeNightmode(savedNightmodeState) {
|
||||
if (savedNightmodeState === 'nightmode') {
|
||||
$('body').addClass('nightmode');
|
||||
$('#toggleNightmode').removeClass('text-grey');
|
||||
$('#toggleNightmode').addClass('text-olive');
|
||||
$('#iconNightmode').removeClass('fa-rotate-180');
|
||||
}
|
||||
}
|
||||
|
||||
function changeLeftSidebarState(savedSidebarState) {
|
||||
if (savedSidebarState === 'sidebar-collapse') {
|
||||
$('body').addClass('sidebar-collapse');
|
||||
function toggleNightmode() {
|
||||
if ($('body').hasClass('nightmode')) {
|
||||
$('body').removeClass('nightmode');
|
||||
$('#toggleNightmode').removeClass('text-olive');
|
||||
$('#toggleNightmode').addClass('text-grey');
|
||||
$('#iconNightmode').addClass('fa-rotate-180');
|
||||
$('#toggleNightmode').blur();
|
||||
store('nightmodeState', null);
|
||||
} else {
|
||||
$('body').addClass('nightmode');
|
||||
$('#toggleNightmode').removeClass('text-grey');
|
||||
$('#toggleNightmode').addClass('text-olive');
|
||||
$('#iconNightmode').removeClass('fa-rotate-180');
|
||||
$('#toggleNightmode').blur();
|
||||
store('nightmodeState', 'nightmode');
|
||||
}
|
||||
}
|
||||
|
||||
function setup() {
|
||||
var tmpSkin = get('skin'),
|
||||
tmpLayoutState = get('layoutState'),
|
||||
tmpNightmodeState = get('nightmodeState'),
|
||||
tmpLeftSidebarState = get('leftSidebarState');
|
||||
|
||||
if (tmpSkin && $.inArray(tmpSkin, mySkins)) {
|
||||
changeSkin(tmpSkin);
|
||||
}
|
||||
|
||||
if (tmpSkin && $.inArray(tmpSkin, mySkins)) changeSkin(tmpSkin);
|
||||
if (tmpLeftSidebarState) {
|
||||
changeLeftSidebarState(tmpLeftSidebarState);
|
||||
}
|
||||
if (tmpLeftSidebarState === 'sidebar-collapse') {
|
||||
$('body').addClass('sidebar-collapse');
|
||||
}
|
||||
}
|
||||
if (tmpLayoutState) changeBoxed(tmpLayoutState);
|
||||
if (tmpNightmodeState) changeNightmode(tmpNightmodeState);
|
||||
|
||||
if (tmpLayoutState) {
|
||||
changeBoxed(tmpLayoutState);
|
||||
}
|
||||
|
||||
$('[data-skin]').on('click', function (e) {
|
||||
changeSkin($(this).data('skin'));
|
||||
$('[data-skin]').on('click', function (e) { changeSkin($(this).data('skin')); });
|
||||
$('#toggleBoxed').on('click', function () { toggleBoxed(); });
|
||||
$('#toggleNightmode').on('click', function () { toggleNightmode(); });
|
||||
$('[data-general]').on('click', function () { changeSetting(); });
|
||||
$('#leftSidebar').on('click', function () {
|
||||
if ($('body').hasClass('sidebar-collapse')) {
|
||||
store('leftSidebarState', 'normal');
|
||||
} else {
|
||||
store('leftSidebarState', 'sidebar-collapse');
|
||||
}
|
||||
});
|
||||
|
||||
$('[data-layout]').on('click', function () {
|
||||
toggleBoxed();
|
||||
});
|
||||
|
||||
$('[data-general]').on('click', function () {
|
||||
changeSetting();
|
||||
});
|
||||
|
||||
$('[data-navigation]').on('click', function () {
|
||||
saveLeftSidebarState();
|
||||
});
|
||||
|
||||
if ($('body').hasClass('layout-boxed')) {
|
||||
$('[data-layout="layout-boxed"]').attr('checked', 'checked');
|
||||
}
|
||||
}
|
||||
|
||||
// Create the menu
|
||||
@@ -606,123 +750,53 @@ $(function () {
|
||||
+ '<div class="form-group">'
|
||||
+ '<label class="control-sidebar-subheading">'
|
||||
+ '<a href="javascript:void(0)" class="text-red pull-right" data-general="resetIPCPassword"><i class="far fa-trash-alt"></i></a>'
|
||||
+ 'Reset IPC Password'
|
||||
+ '<i class="fas fa-lock fa-fw"></i> Reset IPC Password'
|
||||
+ '</label>'
|
||||
+ '<p>Deletes the currently set IPC password</p>'
|
||||
+ '</div>'
|
||||
// Boxed Layout
|
||||
+ '<div class="form-group hidden-xs hidden-sm">'
|
||||
+ '<label class="control-sidebar-subheading">'
|
||||
+ '<input type="checkbox" data-layout="layout-boxed" class="pull-right"/> '
|
||||
+ 'Boxed Layout'
|
||||
+ '<button title="Toggle boxed layout" type="button" class="btn btn-box-tool pull-right text-grey" id="toggleBoxed"><i id="iconBoxed" class="fas fa-toggle-on fa-2x fa-rotate-180"></i></button>'
|
||||
+ '<i class="far fa-square fa-fw"></i> Boxed Layout'
|
||||
+ '</label>'
|
||||
+ '<p>Activate the boxed layout</p>'
|
||||
+ '<p>Toggle the boxed layout</p>'
|
||||
+ '</div>'
|
||||
// Nightmode
|
||||
+ '<div class="form-group">'
|
||||
+ '<label class="control-sidebar-subheading">'
|
||||
+ '<button title="Toggle nightmode" type="button" class="btn btn-box-tool pull-right text-grey" id="toggleNightmode"><i id="iconNightmode" class="fas fa-toggle-on fa-2x fa-rotate-180"></i></button>'
|
||||
+ '<i class="fas fa-moon fa-fw"></i> Nightmode'
|
||||
+ '</label>'
|
||||
+ '<p>Toggle the nightmode</p>'
|
||||
+ '</div>'
|
||||
);
|
||||
|
||||
//#region SkinsList
|
||||
|
||||
var $skinsList = $('<ul />', { 'class': 'list-unstyled clearfix' });
|
||||
|
||||
// Dark sidebar skins
|
||||
var $skinBlue =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-blue" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 7px; background: #367fa9"></span><span class="bg-light-blue" style="display:block; width: 80%; float: left; height: 7px;"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #222d32"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin">Blue</p>');
|
||||
|
||||
var $skinBlue = $('<li />', { style: 'float:left; width: 14%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-blue" class="clearfix full-opacity-hover btn btn-badge bg-blue"></a>');
|
||||
$skinsList.append($skinBlue);
|
||||
var $skinBlack =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-black" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div style="box-shadow: 0 0 2px rgba(0,0,0,0.1)" class="clearfix"><span style="display:block; width: 20%; float: left; height: 7px; background: #fefefe"></span><span style="display:block; width: 80%; float: left; height: 7px; background: #fefefe"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #222"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin">Black</p>');
|
||||
var $skinBlack = $('<li />', { style: 'float:left; width: 14%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-black" class="clearfix full-opacity-hover btn btn-badge bg-black"></a>');
|
||||
$skinsList.append($skinBlack);
|
||||
var $skinPurple =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-purple" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-purple-active"></span><span class="bg-purple" style="display:block; width: 80%; float: left; height: 7px;"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #222d32"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin">Purple</p>');
|
||||
var $skinPurple = $('<li />', { style: 'float:left; width: 14%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-purple" class="clearfix full-opacity-hover btn btn-badge bg-purple"></a>');
|
||||
$skinsList.append($skinPurple);
|
||||
var $skinGreen =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-green" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-green-active"></span><span class="bg-green" style="display:block; width: 80%; float: left; height: 7px;"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #222d32"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin">Green</p>');
|
||||
var $skinGreen = $('<li />', { style: 'float:left; width: 14%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-green" class="clearfix full-opacity-hover btn btn-badge bg-green"></a>');
|
||||
$skinsList.append($skinGreen);
|
||||
var $skinRed =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-red" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-red-active"></span><span class="bg-red" style="display:block; width: 80%; float: left; height: 7px;"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #222d32"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin">Red</p>');
|
||||
var $skinRed = $('<li />', { style: 'float:left; width: 14%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-red" class="clearfix full-opacity-hover btn btn-badge bg-red"></a>');
|
||||
$skinsList.append($skinRed);
|
||||
var $skinYellow =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-yellow" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-yellow-active"></span><span class="bg-yellow" style="display:block; width: 80%; float: left; height: 7px;"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #222d32"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin">Yellow</p>');
|
||||
var $skinYellow = $('<li />', { style: 'float:left; width: 14%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-yellow" class="clearfix full-opacity-hover btn btn-badge bg-yellow"></a>');
|
||||
$skinsList.append($skinYellow);
|
||||
var $skinTeal = $('<li />', { style: 'float:left; width: 14%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-teal" class="clearfix full-opacity-hover btn btn-badge bg-teal"></a>');
|
||||
$skinsList.append($skinTeal);
|
||||
|
||||
// Light sidebar skins
|
||||
var $skinBlueLight =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-blue-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 7px; background: #367fa9"></span><span class="bg-light-blue" style="display:block; width: 80%; float: left; height: 7px;"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #f9fafc"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin" style="font-size: 12px">Blue Light</p>');
|
||||
$skinsList.append($skinBlueLight);
|
||||
var $skinBlackLight =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-black-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div style="box-shadow: 0 0 2px rgba(0,0,0,0.1)" class="clearfix"><span style="display:block; width: 20%; float: left; height: 7px; background: #fefefe"></span><span style="display:block; width: 80%; float: left; height: 7px; background: #fefefe"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #f9fafc"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin" style="font-size: 12px">Black Light</p>');
|
||||
$skinsList.append($skinBlackLight);
|
||||
var $skinPurpleLight =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-purple-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-purple-active"></span><span class="bg-purple" style="display:block; width: 80%; float: left; height: 7px;"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #f9fafc"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin" style="font-size: 12px">Purple Light</p>');
|
||||
$skinsList.append($skinPurpleLight);
|
||||
var $skinGreenLight =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-green-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-green-active"></span><span class="bg-green" style="display:block; width: 80%; float: left; height: 7px;"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #f9fafc"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin" style="font-size: 12px">Green Light</p>');
|
||||
$skinsList.append($skinGreenLight);
|
||||
var $skinRedLight =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-red-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-red-active"></span><span class="bg-red" style="display:block; width: 80%; float: left; height: 7px;"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #f9fafc"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin" style="font-size: 12px">Red Light</p>');
|
||||
$skinsList.append($skinRedLight);
|
||||
var $skinYellowLight =
|
||||
$('<li />', { style: 'float:left; width: 33.33333%; padding: 5px;' })
|
||||
.append('<a href="javascript:void(0)" data-skin="skin-yellow-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-yellow-active"></span><span class="bg-yellow" style="display:block; width: 80%; float: left; height: 7px;"></span></div>'
|
||||
+ '<div><span style="display:block; width: 20%; float: left; height: 20px; background: #f9fafc"></span><span style="display:block; width: 80%; float: left; height: 20px; background: #f4f5f7"></span></div>'
|
||||
+ '</a>'
|
||||
+ '<p class="text-center no-margin" style="font-size: 12px">Yellow Light</p>');
|
||||
$skinsList.append($skinYellowLight);
|
||||
//#endregion SkinsList
|
||||
var $skinsListLight = $('<ul />', { 'class': 'list-unstyled clearfix' });
|
||||
|
||||
$layoutSettings.append('<h4 class="control-sidebar-heading">Skins</h4>');
|
||||
$layoutSettings.append($skinsList);
|
||||
|
||||
@@ -8,49 +8,44 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.2/css/AdminLTE.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.2/css/skins/_all-skins.min.css">
|
||||
<link rel="stylesheet" href="../css/_all-skins.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
|
||||
<!--Change font-awesome to cdnjs once available-->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<link rel="stylesheet" href="../css/_nightmode.min.css">
|
||||
<link rel="icon" href="../favicon.png" type="image/png">
|
||||
<link rel="shortcut icon" href="../favicon.ico" type="img/x-icon">
|
||||
</head>
|
||||
<body class="hold-transition skin-blue sidebar-mini fixed">
|
||||
<div class="wrapper">
|
||||
<!-- Main Header -->
|
||||
<header class="main-header">
|
||||
<!-- Logo -->
|
||||
<a href="#" class="logo">
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<a href="javascript:void(0)" class="logo">
|
||||
<span class="logo-mini"><b>A</b>SF</span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
<span class="logo-lg"><b>Archi</b>SteamFarm</span>
|
||||
</a>
|
||||
|
||||
<!-- Header Navbar -->
|
||||
<!-- Header -->
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
<!-- Sidebar toggle button-->
|
||||
<a href="#" class="sidebar-toggle" data-navigation="leftSidebar" data-toggle="push-menu" role="button">
|
||||
<!-- Left Sidebar Toggle Button-->
|
||||
<a href="javascript:void(0)" class="sidebar-toggle" id="leftSidebar" data-toggle="push-menu" role="button">
|
||||
<i class="fas fa-bars"></i>
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</a>
|
||||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- Control Sidebar Toggle Button -->
|
||||
<li>
|
||||
<a href="#" data-toggle="control-sidebar"><i class="fas fa-cogs"></i></a>
|
||||
</li>
|
||||
<!-- Right Sidebar Toggle Button -->
|
||||
<li><a href="javascript:void(0)" data-toggle="control-sidebar"><i class="fas fa-cogs"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- Left side column. contains the logo and sidebar -->
|
||||
<!-- Left Sidebar -->
|
||||
<aside class="main-sidebar">
|
||||
<section class="sidebar">
|
||||
|
||||
<!-- Sidebar Menu -->
|
||||
<ul class="sidebar-menu" data-widget="tree">
|
||||
<li class="header">HOME</li>
|
||||
<li><a href="command.html"><i class="fas fa-laptop fa-fw"></i> <span>Command</span></a></li>
|
||||
@@ -60,7 +55,7 @@
|
||||
<span class="pull-right-container bot-status">
|
||||
<small class="label pull-right bg-gray" id="offlineBots">0</small>
|
||||
<small class="label pull-right bg-yellow" id="idleBots">0</small>
|
||||
<small class="label pull-right bg-green" id="activeBots">0</small>
|
||||
<small class="label pull-right bg-olive" id="activeBots">0</small>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -69,7 +64,7 @@
|
||||
|
||||
<li class="header">INFORMATION</li>
|
||||
<li class="info-overview">
|
||||
<a href="#">
|
||||
<a>
|
||||
<i class="fas fa-tachometer-alt fa-fw"></i> <span>RAM Usage</span>
|
||||
<span class="pull-right-container">
|
||||
<small class="label pull-right bg-blue" id="ramUsage">0.00 MB</small>
|
||||
@@ -77,7 +72,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="info-overview">
|
||||
<a href="#">
|
||||
<a>
|
||||
<i class="far fa-clock fa-fw"></i> <span>Uptime</span>
|
||||
<span class="pull-right-container">
|
||||
<small class="label pull-right bg-blue" id="uptime">0d 0h 0m</small>
|
||||
@@ -88,9 +83,8 @@
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<!-- Content Header -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Bots
|
||||
@@ -102,9 +96,9 @@
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<!-- Content Body -->
|
||||
<section class="content container-fluid">
|
||||
<div class="box">
|
||||
<div class="box collapsed-box" id="headerBox">
|
||||
<div class="box-header">
|
||||
<i class="fas fa-users"></i>
|
||||
|
||||
@@ -115,28 +109,33 @@
|
||||
Only show <span class="fas fa-caret-down"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><input type="checkbox" class="dropdown-checkbox" id="chkShowOnlineBots">Online bots</li>
|
||||
<li><input type="checkbox" class="dropdown-checkbox" id="chkShowOfflineBots">Offline bots</li>
|
||||
<li><button title="Toggle online bots" type="button" class="btn btn-box-tool text-olive" id="chkShowOnlineBots"><i id="iconShowOnlineBots" class="fas fa-toggle-on fa-2x"></i></button>Online bots</li>
|
||||
<li><button title="Toggle offline bots" type="button" class="btn btn-box-tool text-olive" id="chkShowOfflineBots"><i id="iconShowOfflineBots" class="fas fa-toggle-on fa-2x"></i></button>Offline bots</li>
|
||||
</ul>
|
||||
</div>
|
||||
<button title="Toggle multi select" type="button" class="btn btn-box-tool" id="chkMultiSelect" data-widget="collapse"><i id="iconMultiSelect" class="far fa-square"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnRefreshContent"><i class="fas fa-sync"></i></button>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fas fa-wrench"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><input type="checkbox" class="dropdown-checkbox" id="chkShowDeleteButton">Show delete button</li>
|
||||
<li><button title="Toggle delete button" type="button" class="btn btn-box-tool text-grey" id="chkShowDeleteButton"><i id="iconShowDeleteButton" class="fas fa-toggle-on fa-2x fa-rotate-180"></i></button>Show delete button</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<button title="Select all bots" type="button" class="btn btn-default" id="selectAllBots"><i class="fas fa-th"></i> Select all</button>
|
||||
<button title="Deselect all bots" type="button" class="btn btn-default" id="deselectAllBots"><i class="fas fa-th"></i> Deselect all</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="totalBotOverview"></div>
|
||||
<div class="row" id="botRow"></div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- Main Footer -->
|
||||
<!-- Footer -->
|
||||
<footer class="main-footer">
|
||||
<div class="pull-right" id="version"><b>Version</b> 0.0.0.0</div>
|
||||
<strong>
|
||||
@@ -146,11 +145,9 @@
|
||||
</strong>
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
<!-- Right Sidebar -->
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<!-- Tab content -->
|
||||
<div class="tab-pane" id="control-right-sidebar"></div>
|
||||
</div>
|
||||
</aside>
|
||||
@@ -162,66 +159,152 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.2/js/adminlte.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/humanize-duration/3.12.1/humanize-duration.min.js"></script>
|
||||
<script src="../js/app.js"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
var tmpShowOnlineBots = get('showOnlineBots');
|
||||
var tmpShowOfflineBots = get('showOfflineBots');
|
||||
var tmpShowDeleteButton = get('showDeleteButton');
|
||||
var tmpShowOnlineBots = get('showOnlineBots'),
|
||||
tmpShowOfflineBots = get('showOfflineBots'),
|
||||
tmpShowDeleteButton = get('showDeleteButton'),
|
||||
tmpMultiSelect = get('multiSelect'),
|
||||
currentlySelectedBots = [];
|
||||
|
||||
// Load state of checkboxes
|
||||
$('.box-tools').ready(function () {
|
||||
if (tmpShowOnlineBots === 'false') {
|
||||
$("#chkShowOnlineBots").prop('checked', false);
|
||||
} else {
|
||||
$("#chkShowOnlineBots").prop('checked', true);
|
||||
$('#chkShowOnlineBots').removeClass('text-olive');
|
||||
$('#chkShowOnlineBots').addClass('text-grey');
|
||||
$('#iconShowOnlineBots').addClass('fa-rotate-180');
|
||||
}
|
||||
|
||||
if (tmpShowOfflineBots === 'false') {
|
||||
$("#chkShowOfflineBots").prop('checked', false);
|
||||
} else {
|
||||
$("#chkShowOfflineBots").prop('checked', true);
|
||||
$('#chkShowOfflineBots').removeClass('text-olive');
|
||||
$('#chkShowOfflineBots').addClass('text-grey');
|
||||
$('#iconShowOfflineBots').addClass('fa-rotate-180');
|
||||
}
|
||||
|
||||
if (tmpShowDeleteButton === 'false') {
|
||||
$("#chkShowDeleteButton").prop('checked', false);
|
||||
} else {
|
||||
$("#chkShowDeleteButton").prop('checked', true);
|
||||
if (tmpShowDeleteButton === 'true') {
|
||||
$('#chkShowDeleteButton').removeClass('text-grey');
|
||||
$('#chkShowDeleteButton').addClass('text-olive');
|
||||
$('#iconShowDeleteButton').removeClass('fa-rotate-180');
|
||||
}
|
||||
|
||||
if (tmpShowOnlineBots !== 'false' || tmpShowOfflineBots !== 'false') {
|
||||
loadPageContent();
|
||||
if (tmpShowOnlineBots !== 'false' || tmpShowOfflineBots !== 'false') loadPageContent();
|
||||
|
||||
if (tmpMultiSelect === 'true') {
|
||||
$('#iconMultiSelect').removeClass('fa-square');
|
||||
$('#iconMultiSelect').addClass('fa-check-square');
|
||||
$('#headerBox').removeClass('collapsed-box');
|
||||
$('#headerBox').removeClass('expanded-box');
|
||||
$('#botRow').selectable({
|
||||
//stop: function () {
|
||||
// //$(".ui-selected", this).each(function () {
|
||||
// // var index = $("#selectable li").index(this);
|
||||
// // result.append(" #" + (index + 1));
|
||||
// //});
|
||||
//},
|
||||
//selecting: function (event, ui) {
|
||||
// //$(ui.selecting).addClass('box-solid');
|
||||
//},
|
||||
//unselecting: function (event, ui) {
|
||||
// //$(ui.unselecting).removeClass('box-solid');
|
||||
//},
|
||||
//selected: function (event, ui) {
|
||||
// //$(ui.selected).addClass('box-solid');
|
||||
//},
|
||||
//unselected: function (event, ui) {
|
||||
// //$(ui.unselected).removeClass('box-solid');
|
||||
//}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#chkShowOnlineBots').click(function () {
|
||||
store('showOnlineBots', this.checked);
|
||||
if ($('#iconShowOnlineBots').hasClass('fa-rotate-180')) {
|
||||
$('#iconShowOnlineBots').removeClass('fa-rotate-180');
|
||||
$('#chkShowOnlineBots').removeClass('text-grey');
|
||||
$('#chkShowOnlineBots').addClass('text-olive');
|
||||
store('showOnlineBots', true);
|
||||
} else {
|
||||
$('#iconShowOnlineBots').addClass('fa-rotate-180');
|
||||
$('#chkShowOnlineBots').removeClass('text-olive');
|
||||
$('#chkShowOnlineBots').addClass('text-grey');
|
||||
store('showOnlineBots', false);
|
||||
}
|
||||
loadPageContent();
|
||||
});
|
||||
|
||||
$('#chkShowOfflineBots').click(function () {
|
||||
store('showOfflineBots', this.checked);
|
||||
if ($('#iconShowOfflineBots').hasClass('fa-rotate-180')) {
|
||||
$('#iconShowOfflineBots').removeClass('fa-rotate-180');
|
||||
$('#chkShowOfflineBots').removeClass('text-grey');
|
||||
$('#chkShowOfflineBots').addClass('text-olive');
|
||||
store('showOfflineBots', true);
|
||||
} else {
|
||||
$('#iconShowOfflineBots').addClass('fa-rotate-180');
|
||||
$('#chkShowOfflineBots').removeClass('text-olive');
|
||||
$('#chkShowOfflineBots').addClass('text-grey');
|
||||
store('showOfflineBots', false);
|
||||
}
|
||||
loadPageContent();
|
||||
});
|
||||
|
||||
$('#chkMultiSelect').click(function () {
|
||||
if ($('#iconMultiSelect').hasClass('fa-square')) {
|
||||
$('#iconMultiSelect').removeClass('fa-square');
|
||||
$('#iconMultiSelect').addClass('fa-check-square');
|
||||
$('#botRow').selectable();
|
||||
store('multiSelect', true);
|
||||
} else {
|
||||
$('#iconMultiSelect').removeClass('fa-check-square');
|
||||
$('#iconMultiSelect').addClass('fa-square');
|
||||
$('#botRow').selectable('destroy');
|
||||
store('multiSelect', false);
|
||||
}
|
||||
$('#chkMultiSelect').blur();
|
||||
});
|
||||
|
||||
$('#selectAllBots').click(function () {
|
||||
$(".ui-widget-content").each(function () {
|
||||
$(this).addClass('ui-selected');
|
||||
});
|
||||
});
|
||||
|
||||
$('#deselectAllBots').click(function () {
|
||||
$(".ui-selectee").each(function () {
|
||||
$(this).removeClass('ui-selected');
|
||||
});
|
||||
});
|
||||
|
||||
$('#btnRefreshContent').click(function () {
|
||||
$('#btnRefreshContent').blur();
|
||||
loadPageContent();
|
||||
});
|
||||
|
||||
$('#chkShowDeleteButton').click(function () {
|
||||
store('showDeleteButton', this.checked);
|
||||
if ($('#iconShowDeleteButton').hasClass('fa-rotate-180')) {
|
||||
$('#iconShowDeleteButton').removeClass('fa-rotate-180');
|
||||
$('#chkShowDeleteButton').removeClass('text-grey');
|
||||
$('#chkShowDeleteButton').addClass('text-olive');
|
||||
store('showDeleteButton', true);
|
||||
} else {
|
||||
$('#iconShowDeleteButton').addClass('fa-rotate-180');
|
||||
$('#chkShowDeleteButton').removeClass('text-olive');
|
||||
$('#chkShowDeleteButton').addClass('text-grey');
|
||||
store('showDeleteButton', false);
|
||||
}
|
||||
loadPageContent();
|
||||
});
|
||||
|
||||
function loadPageContent() {
|
||||
var tmpShowOnlineBots = get('showOnlineBots');
|
||||
var tmpShowOfflineBots = get('showOfflineBots');
|
||||
var tmpShowDeleteButton = get('showDeleteButton');
|
||||
var tmpShowOnlineBots = get('showOnlineBots'),
|
||||
tmpShowOfflineBots = get('showOfflineBots'),
|
||||
tmpShowDeleteButton = get('showDeleteButton');
|
||||
|
||||
//clear page content first
|
||||
// Clear page content first
|
||||
$("#totalBotOverview").empty();
|
||||
$("#botRow").empty();
|
||||
|
||||
@@ -238,11 +321,8 @@
|
||||
totalCardsRemaining = 0,
|
||||
farmingIsActive = false;
|
||||
|
||||
if (tmpShowDeleteButton === 'true') {
|
||||
deleteBotHTML = '<button title="Delete this bot" type="button" class="btn btn-box-tool" data-command="deleteBot"><i class="far fa-trash-alt"></i></button>';
|
||||
}
|
||||
if (tmpShowDeleteButton === 'true') deleteBotHTML = '<button title="Delete this bot" type="button" class="btn btn-box-tool" data-command="deleteBot"><i class="far fa-trash-alt"></i></button>';
|
||||
|
||||
// Create one box for each bot
|
||||
for (var i = 0; i < json.length; i++) {
|
||||
var obj = json[i],
|
||||
BotName = obj.BotName,
|
||||
@@ -263,30 +343,24 @@
|
||||
var folder = AvatarHash.substring(0, 2);
|
||||
avatarHTML = steamAvatarBaseURL + folder + "/" + AvatarHash + ".jpg";
|
||||
} else {
|
||||
// Use steam default pic
|
||||
avatarHTML = steamAvatarBaseURL + "fe/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb.jpg";
|
||||
}
|
||||
|
||||
if (KeepRunning === false) {
|
||||
// Bot is offline
|
||||
if (tmpShowOfflineBots === 'false') { continue; }
|
||||
if (KeepRunning === false) { // Bot is offline
|
||||
if (tmpShowOfflineBots === 'false') continue;
|
||||
boxColorHTML = "box-gray";
|
||||
startOrStopHTML = '<button title="Start <' + BotName + '>" type="button" class="btn btn-box-tool bot-stopped" data-command="startBot"><i class="fas fa-power-off"></i></button>';
|
||||
} else {
|
||||
// Bot is idling
|
||||
if (tmpShowOnlineBots === 'false') { continue; }
|
||||
} else { // Bot is idling
|
||||
if (tmpShowOnlineBots === 'false') continue;
|
||||
boxColorHTML = "box-warning";
|
||||
startOrStopHTML = '<button title="Stop <' + BotName + '>" type="button" class="btn btn-box-tool bot-started" data-command="stopBot"><i class="fas fa-power-off"></i></button>';
|
||||
|
||||
var TimeRemaining = obj.CardsFarmer.TimeRemaining;
|
||||
|
||||
if (SteamID === 0) {
|
||||
// Bot is not connected to steam
|
||||
if (SteamID === 0) { // Bot is not connected to steam
|
||||
boxColorHTML = "box-danger";
|
||||
} else {
|
||||
// Bot is connected to steam
|
||||
if (TimeRemaining !== "00:00:00") {
|
||||
// Bot is farming
|
||||
} else { // Bot is connected to steam
|
||||
if (TimeRemaining !== "00:00:00") { // Bot is farming
|
||||
var GamesToFarm = obj.CardsFarmer.GamesToFarm,
|
||||
CurrentGamesFarming = obj.CardsFarmer.CurrentGamesFarming,
|
||||
allGamesRemainingName = [],
|
||||
@@ -306,9 +380,7 @@
|
||||
allGamesFarmingAppID.push(CurrentGamesFarming[k].AppID);
|
||||
}
|
||||
|
||||
if (totalTimeRemaining < TimeRemaining) {
|
||||
totalTimeRemaining = TimeRemaining;
|
||||
}
|
||||
if (totalTimeRemaining < TimeRemaining) totalTimeRemaining = TimeRemaining;
|
||||
|
||||
totalGamesRemaining += GamesToFarm.length;
|
||||
|
||||
@@ -321,9 +393,7 @@
|
||||
if (allGamesFarmingAppID.length === 1) {
|
||||
var value = allGamesFarmingAppID;
|
||||
allGamesHTML = '<img src="' + steamGameBaseURL + value[0] + '/header.jpg" alt="" class="img-responsive">'; // fill alt="" with gameName
|
||||
|
||||
} else {
|
||||
// Multiple game farming
|
||||
} else { // Multiple game farming
|
||||
allGamesHTML = '<div class="games-carousel-' + BotName + '">';
|
||||
|
||||
for (var appID in allGamesFarmingAppID) {
|
||||
@@ -363,7 +433,7 @@
|
||||
|
||||
$("#botRow").append('<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">'
|
||||
+ '<div class="box ' + boxColorHTML + ' collapsed-box" id="bot-box-' + BotName + '">'
|
||||
+ '<div class="box-header with-border botHeader">'
|
||||
+ '<div class="box-header with-border botHeader ui-widget-content">'
|
||||
+ '<img src="' + avatarHTML + '">'
|
||||
+ '<h3 class="box-title botTitle">' + BotName + '</h3>'
|
||||
+ '<div class="box-tools pull-right botTools" id="' + BotName + '">'
|
||||
@@ -383,7 +453,6 @@
|
||||
collapseIcon: 'fa-minus',
|
||||
expandIcon: 'fa-plus',
|
||||
})
|
||||
// This will be triggered if a user expands the BOT menu.
|
||||
.on('expanded.boxwidget', function (BotName) {
|
||||
var botCarousel = $('.games-carousel-' + BotName);
|
||||
|
||||
@@ -398,87 +467,88 @@
|
||||
draggable: true,
|
||||
autoplay: true,
|
||||
autoplaySpeed: 2000,
|
||||
arrows: false, //move arrows inside of .game-box
|
||||
arrows: false,
|
||||
infinite: true
|
||||
});
|
||||
}
|
||||
}.bind(null, BotName))
|
||||
// This will be triggered if a user collapses the BOT menu.
|
||||
.on('collapsed.boxwidget', function (BotName) {
|
||||
// Just pause Slick's animation and collapse the menu.
|
||||
$('.games-carousel-' + BotName).slick('slickPause');
|
||||
}.bind(null, BotName)
|
||||
);
|
||||
);
|
||||
|
||||
$('#bot-box-' + BotName + ' .btn').click(function () {
|
||||
var BotName = $(this).parent().attr('id');
|
||||
var cmd = $(this).data('command');
|
||||
var BotName = $(this).parent().attr('id'),
|
||||
cmd = $(this).data('command'),
|
||||
$botBox = $('#bot-box-' + BotName);
|
||||
|
||||
switch (cmd) {
|
||||
case 'startBot':
|
||||
$botBox.append('<div class="overlay bot-box-loading"><i class="fas fa-sync fa-spin"></i></div>');
|
||||
$.ajax({
|
||||
url: "/Api/Command/start " + encodeURIComponent(BotName),
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
$('.overlay').remove();
|
||||
swal({
|
||||
title: "Success!",
|
||||
text: "<" + BotName + "> has been started.",
|
||||
type: "success"
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
}, function () { location.reload(); });
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'stopBot':
|
||||
$botBox.append('<div class="overlay bot-box-loading"><i class="fas fa-sync fa-spin"></i></div>');
|
||||
$.ajax({
|
||||
url: "/Api/Command/stop " + encodeURIComponent(BotName),
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
$('.overlay').remove();
|
||||
swal({
|
||||
title: "Success!",
|
||||
text: "<" + BotName + "> has been stopped.",
|
||||
type: "success"
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
}, function () { location.reload(); });
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case 'pauseBot':
|
||||
$botBox.append('<div class="overlay bot-box-loading"><i class="fas fa-sync fa-spin"></i></div>');
|
||||
$.ajax({
|
||||
url: "/Api/Command/pause " + encodeURIComponent(BotName),
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
$('.overlay').remove();
|
||||
swal({
|
||||
title: "Success!",
|
||||
text: "<" + BotName + "> has been paused.",
|
||||
type: "success"
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
}, function () { location.reload(); });
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case 'resumeBot':
|
||||
$botBox.append('<div class="overlay bot-box-loading"><i class="fas fa-sync fa-spin"></i></div>');
|
||||
$.ajax({
|
||||
url: "/Api/Command/resume " + encodeURIComponent(BotName),
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
$('.overlay').remove();
|
||||
swal({
|
||||
title: "Success!",
|
||||
text: "<" + BotName + "> has been resumed.",
|
||||
type: "success"
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
}, function () { location.reload(); });
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case 'deleteBot':
|
||||
$botBox.append('<div class="overlay bot-box-loading"><i class="fas fa-sync fa-spin"></i></div>');
|
||||
swal({
|
||||
title: "Are you sure?",
|
||||
text: "You will not be able to recover any bot files!",
|
||||
@@ -488,20 +558,23 @@
|
||||
confirmButtonText: "Yes, delete bot!",
|
||||
closeOnConfirm: false,
|
||||
showLoaderOnConfirm: true
|
||||
}, function () {
|
||||
$.ajax({
|
||||
url: "/Api/Bot/" + encodeURIComponent(BotName),
|
||||
type: "DELETE",
|
||||
success: function (data) {
|
||||
swal({
|
||||
title: "Success!",
|
||||
text: "<" + BotName + "> and all related files have been deleted.",
|
||||
type: "success"
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
$.ajax({
|
||||
url: "/Api/Bot/" + encodeURIComponent(BotName),
|
||||
type: "DELETE",
|
||||
success: function (data) {
|
||||
$('.overlay').remove();
|
||||
swal({
|
||||
title: "Success!",
|
||||
text: "<" + BotName + "> and all related files have been deleted.",
|
||||
type: "success"
|
||||
}, function () { location.reload(); });
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('.overlay').remove();
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -8,48 +8,43 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.2/css/AdminLTE.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.2/css/skins/_all-skins.min.css">
|
||||
<link rel="stylesheet" href="../css/_all-skins.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
|
||||
<!--Change font-awesome to cdnjs once available-->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<link rel="stylesheet" href="../css/_nightmode.min.css">
|
||||
<link rel="icon" href="../favicon.png" type="image/png">
|
||||
<link rel="shortcut icon" href="../favicon.ico" type="img/x-icon">
|
||||
</head>
|
||||
<body class="hold-transition skin-blue sidebar-mini fixed">
|
||||
<div class="wrapper">
|
||||
<!-- Main Header -->
|
||||
<header class="main-header">
|
||||
<!-- Logo -->
|
||||
<a href="#" class="logo">
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<a href="javascript:void(0)" class="logo">
|
||||
<span class="logo-mini"><b>A</b>SF</span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
<span class="logo-lg"><b>Archi</b>SteamFarm</span>
|
||||
</a>
|
||||
|
||||
<!-- Header Navbar -->
|
||||
<!-- Header -->
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
<!-- Sidebar toggle button-->
|
||||
<a href="#" class="sidebar-toggle" data-navigation="leftSidebar" data-toggle="push-menu" role="button">
|
||||
<!-- Left Sidebar Toggle Button-->
|
||||
<a href="javascript:void(0)" class="sidebar-toggle" id="leftSidebar" data-toggle="push-menu" role="button">
|
||||
<i class="fas fa-bars"></i>
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</a>
|
||||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- Control Sidebar Toggle Button -->
|
||||
<li>
|
||||
<a href="#" data-toggle="control-sidebar"><i class="fas fa-cogs"></i></a>
|
||||
</li>
|
||||
<!-- Right Sidebar Toggle Button -->
|
||||
<li><a href="javascript:void(0)" data-toggle="control-sidebar"><i class="fas fa-cogs"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- Left side column. contains the logo and sidebar -->
|
||||
|
||||
<!-- Left Sidebar -->
|
||||
<aside class="main-sidebar">
|
||||
<section class="sidebar">
|
||||
|
||||
<!-- Sidebar Menu -->
|
||||
<ul class="sidebar-menu" data-widget="tree">
|
||||
<li class="header">HOME</li>
|
||||
<li class="active"><a href="command.html"><i class="fas fa-laptop fa-fw"></i> <span>Command</span></a></li>
|
||||
@@ -59,7 +54,7 @@
|
||||
<span class="pull-right-container bot-status">
|
||||
<small class="label pull-right bg-gray" id="offlineBots">0</small>
|
||||
<small class="label pull-right bg-yellow" id="idleBots">0</small>
|
||||
<small class="label pull-right bg-green" id="activeBots">0</small>
|
||||
<small class="label pull-right bg-olive" id="activeBots">0</small>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -68,7 +63,7 @@
|
||||
|
||||
<li class="header">INFORMATION</li>
|
||||
<li class="info-overview">
|
||||
<a href="#">
|
||||
<a>
|
||||
<i class="fas fa-tachometer-alt fa-fw"></i> <span>RAM Usage</span>
|
||||
<span class="pull-right-container">
|
||||
<small class="label pull-right bg-blue" id="ramUsage">0.00 MB</small>
|
||||
@@ -76,7 +71,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="info-overview">
|
||||
<a href="#">
|
||||
<a>
|
||||
<i class="far fa-clock fa-fw"></i> <span>Uptime</span>
|
||||
<span class="pull-right-container">
|
||||
<small class="label pull-right bg-blue" id="uptime">0d 0h 0m</small>
|
||||
@@ -87,9 +82,8 @@
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<!-- Content Header -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Command
|
||||
@@ -101,7 +95,7 @@
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<!-- Content Body -->
|
||||
<section class="content container-fluid">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
@@ -114,28 +108,28 @@
|
||||
<i class="fas fa-wrench"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><input type="checkbox" class="dropdown-checkbox" id="autoClear">Auto clear</li>
|
||||
<li><button title="Toggle auto clear" type="button" class="btn btn-box-tool text-olive" id="chkAutoClear"><i id="iconAutoClear" class="fas fa-toggle-on fa-2x"></i></button>Auto clear</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="box-content-command resize" id="commandReply"></div>
|
||||
<div class="box-content-command"></div>
|
||||
<input type="text" class="form-control" id="commandSent" disabled>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<div class="input-group">
|
||||
<div class="input-group-btn hidden-xs">
|
||||
<div class="input-group-btn hidden-xs" id="cmdsDropDownBox">
|
||||
<button title="Show all commands" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
Commands
|
||||
<span class="fas fa-caret-down"></span>
|
||||
<span class="fas fa-caret-down" id="iconCmdsDropDownBox"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu scrollable-menu" id="commandsDropDown"></ul>
|
||||
</div>
|
||||
<div class="input-group-btn hidden-xs">
|
||||
<div class="input-group-btn hidden-xs" id="botsDropDownBox">
|
||||
<button title="Show all bots" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
Bots
|
||||
<span class="fas fa-caret-down"></span>
|
||||
<span class="fas fa-caret-down" id="iconBotsDropDownBox"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu scrollable-menu" id="botsDropDown"></ul>
|
||||
</div>
|
||||
@@ -149,7 +143,7 @@
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- Main Footer -->
|
||||
<!-- Footer -->
|
||||
<footer class="main-footer">
|
||||
<div class="pull-right" id="version"><b>Version</b> 0.0.0.0</div>
|
||||
<strong>
|
||||
@@ -159,11 +153,9 @@
|
||||
</strong>
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
<!-- Right Sidebar -->
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<!-- Tab content -->
|
||||
<div class="tab-pane" id="control-right-sidebar"></div>
|
||||
</div>
|
||||
</aside>
|
||||
@@ -180,31 +172,46 @@
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
$("#commandInput").focus();
|
||||
var $chkAutoClear = $('#chkAutoClear'),
|
||||
$iconAutoClear = $('#iconAutoClear'),
|
||||
$commandInput = $('#commandInput'),
|
||||
$cmdsDropDownBox = $('#cmdsDropDownBox'),
|
||||
$botsDropDownBox = $('#botsDropDownBox'),
|
||||
$iconCmdsDropDownBox = $('#iconCmdsDropDownBox'),
|
||||
$iconBotsDropDownBox = $('#iconBotsDropDownBox'),
|
||||
$botsDropDown = $("#botsDropDown"),
|
||||
$commandsDropDown = $("#commandsDropDown");
|
||||
|
||||
var myCommands = { // For the future: Make this dynamic
|
||||
'addlicense': 'Activates given appIDs (Steam Network) or subIDs (Steam Store) on given bot instances (free games only).',
|
||||
'redeem': 'Redeems given cd-keys on given bot instances.',
|
||||
'2faok': 'Accepts all pending 2FA confirmations for given bot instances.',
|
||||
'2fa': 'Generates temporary 2FA token for given bot instances.',
|
||||
'loot': 'Sends all MatchableTypes items of given bot instances to Master user defined in their SteamUserPermissions (with lowest steamID if more than one).',
|
||||
'play': 'Switches to manual farming - launches given AppIDs on given bot instances, optionally also with custom GameName. Use !resume for returning to automatic farming.',
|
||||
'start': 'Starts given bot instances.',
|
||||
'stop': 'Stops given bot instances.',
|
||||
'pause': 'Permanently pauses automatic cards farming module of given bot instances. ASF will not attempt to farm current account in this session, unless you manually !resume it, or restart the process. Also called sticky pause.',
|
||||
'resume': 'Resumes automatic farming of given bot instances. Also see !pause, !play.',
|
||||
'restart': 'Restarts ASF process.'
|
||||
};
|
||||
|
||||
var myCommands = [
|
||||
'redeem',
|
||||
'loot',
|
||||
'play',
|
||||
'start',
|
||||
'stop',
|
||||
'pause',
|
||||
'resume'
|
||||
]
|
||||
var keyCount = 0,
|
||||
prevCommand = (JSON.parse(get('prevCommand')) === null) ? [] : JSON.parse(get('prevCommand'));
|
||||
|
||||
var keyCount = 0;
|
||||
var prevCommand = (JSON.parse(get('prevCommand')) === null) ? [] : JSON.parse(get('prevCommand'));
|
||||
$commandInput.focus();
|
||||
|
||||
$("#sendCommand").click(function (e) {
|
||||
var cmd = $('#commandInput').val();
|
||||
var cmd = $commandInput.val();
|
||||
keyCount = 0;
|
||||
|
||||
if (typeof prevCommand[prevCommand.length - 1] === "undefined") {
|
||||
prevCommand.push(cmd);
|
||||
} else if (prevCommand[prevCommand.length - 1] !== cmd) {
|
||||
prevCommand.push(cmd);
|
||||
}
|
||||
|
||||
store('prevCommand', JSON.stringify(prevCommand.slice(-20)));
|
||||
store('prevCommand', JSON.stringify(prevCommand.slice(-20))); // Only save the last 20 commands
|
||||
prevCommand = (JSON.parse(get('prevCommand')) === null) ? [] : JSON.parse(get('prevCommand'));
|
||||
|
||||
sendCommand();
|
||||
@@ -212,56 +219,76 @@
|
||||
});
|
||||
|
||||
$(document).keydown(function (e) {
|
||||
if (e.which == 38 && $("#commandInput").is(":focus")) {
|
||||
if (prevCommand.length > keyCount) {
|
||||
keyCount++;
|
||||
}
|
||||
|
||||
if (e.which == 38 && $commandInput.is(":focus")) {
|
||||
if (prevCommand.length > keyCount) keyCount++;
|
||||
var index = prevCommand.length - keyCount;
|
||||
$('#commandInput').val(prevCommand[index]);
|
||||
} else if (e.which == 40 && $("#commandInput").is(":focus")) {
|
||||
if (keyCount > 0) {
|
||||
keyCount--;
|
||||
}
|
||||
|
||||
$commandInput.val(prevCommand[index]);
|
||||
} else if (e.which == 40 && $commandInput.is(":focus")) {
|
||||
if (keyCount > 0) keyCount--;
|
||||
var index = prevCommand.length - keyCount;
|
||||
$('#commandInput').val(prevCommand[index]);
|
||||
$commandInput.val(prevCommand[index]);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).keypress(function (e) {
|
||||
if (e.which == 13 && cmdInput.value !== "") {
|
||||
$("#sendCommand").click();
|
||||
}
|
||||
if (e.which == 13 && $cmdInput.val() !== "") $("#sendCommand").click();
|
||||
});
|
||||
|
||||
// Load state of checkbox
|
||||
|
||||
$('.box-tools').ready(function () {
|
||||
var tmpAutoClear = get('autoClear');
|
||||
|
||||
if (tmpAutoClear === 'false') {
|
||||
$("#autoClear").prop('checked', false);
|
||||
} else {
|
||||
$("#autoClear").prop('checked', true);
|
||||
$chkAutoClear.removeClass('text-olive');
|
||||
$chkAutoClear.addClass('text-grey');
|
||||
$iconAutoClear.addClass('fa-rotate-180');
|
||||
}
|
||||
});
|
||||
|
||||
$('#autoClear').click(function () {
|
||||
store('autoClear', this.checked);
|
||||
$chkAutoClear.click(function () {
|
||||
if ($iconAutoClear.hasClass('fa-rotate-180')) {
|
||||
$iconAutoClear.removeClass('fa-rotate-180');
|
||||
$chkAutoClear.removeClass('text-grey');
|
||||
$chkAutoClear.addClass('text-olive');
|
||||
$chkAutoClear.blur();
|
||||
store('autoClear', true);
|
||||
} else {
|
||||
$iconAutoClear.addClass('fa-rotate-180');
|
||||
$chkAutoClear.removeClass('text-olive');
|
||||
$chkAutoClear.addClass('text-grey');
|
||||
$chkAutoClear.blur();
|
||||
store('autoClear', false);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Load height of commandReply
|
||||
|
||||
$('.box-content-command').ready(function () {
|
||||
var tmpHeight = get('commandHeight');
|
||||
|
||||
if (isNaN(tmpHeight)) {
|
||||
$('#commandReply').css('height', 400 + 'px');
|
||||
$('.box-content-command').css('height', 400 + 'px');
|
||||
} else {
|
||||
$('#commandReply').css('height', tmpHeight + 'px');
|
||||
$('.box-content-command').css('height', tmpHeight + 'px');
|
||||
|
||||
if (tmpHeight > 475) {
|
||||
$cmdsDropDownBox.addClass('dropup');
|
||||
$botsDropDownBox.addClass('dropup');
|
||||
$iconCmdsDropDownBox.removeClass('fa-caret-down');
|
||||
$iconCmdsDropDownBox.addClass('fa-caret-up');
|
||||
$iconBotsDropDownBox.removeClass('fa-caret-down');
|
||||
$iconBotsDropDownBox.addClass('fa-caret-up');
|
||||
|
||||
} else {
|
||||
$cmdsDropDownBox.removeClass('dropup');
|
||||
$botsDropDownBox.removeClass('dropup');
|
||||
$iconCmdsDropDownBox.removeClass('fa-caret-up');
|
||||
$iconCmdsDropDownBox.addClass('fa-caret-down');
|
||||
$iconBotsDropDownBox.removeClass('fa-caret-up');
|
||||
$iconBotsDropDownBox.addClass('fa-caret-down');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
interact('.resize')
|
||||
interact('.box-content-command')
|
||||
.resizable({
|
||||
edges: { left: false, right: false, bottom: true, top: false },
|
||||
restrictEdges: {
|
||||
@@ -277,47 +304,56 @@
|
||||
.on('resizeend', function (event) {
|
||||
var currentHeight = parseInt(event.target.style.height, 10);
|
||||
store('commandHeight', currentHeight);
|
||||
|
||||
if (currentHeight > 475) {
|
||||
$cmdsDropDownBox.addClass('dropup');
|
||||
$botsDropDownBox.addClass('dropup');
|
||||
$iconCmdsDropDownBox.removeClass('fa-caret-down');
|
||||
$iconCmdsDropDownBox.addClass('fa-caret-up');
|
||||
$iconBotsDropDownBox.removeClass('fa-caret-down');
|
||||
$iconBotsDropDownBox.addClass('fa-caret-up');
|
||||
|
||||
} else {
|
||||
$cmdsDropDownBox.removeClass('dropup');
|
||||
$botsDropDownBox.removeClass('dropup');
|
||||
$iconCmdsDropDownBox.removeClass('fa-caret-up');
|
||||
$iconCmdsDropDownBox.addClass('fa-caret-down');
|
||||
$iconBotsDropDownBox.removeClass('fa-caret-up');
|
||||
$iconBotsDropDownBox.addClass('fa-caret-down');
|
||||
}
|
||||
});
|
||||
|
||||
$('.box-footer').ready(function () {
|
||||
// Fill drop down with all bots + ASF
|
||||
$.ajax({
|
||||
$.ajax({ // Fill drop down with all bots + ASF
|
||||
url: "/Api/Bot/ASF",
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
var json = data["Result"];
|
||||
|
||||
$("#botsDropDown").append('<li><a href="#" onclick="fillBots(\'ASF\')">ASF</a></li><li class="divider"></li>');
|
||||
$botsDropDown.append('<li><a href="javascript:void(0)" onclick="fillBots(\'ASF\')">ASF</a></li><li class="divider"></li>');
|
||||
|
||||
for (var i = 0; i < json.length; i++) {
|
||||
var obj = json[i];
|
||||
var botName = obj.BotName;
|
||||
var obj = json[i],
|
||||
botName = obj.BotName;
|
||||
|
||||
$("#botsDropDown").append('<li><a href="#" onclick="fillBots(\'' + botName + '\')">' + botName + '</a></li>');
|
||||
$botsDropDown.append('<li><a href="javascript:void(0)" onclick="fillBots(\'' + botName + '\')">' + botName + '</a></li>');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Fill drop down with all commands
|
||||
myCommands.forEach(function (command) {
|
||||
$("#commandsDropDown").append('<li><a href="#" id="' + command + '" onclick="fillCommand(\'' + command + '\')">' + command + '</a></li>');
|
||||
//$('#' + command + '')
|
||||
// .mouseenter(function () {
|
||||
// $('#commandInput').val('show description for command: ' + command);
|
||||
// })
|
||||
// .mouseleave(function () {
|
||||
// $('#commandInput').val('');
|
||||
// });
|
||||
});
|
||||
|
||||
$("#commandsDropDown").append('<li class="divider"></li><li><a href="#" id="restart" onclick="fillCommand(\'restart\')">restart</a></li>');
|
||||
//$('#restart')
|
||||
// .mouseenter(function () {
|
||||
// $('#commandInput').val('show description for command: restart');
|
||||
// })
|
||||
// .mouseleave(function () {
|
||||
// $('#commandInput').val('');
|
||||
// });
|
||||
|
||||
for (var cmd in myCommands) { // Fill drop down with all commands
|
||||
if (myCommands.hasOwnProperty(cmd)) {
|
||||
$commandsDropDown.append('<li><a href="javascript:void(0)" id="' + cmd + '" onclick="fillCommand(\'' + cmd + '\')">' + cmd + '</a></li>');
|
||||
|
||||
$('#' + cmd)
|
||||
.mouseenter(function () {
|
||||
$commandInput.attr('placeholder', myCommands[this.id]); // Find a better solution for where to display description.
|
||||
})
|
||||
.mouseleave(function () {
|
||||
$commandInput.attr('placeholder', 'Type command...');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -8,48 +8,43 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.2/css/AdminLTE.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.2/css/skins/_all-skins.min.css">
|
||||
<link rel="stylesheet" href="../css/_all-skins.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
|
||||
<!--Change font-awesome to cdnjs once available-->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<link rel="stylesheet" href="../css/_nightmode.min.css">
|
||||
<link rel="icon" href="../favicon.png" type="image/png">
|
||||
<link rel="shortcut icon" href="../favicon.ico" type="img/x-icon">
|
||||
</head>
|
||||
<body class="hold-transition skin-blue sidebar-mini fixed">
|
||||
<div class="wrapper">
|
||||
<!-- Main Header -->
|
||||
<header class="main-header">
|
||||
<!-- Logo -->
|
||||
<a href="#" class="logo">
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<a href="javascript:void(0)" class="logo">
|
||||
<span class="logo-mini"><b>A</b>SF</span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
<span class="logo-lg"><b>Archi</b>SteamFarm</span>
|
||||
</a>
|
||||
|
||||
<!-- Header Navbar -->
|
||||
<!-- Header -->
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
<!-- Sidebar toggle button-->
|
||||
<a href="#" class="sidebar-toggle" data-navigation="leftSidebar" data-toggle="push-menu" role="button">
|
||||
<!-- Left Sidebar Toggle Button-->
|
||||
<a href="javascript:void(0)" class="sidebar-toggle" id="leftSidebar" data-toggle="push-menu" role="button">
|
||||
<i class="fas fa-bars"></i>
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</a>
|
||||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- Control Sidebar Toggle Button -->
|
||||
<li>
|
||||
<a href="#" data-toggle="control-sidebar"><i class="fas fa-cogs"></i></a>
|
||||
</li>
|
||||
<!-- Right Sidebar Toggle Button -->
|
||||
<li><a href="javascript:void(0)" data-toggle="control-sidebar"><i class="fas fa-cogs"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- Left side column. contains the logo and sidebar -->
|
||||
|
||||
<!-- Left Sidebar -->
|
||||
<aside class="main-sidebar">
|
||||
<section class="sidebar">
|
||||
|
||||
<!-- Sidebar Menu -->
|
||||
<ul class="sidebar-menu" data-widget="tree">
|
||||
<li class="header">HOME</li>
|
||||
<li><a href="command.html"><i class="fas fa-laptop fa-fw"></i> <span>Command</span></a></li>
|
||||
@@ -59,7 +54,7 @@
|
||||
<span class="pull-right-container bot-status">
|
||||
<small class="label pull-right bg-gray" id="offlineBots">0</small>
|
||||
<small class="label pull-right bg-yellow" id="idleBots">0</small>
|
||||
<small class="label pull-right bg-green" id="activeBots">0</small>
|
||||
<small class="label pull-right bg-olive" id="activeBots">0</small>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -68,7 +63,7 @@
|
||||
|
||||
<li class="header">INFORMATION</li>
|
||||
<li class="info-overview">
|
||||
<a href="#">
|
||||
<a>
|
||||
<i class="fas fa-tachometer-alt fa-fw"></i> <span>RAM Usage</span>
|
||||
<span class="pull-right-container">
|
||||
<small class="label pull-right bg-blue" id="ramUsage">0.00 MB</small>
|
||||
@@ -76,7 +71,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="info-overview">
|
||||
<a href="#">
|
||||
<a>
|
||||
<i class="far fa-clock fa-fw"></i> <span>Uptime</span>
|
||||
<span class="pull-right-container">
|
||||
<small class="label pull-right bg-blue" id="uptime">0d 0h 0m</small>
|
||||
@@ -87,9 +82,8 @@
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<!-- Content Header -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Config
|
||||
@@ -101,12 +95,12 @@
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<!-- Content Body -->
|
||||
<section class="content container-fluid">
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#configChangerTab" data-toggle="tab" aria-expanded="true"><i class="far fa-file-alt"></i> Changer</a></li>
|
||||
<li class="pull-right"><a href="#configGeneratorTab" data-toggle="tab" aria-expanded="false"><i class="far fa-copy"></i> Generator</a></li>
|
||||
<li class="active"><a href="#configChangerTab" data-toggle="tab" aria-expanded="true" id="changerTabButton"><i class="far fa-edit"></i> Changer</a></li>
|
||||
<li class="pull-right"><a href="#configGeneratorTab" data-toggle="tab" aria-expanded="false" id="generatorTabButton"><i class="far fa-copy"></i> Generator</a></li>
|
||||
</ul>
|
||||
<div class="tab-content no-padding">
|
||||
<div class="tab-pane active" id="configChangerTab"></div>
|
||||
@@ -119,14 +113,14 @@
|
||||
</div>
|
||||
|
||||
<div class="box-footer">
|
||||
<!--change to btn-success once something has been edited-->
|
||||
<button type="submit" class="btn btn-default pull-right" id="saveConfig">Save</button>
|
||||
<button type="submit" class="btn btn-default pull-right" id="saveButton"><i class="far fa-save"></i> Save</button>
|
||||
<button type="submit" class="btn btn-default pull-right" id="downloadButton" disabled><i class="fas fa-cloud-download-alt"></i> Download</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- Main Footer -->
|
||||
<!-- Footer -->
|
||||
<footer class="main-footer">
|
||||
<div class="pull-right" id="version"><b>Version</b> 0.0.0.0</div>
|
||||
<strong>
|
||||
@@ -136,11 +130,9 @@
|
||||
</strong>
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
<!-- Right Sidebar -->
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<!-- Tab content -->
|
||||
<div class="tab-pane" id="control-right-sidebar"></div>
|
||||
</div>
|
||||
</aside>
|
||||
@@ -157,6 +149,7 @@
|
||||
'use strict';
|
||||
|
||||
$('#configChangerTab').ready(function () {
|
||||
$('#downloadButton').hide();
|
||||
generateConfigChangerHTML();
|
||||
|
||||
$.ajax({
|
||||
@@ -164,40 +157,24 @@
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
var json = data["Result"];
|
||||
|
||||
loadConfigValuesForBot(json[0].BotName);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var objBotConfig = {}
|
||||
$('#generatorTabButton').click(function (e) {
|
||||
$('#downloadButton').show();
|
||||
$('#saveButton').hide();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
var botConfig = JSON.stringify(objBotConfig);
|
||||
|
||||
function saveConfig(botName, config) {
|
||||
$.ajax({
|
||||
url: "/Api/Bot/" + encodeURIComponent(botName),
|
||||
type: "POST",
|
||||
data: botConfig,
|
||||
contentType: "application/json",
|
||||
success: function (data) {
|
||||
swal({
|
||||
title: "Success!",
|
||||
text: "<" + botName + "> and its config file got updated.",
|
||||
type: "success"
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(jqXHR.status + ' - ' + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#saveConfig").click(function (e) {
|
||||
var botName = $("#saveConfig").data("BotName");
|
||||
$('#changerTabButton').click(function (e) {
|
||||
$('#downloadButton').hide();
|
||||
$('#saveButton').show();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$("#saveButton").click(function (e) {
|
||||
swal({
|
||||
title: "Are you sure?",
|
||||
text: "The config will be updated and the bot will be restarted!",
|
||||
@@ -207,9 +184,7 @@
|
||||
confirmButtonText: "Yes, update config!",
|
||||
closeOnConfirm: false,
|
||||
showLoaderOnConfirm: true
|
||||
}, function () {
|
||||
saveConfig(botName, botConfig);
|
||||
});
|
||||
}, function () { prepareBotConfigForSaving(); });
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
@@ -8,48 +8,43 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.2/css/AdminLTE.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.2/css/skins/_all-skins.min.css">
|
||||
<link rel="stylesheet" href="../css/_all-skins.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
|
||||
<!--Change font-awesome to cdnjs once available-->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
|
||||
<link rel="stylesheet" href="../css/app.css">
|
||||
<link rel="stylesheet" href="../css/_nightmode.min.css">
|
||||
<link rel="icon" href="../favicon.png" type="image/png">
|
||||
<link rel="shortcut icon" href="../favicon.ico" type="img/x-icon">
|
||||
</head>
|
||||
<body class="hold-transition skin-blue sidebar-mini fixed">
|
||||
<div class="wrapper">
|
||||
<!-- Main Header -->
|
||||
<header class="main-header">
|
||||
<!-- Logo -->
|
||||
<a href="#" class="logo">
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<a href="javascript:void(0)" class="logo">
|
||||
<span class="logo-mini"><b>A</b>SF</span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
<span class="logo-lg"><b>Archi</b>SteamFarm</span>
|
||||
</a>
|
||||
|
||||
<!-- Header Navbar -->
|
||||
<!-- Header -->
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
<!-- Sidebar toggle button-->
|
||||
<a href="#" class="sidebar-toggle" data-navigation="leftSidebar" data-toggle="push-menu" role="button">
|
||||
<!-- Left Sidebar Toggle Button-->
|
||||
<a href="javascript:void(0)" class="sidebar-toggle" id="leftSidebar" data-toggle="push-menu" role="button">
|
||||
<i class="fas fa-bars"></i>
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</a>
|
||||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- Control Sidebar Toggle Button -->
|
||||
<li>
|
||||
<a href="#" data-toggle="control-sidebar"><i class="fas fa-cogs"></i></a>
|
||||
</li>
|
||||
<!-- Right Sidebar Toggle Button -->
|
||||
<li><a href="javascript:void(0)" data-toggle="control-sidebar"><i class="fas fa-cogs"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- Left side column. contains the logo and sidebar -->
|
||||
|
||||
<!-- Left Sidebar -->
|
||||
<aside class="main-sidebar">
|
||||
<section class="sidebar">
|
||||
|
||||
<!-- Sidebar Menu -->
|
||||
<ul class="sidebar-menu" data-widget="tree">
|
||||
<li class="header">HOME</li>
|
||||
<li><a href="command.html"><i class="fas fa-laptop fa-fw"></i> <span>Command</span></a></li>
|
||||
@@ -59,7 +54,7 @@
|
||||
<span class="pull-right-container bot-status">
|
||||
<small class="label pull-right bg-gray" id="offlineBots">0</small>
|
||||
<small class="label pull-right bg-yellow" id="idleBots">0</small>
|
||||
<small class="label pull-right bg-green" id="activeBots">0</small>
|
||||
<small class="label pull-right bg-olive" id="activeBots">0</small>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -68,7 +63,7 @@
|
||||
|
||||
<li class="header">INFORMATION</li>
|
||||
<li class="info-overview">
|
||||
<a href="#">
|
||||
<a>
|
||||
<i class="fas fa-tachometer-alt fa-fw"></i> <span>RAM Usage</span>
|
||||
<span class="pull-right-container">
|
||||
<small class="label pull-right bg-blue" id="ramUsage">0.00 MB</small>
|
||||
@@ -76,7 +71,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="info-overview">
|
||||
<a href="#">
|
||||
<a>
|
||||
<i class="far fa-clock fa-fw"></i> <span>Uptime</span>
|
||||
<span class="pull-right-container">
|
||||
<small class="label pull-right bg-blue" id="uptime">0d 0h 0m</small>
|
||||
@@ -87,9 +82,8 @@
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<!-- Content Header -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Log
|
||||
@@ -101,7 +95,7 @@
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<!-- Content Body -->
|
||||
<section class="content container-fluid">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
@@ -109,11 +103,11 @@
|
||||
|
||||
<h3 class="box-title">Log</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<button title="Toggle auto scroll" type="button" class="btn btn-box-tool text-green" id="toggleAutoScroll"><i class="fas fa-toggle-on fa-2x"></i></button>
|
||||
<button title="Toggle auto scroll" type="button" class="btn btn-box-tool text-olive" id="toggleAutoScroll"><i class="fas fa-toggle-on fa-2x"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="box-content-log resize" id="log">
|
||||
<div class="box-content-log">
|
||||
<div class="overlay"><i class="fas fa-sync fa-spin" style="color:white"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -121,7 +115,7 @@
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- Main Footer -->
|
||||
<!-- Footer -->
|
||||
<footer class="main-footer">
|
||||
<div class="pull-right" id="version"><b>Version</b> 0.0.0.0</div>
|
||||
<strong>
|
||||
@@ -131,11 +125,9 @@
|
||||
</strong>
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
<!-- Right Sidebar -->
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<!-- Tab content -->
|
||||
<div class="tab-pane" id="control-right-sidebar"></div>
|
||||
</div>
|
||||
</aside>
|
||||
@@ -158,61 +150,62 @@
|
||||
startWebSocket();
|
||||
|
||||
function startWebSocket() {
|
||||
if (!"WebSocket" in window) {
|
||||
window.alert('Please use a modern browser to properly view ASF GUI!')
|
||||
}
|
||||
if (!"WebSocket" in window) window.alert('Please use a modern browser to properly view ASF GUI!')
|
||||
|
||||
var loc = window.location, new_uri;
|
||||
if (loc.protocol === "https:") {
|
||||
new_uri = "wss:";
|
||||
} else {
|
||||
new_uri = "ws:";
|
||||
}
|
||||
var loc = window.location,
|
||||
new_uri = (loc.protocol === "https:") ? "wss:" : "ws:";
|
||||
|
||||
new_uri += "//" + loc.host + "/Api/Log?password=" + encodeURIComponent(IPCPassword);
|
||||
|
||||
ws = new WebSocket(new_uri);
|
||||
|
||||
$('.overlay').remove();
|
||||
|
||||
$('.box-content-log').text(""); //Clear log
|
||||
|
||||
ws.onmessage = function (evt) {
|
||||
var msg = JSON.parse(evt.data)["Result"] + "\n";
|
||||
$('.box-content-log').append(msg);
|
||||
$("#log").stop().animate({ scrollTop: $("#log")[0].scrollHeight }, 1000);
|
||||
$(".box-content-log").stop().animate({ scrollTop: $(".box-content-log")[0].scrollHeight }, 1000);
|
||||
};
|
||||
|
||||
window.onbeforeunload = function () {
|
||||
ws.close()
|
||||
};
|
||||
ws.onclose = function (event) {
|
||||
if (event.code !== 1000) {
|
||||
// code 1000 means that the connection was closed normally
|
||||
swal({
|
||||
title: "Error!",
|
||||
text: event.code + ' - ' + event.reason,
|
||||
type: "error"
|
||||
}, function () { swal.close(); });
|
||||
}
|
||||
}
|
||||
|
||||
window.onbeforeunload = function () { ws.close() };
|
||||
}
|
||||
|
||||
//toggle start or stop fetching log
|
||||
$('#toggleAutoScroll').click(function () {
|
||||
if (ws.readyState === ws.CLOSED) {
|
||||
startWebSocket();
|
||||
document.getElementById("toggleAutoScroll").classList.remove('text-red');
|
||||
document.getElementById("toggleAutoScroll").classList.add('text-green');
|
||||
$("#toggleAutoScroll").html('<i class="fas fa-toggle-on fa-2x"></i>');
|
||||
$('#toggleAutoScroll').removeClass('text-grey');
|
||||
$('#toggleAutoScroll').addClass('text-olive');
|
||||
$('#toggleAutoScroll').html('<i class="fas fa-toggle-on fa-2x"></i>');
|
||||
$('#toggleAutoScroll').blur();
|
||||
} else if (ws.readyState === ws.OPEN) {
|
||||
ws.close();
|
||||
document.getElementById("toggleAutoScroll").classList.remove('text-green');
|
||||
document.getElementById("toggleAutoScroll").classList.add('text-red');
|
||||
$("#toggleAutoScroll").html('<i class="fas fa-toggle-on fa-2x fa-rotate-180"></i>');
|
||||
$('#toggleAutoScroll').removeClass('text-olive');
|
||||
$('#toggleAutoScroll').addClass('text-grey');
|
||||
$('#toggleAutoScroll').html('<i class="fas fa-toggle-on fa-2x fa-rotate-180"></i>');
|
||||
$('#toggleAutoScroll').blur();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//Stop fetching log when scrolling upwards
|
||||
$('.box-content-log').on('scroll', function () {
|
||||
var newScrollPosition = $(this).scrollTop();
|
||||
|
||||
if (newScrollPosition < lastScrollPosition) {
|
||||
if (ws.readyState === ws.OPEN) {
|
||||
ws.close();
|
||||
document.getElementById("toggleAutoScroll").classList.remove('text-green');
|
||||
document.getElementById("toggleAutoScroll").classList.add('text-red');
|
||||
$("#toggleAutoScroll").html('<i class="fas fa-toggle-on fa-2x fa-rotate-180"></i>');
|
||||
$('#toggleAutoScroll').removeClass('text-olive');
|
||||
$('#toggleAutoScroll').addClass('text-grey');
|
||||
$('#toggleAutoScroll').html('<i class="fas fa-toggle-on fa-2x fa-rotate-180"></i>');
|
||||
$('#toggleAutoScroll').blur();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +222,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
interact('.resize')
|
||||
interact('.box-content-log')
|
||||
.resizable({
|
||||
edges: { left: false, right: false, bottom: true, top: false },
|
||||
restrictEdges: {
|
||||
|
||||
Reference in New Issue
Block a user