This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
89 lines (87 loc) · 3.17 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
$(document).ready(function () {
let welcome = document.createElement('div')
let welcome_header = document.createElement('p')
let welcome_logo = document.createElement('pre')
let welcome_footer = document.createElement('p')
welcome_header.id = 'welcome_header'
welcome_logo.id = 'welcome_logo'
welcome_footer.id = 'welcome_footer'
welcome_header.style.textAlign = 'center'
welcome_logo.style.textAlign = 'center'
welcome_logo.innerText = 'loading ...'
welcome_footer.style.textAlign = 'center'
welcome_header.innerHTML = 'welcome to <b>flamincome</b>'
welcome_footer.innerHTML = 'get start at <a href="https://flamincome.github.io/docs">docs</a><br><b>USE AT YOUR OWN RISK!!!</b>'
welcome.appendChild(welcome_header)
welcome.appendChild(welcome_logo)
welcome.appendChild(welcome_footer)
let $ptty = $('#terminal').Ptty({
i18n: {
welcome: welcome.outerHTML,
}
});
$ptty.register('command', {
name: 'get-github',
method: function (cmd) {
if (cmd[1]) {
return {
out: `<a href="https://github.com/flamincome/${cmd[1]}">${cmd[1]}</a>`,
};
}
return {
out: '<a href="https://github.com/flamincome">Flamincome Github</a>',
};
},
options: [1],
help: 'flamincome github page'
});
$ptty.register('command', {
name: 'deposit-token',
method: function (cmd) {
return {
out: 'coming soon ...',
};
},
help: 'deposit'
});
$ptty.register('command', {
name: 'withdraw-token',
method: function (cmd) {
return {
out: 'coming soon ...',
};
},
help: 'withdraw'
});
fetch("/logo/flamincome").then(resp => {
resp.text().then(logo => {
$('#welcome_logo').text(logo)
$ptty.register('command', {
name: 'flamincome:',
method: function (cmd) {
let div = document.createElement('div')
let pre = document.createElement('pre')
let p = document.createElement('p')
let args = $ptty.get_command_option('last').split(' ')
args.shift()
p.innerText = args.join(' ');
pre.innerText = logo
pre.style.backgroundColor = 'transparent'
pre.style.border = '0px'
div.style.justifyContent = 'center'
div.style.alignItems = 'center'
div.style.display = 'flex'
div.style.backgroundColor = 'rgba(0,0,0,0.9)'
div.style.border = '1px solid rgba(255,255,255,0.15)'
p.style.color = '#b5e853'
div.appendChild(pre)
div.appendChild(p)
return {
out: div.outerHTML,
};
},
help: 'flamincome can speak (example: `flamincome I want $!`)'
});
})
})
});