whatever
This commit is contained in:
1 parent
93eae7d19a
commit
71299c255e
15 files changed
+591
-28
No files matched your search
@@ -921,6 +921,14 @@ io.on('connection', function (socket) {
|
||||
db.addConnection(handle)
|
||||
Functions.log({ action: "connect", handle: handle });
|
||||
|
||||
socket.emit('broadcast', {
|
||||
type: 'log',
|
||||
data: {
|
||||
data: 'lol',
|
||||
type: 'server'
|
||||
}
|
||||
})
|
||||
|
||||
socket.on('disconnect', function () {
|
||||
db.removeConnection(handle)
|
||||
Functions.log({ action: "disconnect", handle: handle });
|
||||
@@ -969,6 +977,22 @@ io.on('connection', function (socket) {
|
||||
|
||||
});
|
||||
|
||||
socket.on('silent', function (data) {
|
||||
function reply(rep) {
|
||||
socket.emit('silent', {
|
||||
rep: rep,
|
||||
id: data.id
|
||||
})
|
||||
}
|
||||
var actions = {
|
||||
'size': () => {
|
||||
reply('lol')
|
||||
}
|
||||
}
|
||||
if (actions[data.query])
|
||||
actions[data.query]()
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
|
||||
@@ -10,6 +10,7 @@ module.exports = {
|
||||
test: {
|
||||
f: com => {
|
||||
com.insert(['whatever', [1,2]], {flag: 1});
|
||||
com.insert(['whatever', [1,3]], {flag: 1});
|
||||
com.end();
|
||||
},
|
||||
desc: "block test",
|
||||
|
||||
+3
-22
@@ -2,7 +2,6 @@
|
||||
<html lang="pl">
|
||||
|
||||
<head>
|
||||
<!-- Document configuration -->
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
@@ -10,37 +9,19 @@
|
||||
<meta name="google-site-verification" content="qQeOFnhYi_FvBiPv_mYzmZiWHBTapnWGLWmyE-novig" />
|
||||
<title>smart-home</title>
|
||||
|
||||
<!-- Icons -->
|
||||
<link rel="shortcut icon" href="img/favicon.ico" sizes="128x128">
|
||||
<link rel="shortcut icon" href="img/favicon.png" sizes="192x192">
|
||||
<link rel="shortcut icon" href="img/faviconb.png" sizes="512x512">
|
||||
|
||||
<!-- Libraries from external CDNs -->
|
||||
<!-- <script rel="preload" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> -->
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script> -->
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script> -->
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script> -->
|
||||
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/atom-one-dark.min.css"> -->
|
||||
|
||||
<!-- Google Fonts -->
|
||||
<!-- <link href="https://fonts.googleapis.com/css?family=Lato:400,700&subset=latin,latin-ext" rel="stylesheet" type="text/css"> -->
|
||||
<!-- <link href="https://fonts.googleapis.com/css?family=Ubuntu+Mono" rel="stylesheet"> -->
|
||||
|
||||
<script src="res/jquery-3.3.1.min.js"></script>
|
||||
<!-- <script src="res/socket.io.slim.js"></script> -->
|
||||
<script rel="preload" src="/main.js"></script>
|
||||
<script src="res/jquery-3.3.1.slim.min.js"></script>
|
||||
<script src="main.js" rel="preload"></script>
|
||||
|
||||
<link href="res/fontello.css" rel="stylesheet" type="text/css" />
|
||||
<!-- <link href="fontello/css/fontello.css" rel="stylesheet" type="text/css" /> -->
|
||||
<!-- <link href="hljsct.css" rel="stylesheet" type="text/css" /> -->
|
||||
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<link href="manifest.json" rel="manifest">
|
||||
<link href="style.css" rel="stylesheet" type="text/css" />
|
||||
<!-- <link href="tree.min.css" rel="stylesheet" type="text/css" /> -->
|
||||
<!-- <script src="chart.min.js"></script> -->
|
||||
|
||||
<!-- <script src="highlight.min.js"></script> -->
|
||||
<!-- <link rel="stylesheet" href="atom-one-dark.min.css"> -->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
function download(content, filename) {
|
||||
/**
|
||||
* Download variable as file
|
||||
* @param {mixed} content any variable
|
||||
* @param {string} filename name of downloaded file
|
||||
*
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
var createObjectURL = (window.URL || window.webkitURL || {}).createObjectURL || function () { };
|
||||
var blob = null;
|
||||
var mimeString = "application/octet-stream";
|
||||
window.BlobBuilder = window.BlobBuilder ||
|
||||
window.WebKitBlobBuilder ||
|
||||
window.MozBlobBuilder ||
|
||||
window.MSBlobBuilder;
|
||||
|
||||
|
||||
if (window.BlobBuilder) {
|
||||
var bb = new BlobBuilder();
|
||||
bb.append(content);
|
||||
blob = bb.getBlob(mimeString);
|
||||
} else {
|
||||
blob = new Blob([content], { type: mimeString });
|
||||
}
|
||||
var url = createObjectURL(blob);
|
||||
var a = document.createElement("a");
|
||||
a.href = url
|
||||
a.download = filename;
|
||||
a.innerHTML = "";
|
||||
document.body.appendChild(a);
|
||||
a.click()
|
||||
a.remove()
|
||||
}
|
||||
@@ -1,6 +1,28 @@
|
||||
export var type = "command"
|
||||
|
||||
export default {
|
||||
'settings': com =>{
|
||||
var actions = {
|
||||
'set': () => {
|
||||
com.con.settings[com.arg[1]] = eval(com.arg[2])
|
||||
Storage.Local.set('settings', com.con.settings)
|
||||
com._end()
|
||||
}
|
||||
}
|
||||
actions[com.arg[0]]()
|
||||
},
|
||||
'mod': com => {
|
||||
var actions = {
|
||||
'get': ()=>{
|
||||
com.con.prompt(`Install ${com.arg[1]} module? [y\\n]`)
|
||||
.then(()=>{
|
||||
com.con._requires(com.arg[1])
|
||||
.then(()=>com._end())
|
||||
})
|
||||
}
|
||||
}
|
||||
actions[com.arg[0]]()
|
||||
},
|
||||
'clear': com => {
|
||||
com.con.clear()
|
||||
},
|
||||
@@ -12,6 +34,7 @@ export default {
|
||||
} catch (error) {
|
||||
com.log(error, "error");
|
||||
}
|
||||
com._end()
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
export var type = 'sub'
|
||||
|
||||
export default class Font{
|
||||
constructor(con){
|
||||
this.con = con
|
||||
this.fonts = {}
|
||||
}
|
||||
|
||||
set(name){
|
||||
if(this.fonts[name]){
|
||||
$(':root').css('--font', name)
|
||||
} else {
|
||||
this.con.log(`Font ${name} is not installed`, 'error')
|
||||
}
|
||||
}
|
||||
|
||||
install(url, name, prop){
|
||||
this.fonts[name] = new FontFace(name, `url(${url})`, prop);
|
||||
this._load(name)
|
||||
}
|
||||
|
||||
_load(name){
|
||||
this.fonts[name].load().then(face => {
|
||||
document.fonts.add(face)
|
||||
}).catch(err => {
|
||||
this.con.log(`Loading font ${name} failed: ${err}`)
|
||||
throw err
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export var type = 'Class'
|
||||
|
||||
export var requires = {
|
||||
styles: ['res/fontello.css']
|
||||
}
|
||||
|
||||
export default class Fontello{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
function toGraph(data, x, y) {
|
||||
/**
|
||||
* Create chart.js graph
|
||||
* @param {object} data chart.js configuration object
|
||||
* @param {number} x graph width
|
||||
* @param {number} y grap height
|
||||
*
|
||||
* @returns {H} chart.js html element with init script
|
||||
*/
|
||||
|
||||
var id = makeID(6);
|
||||
|
||||
return `<div class="chartdiv"><canvas id="${id}" width="${isDefined(x, 400)}" height="${isDefined(y, 400)}"></canvas></div><script>var ctx = document.getElementById("${id}").getContext("2d");var myChart = new Chart(ctx, JSON.parse('${JSON.stringify(data)}'));</script>`
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
export var type = 'sub'
|
||||
|
||||
export var commands = {
|
||||
|
||||
}
|
||||
|
||||
export default class Json{
|
||||
|
||||
// .append(
|
||||
// $("<input>")
|
||||
// .addClass("jsonl")
|
||||
// .prop("type", "file")
|
||||
// .hide()
|
||||
// )
|
||||
// this.elements.$jsonl[0].addEventListener('chsange', this.readJson, false);
|
||||
// readJson(data) {
|
||||
// var file = data.target.files[0];
|
||||
// var reader = new FileReader();
|
||||
|
||||
// reader.con = $(this).closest(".wind").data("con");
|
||||
// reader.onload = function (event) {
|
||||
// try {
|
||||
// this.con.jsond = JSON.parse(event.target.result);
|
||||
// this.con.log("JSON loaded", "ok");
|
||||
// } catch (error) {
|
||||
// this.con.log(`JSON parsing error: ${error}`, "error");
|
||||
// }
|
||||
|
||||
// }
|
||||
// reader.readAsText(file, "UTF-8");
|
||||
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
// function mesparse(data, amount, con) { // parse mesenger chat information
|
||||
// var response = "";
|
||||
// var perf = performance.now();
|
||||
|
||||
// // check if json is loaded\
|
||||
// if (typeof data != "undefined") {
|
||||
|
||||
// // check if participants are defined\
|
||||
// if (typeof data.participants != "undefined") {
|
||||
|
||||
// l = []; // links
|
||||
// p = 0; // pics
|
||||
// a = []; // unique words
|
||||
// ac = []; // unique words counter
|
||||
// w = 0; // word counter
|
||||
// d = [0, 0, 0, 0, 0, 0, 0] // weekdays
|
||||
// h = new Array(24).fill(0);
|
||||
|
||||
// // unique words by participant
|
||||
// for (let key in data.participants) {
|
||||
// data.participants[key].w = [];
|
||||
// }
|
||||
|
||||
// // check if messages are defined\
|
||||
// if (typeof data.messages != "undefined") {
|
||||
|
||||
// // parse every message in file
|
||||
// for (let key in data.messages) {
|
||||
|
||||
// // check if content is present
|
||||
// if (typeof data.messages[key].content != "undefined") {
|
||||
|
||||
// let x = new Date();
|
||||
// x.setTime(data.messages[key].timestamp_ms);
|
||||
// d[x.getDay()] += 1;
|
||||
// h[x.getHours()] += 1;
|
||||
|
||||
// // check if message is a photo
|
||||
// if (data.messages[key].photos) {
|
||||
// p++;
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// data.messages[key].content = data.messages[key].content.replace(/ +(?= )/g, '');
|
||||
// words = data.messages[key].content.split(" ");
|
||||
|
||||
// for (let word in words) {
|
||||
|
||||
// let i = a.indexOf(words[word]);
|
||||
// if (i == -1) {
|
||||
// a.push(words[word]);
|
||||
// ac.push(1);
|
||||
// } else {
|
||||
// ac[i] += 1;
|
||||
// }
|
||||
|
||||
// for (let p in data.participants) {
|
||||
// if (data.messages[key].sender_name == data.participants[p].name)
|
||||
// data.participants[p].w.push(words[word])
|
||||
// }
|
||||
// // if(data.messages[key].sender_name == "Sebastian Fudalej") s.push(words[word]);
|
||||
// // else if(data.messages[key].sender_name == "Mateusz Pstrucha") m.push(words[word]);
|
||||
// w++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // break if requested amount is parsed
|
||||
// if (typeof amount != "undefined")
|
||||
// if (amount > 0)
|
||||
// if (key == amount) break;
|
||||
// }
|
||||
|
||||
// // merging words and count arrays
|
||||
// b = [];
|
||||
// for (let key in a) {
|
||||
// b.push([a[key], ac[key]]);
|
||||
// }
|
||||
|
||||
// // sorting words by count
|
||||
// b.sort(function (a, b) {
|
||||
// if (a[1] === b[1]) {
|
||||
// return 0;
|
||||
// }
|
||||
// else {
|
||||
// return (a[1] > b[1]) ? -1 : 1;
|
||||
// }
|
||||
// });
|
||||
|
||||
// response += "<br>" + con.returnError("Done", "ok");
|
||||
// response += "<br><txpnk>#### " + data.title + ": ####</txpnk>"
|
||||
|
||||
// // top #10 words
|
||||
// let v = b.slice(0, 10);
|
||||
// var tp = [];
|
||||
// for (let key in v) {
|
||||
// tp.push(["<txyel>" + decodeURIComponent(escape(v[key][0])) + "</txyel>", v[key][1]]);
|
||||
// }
|
||||
// response += toTable(tp);
|
||||
|
||||
// // words by participant
|
||||
// var partic = [];
|
||||
// for (let key in data.participants) {
|
||||
// partic.push(["<txorn>" + decodeURIComponent(escape(data.participants[key].name)) + "</txorn>", data.participants[key].w.length])
|
||||
// // response += "<br><txorn>"+decodeURIComponent(escape(data.participants[key].name))+"</txorn> words: "+data.participants[key].w.length;
|
||||
// }
|
||||
// response += toTable(partic);
|
||||
|
||||
// // response += toTable([
|
||||
// // ["<txred>Monday</txred>", d[0]],
|
||||
// // ["<txred>Tuesday</txred>", d[1]],
|
||||
// // ["<txred>Wednesday</txred>", d[2]],
|
||||
// // ["<txred>Thursday</txred>", d[3]],
|
||||
// // ["<txred>Friday</txred>", d[4]],
|
||||
// // ["<txred>Saturday</txred>", d[5]],
|
||||
// // ["<txred>Sunday</txred>", d[6]]
|
||||
// // ])
|
||||
|
||||
// // let hrs = [];
|
||||
// // for(let hours in h){
|
||||
// // hrs.push([hours+":00", h[hours]]);
|
||||
// // }
|
||||
|
||||
// response += toGraph({
|
||||
// type: 'line',
|
||||
// data: {
|
||||
// labels: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
||||
// datasets: [{
|
||||
// label: '# per hour of day',
|
||||
// data: h,
|
||||
// backgroundColor: "#ffffff66",
|
||||
// borderColor: "#ffffff66",
|
||||
// borderWidth: 1
|
||||
// }]
|
||||
// },
|
||||
// options: {
|
||||
// maintainAspectRatio: false,
|
||||
// responsive: false,
|
||||
// scales: {
|
||||
// yAxes: [{
|
||||
// ticks: {
|
||||
// beginAtZero: true
|
||||
// }
|
||||
// }]
|
||||
// }
|
||||
// }
|
||||
// }, 400, 200);
|
||||
|
||||
// response += toGraph({
|
||||
// type: 'line',
|
||||
// data: {
|
||||
// labels: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
|
||||
// datasets: [{
|
||||
// label: '# per weekday',
|
||||
// data: d,
|
||||
// backgroundColor: "#ffffff66",
|
||||
// borderColor: "#ffffff66",
|
||||
// borderWidth: 1
|
||||
// }]
|
||||
// },
|
||||
// options: {
|
||||
// maintainAspectRatio: false,
|
||||
// responsive: false,
|
||||
// scales: {
|
||||
// yAxes: [{
|
||||
// ticks: {
|
||||
// beginAtZero: true
|
||||
// }
|
||||
// }]
|
||||
// }
|
||||
// }
|
||||
// }, 400, 200);
|
||||
|
||||
// response += toTable([
|
||||
// ["<txcya>Total messages</txcya>", data.messages.length],
|
||||
// ["<txcya>Total words</txcya>", w],
|
||||
// ["<txcya>Unique words</txcya>", a.length],
|
||||
// ["<txcya>Total photos</txcya>", p],
|
||||
|
||||
// ["<txcya>Parsing time</txcya>", (performance.now() - perf) + "ms"]
|
||||
// ])
|
||||
|
||||
// // response += "<br>"+"<txcya>Unique words</txcya>: "+a.length;
|
||||
// // response += "<br>"+"<txcya>Total photos</txcya>: "+p;
|
||||
// // response += "<br>"+"<txcya>Total words</txcya>: "+w;
|
||||
// // response += "<br>"+"<txcya>Parsing time</txcya>: "+(performance.now()-perf)+"ms";
|
||||
|
||||
// } else {
|
||||
// response += "<br>" + con.returnError("JSON structure invalid", "error");
|
||||
// }
|
||||
// } else {
|
||||
// response += "<br>" + con.returnError("Invalid message file", "error");
|
||||
// }
|
||||
// } else {
|
||||
// response += "<br>" + con.returnError("No json data loaded", "error");
|
||||
// }
|
||||
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// function mesall(data, amount, con) { // parse mesenger chat information
|
||||
// var response = "";
|
||||
// var perf = performance.now();
|
||||
|
||||
// // check if json is loaded
|
||||
// response += "<br>" + con.returnError("Checking data", "info");
|
||||
// if (typeof data != "undefined") {
|
||||
|
||||
// // check if participants are defined
|
||||
// response += "<br>" + con.returnError("Loading participants", "info");
|
||||
// if (typeof data.participants != "undefined") {
|
||||
|
||||
// response += "<br>" + con.returnError("Initializing variables", "info");
|
||||
// var colors = {};
|
||||
|
||||
// // unique words by participant
|
||||
// for (let key in data.participants) {
|
||||
// switch (key) {
|
||||
// case "0":
|
||||
// colors[data.participants[key].name] = "txgrn";
|
||||
// break;
|
||||
// case "1":
|
||||
// colors[data.participants[key].name] = "txblu";
|
||||
// break;
|
||||
// case "2":
|
||||
// colors[data.participants[key].name] = "txcya";
|
||||
// break;
|
||||
// case "3":
|
||||
// colors[data.participants[key].name] = "txyel";
|
||||
// break;
|
||||
// case "4":
|
||||
// colors[data.participants[key].name] = "txorn";
|
||||
// break;
|
||||
// case "5":
|
||||
// colors[data.participants[key].name] = "txred";
|
||||
// break;
|
||||
// case "6":
|
||||
// colors[data.participants[key].name] = "txpnk";
|
||||
// break;
|
||||
// case "7":
|
||||
// colors[data.participants[key].name] = "txred";
|
||||
// break;
|
||||
// default:
|
||||
// colors[data.participants[key].name] = "txblk";
|
||||
// break;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// // check if messages are defined
|
||||
// response += "<br>" + con.returnError("Parsing messages", "info");
|
||||
// if (typeof data.messages != "undefined") {
|
||||
|
||||
// // parse every message in file
|
||||
// var messages = data.messages.slice().reverse()
|
||||
// for (let key in messages) {
|
||||
// let col = colors[messages[key].sender_name] ? colors[messages[key].sender_name] : "txblk";
|
||||
// con.log("<" + col + ">" + decodeURIComponent(escape(messages[key].sender_name)) + "</" + col + ">: " + decodeURIComponent(escape(messages[key].content)));
|
||||
|
||||
// // break if requested amount is parsed
|
||||
// if (typeof amount != "undefined")
|
||||
// if (amount > 0)
|
||||
// if (key == amount) break;
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// response += "<br>" + con.returnError("JSON structure invalid", "error");
|
||||
// }
|
||||
// } else {
|
||||
// response += "<br>" + con.returnError("Invalid message file", "error");
|
||||
// }
|
||||
// } else {
|
||||
// response += "<br>" + con.returnError("No json data loaded", "error");
|
||||
// }
|
||||
|
||||
// return null;
|
||||
// }
|
||||
@@ -0,0 +1,55 @@
|
||||
function toSyntax(data, lang) {
|
||||
/**
|
||||
* Text syntax highlighting
|
||||
* @param {string} data text to highlight
|
||||
* @param [lang] syntax language
|
||||
*/
|
||||
|
||||
if (lang) {
|
||||
var langs = [];
|
||||
langs.push(lang)
|
||||
}
|
||||
var hl = hljs.highlightAuto(data, lang);
|
||||
var out = "";
|
||||
|
||||
var r = /(\<.*?\>)(.*?)(\<\/[\S]*?\>)/g;
|
||||
|
||||
out = hl.value.replace(r, function (match, beg, mid, end) {
|
||||
// console.log(beg+"|"+mid+"|"+end);
|
||||
// console.log(beg+ mid.replace(/\n/g, `[\n]`) +end)
|
||||
return beg + mid.replace(/\n/g, `${end}\n${beg}`) + end
|
||||
})
|
||||
|
||||
// var match = r.exec(hl.value);
|
||||
// while (match != null) {
|
||||
// console.log(match[0])
|
||||
// out += match[1] + match[2].replace("\n", `${match[3]}\n${match[2]}`) + match[3]
|
||||
// match = r.exec(hl.value);
|
||||
// }
|
||||
|
||||
|
||||
var lines = out.split("\n");
|
||||
var code = $("<code></code>")
|
||||
.append(`<!-- language: ${hl.language}, r: ${hl.r}, second: ${hl.second_best ? hl.second_best.language : undefined}-->`)
|
||||
|
||||
/*for(let index in lines){
|
||||
code.append(
|
||||
$("<span></span>")
|
||||
.addClass('hljs-newline')
|
||||
.append(lines[index])
|
||||
// .prop( "data-int", " ".repeat( (lines.length.toString().length) - ((parseInt(index)+1).toString().length) ) + (parseInt(index)+1) )
|
||||
)
|
||||
.append("\n")
|
||||
}*/
|
||||
code.append(hl.value)
|
||||
|
||||
return $("<pre></pre>").append(code)
|
||||
|
||||
/*for(let index in lines){
|
||||
indexed+=`<span class="hljs-newline" data-int="${
|
||||
" ".repeat( (lines.length.toString().length) - ((parseInt(index)+1).toString().length) ) + (parseInt(index)+1)
|
||||
}">${lines[index]}</span>\n`
|
||||
}
|
||||
|
||||
return `<pre><code>${indexed}</code></pre>`*/
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
function toTable(content) {
|
||||
/**
|
||||
* Creates html table from 2D array
|
||||
* @param {array} content 2d array
|
||||
*
|
||||
* @returns {H} html table from array
|
||||
*/
|
||||
|
||||
var $table = $("<table></table>")
|
||||
|
||||
for (let row of content) {
|
||||
let tr = $("<tr></tr>")
|
||||
for (let col of row) {
|
||||
tr.append(
|
||||
$("<td></td>").append(col + "")
|
||||
)
|
||||
}
|
||||
$table.append(tr)
|
||||
}
|
||||
|
||||
return $table
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
export var type = 'sub'
|
||||
|
||||
export var commands = {
|
||||
'theme': com => {
|
||||
var actions = {
|
||||
'set': () => {
|
||||
if (com.con.Themes.check(com.arg[1])){
|
||||
com.con.Themes.change(com.arg[1])
|
||||
com.log(`Theme ${com.arg[1]} applied`, 'ok')
|
||||
} else {
|
||||
com.log(`Theme ${com.arg[1]} not found`, 'error')
|
||||
}
|
||||
com._end()
|
||||
}
|
||||
}
|
||||
if (actions[com.arg[0]])
|
||||
actions[com.arg[0]]()
|
||||
}
|
||||
}
|
||||
|
||||
export default class Themes{
|
||||
constructor(con){
|
||||
this.con = con
|
||||
this.list = {
|
||||
'default': {
|
||||
blk: '#1f1f1f',
|
||||
red: '#d25252',
|
||||
grn: '#7fe173',
|
||||
yel: '#ffc66d',
|
||||
blu: '#4099ff',
|
||||
prp: '#f680ff',
|
||||
cya: '#bed6ff',
|
||||
wht: '#eeeeec',
|
||||
xblk: '#535353',
|
||||
xred: '#f07070',
|
||||
xgrn: '#9dff91',
|
||||
xyel: '#ffe48b',
|
||||
xblu: '#5eb7f7',
|
||||
xprp: '#ff9dff',
|
||||
xcya: '#dcf4ff',
|
||||
xwht: '#ffffff'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check(name){
|
||||
return true
|
||||
}
|
||||
|
||||
add(theme){}
|
||||
|
||||
change(name){
|
||||
var n = this.list[name]
|
||||
for(let color in n){
|
||||
$(':root').css(`--tx${color}`, n[color])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ var colors = {
|
||||
export default class Tree {
|
||||
constructor(data) {
|
||||
this.data = data
|
||||
this.mdepth = 4
|
||||
|
||||
if (this._typeOf(data) != "array" && this._typeOf(data) != "object")
|
||||
this.$ = $("<span></span>").append(this._contentType(data)).append(": ").append(`${data}`)
|
||||
@@ -112,7 +113,7 @@ export default class Tree {
|
||||
|
||||
_recur(obj, depth) {
|
||||
|
||||
let m = this.mdepth || Config.treeDepth || 4
|
||||
let m = this.mdepth || 4
|
||||
const maxd = m <= 7 ? m : 7; // max depth
|
||||
const maxn = 50; // max level length
|
||||
const maxs = 150; // max string length
|
||||
|
||||
+6
-5
@@ -1,10 +1,10 @@
|
||||
@font-face {
|
||||
/* @font-face {
|
||||
font-family: 'Ubuntu Mono';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(res/ubuntu-mono.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
} */
|
||||
|
||||
:root{
|
||||
--txblk: #1f1f1f;
|
||||
@@ -24,19 +24,21 @@
|
||||
--txxprp: #ff9dff;
|
||||
--txxcya: #dcf4ff;
|
||||
--txxwht: #ffffff;
|
||||
|
||||
--font: Courier New;
|
||||
}
|
||||
|
||||
body{
|
||||
height: 100vh;
|
||||
font-size: 14px;
|
||||
margin: 0px;
|
||||
font-family: Ubuntu Mono;
|
||||
font-family: var(--font);
|
||||
}
|
||||
|
||||
/* text inputs */
|
||||
input,textarea{
|
||||
color: white;
|
||||
font-family: Ubuntu Mono;
|
||||
font-family: var(--font);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@@ -87,7 +89,6 @@ txprp, .txprp {color: #AE00FF;} */
|
||||
float: left;
|
||||
padding: 0px 15px;
|
||||
color: var(--txwht);
|
||||
/* font-family: Ubuntu Mono; */
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
box-sizing: border-box;
|
||||
|
||||
Reference in new issue
Block a user