From 0903266deeb7d7e43249c8882a93aa3cd981bfaf Mon Sep 17 00:00:00 2001 From: "[it/its]@Rory&" <[it/its]@Rory&> Date: Thu, 1 Jan 2026 15:40:12 +0100 Subject: [PATCH] visable -> visible --- src/webpage/channel.ts | 18 ++++++++-------- src/webpage/contextmenu.ts | 44 +++++++++++++++++++------------------- src/webpage/direct.ts | 7 +++--- src/webpage/guild.ts | 16 +++++++------- src/webpage/index.ts | 4 ++-- src/webpage/localuser.ts | 2 +- src/webpage/message.ts | 16 +++++++------- src/webpage/role.ts | 4 ++-- src/webpage/user.ts | 28 ++++++++++++------------ 9 files changed, 69 insertions(+), 70 deletions(-) diff --git a/src/webpage/channel.ts b/src/webpage/channel.ts index f1b1300..6ecd857 100644 --- a/src/webpage/channel.ts +++ b/src/webpage/channel.ts @@ -99,7 +99,7 @@ class Channel extends SnowFlake { this.createInvite(); }, { - visable: function () { + visible: function () { return this.hasPermission("CREATE_INSTANT_INVITE") && this.type !== 4; }, color: "blue", @@ -119,7 +119,7 @@ class Channel extends SnowFlake { this.muteChannel(); }, { - visable: function () { + visible: function () { return !this.muted && this.type !== 4; }, }, @@ -130,7 +130,7 @@ class Channel extends SnowFlake { this.unmuteChannel(); }, { - visable: function () { + visible: function () { return this.muted; }, }, @@ -142,7 +142,7 @@ class Channel extends SnowFlake { this.generateSettings(); }, { - visable: function () { + visible: function () { return this.hasPermission("MANAGE_CHANNELS"); }, icon: { @@ -162,7 +162,7 @@ class Channel extends SnowFlake { this.deleteChannel(); }, { - visable: function () { + visible: function () { return this.hasPermission("MANAGE_CHANNELS"); }, icon: { @@ -741,7 +741,7 @@ class Channel extends SnowFlake { } static dragged: [Channel, HTMLDivElement] | [] = []; html: WeakRef | undefined; - get visable() { + get visible() { return this.hasPermission("VIEW_CHANNEL"); } voiceUsers = new WeakRef(document.createElement("div")); @@ -807,10 +807,10 @@ class Channel extends SnowFlake { ); } this.html = new WeakRef(div); - if (!this.visable) { + if (!this.visible) { let quit = true; for (const thing of this.children) { - if (thing.visable) { + if (thing.visible) { quit = false; } } @@ -1706,7 +1706,7 @@ class Channel extends SnowFlake { command.render(typebox, this); } async getHTML(addstate = true, getMessages: boolean | void = undefined, aroundMessage?: string) { - if (!this.visable) { + if (!this.visible) { this.guild.loadChannel(); return; } diff --git a/src/webpage/contextmenu.ts b/src/webpage/contextmenu.ts index 7af5067..e351d66 100644 --- a/src/webpage/contextmenu.ts +++ b/src/webpage/contextmenu.ts @@ -25,7 +25,7 @@ class ContextButton implements menuPart { private text: string | ((this: x, arg: y) => string); private onClick: (this: x, arg: y, e: MouseEvent) => void; private icon?: iconJson; - private visable?: (this: x, arg: y) => boolean; + private visible?: (this: x, arg: y) => boolean; private enabled?: (this: x, arg: y) => boolean; //TODO there *will* be more colors private color?: "red" | "blue"; @@ -35,7 +35,7 @@ class ContextButton implements menuPart { onClick: ContextButton["onClick"], addProps: { icon?: iconJson; - visable?: (this: x, arg: y) => boolean; + visible?: (this: x, arg: y) => boolean; enabled?: (this: x, arg: y) => boolean; color?: "red" | "blue"; group?: string; @@ -44,17 +44,17 @@ class ContextButton implements menuPart { this.text = text; this.onClick = onClick; this.icon = addProps.icon; - this.visable = addProps.visable; + this.visible = addProps.visible; this.enabled = addProps.enabled; this.color = addProps.color; this.group = addProps.group; } - isVisable(obj1: x, obj2: y): boolean { - if (!this.visable) return true; - return this.visable.call(obj1, obj2); + isVisible(obj1: x, obj2: y): boolean { + if (!this.visible) return true; + return this.visible.call(obj1, obj2); } makeContextHTML(obj1: x, obj2: y, menu: HTMLDivElement) { - if (!this.isVisable(obj1, obj2)) { + if (!this.isVisible(obj1, obj2)) { return; } @@ -113,22 +113,22 @@ class ContextButton implements menuPart { } } class ContextGroup implements menuPart { - private visable?: (this: x, arg: y) => boolean; + private visible?: (this: x, arg: y) => boolean; groupSel: string; group = undefined; constructor( group: string, addProps: { - visable?: (this: x, arg: y) => boolean; + visible?: (this: x, arg: y) => boolean; } = {}, ) { - this.visable = addProps.visable; + this.visible = addProps.visible; this.groupSel = group; } - isVisable(obj1: x, obj2: y): boolean { - if (!this.visable) return true; - return this.visable.call(obj1, obj2); + isVisible(obj1: x, obj2: y): boolean { + if (!this.visible) return true; + return this.visible.call(obj1, obj2); } makeContextHTML( x: x, @@ -137,7 +137,7 @@ class ContextGroup implements menuPart { layered: contextCluster[], processed: WeakSet>, ) { - if (!this.isVisable(x, y)) { + if (!this.isVisible(x, y)) { return; } for (const [menu, x, y] of layered) { @@ -151,14 +151,14 @@ class ContextGroup implements menuPart { } } class Seperator implements menuPart { - private visable?: (obj1: x, obj2: y) => boolean; + private visible?: (obj1: x, obj2: y) => boolean; group?: string; - constructor(visable?: (obj1: x, obj2: y) => boolean, group?: string) { - this.visable = visable; + constructor(visible?: (obj1: x, obj2: y) => boolean, group?: string) { + this.visible = visible; this.group = group; } makeContextHTML(obj1: x, obj2: y, menu: HTMLDivElement): void { - if (!this.visable || this.visable(obj1, obj2)) { + if (!this.visible || this.visible(obj1, obj2)) { if (menu.children[menu.children.length - 1].tagName === "HR") { return; } @@ -236,7 +236,7 @@ class Contextmenu { onClick: ContextButton["onClick"], addProps: { icon?: iconJson; - visable?: (this: x, arg: y) => boolean; + visible?: (this: x, arg: y) => boolean; enabled?: (this: x, arg: y) => boolean; color?: "red" | "blue"; group?: string; @@ -244,13 +244,13 @@ class Contextmenu { ) { this.buttons.push(new ContextButton(text, onClick, addProps)); } - addSeperator(visable?: (obj1: x, obj2: y) => boolean, group?: string) { - this.buttons.push(new Seperator(visable, group)); + addSeperator(visible?: (obj1: x, obj2: y) => boolean, group?: string) { + this.buttons.push(new Seperator(visible, group)); } addGroup( group: string, addprops?: { - visable?: (this: x, arg: y) => boolean; + visible?: (this: x, arg: y) => boolean; }, ) { this.buttons.push(new ContextGroup(group, addprops)); diff --git a/src/webpage/direct.ts b/src/webpage/direct.ts index f1cb656..b264f03 100644 --- a/src/webpage/direct.ts +++ b/src/webpage/direct.ts @@ -410,7 +410,7 @@ class Group extends Channel { }, { group: "default", - visable: function (user) { + visible: function (user) { return this.localuser.user.id !== user.id && this.owner_id === this.localuser.user.id; }, color: "red", @@ -435,7 +435,7 @@ class Group extends Channel { this.edit(); }, { - visable: function () { + visible: function () { return this.type !== 1; }, }, @@ -466,7 +466,7 @@ class Group extends Channel { navigator.clipboard.writeText(this.users[0].id); }, { - visable: function () { + visible: function () { return this.type === 1; }, }, @@ -576,7 +576,6 @@ class Group extends Channel { } else if (this.lastmessage) { this.position = this.lastmessage.getTimeStamp(); } else if (this.lastmessageid) { - console.log(this.lastmessageid); this.position = SnowFlake.stringToUnixTime(this.lastmessageid); } else { this.position = 0; diff --git a/src/webpage/guild.ts b/src/webpage/guild.ts index 806c01e..a3f079a 100644 --- a/src/webpage/guild.ts +++ b/src/webpage/guild.ts @@ -235,7 +235,7 @@ class Guild extends SnowFlake { this.confirmleave(); }, { - visable: function (_) { + visible: function (_) { return this.properties.owner_id !== this.member.user.id; }, color: "red", @@ -248,7 +248,7 @@ class Guild extends SnowFlake { this.confirmDelete(); }, { - visable: function (_) { + visible: function (_) { return this.properties.owner_id === this.member.user.id; }, color: "red", @@ -264,7 +264,7 @@ class Guild extends SnowFlake { this.generateSettings(); }, { - visable: function () { + visible: function () { return this.member.hasPermission("MANAGE_GUILD"); }, icon: { @@ -287,7 +287,7 @@ class Guild extends SnowFlake { this.createchannels(); }, { - visable: function () { + visible: function () { return this.member.hasPermission("MANAGE_CHANNELS"); }, }, @@ -298,7 +298,7 @@ class Guild extends SnowFlake { this.createcategory(); }, { - visable: function () { + visible: function () { return this.member.hasPermission("MANAGE_CHANNELS"); }, }, @@ -1723,14 +1723,14 @@ class Guild extends SnowFlake { return; } } - if (this.prevchannel && ID !== null && this.prevchannel.visable) { + if (this.prevchannel && ID !== null && this.prevchannel.visible) { console.log(this.prevchannel); await this.prevchannel.getHTML(addstate, undefined, message); return; } if (this.id !== "@me") { for (const thing of this.channels) { - if (thing.type !== 4 && thing.visable) { + if (thing.type !== 4 && thing.visible) { await thing.getHTML(addstate, undefined, message); return; } @@ -1762,7 +1762,7 @@ class Guild extends SnowFlake { } noChannel(addstate: boolean) { for (const c of this.channels) { - if (c.visable) { + if (c.visible) { this.loadChannel(c.id, addstate); return; } diff --git a/src/webpage/index.ts b/src/webpage/index.ts index f9fee3f..62c3040 100644 --- a/src/webpage/index.ts +++ b/src/webpage/index.ts @@ -97,7 +97,7 @@ menu.addButton( thisUser.lookingguild.createchannels(); } }, - {visable: () => thisUser.isAdmin()}, + {visible: () => thisUser.isAdmin()}, ); menu.addButton( @@ -107,7 +107,7 @@ menu.addButton( thisUser.lookingguild.createcategory(); } }, - {visable: () => thisUser.isAdmin()}, + {visible: () => thisUser.isAdmin()}, ); const channelw = document.getElementById("channelw"); console.log(channelw); diff --git a/src/webpage/localuser.ts b/src/webpage/localuser.ts index 35be51d..02ecfc9 100644 --- a/src/webpage/localuser.ts +++ b/src/webpage/localuser.ts @@ -1443,7 +1443,7 @@ class Localuser { if (this.channelfocus.guild.id === "@me") { return; } - if (!this.channelfocus.visable) return; + if (!this.channelfocus.visible) return; this.ws.send( JSON.stringify({ d: { diff --git a/src/webpage/message.ts b/src/webpage/message.ts index cbb1c83..aead5de 100644 --- a/src/webpage/message.ts +++ b/src/webpage/message.ts @@ -77,7 +77,7 @@ class Message extends SnowFlake { icon: { css: "svg-reply", }, - visable: function () { + visible: function () { return !this.ephemeral && this.channel.hasPermission("SEND_MESSAGES"); }, }, @@ -89,7 +89,7 @@ class Message extends SnowFlake { this.setEdit(); }, { - visable: function () { + visible: function () { return this.author.id === this.localuser.user.id && editTypes.has(this.type); }, @@ -110,7 +110,7 @@ class Message extends SnowFlake { icon: { css: "svg-emoji", }, - visable: function () { + visible: function () { return this.channel.hasPermission("ADD_REACTIONS"); }, }, @@ -121,7 +121,7 @@ class Message extends SnowFlake { this.viewReactions(); }, { - visable: function () { + visible: function () { return !!this.reactions.length; }, }, @@ -163,7 +163,7 @@ class Message extends SnowFlake { icon: { css: "svg-pin", }, - visable: function () { + visible: function () { if (this.pinned) return false; if (this.channel.guild.id === "@me") return true; return this.channel.hasPermission("MANAGE_MESSAGES"); @@ -184,7 +184,7 @@ class Message extends SnowFlake { icon: { css: "svg-pin", }, - visable: function () { + visible: function () { if (!this.pinned) return false; if (this.channel.guild.id === "@me") return true; return this.channel.hasPermission("MANAGE_MESSAGES"); @@ -206,7 +206,7 @@ class Message extends SnowFlake { this.confirmDelete(); }, { - visable: function () { + visible: function () { return this.canDelete(); }, icon: { @@ -221,7 +221,7 @@ class Message extends SnowFlake { () => I18n.usedFermi(), () => {}, { - visable: function () { + visible: function () { return !!this.nonce && this.nonce.length <= 9 && this.nonce.length !== 0; }, enabled: () => false, diff --git a/src/webpage/role.ts b/src/webpage/role.ts index a4b4ff4..4de32d3 100644 --- a/src/webpage/role.ts +++ b/src/webpage/role.ts @@ -425,7 +425,7 @@ class RoleList extends Buttons { }); }, { - visable: function (role) { + visible: function (role) { //TODO, maybe this needs a check if the user is above/bellow the other user, hard to say return role.id !== this.guild.id; }, @@ -475,7 +475,7 @@ class RoleList extends Buttons { this.deleteRole(role); }, { - visable: (role) => role.id !== role.guild.id, + visible: (role) => role.id !== role.guild.id, }, ); menu.addButton( diff --git a/src/webpage/user.ts b/src/webpage/user.ts index 2efd360..367c6a0 100644 --- a/src/webpage/user.ts +++ b/src/webpage/user.ts @@ -298,7 +298,7 @@ class User extends SnowFlake { this.block(); }, { - visable: function () { + visible: function () { return this.relationshipType !== 2 && this.id !== this.localuser.user.id; }, }, @@ -310,7 +310,7 @@ class User extends SnowFlake { this.unblock(); }, { - visable: function () { + visible: function () { return this.relationshipType === 2 && this.id !== this.localuser.user.id; }, }, @@ -321,7 +321,7 @@ class User extends SnowFlake { this.changeRelationship(1); }, { - visable: function () { + visible: function () { return ( (this.relationshipType === 0 || this.relationshipType === 3) && this.id !== this.localuser.user.id && @@ -339,7 +339,7 @@ class User extends SnowFlake { this.changeRelationship(0); }, { - visable: function () { + visible: function () { return this.relationshipType === 1 && this.id !== this.localuser.user.id; }, }, @@ -363,7 +363,7 @@ class User extends SnowFlake { this.setFriendNick(); }, { - visable: function () { + visible: function () { return new Set([1, 2, 3, 4]).has(this.relationshipType); }, }, @@ -378,7 +378,7 @@ class User extends SnowFlake { member.showEditProfile(); }, { - visable: function (member) { + visible: function (member) { return member?.id === this.localuser.user.id; }, }, @@ -391,7 +391,7 @@ class User extends SnowFlake { member.showEditNick(); }, { - visable: function (member) { + visible: function (member) { return ( !!member && member?.id !== this.localuser.user.id && @@ -407,7 +407,7 @@ class User extends SnowFlake { member?.timeout(); }, { - visable: function (member) { + visible: function (member) { if (!member) return false; if (member.hasPermission("MODERATE_MEMBERS")) return false; @@ -428,7 +428,7 @@ class User extends SnowFlake { memb?.removeTimeout(); }, { - visable: function (member) { + visible: function (member) { if (!member) return false; return ( @@ -447,7 +447,7 @@ class User extends SnowFlake { member?.kick(); }, { - visable: function (member) { + visible: function (member) { if (!member) return false; const us = member.guild.member; if (member.id === us.id) { @@ -469,7 +469,7 @@ class User extends SnowFlake { member?.ban(); }, { - visable: function (member) { + visible: function (member) { if (!member) return false; const us = member.guild.member; if (member.id === us.id) { @@ -505,7 +505,7 @@ class User extends SnowFlake { } }, { - visable: (member) => { + visible: (member) => { if (!member) return false; const us = member.guild.member; console.log(us.hasPermission("MANAGE_ROLES")); @@ -532,7 +532,7 @@ class User extends SnowFlake { } }, { - visable: (member) => { + visible: (member) => { if (!member) return false; const us = member.guild.member; console.log(us.hasPermission("MANAGE_ROLES")); @@ -584,7 +584,7 @@ class User extends SnowFlake { menu.show(); }, { - visable: function () { + visible: function () { return this.localuser.rights.hasPermission("MANAGE_USERS"); }, color: "red",