[breaking] fix typos

This commit is contained in:
TomatoCake 2024-07-01 20:31:47 +02:00
parent 8fe0c9f46b
commit 611e58090b
15 changed files with 113 additions and 115 deletions

View file

@ -42,13 +42,13 @@ class Voice{
this.updateWave(); this.updateWave();
} }
updateWave():void{ updateWave():void{
const func=this.waveFucnion(); const func=this.waveFunction();
for (let i = 0; i < this.buffer.length; i++) { for (let i = 0; i < this.buffer.length; i++) {
this.buffer[i]=func(i/this.audioCtx.sampleRate,this.freq); this.buffer[i]=func(i/this.audioCtx.sampleRate,this.freq);
} }
} }
waveFucnion():Function{ waveFunction():Function{
if(typeof this.wave === 'function'){ if(typeof this.wave === 'function'){
return this.wave; return this.wave;
} }
@ -134,12 +134,12 @@ class Voice{
} }
static setNotificationSound(sound:string){ static setNotificationSound(sound:string){
let userinfos=getBulkInfo(); let userinfos=getBulkInfo();
userinfos.preferances.notisound=sound; userinfos.preferences.notisound=sound;
localStorage.setItem("userinfos",JSON.stringify(userinfos)); localStorage.setItem("userinfos",JSON.stringify(userinfos));
} }
static getNotificationSound(){ static getNotificationSound(){
let userinfos=getBulkInfo(); let userinfos=getBulkInfo();
return userinfos.preferances.notisound; return userinfos.preferences.notisound;
} }
} }
export {Voice as Voice}; export {Voice as Voice};

View file

@ -24,7 +24,7 @@ class Channel{
name:string; name:string;
id:string; id:string;
parent_id:string; parent_id:string;
parrent:Channel; parent:Channel;
children:Channel[]; children:Channel[];
guild_id:string; guild_id:string;
messageids:{[key : string]:Message}; messageids:{[key : string]:Message};
@ -95,7 +95,7 @@ class Channel{
this.name=JSON.name; this.name=JSON.name;
this.id=JSON.id; this.id=JSON.id;
this.parent_id=JSON.parent_id; this.parent_id=JSON.parent_id;
this.parrent=null; this.parent=null;
this.children=[]; this.children=[];
this.guild_id=JSON.guild_id; this.guild_id=JSON.guild_id;
this.messageids={}; this.messageids={};
@ -142,12 +142,12 @@ class Channel{
} }
for(const thing of member.roles){ for(const thing of member.roles){
if(this.permission_overwrites[thing.id]){ if(this.permission_overwrites[thing.id]){
let perm=this.permission_overwrites[thing.id].getPermision(name); let perm=this.permission_overwrites[thing.id].getPermission(name);
if(perm){ if(perm){
return perm===1; return perm===1;
} }
} }
if(thing.permissions.getPermision(name)){ if(thing.permissions.getPermission(name)){
return true; return true;
} }
} }
@ -163,12 +163,12 @@ class Channel{
this.children.sort((a,b)=>{return a.position-b.position}); this.children.sort((a,b)=>{return a.position-b.position});
} }
resolveparent(guild:Guild){ resolveparent(guild:Guild){
this.parrent=guild.channelids[this.parent_id]; this.parent=guild.channelids[this.parent_id];
this.parrent??=null; this.parent??=null;
if(this.parrent!==null){ if(this.parent!==null){
this.parrent.children.push(this); this.parent.children.push(this);
} }
return this.parrent===null; return this.parent===null;
} }
calculateReorder(){ calculateReorder(){
let position=-1; let position=-1;
@ -298,9 +298,9 @@ class Channel{
const search=document.getElementById("channels").children[0].children const search=document.getElementById("channels").children[0].children
if(this.guild!==this.localuser.lookingguild){ if(this.guild!==this.localuser.lookingguild){
return null return null
}else if(this.parrent){ }else if(this.parent){
for(const thing of search){ for(const thing of search){
if(thing["all"]===this.parrent){ if(thing["all"]===this.parent){
for(const thing2 of thing.children[1].children){ for(const thing2 of thing.children[1].children){
if(thing2["all"]===this){ if(thing2["all"]===this){
return thing2; return thing2;
@ -347,30 +347,30 @@ class Channel{
event.preventDefault(); event.preventDefault();
if(container){ if(container){
that.move_id=this.id; that.move_id=this.id;
if(that.parrent){ if(that.parent){
that.parrent.children.splice(that.parrent.children.indexOf(that),1); that.parent.children.splice(that.parent.children.indexOf(that),1);
} }
that.parrent=this; that.parent=this;
(container as HTMLElement).prepend(Channel.dragged[1]); (container as HTMLElement).prepend(Channel.dragged[1]);
this.children.unshift(that); this.children.unshift(that);
}else{ }else{
console.log(this,Channel.dragged); console.log(this,Channel.dragged);
that.move_id=this.parent_id; that.move_id=this.parent_id;
if(that.parrent){ if(that.parent){
that.parrent.children.splice(that.parrent.children.indexOf(that),1); that.parent.children.splice(that.parent.children.indexOf(that),1);
}else{ }else{
this.guild.headchannels.splice(this.guild.headchannels.indexOf(that),1); this.guild.headchannels.splice(this.guild.headchannels.indexOf(that),1);
} }
that.parrent=this.parrent; that.parent=this.parent;
if(that.parrent){ if(that.parent){
const build=[]; const build=[];
for(let i=0;i<that.parrent.children.length;i++){ for(let i=0;i<that.parent.children.length;i++){
build.push(that.parrent.children[i]) build.push(that.parent.children[i])
if(that.parrent.children[i]===this){ if(that.parent.children[i]===this){
build.push(that); build.push(that);
} }
} }
that.parrent.children=build; that.parent.children=build;
}else{ }else{
const build=[]; const build=[];
for(let i=0;i<this.guild.headchannels.length;i++){ for(let i=0;i<this.guild.headchannels.length;i++){
@ -390,7 +390,7 @@ class Channel{
} }
createChannel(name:string,type:number){ createChannel(name:string,type:number){
fetch(this.info.api.toString()+"/guilds/"+this.guild.id+"/channels",{ fetch(this.info.api.toString()+"/guilds/"+this.guild.id+"/channels",{
method:"Post", method:"POST",
headers:this.headers, headers:this.headers,
body:JSON.stringify({ body:JSON.stringify({
name: name, name: name,
@ -511,14 +511,13 @@ class Channel{
async putmessages(){ async putmessages(){
if(this.messages.length>=100||this.allthewayup){return}; if(this.messages.length>=100||this.allthewayup){return};
const j=await fetch(this.info.api.toString()+"/channels/"+this.id+"/messages?limit=100",{ const j=await fetch(this.info.api.toString()+"/channels/"+this.id+"/messages?limit=100",{
method: 'GET',
headers: this.headers, headers: this.headers,
}) })
const responce=await j.json(); const response=await j.json();
if(responce.length!==100){ if(response.length!==100){
this.allthewayup=true; this.allthewayup=true;
} }
for(const thing of responce){ for(const thing of response){
const messager=new Message(thing,this) const messager=new Message(thing,this)
if(this.messageids[messager.id]===undefined){ if(this.messageids[messager.id]===undefined){
this.messageids[messager.id]=messager; this.messageids[messager.id]=messager;
@ -542,24 +541,23 @@ class Channel{
const out=this; const out=this;
await fetch(this.info.api.toString()+"/channels/"+this.id+"/messages?before="+this.messages[this.messages.length-1].id+"&limit=100",{ await fetch(this.info.api.toString()+"/channels/"+this.id+"/messages?before="+this.messages[this.messages.length-1].id+"&limit=100",{
method:"GET",
headers:this.headers headers:this.headers
}).then((j)=>{return j.json()}).then(responce=>{ }).then((j)=>{return j.json()}).then(response=>{
//messages.innerHTML = ''; //messages.innerHTML = '';
//responce.reverse() //response.reverse()
let next:Message; let next:Message;
if(responce.length===0){ if(response.length===0){
out.allthewayup=true; out.allthewayup=true;
} }
for(const i in responce){ for(const i in response){
let messager:Message; let messager:Message;
if(!next){ if(!next){
messager=new Message(responce[i],this) messager=new Message(response[i],this)
}else{ }else{
messager=next; messager=next;
} }
if(responce[+i+1]!==undefined){ if(response[+i+1]!==undefined){
next=new Message(responce[+i+1],this); next=new Message(response[+i+1],this);
}else{ }else{
next=undefined; next=undefined;
console.log("ohno",+i+1) console.log("ohno",+i+1)
@ -593,7 +591,7 @@ class Channel{
this.type=JSON.type; this.type=JSON.type;
this.name=JSON.name; this.name=JSON.name;
this.parent_id=JSON.parent_id; this.parent_id=JSON.parent_id;
this.parrent=null; this.parent=null;
this.children=[]; this.children=[];
this.guild_id=JSON.guild_id; this.guild_id=JSON.guild_id;
this.messageids={}; this.messageids={};
@ -763,15 +761,15 @@ class Channel{
this.permission_overwritesar.push([role.id,perm]); this.permission_overwritesar.push([role.id,perm]);
} }
async updateRolePermissions(id:string,perms:Permissions){ async updateRolePermissions(id:string,perms:Permissions){
const permision=this.permission_overwrites[id]; const permission=this.permission_overwrites[id];
permision.allow=perms.allow; permission.allow=perms.allow;
permision.deny=perms.deny; permission.deny=perms.deny;
await fetch(this.info.api.toString()+"/channels/"+this.id+"/permissions/"+id,{ await fetch(this.info.api.toString()+"/channels/"+this.id+"/permissions/"+id,{
method:"PUT", method:"PUT",
headers:this.headers, headers:this.headers,
body:JSON.stringify({ body:JSON.stringify({
allow:permision.allow.toString(), allow:permission.allow.toString(),
deny:permision.deny.toString(), deny:permission.deny.toString(),
id:id, id:id,
type:0 type:0
}) })

View file

@ -22,7 +22,7 @@ class Direct extends Guild{
this.roles=[]; this.roles=[];
this.roleids={}; this.roleids={};
this.prevchannel=undefined; this.prevchannel=undefined;
this.properties.name="Dirrect Messages"; this.properties.name="Direct Messages";
for(const thing of JSON){ for(const thing of JSON){
const temp=new Group(thing,this); const temp=new Group(thing,this);
this.channels.push(temp); this.channels.push(temp);
@ -77,7 +77,7 @@ class Group extends Channel{
this.name??=this.localuser.user.username; this.name??=this.localuser.user.username;
this.id=JSON.id; this.id=JSON.id;
this.parent_id=null; this.parent_id=null;
this.parrent=null; this.parent=null;
this.children=[]; this.children=[];
this.guild_id="@me"; this.guild_id="@me";
this.messageids={}; this.messageids={};

View file

@ -170,10 +170,10 @@ class Embed{
const div=document.createElement("div"); const div=document.createElement("div");
div.classList.add("embed"); div.classList.add("embed");
if(this.json.provider){ if(this.json.provider){
const providor=document.createElement("p"); const provider=document.createElement("p");
providor.classList.add("provider"); provider.classList.add("provider");
providor.textContent=this.json.provider.name; provider.textContent=this.json.provider.name;
div.append(providor); div.append(provider);
} }
const a=document.createElement("a"); const a=document.createElement("a");
a.href=this.json.url; a.href=this.json.url;

View file

@ -423,7 +423,7 @@ class Guild{
this.channelids[JSON.id]=thischannel; this.channelids[JSON.id]=thischannel;
this.channels.push(thischannel); this.channels.push(thischannel);
thischannel.resolveparent(this); thischannel.resolveparent(this);
if(!thischannel.parrent){ if(!thischannel.parent){
this.headchannels.push(thischannel); this.headchannels.push(thischannel);
} }
this.calculateReorder(); this.calculateReorder();
@ -489,8 +489,8 @@ class Guild{
build.push(thing) build.push(thing)
}else{ }else{
console.log("fail"); console.log("fail");
if(thing.parrent){ if(thing.parent){
thing.parrent.delChannel(JSON); thing.parent.delChannel(JSON);
} }
} }
} }
@ -500,7 +500,7 @@ class Guild{
} }
createChannel(name:string,type:number){ createChannel(name:string,type:number){
fetch(this.info.api.toString()+"/guilds/"+this.id+"/channels",{ fetch(this.info.api.toString()+"/guilds/"+this.id+"/channels",{
method:"Post", method:"POST",
headers:this.headers, headers:this.headers,
body:JSON.stringify({name: name, type: type}) body:JSON.stringify({name: name, type: type})
}) })

View file

@ -28,7 +28,7 @@
<div class="userflex"> <div class="userflex">
<p id="username">USERNAME</p> <p id="username">USERNAME</p>
<p id="status">SATUS</p> <p id="status">STATUS</p>
</div> </div>
</div> </div>
<h2 id="settings"></h2> <h2 id="settings"></h2>
@ -47,15 +47,15 @@
<div id="pasteimage"></div> <div id="pasteimage"></div>
<div id="replybox" class="hideReplyBox"></div> <div id="replybox" class="hideReplyBox"></div>
<div id="typediv"> <div id="typediv">
<textarea id="typebox"></textarea> <textarea id="typebox"></textarea>
<div id="typing" class="hidden"> <div id="typing" class="hidden">
<p id="typingtext">typing</p> <p id="typingtext">typing</p>
<div class="loading-indicator"> <div class="loading-indicator">
<span class="dot">.</span> <span class="dot">.</span>
<span class="dot">.</span> <span class="dot">.</span>
<span class="dot">.</span> <span class="dot">.</span>
</div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -168,7 +168,7 @@ class Localuser{
break; break;
case "TYPING_START": case "TYPING_START":
if(this.initialized){ if(this.initialized){
this.typeingStart(temp); this.typingStart(temp);
} }
break; break;
case "USER_UPDATE": case "USER_UPDATE":
@ -208,7 +208,7 @@ class Localuser{
const guildy=new Guild(temp.d,this,this.user); const guildy=new Guild(temp.d,this,this.user);
this.guilds.push(guildy); this.guilds.push(guildy);
this.guildids[guildy.id]=guildy; this.guildids[guildy.id]=guildy;
document.getElementById("servers").insertBefore(guildy.generateGuildIcon(),document.getElementById("bottomseperator")); document.getElementById("servers").insertBefore(guildy.generateGuildIcon(),document.getElementById("bottomseparator"));
} }
} }
@ -351,7 +351,7 @@ class Localuser{
const br=document.createElement("hr"); const br=document.createElement("hr");
br.classList.add("lightbr"); br.classList.add("lightbr");
serverlist.appendChild(br); serverlist.appendChild(br);
br.id="bottomseperator"; br.id="bottomseparator";
const div=document.createElement("div"); const div=document.createElement("div");
div.textContent="+"; div.textContent="+";
@ -423,7 +423,7 @@ class Localuser{
thing.unreads(this.guildhtml[thing.id]); thing.unreads(this.guildhtml[thing.id]);
} }
} }
typeingStart(typing):void{ typingStart(typing):void{
if(this.channelfocus.id===typing.d.channel_id){ if(this.channelfocus.id===typing.d.channel_id){
const memb=typing.d.member; const memb=typing.d.member;
let name; let name;
@ -517,16 +517,16 @@ class Localuser{
} }
} }
genusersettings():void{ genusersettings():void{
const hypothetcialprofie=document.createElement("div"); const hypotheticalProfile=document.createElement("div");
let file=null; let file=null;
let newprouns=null; let newprouns=null;
let newbio=null; let newbio=null;
let hypouser=new User(this.user,this,true); let hypouser=new User(this.user,this,true);
function regen(){ function regen(){
hypothetcialprofie.textContent=""; hypotheticalProfile.textContent="";
const hypoprofile=hypouser.buildprofile(-1,-1); const hypoprofile=hypouser.buildprofile(-1,-1);
hypothetcialprofie.appendChild(hypoprofile) hypotheticalProfile.appendChild(hypoprofile)
} }
regen(); regen();
this.usersettings=new Fullscreen( this.usersettings=new Fullscreen(
@ -573,7 +573,7 @@ class Localuser{
},Voice.sounds.indexOf(Voice.getNotificationSound())] },Voice.sounds.indexOf(Voice.getNotificationSound())]
], ],
["vdiv", ["vdiv",
["html",hypothetcialprofie] ["html",hypotheticalProfile]
] ]
],_=>{},function(){ ],_=>{},function(){
console.log(this); console.log(this);

View file

@ -25,10 +25,10 @@ function setDefaults(){
localStorage.setItem("userinfos",JSON.stringify({ localStorage.setItem("userinfos",JSON.stringify({
currentuser:null, currentuser:null,
users:{}, users:{},
preferances: preferences:
{ {
theme:"Dark", theme:"Dark",
notifcations:false, notifications:false,
notisound:"three", notisound:"three",
}, },
})); }));
@ -37,15 +37,15 @@ function setDefaults(){
if(userinfos.users===undefined){ if(userinfos.users===undefined){
userinfos.users={}; userinfos.users={};
} }
if(userinfos.preferances===undefined){ if(userinfos.preferences===undefined){
userinfos.preferances={ userinfos.preferences={
theme:"Dark", theme:"Dark",
notifcations:false, notifications:false,
notisound:"three", notisound:"three",
} }
} }
if(userinfos.preferances&&(userinfos.preferances.notisound===undefined)){ if(userinfos.preferences&&(userinfos.preferences.notisound===undefined)){
userinfos.preferances.notisound="three"; userinfos.preferences.notisound="three";
} }
localStorage.setItem("userinfos",JSON.stringify(userinfos)); localStorage.setItem("userinfos",JSON.stringify(userinfos));
} }
@ -158,7 +158,7 @@ async function login(username, password){
try{ try{
const info=JSON.parse(localStorage.getItem("instanceinfo")); const info=JSON.parse(localStorage.getItem("instanceinfo"));
const url=new URL(info.login); const url=new URL(info.login);
return await fetch(url.origin+'/api/auth/login',options).then(responce=>responce.json()) return await fetch(url.origin+'/api/auth/login',options).then(response=>response.json())
.then((response) => { .then((response) => {
console.log(response,response.message) console.log(response,response.message)
if("Invalid Form Body"===response.message){ if("Invalid Form Body"===response.message){

View file

@ -270,12 +270,12 @@ function markdown(text : string|string[],{keep=false,stdsize=false} = {}){
if(find===count){ if(find===count){
appendcurrent(); appendcurrent();
i=j; i=j;
const underscores="~~"; const tildes="~~";
if(count===2){ if(count===2){
const s=document.createElement("s"); const s=document.createElement("s");
if(keep){s.append(underscores)} if(keep){s.append(tildes)}
s.appendChild(markdown(build,{keep:keep,stdsize:stdsize})); s.appendChild(markdown(build,{keep:keep,stdsize:stdsize}));
if(keep){s.append(underscores)} if(keep){s.append(tildes)}
span.appendChild(s); span.appendChild(s);
} }
continue; continue;
@ -300,14 +300,14 @@ function markdown(text : string|string[],{keep=false,stdsize=false} = {}){
if(find===count){ if(find===count){
appendcurrent(); appendcurrent();
i=j; i=j;
const underscores="||"; const pipes="||";
if(count===2){ if(count===2){
const j=document.createElement("j"); const j=document.createElement("j");
if(keep){j.append(underscores)} if(keep){j.append(pipes)}
j.appendChild(markdown(build,{keep:keep,stdsize:stdsize})); j.appendChild(markdown(build,{keep:keep,stdsize:stdsize}));
j.classList.add("spoiler"); j.classList.add("spoiler");
j.onclick=markdown.unspoil; j.onclick=markdown.unspoil;
if(keep){j.append(underscores)} if(keep){j.append(pipes)}
span.appendChild(j); span.appendChild(j);
} }
continue; continue;

View file

@ -119,7 +119,7 @@ class Member{
} }
isAdmin(){ isAdmin(){
for(const role of this.roles){ for(const role of this.roles){
if(role.permissions.getPermision("ADMINISTRATOR")){ if(role.permissions.getPermission("ADMINISTRATOR")){
return true; return true;
} }
} }

View file

@ -269,11 +269,11 @@ class Message{
build.appendChild(text) build.appendChild(text)
if(this.attachments.length){ if(this.attachments.length){
console.log(this.attachments) console.log(this.attachments)
const attatch = document.createElement("tr") const attach = document.createElement("tr")
for(const thing of this.attachments){ for(const thing of this.attachments){
attatch.appendChild(thing.getHTML()) attach.appendChild(thing.getHTML())
} }
messagedwrap.appendChild(attatch) messagedwrap.appendChild(attach)
} }
if(this.embeds.length){ if(this.embeds.length){
const embeds = document.createElement("tr") const embeds = document.createElement("tr")

View file

@ -8,10 +8,10 @@ class Permissions{
this.allow=BigInt(allow); this.allow=BigInt(allow);
this.deny=BigInt(deny); this.deny=BigInt(deny);
} }
getPermisionbit(b:number,big:bigint) : boolean{ getPermissionbit(b:number,big:bigint) : boolean{
return Boolean((big>>BigInt(b))&1n); return Boolean((big>>BigInt(b))&1n);
} }
setPermisionbit(b:number,state:boolean,big:bigint) : bigint{ setPermissionbit(b:number,state:boolean,big:bigint) : bigint{
const bit=1n<<BigInt(b); const bit=1n<<BigInt(b);
return (big & ~bit) | (BigInt(state) << BigInt(b));//thanks to geotale for this code :3 return (big & ~bit) | (BigInt(state) << BigInt(b));//thanks to geotale for this code :3
} }
@ -235,28 +235,28 @@ class Permissions{
i++; i++;
} }
} }
getPermision(name:string):number{ getPermission(name:string):number{
if(this.getPermisionbit(Permissions.map[name] as number,this.allow)){ if(this.getPermissionbit(Permissions.map[name] as number,this.allow)){
return 1; return 1;
}else if(this.getPermisionbit(Permissions.map[name] as number,this.deny)){ }else if(this.getPermissionbit(Permissions.map[name] as number,this.deny)){
return -1; return -1;
}else{ }else{
return 0; return 0;
} }
} }
setPermision(name:string,setto:number):void{ setPermission(name:string,setto:number):void{
const bit=Permissions.map[name] as number; const bit=Permissions.map[name] as number;
if(setto===0){ if(setto===0){
this.deny=this.setPermisionbit(bit,false,this.deny); this.deny=this.setPermissionbit(bit,false,this.deny);
this.allow=this.setPermisionbit(bit,false,this.allow); this.allow=this.setPermissionbit(bit,false,this.allow);
}else if(setto===1){ }else if(setto===1){
this.deny=this.setPermisionbit(bit,false,this.deny); this.deny=this.setPermissionbit(bit,false,this.deny);
this.allow=this.setPermisionbit(bit,true,this.allow); this.allow=this.setPermissionbit(bit,true,this.allow);
}else if(setto===-1){ }else if(setto===-1){
this.deny=this.setPermisionbit(bit,true,this.deny); this.deny=this.setPermissionbit(bit,true,this.deny);
this.allow=this.setPermisionbit(bit,false,this.allow); this.allow=this.setPermissionbit(bit,false,this.allow);
}else{ }else{
console.error("invalid number entered:"+setto); console.error("invalid number entered:"+setto);
} }

View file

@ -28,7 +28,7 @@
<input type="date" id="start" name="date"/><br><br> <input type="date" id="start" name="date"/><br><br>
<b id="TOSbox">I agree to the <a href="" id="TOSa">TOS</a>:</b> <b id="TOSbox">I agree to the <a href="" id="TOSa">Terms of Service</a>:</b>
<input type="checkbox" id="TOS" name="TOS"/><br> <input type="checkbox" id="TOS" name="TOS"/><br>
<p class="wrongred" id="wrong"></p><br> <p class="wrongred" id="wrong"></p><br>
<button type="submit">Create account</button> <button type="submit">Create account</button>

View file

@ -46,11 +46,11 @@ async function tosLogic(){
const apiurl=new URL(JSON.parse(localStorage.getItem("instanceinfo")).api) const apiurl=new URL(JSON.parse(localStorage.getItem("instanceinfo")).api)
const tosPage=(await (await fetch(apiurl.toString()+"/ping")).json()).instance.tosPage; const tosPage=(await (await fetch(apiurl.toString()+"/ping")).json()).instance.tosPage;
if(tosPage){ if(tosPage){
document.getElementById("TOSbox").innerHTML="I agree to the <a href=\"\" id=\"TOSa\">TOS</a>:"; document.getElementById("TOSbox").innerHTML="I agree to the <a href=\"\" id=\"TOSa\">Terms of Service</a>:";
TOSa=document.getElementById("TOSa"); TOSa=document.getElementById("TOSa");
TOSa.href=tosPage; TOSa.href=tosPage;
}else{ }else{
document.getElementById("TOSbox").textContent="This instance has no TOS, accept TOS anyways:"; document.getElementById("TOSbox").textContent="This instance has no Terms of Service, accept ToS anyways:";
TOSa=null; TOSa=null;
} }
console.log(tosPage); console.log(tosPage);

View file

@ -63,11 +63,11 @@ class Buttons{
save(){} save(){}
} }
class PermisionToggle{ class PermissionToggle{
readonly rolejson:{name:string,readableName:string,description:string}; readonly rolejson:{name:string,readableName:string,description:string};
permissions:Permissions; permissions:Permissions;
owner:Options; owner:Options;
constructor(roleJSON:PermisionToggle["rolejson"],permissions:Permissions,owner:Options){ constructor(roleJSON:PermissionToggle["rolejson"],permissions:Permissions,owner:Options){
this.rolejson=roleJSON; this.rolejson=roleJSON;
this.permissions=permissions; this.permissions=permissions;
this.owner=owner; this.owner=owner;
@ -90,7 +90,7 @@ class PermisionToggle{
generateCheckbox():HTMLElement{ generateCheckbox():HTMLElement{
const div=document.createElement("div"); const div=document.createElement("div");
div.classList.add("tritoggle"); div.classList.add("tritoggle");
const state=this.permissions.getPermision(this.rolejson.name); const state=this.permissions.getPermission(this.rolejson.name);
const on=document.createElement("input"); const on=document.createElement("input");
on.type="radio"; on.type="radio";
@ -98,7 +98,7 @@ class PermisionToggle{
div.append(on); div.append(on);
if(state===1){on.checked=true;}; if(state===1){on.checked=true;};
on.onclick=_=>{ on.onclick=_=>{
this.permissions.setPermision(this.rolejson.name,1); this.permissions.setPermission(this.rolejson.name,1);
this.owner.changed(); this.owner.changed();
} }
@ -108,7 +108,7 @@ class PermisionToggle{
div.append(no); div.append(no);
if(state===0){no.checked=true;}; if(state===0){no.checked=true;};
no.onclick=_=>{ no.onclick=_=>{
this.permissions.setPermision(this.rolejson.name,0); this.permissions.setPermission(this.rolejson.name,0);
this.owner.changed(); this.owner.changed();
} }
if(this.permissions.hasDeny){ if(this.permissions.hasDeny){
@ -118,7 +118,7 @@ class PermisionToggle{
div.append(off); div.append(off);
if(state===-1){off.checked=true;}; if(state===-1){off.checked=true;};
off.onclick=_=>{ off.onclick=_=>{
this.permissions.setPermision(this.rolejson.name,-1); this.permissions.setPermission(this.rolejson.name,-1);
this.owner.changed(); this.owner.changed();
} }
} }
@ -147,7 +147,7 @@ class RoleList extends Buttons{
this.permission=new Permissions("0"); this.permission=new Permissions("0");
} }
for(const thing of Permissions.info){ for(const thing of Permissions.info){
options.addPermisionToggle(thing,this.permission);// options.addPermissionToggle(thing,this.permission);//
} }
for(const i of permissions){ for(const i of permissions){
this.buttons.push([guild.getRole(i[0]).name,i[0]])// this.buttons.push([guild.getRole(i[0]).name,i[0]])//
@ -170,7 +170,7 @@ class RoleList extends Buttons{
class Options{ class Options{
name:string; name:string;
haschanged=false; haschanged=false;
readonly options:(PermisionToggle|Buttons|RoleList)[]; readonly options:(PermissionToggle|Buttons|RoleList)[];
readonly owner:Buttons; readonly owner:Buttons;
constructor(name:string,owner:Buttons){ constructor(name:string,owner:Buttons){
@ -179,8 +179,8 @@ class Options{
this.owner=owner; this.owner=owner;
} }
addPermisionToggle(roleJSON:PermisionToggle["rolejson"],permissions:Permissions){ addPermissionToggle(roleJSON:PermissionToggle["rolejson"],permissions:Permissions){
this.options.push(new PermisionToggle(roleJSON,permissions,this)); this.options.push(new PermissionToggle(roleJSON,permissions,this));
} }
generateHTML():HTMLElement{ generateHTML():HTMLElement{
const div=document.createElement("div"); const div=document.createElement("div");