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;
|
||||
}
|
||||
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(){
|
||||
if(!this.voice) return;
|
||||
this.voice.onMemberChange=async (memb,joined)=>{
|
||||
|
|
|
@ -84,7 +84,7 @@ class Contextmenu<x, y>{
|
|||
Contextmenu.currentmenu = 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)=>{
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
|
@ -92,13 +92,39 @@ class Contextmenu<x, y>{
|
|||
};
|
||||
obj.addEventListener("contextmenu", func);
|
||||
if(iOS){
|
||||
let hold:NodeJS.Timeout|undefined;
|
||||
let x!:number;
|
||||
let y!:number;
|
||||
obj.addEventListener("touchstart",(event: TouchEvent)=>{
|
||||
x=event.touches[0].pageX;
|
||||
y=event.touches[0].pageY;
|
||||
if(event.touches.length > 1){
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
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});
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -147,6 +147,7 @@ offset: number
|
|||
|
||||
if(nextid){
|
||||
const html = await this.getHTMLFromID(nextid);
|
||||
|
||||
if(!html){
|
||||
this.destroyFromID(nextid);
|
||||
return false;
|
||||
|
@ -155,6 +156,7 @@ offset: number
|
|||
fragment.prepend(html);
|
||||
this.HTMLElements.unshift([html, nextid]);
|
||||
this.scrollTop += this.averageheight;
|
||||
|
||||
}
|
||||
}
|
||||
if(this.scrollTop > this.maxDist){
|
||||
|
@ -162,7 +164,9 @@ offset: number
|
|||
if(html){
|
||||
again = true;
|
||||
await this.destroyFromID(html[1]);
|
||||
|
||||
this.scrollTop -= this.averageheight;
|
||||
|
||||
}
|
||||
}
|
||||
if(again){
|
||||
|
|
|
@ -1231,10 +1231,11 @@ class Localuser{
|
|||
}
|
||||
|
||||
{
|
||||
const userinfos = getBulkInfo();
|
||||
let userinfos = getBulkInfo();
|
||||
tas.addColorInput(
|
||||
I18n.getTranslation("localuser.accentColor"),
|
||||
_=>{
|
||||
userinfos = getBulkInfo();
|
||||
userinfos.accent_color = _;
|
||||
localStorage.setItem("userinfos", JSON.stringify(userinfos));
|
||||
document.documentElement.style.setProperty(
|
||||
|
@ -1347,11 +1348,11 @@ class Localuser{
|
|||
method: "PATCH",
|
||||
}
|
||||
);
|
||||
form.addTextInput(I18n.getTranslation("lcoaluser.newDiscriminator"), "discriminator");
|
||||
form.addTextInput(I18n.getTranslation("localuser.newDiscriminator"), "discriminator");
|
||||
});
|
||||
security.addButtonInput("", I18n.getTranslation("localuser.changeEmail"), ()=>{
|
||||
const form = security.addSubForm(
|
||||
I18n.getTranslation("lcoaluser.changeEmail"),
|
||||
I18n.getTranslation("localuser.changeEmail"),
|
||||
_=>{
|
||||
security.returnFromSub();
|
||||
},
|
||||
|
|
|
@ -89,7 +89,7 @@ function trimswitcher(){
|
|||
}
|
||||
|
||||
function getBulkInfo(){
|
||||
return JSON.parse(localStorage.getItem("userinfos")!);
|
||||
return JSON.parse(localStorage.getItem("userinfos") as string);
|
||||
}
|
||||
function setDefaults(){
|
||||
let userinfos = getBulkInfo();
|
||||
|
@ -126,6 +126,7 @@ function setDefaults(){
|
|||
};
|
||||
}
|
||||
if(userinfos.preferences && userinfos.preferences.notisound === undefined){
|
||||
console.warn("uhoh")
|
||||
userinfos.preferences.notisound = "three";
|
||||
}
|
||||
localStorage.setItem("userinfos", JSON.stringify(userinfos));
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
"name": "Jank Client",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/logo.svg",
|
||||
"src": "/logo.webp",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": "/channels/@me",
|
||||
"display": "standalone",
|
||||
"theme_color": "#05050a"
|
||||
"theme_color": "#05050a",
|
||||
"offline_enabled": true
|
||||
}
|
|
@ -208,7 +208,21 @@ class Message extends SnowFlake{
|
|||
return this.owner.info;
|
||||
}
|
||||
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;
|
||||
obj.classList.add("messagediv");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue