[breaking] fix typos
This commit is contained in:
parent
8fe0c9f46b
commit
611e58090b
15 changed files with 113 additions and 115 deletions
|
@ -42,13 +42,13 @@ class Voice{
|
|||
this.updateWave();
|
||||
}
|
||||
updateWave():void{
|
||||
const func=this.waveFucnion();
|
||||
const func=this.waveFunction();
|
||||
for (let i = 0; i < this.buffer.length; i++) {
|
||||
this.buffer[i]=func(i/this.audioCtx.sampleRate,this.freq);
|
||||
}
|
||||
|
||||
}
|
||||
waveFucnion():Function{
|
||||
waveFunction():Function{
|
||||
if(typeof this.wave === 'function'){
|
||||
return this.wave;
|
||||
}
|
||||
|
@ -134,12 +134,12 @@ class Voice{
|
|||
}
|
||||
static setNotificationSound(sound:string){
|
||||
let userinfos=getBulkInfo();
|
||||
userinfos.preferances.notisound=sound;
|
||||
userinfos.preferences.notisound=sound;
|
||||
localStorage.setItem("userinfos",JSON.stringify(userinfos));
|
||||
}
|
||||
static getNotificationSound(){
|
||||
let userinfos=getBulkInfo();
|
||||
return userinfos.preferances.notisound;
|
||||
return userinfos.preferences.notisound;
|
||||
}
|
||||
}
|
||||
export {Voice as Voice};
|
||||
|
|
|
@ -24,7 +24,7 @@ class Channel{
|
|||
name:string;
|
||||
id:string;
|
||||
parent_id:string;
|
||||
parrent:Channel;
|
||||
parent:Channel;
|
||||
children:Channel[];
|
||||
guild_id:string;
|
||||
messageids:{[key : string]:Message};
|
||||
|
@ -95,7 +95,7 @@ class Channel{
|
|||
this.name=JSON.name;
|
||||
this.id=JSON.id;
|
||||
this.parent_id=JSON.parent_id;
|
||||
this.parrent=null;
|
||||
this.parent=null;
|
||||
this.children=[];
|
||||
this.guild_id=JSON.guild_id;
|
||||
this.messageids={};
|
||||
|
@ -142,12 +142,12 @@ class Channel{
|
|||
}
|
||||
for(const thing of member.roles){
|
||||
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){
|
||||
return perm===1;
|
||||
}
|
||||
}
|
||||
if(thing.permissions.getPermision(name)){
|
||||
if(thing.permissions.getPermission(name)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -163,12 +163,12 @@ class Channel{
|
|||
this.children.sort((a,b)=>{return a.position-b.position});
|
||||
}
|
||||
resolveparent(guild:Guild){
|
||||
this.parrent=guild.channelids[this.parent_id];
|
||||
this.parrent??=null;
|
||||
if(this.parrent!==null){
|
||||
this.parrent.children.push(this);
|
||||
this.parent=guild.channelids[this.parent_id];
|
||||
this.parent??=null;
|
||||
if(this.parent!==null){
|
||||
this.parent.children.push(this);
|
||||
}
|
||||
return this.parrent===null;
|
||||
return this.parent===null;
|
||||
}
|
||||
calculateReorder(){
|
||||
let position=-1;
|
||||
|
@ -298,9 +298,9 @@ class Channel{
|
|||
const search=document.getElementById("channels").children[0].children
|
||||
if(this.guild!==this.localuser.lookingguild){
|
||||
return null
|
||||
}else if(this.parrent){
|
||||
}else if(this.parent){
|
||||
for(const thing of search){
|
||||
if(thing["all"]===this.parrent){
|
||||
if(thing["all"]===this.parent){
|
||||
for(const thing2 of thing.children[1].children){
|
||||
if(thing2["all"]===this){
|
||||
return thing2;
|
||||
|
@ -347,30 +347,30 @@ class Channel{
|
|||
event.preventDefault();
|
||||
if(container){
|
||||
that.move_id=this.id;
|
||||
if(that.parrent){
|
||||
that.parrent.children.splice(that.parrent.children.indexOf(that),1);
|
||||
if(that.parent){
|
||||
that.parent.children.splice(that.parent.children.indexOf(that),1);
|
||||
}
|
||||
that.parrent=this;
|
||||
that.parent=this;
|
||||
(container as HTMLElement).prepend(Channel.dragged[1]);
|
||||
this.children.unshift(that);
|
||||
}else{
|
||||
console.log(this,Channel.dragged);
|
||||
that.move_id=this.parent_id;
|
||||
if(that.parrent){
|
||||
that.parrent.children.splice(that.parrent.children.indexOf(that),1);
|
||||
if(that.parent){
|
||||
that.parent.children.splice(that.parent.children.indexOf(that),1);
|
||||
}else{
|
||||
this.guild.headchannels.splice(this.guild.headchannels.indexOf(that),1);
|
||||
}
|
||||
that.parrent=this.parrent;
|
||||
if(that.parrent){
|
||||
that.parent=this.parent;
|
||||
if(that.parent){
|
||||
const build=[];
|
||||
for(let i=0;i<that.parrent.children.length;i++){
|
||||
build.push(that.parrent.children[i])
|
||||
if(that.parrent.children[i]===this){
|
||||
for(let i=0;i<that.parent.children.length;i++){
|
||||
build.push(that.parent.children[i])
|
||||
if(that.parent.children[i]===this){
|
||||
build.push(that);
|
||||
}
|
||||
}
|
||||
that.parrent.children=build;
|
||||
that.parent.children=build;
|
||||
}else{
|
||||
const build=[];
|
||||
for(let i=0;i<this.guild.headchannels.length;i++){
|
||||
|
@ -390,7 +390,7 @@ class Channel{
|
|||
}
|
||||
createChannel(name:string,type:number){
|
||||
fetch(this.info.api.toString()+"/guilds/"+this.guild.id+"/channels",{
|
||||
method:"Post",
|
||||
method:"POST",
|
||||
headers:this.headers,
|
||||
body:JSON.stringify({
|
||||
name: name,
|
||||
|
@ -511,14 +511,13 @@ class Channel{
|
|||
async putmessages(){
|
||||
if(this.messages.length>=100||this.allthewayup){return};
|
||||
const j=await fetch(this.info.api.toString()+"/channels/"+this.id+"/messages?limit=100",{
|
||||
method: 'GET',
|
||||
headers: this.headers,
|
||||
})
|
||||
const responce=await j.json();
|
||||
if(responce.length!==100){
|
||||
const response=await j.json();
|
||||
if(response.length!==100){
|
||||
this.allthewayup=true;
|
||||
}
|
||||
for(const thing of responce){
|
||||
for(const thing of response){
|
||||
const messager=new Message(thing,this)
|
||||
if(this.messageids[messager.id]===undefined){
|
||||
this.messageids[messager.id]=messager;
|
||||
|
@ -542,24 +541,23 @@ class Channel{
|
|||
const out=this;
|
||||
|
||||
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
|
||||
}).then((j)=>{return j.json()}).then(responce=>{
|
||||
}).then((j)=>{return j.json()}).then(response=>{
|
||||
//messages.innerHTML = '';
|
||||
//responce.reverse()
|
||||
//response.reverse()
|
||||
let next:Message;
|
||||
if(responce.length===0){
|
||||
if(response.length===0){
|
||||
out.allthewayup=true;
|
||||
}
|
||||
for(const i in responce){
|
||||
for(const i in response){
|
||||
let messager:Message;
|
||||
if(!next){
|
||||
messager=new Message(responce[i],this)
|
||||
messager=new Message(response[i],this)
|
||||
}else{
|
||||
messager=next;
|
||||
}
|
||||
if(responce[+i+1]!==undefined){
|
||||
next=new Message(responce[+i+1],this);
|
||||
if(response[+i+1]!==undefined){
|
||||
next=new Message(response[+i+1],this);
|
||||
}else{
|
||||
next=undefined;
|
||||
console.log("ohno",+i+1)
|
||||
|
@ -593,7 +591,7 @@ class Channel{
|
|||
this.type=JSON.type;
|
||||
this.name=JSON.name;
|
||||
this.parent_id=JSON.parent_id;
|
||||
this.parrent=null;
|
||||
this.parent=null;
|
||||
this.children=[];
|
||||
this.guild_id=JSON.guild_id;
|
||||
this.messageids={};
|
||||
|
@ -763,15 +761,15 @@ class Channel{
|
|||
this.permission_overwritesar.push([role.id,perm]);
|
||||
}
|
||||
async updateRolePermissions(id:string,perms:Permissions){
|
||||
const permision=this.permission_overwrites[id];
|
||||
permision.allow=perms.allow;
|
||||
permision.deny=perms.deny;
|
||||
const permission=this.permission_overwrites[id];
|
||||
permission.allow=perms.allow;
|
||||
permission.deny=perms.deny;
|
||||
await fetch(this.info.api.toString()+"/channels/"+this.id+"/permissions/"+id,{
|
||||
method:"PUT",
|
||||
headers:this.headers,
|
||||
body:JSON.stringify({
|
||||
allow:permision.allow.toString(),
|
||||
deny:permision.deny.toString(),
|
||||
allow:permission.allow.toString(),
|
||||
deny:permission.deny.toString(),
|
||||
id:id,
|
||||
type:0
|
||||
})
|
||||
|
|
|
@ -22,7 +22,7 @@ class Direct extends Guild{
|
|||
this.roles=[];
|
||||
this.roleids={};
|
||||
this.prevchannel=undefined;
|
||||
this.properties.name="Dirrect Messages";
|
||||
this.properties.name="Direct Messages";
|
||||
for(const thing of JSON){
|
||||
const temp=new Group(thing,this);
|
||||
this.channels.push(temp);
|
||||
|
@ -77,7 +77,7 @@ class Group extends Channel{
|
|||
this.name??=this.localuser.user.username;
|
||||
this.id=JSON.id;
|
||||
this.parent_id=null;
|
||||
this.parrent=null;
|
||||
this.parent=null;
|
||||
this.children=[];
|
||||
this.guild_id="@me";
|
||||
this.messageids={};
|
||||
|
|
|
@ -170,10 +170,10 @@ class Embed{
|
|||
const div=document.createElement("div");
|
||||
div.classList.add("embed");
|
||||
if(this.json.provider){
|
||||
const providor=document.createElement("p");
|
||||
providor.classList.add("provider");
|
||||
providor.textContent=this.json.provider.name;
|
||||
div.append(providor);
|
||||
const provider=document.createElement("p");
|
||||
provider.classList.add("provider");
|
||||
provider.textContent=this.json.provider.name;
|
||||
div.append(provider);
|
||||
}
|
||||
const a=document.createElement("a");
|
||||
a.href=this.json.url;
|
||||
|
|
|
@ -423,7 +423,7 @@ class Guild{
|
|||
this.channelids[JSON.id]=thischannel;
|
||||
this.channels.push(thischannel);
|
||||
thischannel.resolveparent(this);
|
||||
if(!thischannel.parrent){
|
||||
if(!thischannel.parent){
|
||||
this.headchannels.push(thischannel);
|
||||
}
|
||||
this.calculateReorder();
|
||||
|
@ -489,8 +489,8 @@ class Guild{
|
|||
build.push(thing)
|
||||
}else{
|
||||
console.log("fail");
|
||||
if(thing.parrent){
|
||||
thing.parrent.delChannel(JSON);
|
||||
if(thing.parent){
|
||||
thing.parent.delChannel(JSON);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ class Guild{
|
|||
}
|
||||
createChannel(name:string,type:number){
|
||||
fetch(this.info.api.toString()+"/guilds/"+this.id+"/channels",{
|
||||
method:"Post",
|
||||
method:"POST",
|
||||
headers:this.headers,
|
||||
body:JSON.stringify({name: name, type: type})
|
||||
})
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
<div class="userflex">
|
||||
<p id="username">USERNAME</p>
|
||||
<p id="status">SATUS</p>
|
||||
<p id="status">STATUS</p>
|
||||
</div>
|
||||
</div>
|
||||
<h2 id="settings">⚙</h2>
|
||||
|
@ -47,15 +47,15 @@
|
|||
<div id="pasteimage"></div>
|
||||
<div id="replybox" class="hideReplyBox"></div>
|
||||
<div id="typediv">
|
||||
<textarea id="typebox"></textarea>
|
||||
<div id="typing" class="hidden">
|
||||
<p id="typingtext">typing</p>
|
||||
<div class="loading-indicator">
|
||||
<span class="dot">.</span>
|
||||
<span class="dot">.</span>
|
||||
<span class="dot">.</span>
|
||||
</div>
|
||||
<textarea id="typebox"></textarea>
|
||||
<div id="typing" class="hidden">
|
||||
<p id="typingtext">typing</p>
|
||||
<div class="loading-indicator">
|
||||
<span class="dot">.</span>
|
||||
<span class="dot">.</span>
|
||||
<span class="dot">.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -168,7 +168,7 @@ class Localuser{
|
|||
break;
|
||||
case "TYPING_START":
|
||||
if(this.initialized){
|
||||
this.typeingStart(temp);
|
||||
this.typingStart(temp);
|
||||
}
|
||||
break;
|
||||
case "USER_UPDATE":
|
||||
|
@ -208,7 +208,7 @@ class Localuser{
|
|||
const guildy=new Guild(temp.d,this,this.user);
|
||||
this.guilds.push(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");
|
||||
br.classList.add("lightbr");
|
||||
serverlist.appendChild(br);
|
||||
br.id="bottomseperator";
|
||||
br.id="bottomseparator";
|
||||
|
||||
const div=document.createElement("div");
|
||||
div.textContent="+";
|
||||
|
@ -423,7 +423,7 @@ class Localuser{
|
|||
thing.unreads(this.guildhtml[thing.id]);
|
||||
}
|
||||
}
|
||||
typeingStart(typing):void{
|
||||
typingStart(typing):void{
|
||||
if(this.channelfocus.id===typing.d.channel_id){
|
||||
const memb=typing.d.member;
|
||||
let name;
|
||||
|
@ -517,16 +517,16 @@ class Localuser{
|
|||
}
|
||||
}
|
||||
genusersettings():void{
|
||||
const hypothetcialprofie=document.createElement("div");
|
||||
const hypotheticalProfile=document.createElement("div");
|
||||
let file=null;
|
||||
let newprouns=null;
|
||||
let newbio=null;
|
||||
let hypouser=new User(this.user,this,true);
|
||||
function regen(){
|
||||
hypothetcialprofie.textContent="";
|
||||
hypotheticalProfile.textContent="";
|
||||
const hypoprofile=hypouser.buildprofile(-1,-1);
|
||||
|
||||
hypothetcialprofie.appendChild(hypoprofile)
|
||||
hypotheticalProfile.appendChild(hypoprofile)
|
||||
}
|
||||
regen();
|
||||
this.usersettings=new Fullscreen(
|
||||
|
@ -573,7 +573,7 @@ class Localuser{
|
|||
},Voice.sounds.indexOf(Voice.getNotificationSound())]
|
||||
],
|
||||
["vdiv",
|
||||
["html",hypothetcialprofie]
|
||||
["html",hypotheticalProfile]
|
||||
]
|
||||
],_=>{},function(){
|
||||
console.log(this);
|
||||
|
|
|
@ -25,10 +25,10 @@ function setDefaults(){
|
|||
localStorage.setItem("userinfos",JSON.stringify({
|
||||
currentuser:null,
|
||||
users:{},
|
||||
preferances:
|
||||
preferences:
|
||||
{
|
||||
theme:"Dark",
|
||||
notifcations:false,
|
||||
notifications:false,
|
||||
notisound:"three",
|
||||
},
|
||||
}));
|
||||
|
@ -37,15 +37,15 @@ function setDefaults(){
|
|||
if(userinfos.users===undefined){
|
||||
userinfos.users={};
|
||||
}
|
||||
if(userinfos.preferances===undefined){
|
||||
userinfos.preferances={
|
||||
if(userinfos.preferences===undefined){
|
||||
userinfos.preferences={
|
||||
theme:"Dark",
|
||||
notifcations:false,
|
||||
notifications:false,
|
||||
notisound:"three",
|
||||
}
|
||||
}
|
||||
if(userinfos.preferances&&(userinfos.preferances.notisound===undefined)){
|
||||
userinfos.preferances.notisound="three";
|
||||
if(userinfos.preferences&&(userinfos.preferences.notisound===undefined)){
|
||||
userinfos.preferences.notisound="three";
|
||||
}
|
||||
localStorage.setItem("userinfos",JSON.stringify(userinfos));
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ async function login(username, password){
|
|||
try{
|
||||
const info=JSON.parse(localStorage.getItem("instanceinfo"));
|
||||
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) => {
|
||||
console.log(response,response.message)
|
||||
if("Invalid Form Body"===response.message){
|
||||
|
|
|
@ -270,12 +270,12 @@ function markdown(text : string|string[],{keep=false,stdsize=false} = {}){
|
|||
if(find===count){
|
||||
appendcurrent();
|
||||
i=j;
|
||||
const underscores="~~";
|
||||
const tildes="~~";
|
||||
if(count===2){
|
||||
const s=document.createElement("s");
|
||||
if(keep){s.append(underscores)}
|
||||
if(keep){s.append(tildes)}
|
||||
s.appendChild(markdown(build,{keep:keep,stdsize:stdsize}));
|
||||
if(keep){s.append(underscores)}
|
||||
if(keep){s.append(tildes)}
|
||||
span.appendChild(s);
|
||||
}
|
||||
continue;
|
||||
|
@ -300,14 +300,14 @@ function markdown(text : string|string[],{keep=false,stdsize=false} = {}){
|
|||
if(find===count){
|
||||
appendcurrent();
|
||||
i=j;
|
||||
const underscores="||";
|
||||
const pipes="||";
|
||||
if(count===2){
|
||||
const j=document.createElement("j");
|
||||
if(keep){j.append(underscores)}
|
||||
if(keep){j.append(pipes)}
|
||||
j.appendChild(markdown(build,{keep:keep,stdsize:stdsize}));
|
||||
j.classList.add("spoiler");
|
||||
j.onclick=markdown.unspoil;
|
||||
if(keep){j.append(underscores)}
|
||||
if(keep){j.append(pipes)}
|
||||
span.appendChild(j);
|
||||
}
|
||||
continue;
|
||||
|
|
|
@ -119,7 +119,7 @@ class Member{
|
|||
}
|
||||
isAdmin(){
|
||||
for(const role of this.roles){
|
||||
if(role.permissions.getPermision("ADMINISTRATOR")){
|
||||
if(role.permissions.getPermission("ADMINISTRATOR")){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,11 +269,11 @@ class Message{
|
|||
build.appendChild(text)
|
||||
if(this.attachments.length){
|
||||
console.log(this.attachments)
|
||||
const attatch = document.createElement("tr")
|
||||
const attach = document.createElement("tr")
|
||||
for(const thing of this.attachments){
|
||||
attatch.appendChild(thing.getHTML())
|
||||
attach.appendChild(thing.getHTML())
|
||||
}
|
||||
messagedwrap.appendChild(attatch)
|
||||
messagedwrap.appendChild(attach)
|
||||
}
|
||||
if(this.embeds.length){
|
||||
const embeds = document.createElement("tr")
|
||||
|
|
|
@ -8,10 +8,10 @@ class Permissions{
|
|||
this.allow=BigInt(allow);
|
||||
this.deny=BigInt(deny);
|
||||
}
|
||||
getPermisionbit(b:number,big:bigint) : boolean{
|
||||
getPermissionbit(b:number,big:bigint) : boolean{
|
||||
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);
|
||||
return (big & ~bit) | (BigInt(state) << BigInt(b));//thanks to geotale for this code :3
|
||||
}
|
||||
|
@ -235,28 +235,28 @@ class Permissions{
|
|||
i++;
|
||||
}
|
||||
}
|
||||
getPermision(name:string):number{
|
||||
if(this.getPermisionbit(Permissions.map[name] as number,this.allow)){
|
||||
getPermission(name:string):number{
|
||||
if(this.getPermissionbit(Permissions.map[name] as number,this.allow)){
|
||||
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;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
setPermision(name:string,setto:number):void{
|
||||
setPermission(name:string,setto:number):void{
|
||||
const bit=Permissions.map[name] as number;
|
||||
if(setto===0){
|
||||
this.deny=this.setPermisionbit(bit,false,this.deny);
|
||||
this.allow=this.setPermisionbit(bit,false,this.allow);
|
||||
this.deny=this.setPermissionbit(bit,false,this.deny);
|
||||
this.allow=this.setPermissionbit(bit,false,this.allow);
|
||||
}else if(setto===1){
|
||||
|
||||
this.deny=this.setPermisionbit(bit,false,this.deny);
|
||||
this.allow=this.setPermisionbit(bit,true,this.allow);
|
||||
this.deny=this.setPermissionbit(bit,false,this.deny);
|
||||
this.allow=this.setPermissionbit(bit,true,this.allow);
|
||||
}else if(setto===-1){
|
||||
|
||||
this.deny=this.setPermisionbit(bit,true,this.deny);
|
||||
this.allow=this.setPermisionbit(bit,false,this.allow);
|
||||
this.deny=this.setPermissionbit(bit,true,this.deny);
|
||||
this.allow=this.setPermissionbit(bit,false,this.allow);
|
||||
}else{
|
||||
console.error("invalid number entered:"+setto);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<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>
|
||||
<p class="wrongred" id="wrong"></p><br>
|
||||
<button type="submit">Create account</button>
|
||||
|
|
|
@ -46,11 +46,11 @@ async function tosLogic(){
|
|||
const apiurl=new URL(JSON.parse(localStorage.getItem("instanceinfo")).api)
|
||||
const tosPage=(await (await fetch(apiurl.toString()+"/ping")).json()).instance.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.href=tosPage;
|
||||
}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;
|
||||
}
|
||||
console.log(tosPage);
|
||||
|
|
|
@ -63,11 +63,11 @@ class Buttons{
|
|||
save(){}
|
||||
}
|
||||
|
||||
class PermisionToggle{
|
||||
class PermissionToggle{
|
||||
readonly rolejson:{name:string,readableName:string,description:string};
|
||||
permissions:Permissions;
|
||||
owner:Options;
|
||||
constructor(roleJSON:PermisionToggle["rolejson"],permissions:Permissions,owner:Options){
|
||||
constructor(roleJSON:PermissionToggle["rolejson"],permissions:Permissions,owner:Options){
|
||||
this.rolejson=roleJSON;
|
||||
this.permissions=permissions;
|
||||
this.owner=owner;
|
||||
|
@ -90,7 +90,7 @@ class PermisionToggle{
|
|||
generateCheckbox():HTMLElement{
|
||||
const div=document.createElement("div");
|
||||
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");
|
||||
on.type="radio";
|
||||
|
@ -98,7 +98,7 @@ class PermisionToggle{
|
|||
div.append(on);
|
||||
if(state===1){on.checked=true;};
|
||||
on.onclick=_=>{
|
||||
this.permissions.setPermision(this.rolejson.name,1);
|
||||
this.permissions.setPermission(this.rolejson.name,1);
|
||||
this.owner.changed();
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ class PermisionToggle{
|
|||
div.append(no);
|
||||
if(state===0){no.checked=true;};
|
||||
no.onclick=_=>{
|
||||
this.permissions.setPermision(this.rolejson.name,0);
|
||||
this.permissions.setPermission(this.rolejson.name,0);
|
||||
this.owner.changed();
|
||||
}
|
||||
if(this.permissions.hasDeny){
|
||||
|
@ -118,7 +118,7 @@ class PermisionToggle{
|
|||
div.append(off);
|
||||
if(state===-1){off.checked=true;};
|
||||
off.onclick=_=>{
|
||||
this.permissions.setPermision(this.rolejson.name,-1);
|
||||
this.permissions.setPermission(this.rolejson.name,-1);
|
||||
this.owner.changed();
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ class RoleList extends Buttons{
|
|||
this.permission=new Permissions("0");
|
||||
}
|
||||
for(const thing of Permissions.info){
|
||||
options.addPermisionToggle(thing,this.permission);//
|
||||
options.addPermissionToggle(thing,this.permission);//
|
||||
}
|
||||
for(const i of permissions){
|
||||
this.buttons.push([guild.getRole(i[0]).name,i[0]])//
|
||||
|
@ -170,7 +170,7 @@ class RoleList extends Buttons{
|
|||
class Options{
|
||||
name:string;
|
||||
haschanged=false;
|
||||
readonly options:(PermisionToggle|Buttons|RoleList)[];
|
||||
readonly options:(PermissionToggle|Buttons|RoleList)[];
|
||||
readonly owner:Buttons;
|
||||
|
||||
constructor(name:string,owner:Buttons){
|
||||
|
@ -179,8 +179,8 @@ class Options{
|
|||
this.owner=owner;
|
||||
|
||||
}
|
||||
addPermisionToggle(roleJSON:PermisionToggle["rolejson"],permissions:Permissions){
|
||||
this.options.push(new PermisionToggle(roleJSON,permissions,this));
|
||||
addPermissionToggle(roleJSON:PermissionToggle["rolejson"],permissions:Permissions){
|
||||
this.options.push(new PermissionToggle(roleJSON,permissions,this));
|
||||
}
|
||||
generateHTML():HTMLElement{
|
||||
const div=document.createElement("div");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue