Compare commits
No commits in common. "351fef504c9aa26b05353b185cea9e7356addea3" and "1c58165425c81862e13d278d31eaf1e3c8595245" have entirely different histories.
351fef504c
...
1c58165425
@ -36,11 +36,6 @@ export class Container extends EventHandler{
|
|||||||
this._container.classList.toggle("hidden")
|
this._container.classList.toggle("hidden")
|
||||||
this.refresh()
|
this.refresh()
|
||||||
}
|
}
|
||||||
fit(){
|
|
||||||
this._fitAddon.fit();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
constructor(channelUid,log){
|
constructor(channelUid,log){
|
||||||
super()
|
super()
|
||||||
|
|||||||
@ -60,59 +60,7 @@
|
|||||||
import { app } from "/app.js";
|
import { app } from "/app.js";
|
||||||
import { Container } from "/container.js";
|
import { Container } from "/container.js";
|
||||||
let prevKey = null;
|
let prevKey = null;
|
||||||
|
document.addEventListener("keydown", () => {
|
||||||
function toggleDevelopmentMode(){
|
|
||||||
const headerElement = document.querySelector('header');
|
|
||||||
headerElement.style.display = 'none';
|
|
||||||
const sidebarElement = document.querySelector('aside');
|
|
||||||
|
|
||||||
sidebarElement.style.position = 'fixed'
|
|
||||||
sidebarElement.style.width= '10%'
|
|
||||||
sidebarElement.style.top = '0px'
|
|
||||||
sidebarElement.style.left='0px'
|
|
||||||
sidebarElement.style.height='100%'
|
|
||||||
|
|
||||||
// sidebarElement.style.display = 'none';
|
|
||||||
const containerElement = document.querySelector('#terminal');
|
|
||||||
containerElement.style.position = 'fixed';
|
|
||||||
containerElement.style.width = '40%';
|
|
||||||
containerElement.style.height = '100%';
|
|
||||||
containerElement.style.left = '10%';
|
|
||||||
containerElement.style.top = '0px';
|
|
||||||
//window.container.resizeToPercentage(document.body,'50%','100%')
|
|
||||||
|
|
||||||
const messagesElement = document.querySelector('.chat-area');
|
|
||||||
messagesElement.style.position = 'fixed';
|
|
||||||
messagesElement.style.width = '40%';
|
|
||||||
messagesElement.style.height = '100%';
|
|
||||||
messagesElement.style.left = '50%';
|
|
||||||
messagesElement.style.top = '0px';
|
|
||||||
|
|
||||||
const messageList = document.querySelector('message-list')
|
|
||||||
messageList.scrollToBottom()
|
|
||||||
|
|
||||||
window.container.fit()
|
|
||||||
|
|
||||||
app.starField.renderWord("H4x0r 1337")
|
|
||||||
}
|
|
||||||
|
|
||||||
{% if channel %}
|
|
||||||
app.channelUid = '{{ channel.uid.value }}'
|
|
||||||
window.getContainer = async function (){
|
|
||||||
if(window.c) return window.c
|
|
||||||
window.c = new Container(app.channelUid,false)
|
|
||||||
window.c.start()
|
|
||||||
window.t = document.querySelector("#terminal")
|
|
||||||
window.t.classList.toggle("hidden")
|
|
||||||
window.c.render(window.t)
|
|
||||||
|
|
||||||
|
|
||||||
return window.c
|
|
||||||
}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener("keydown", async() => {
|
|
||||||
if(prevKey == "Escape"){
|
if(prevKey == "Escape"){
|
||||||
document.querySelector("chat-input").querySelector("textarea").value = "";
|
document.querySelector("chat-input").querySelector("textarea").value = "";
|
||||||
}
|
}
|
||||||
@ -122,14 +70,9 @@ app.starField.renderWord("H4x0r 1337")
|
|||||||
}
|
}
|
||||||
if(event.key == "." && event.ctrlKey){
|
if(event.key == "." && event.ctrlKey){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if(!window.c)
|
if(window.container){
|
||||||
{
|
|
||||||
window.getContainer()
|
|
||||||
}
|
|
||||||
if(window.c){
|
|
||||||
|
|
||||||
toggleDevelopmentMode()
|
window.container.terminal.element.hidden = !window.container.terminal.element.hidden
|
||||||
//window.container.terminal.element.hidden = !window.container.terminal.element.hidden
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -141,11 +84,17 @@ app.starField.renderWord("H4x0r 1337")
|
|||||||
let textAreas = document.querySelectorAll("textarea")
|
let textAreas = document.querySelectorAll("textarea")
|
||||||
textAreas.forEach(textArea => {
|
textAreas.forEach(textArea => {
|
||||||
if(document.activeElement != textArea)
|
if(document.activeElement != textArea)
|
||||||
setTimeout(() => textArea.focus(), 10)
|
setTimeout(() => textArea.focus(), 300)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
{% if channel %}
|
||||||
|
app.channelUid = '{{ channel.uid.value }}'
|
||||||
|
window.getContainer = function(){
|
||||||
|
return new Container(app.channelUid,false)
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
let installPrompt = null
|
let installPrompt = null
|
||||||
window.addEventListener("beforeinstallprompt", (e) => {
|
window.addEventListener("beforeinstallprompt", (e) => {
|
||||||
//e.preventDefault();
|
//e.preventDefault();
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
{{ message.html }}
|
{{ message.html }}
|
||||||
{% endautoescape %}
|
{% endautoescape %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<div class="message-list-bottom"></div>
|
<div class="message-list-bottom"></div>
|
||||||
</message-list>
|
</message-list>
|
||||||
<chat-input live-type="true" channel="{{ channel.uid.value }}"></chat-input>
|
<chat-input live-type="true" channel="{{ channel.uid.value }}"></chat-input>
|
||||||
@ -47,6 +48,7 @@ const messagesContainer = document.querySelector(".chat-messages");
|
|||||||
const chatArea = document.querySelector(".chat-area");
|
const chatArea = document.querySelector(".chat-area");
|
||||||
const channelUid = "{{ channel.uid.value }}";
|
const channelUid = "{{ channel.uid.value }}";
|
||||||
const username = "{{ user.username.value }}";
|
const username = "{{ user.username.value }}";
|
||||||
|
let container = null
|
||||||
// --- Command completions ---
|
// --- Command completions ---
|
||||||
chatInputField.autoCompletions = {
|
chatInputField.autoCompletions = {
|
||||||
"/online": showOnline,
|
"/online": showOnline,
|
||||||
@ -54,7 +56,14 @@ chatInputField.autoCompletions = {
|
|||||||
"/live": () => { chatInputField.liveType = !chatInputField.liveType; },
|
"/live": () => { chatInputField.liveType = !chatInputField.liveType; },
|
||||||
"/help": showHelp,
|
"/help": showHelp,
|
||||||
"/container": async() =>{
|
"/container": async() =>{
|
||||||
containerDialog.openWithStatus()
|
if(container == null){
|
||||||
|
window.c = await window.getContainer()
|
||||||
|
await window.c.start()
|
||||||
|
window.t = document.querySelector("#terminal")
|
||||||
|
window.t.classList.toggle("hidden")
|
||||||
|
window.c.render(window.t)
|
||||||
|
}
|
||||||
|
//containerDialog.openWithStatus()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user