Various fixes
This commit is contained in:
parent
0d4ca2d68a
commit
49cdb8fda6
7 changed files with 67 additions and 9 deletions
|
@ -579,6 +579,17 @@ class Channel extends SnowFlake{
|
||||||
}
|
}
|
||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
|
async moveForDrag(x:number){
|
||||||
|
const mainarea=document.getElementById("mainarea");
|
||||||
|
if(!mainarea) return;
|
||||||
|
if(x===-1){
|
||||||
|
mainarea.style.removeProperty("left");
|
||||||
|
mainarea.style.removeProperty("transition");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mainarea.style.left=x+"px";
|
||||||
|
mainarea.style.transition="left 0s"
|
||||||
|
}
|
||||||
async setUpVoice(){
|
async setUpVoice(){
|
||||||
if(!this.voice) return;
|
if(!this.voice) return;
|
||||||
this.voice.onMemberChange=async (memb,joined)=>{
|
this.voice.onMemberChange=async (memb,joined)=>{
|
||||||
|
|
|
@ -84,7 +84,7 @@ class Contextmenu<x, y>{
|
||||||
Contextmenu.currentmenu = div;
|
Contextmenu.currentmenu = div;
|
||||||
return this.div;
|
return this.div;
|
||||||
}
|
}
|
||||||
bindContextmenu(obj: HTMLElement, addinfo: x, other: y){
|
bindContextmenu(obj: HTMLElement, addinfo: x, other: y,touchDrag:(x:number,y:number)=>unknown=()=>{},touchEnd:(x:number,y:number)=>unknown=()=>{}){
|
||||||
const func = (event: MouseEvent)=>{
|
const func = (event: MouseEvent)=>{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
|
@ -92,13 +92,39 @@ class Contextmenu<x, y>{
|
||||||
};
|
};
|
||||||
obj.addEventListener("contextmenu", func);
|
obj.addEventListener("contextmenu", func);
|
||||||
if(iOS){
|
if(iOS){
|
||||||
|
let hold:NodeJS.Timeout|undefined;
|
||||||
|
let x!:number;
|
||||||
|
let y!:number;
|
||||||
obj.addEventListener("touchstart",(event: TouchEvent)=>{
|
obj.addEventListener("touchstart",(event: TouchEvent)=>{
|
||||||
|
x=event.touches[0].pageX;
|
||||||
|
y=event.touches[0].pageY;
|
||||||
if(event.touches.length > 1){
|
if(event.touches.length > 1){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
this.makemenu(event.touches[0].clientX, event.touches[0].clientY, addinfo, other);
|
this.makemenu(event.touches[0].clientX, event.touches[0].clientY, addinfo, other);
|
||||||
|
}else{
|
||||||
|
//
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
hold=setTimeout(()=>{
|
||||||
|
if(lastx**2+lasty**2>10**2) return;
|
||||||
|
this.makemenu(event.touches[0].clientX, event.touches[0].clientY, addinfo, other);
|
||||||
|
console.log(obj);
|
||||||
|
},500)
|
||||||
}
|
}
|
||||||
},{passive: false});
|
},{passive: false});
|
||||||
|
let lastx=0;
|
||||||
|
let lasty=0;
|
||||||
|
obj.addEventListener("touchend",()=>{
|
||||||
|
if(hold){
|
||||||
|
clearTimeout(hold);
|
||||||
|
}
|
||||||
|
touchEnd(lastx,lasty);
|
||||||
|
});
|
||||||
|
obj.addEventListener("touchmove",(event)=>{
|
||||||
|
lastx=event.touches[0].pageX-x;
|
||||||
|
lasty=event.touches[0].pageY-y;
|
||||||
|
touchDrag(lastx,lasty);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,7 @@ offset: number
|
||||||
|
|
||||||
if(nextid){
|
if(nextid){
|
||||||
const html = await this.getHTMLFromID(nextid);
|
const html = await this.getHTMLFromID(nextid);
|
||||||
|
|
||||||
if(!html){
|
if(!html){
|
||||||
this.destroyFromID(nextid);
|
this.destroyFromID(nextid);
|
||||||
return false;
|
return false;
|
||||||
|
@ -155,6 +156,7 @@ offset: number
|
||||||
fragment.prepend(html);
|
fragment.prepend(html);
|
||||||
this.HTMLElements.unshift([html, nextid]);
|
this.HTMLElements.unshift([html, nextid]);
|
||||||
this.scrollTop += this.averageheight;
|
this.scrollTop += this.averageheight;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.scrollTop > this.maxDist){
|
if(this.scrollTop > this.maxDist){
|
||||||
|
@ -162,7 +164,9 @@ offset: number
|
||||||
if(html){
|
if(html){
|
||||||
again = true;
|
again = true;
|
||||||
await this.destroyFromID(html[1]);
|
await this.destroyFromID(html[1]);
|
||||||
|
|
||||||
this.scrollTop -= this.averageheight;
|
this.scrollTop -= this.averageheight;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(again){
|
if(again){
|
||||||
|
|
|
@ -1231,10 +1231,11 @@ class Localuser{
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const userinfos = getBulkInfo();
|
let userinfos = getBulkInfo();
|
||||||
tas.addColorInput(
|
tas.addColorInput(
|
||||||
I18n.getTranslation("localuser.accentColor"),
|
I18n.getTranslation("localuser.accentColor"),
|
||||||
_=>{
|
_=>{
|
||||||
|
userinfos = getBulkInfo();
|
||||||
userinfos.accent_color = _;
|
userinfos.accent_color = _;
|
||||||
localStorage.setItem("userinfos", JSON.stringify(userinfos));
|
localStorage.setItem("userinfos", JSON.stringify(userinfos));
|
||||||
document.documentElement.style.setProperty(
|
document.documentElement.style.setProperty(
|
||||||
|
@ -1347,11 +1348,11 @@ class Localuser{
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
form.addTextInput(I18n.getTranslation("lcoaluser.newDiscriminator"), "discriminator");
|
form.addTextInput(I18n.getTranslation("localuser.newDiscriminator"), "discriminator");
|
||||||
});
|
});
|
||||||
security.addButtonInput("", I18n.getTranslation("localuser.changeEmail"), ()=>{
|
security.addButtonInput("", I18n.getTranslation("localuser.changeEmail"), ()=>{
|
||||||
const form = security.addSubForm(
|
const form = security.addSubForm(
|
||||||
I18n.getTranslation("lcoaluser.changeEmail"),
|
I18n.getTranslation("localuser.changeEmail"),
|
||||||
_=>{
|
_=>{
|
||||||
security.returnFromSub();
|
security.returnFromSub();
|
||||||
},
|
},
|
||||||
|
|
|
@ -89,7 +89,7 @@ function trimswitcher(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBulkInfo(){
|
function getBulkInfo(){
|
||||||
return JSON.parse(localStorage.getItem("userinfos")!);
|
return JSON.parse(localStorage.getItem("userinfos") as string);
|
||||||
}
|
}
|
||||||
function setDefaults(){
|
function setDefaults(){
|
||||||
let userinfos = getBulkInfo();
|
let userinfos = getBulkInfo();
|
||||||
|
@ -126,6 +126,7 @@ function setDefaults(){
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if(userinfos.preferences && userinfos.preferences.notisound === undefined){
|
if(userinfos.preferences && userinfos.preferences.notisound === undefined){
|
||||||
|
console.warn("uhoh")
|
||||||
userinfos.preferences.notisound = "three";
|
userinfos.preferences.notisound = "three";
|
||||||
}
|
}
|
||||||
localStorage.setItem("userinfos", JSON.stringify(userinfos));
|
localStorage.setItem("userinfos", JSON.stringify(userinfos));
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
"name": "Jank Client",
|
"name": "Jank Client",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/logo.svg",
|
"src": "/logo.webp",
|
||||||
"sizes": "512x512"
|
"sizes": "512x512"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"start_url": "/channels/@me",
|
"start_url": "/channels/@me",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"theme_color": "#05050a"
|
"theme_color": "#05050a",
|
||||||
}
|
"offline_enabled": true
|
||||||
|
}
|
||||||
|
|
|
@ -208,7 +208,21 @@ class Message extends SnowFlake{
|
||||||
return this.owner.info;
|
return this.owner.info;
|
||||||
}
|
}
|
||||||
messageevents(obj: HTMLDivElement){
|
messageevents(obj: HTMLDivElement){
|
||||||
Message.contextmenu.bindContextmenu(obj, this, undefined);
|
Message.contextmenu.bindContextmenu(obj, this, undefined,(x)=>{
|
||||||
|
//console.log(x,y);
|
||||||
|
this.channel.moveForDrag(Math.max(x,0));
|
||||||
|
|
||||||
|
},(x,y)=>{
|
||||||
|
console.log(x,y);
|
||||||
|
this.channel.moveForDrag(-1);
|
||||||
|
if(x>60){
|
||||||
|
console.log("In here?")
|
||||||
|
const toggle = document.getElementById("maintoggle") as HTMLInputElement;
|
||||||
|
toggle.checked = false;
|
||||||
|
console.log(toggle);
|
||||||
|
}
|
||||||
|
|
||||||
|
},);
|
||||||
this.div = obj;
|
this.div = obj;
|
||||||
obj.classList.add("messagediv");
|
obj.classList.add("messagediv");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue