mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-08-07 01:39:44 +00:00
visable -> visible
This commit is contained in:
committed by
MathMan05
parent
deb731720f
commit
0903266dee
@@ -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<HTMLElement> | 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;
|
||||
}
|
||||
|
||||
+22
-22
@@ -25,7 +25,7 @@ class ContextButton<x, y> implements menuPart<x, y> {
|
||||
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<x, y> implements menuPart<x, y> {
|
||||
onClick: ContextButton<x, y>["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<x, y> implements menuPart<x, y> {
|
||||
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<x, y> implements menuPart<x, y> {
|
||||
}
|
||||
}
|
||||
class ContextGroup<x, y> implements menuPart<x, y> {
|
||||
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<x, y> implements menuPart<x, y> {
|
||||
layered: contextCluster<unknown, unknown>[],
|
||||
processed: WeakSet<menuPart<unknown, unknown>>,
|
||||
) {
|
||||
if (!this.isVisable(x, y)) {
|
||||
if (!this.isVisible(x, y)) {
|
||||
return;
|
||||
}
|
||||
for (const [menu, x, y] of layered) {
|
||||
@@ -151,14 +151,14 @@ class ContextGroup<x, y> implements menuPart<x, y> {
|
||||
}
|
||||
}
|
||||
class Seperator<x, y> implements menuPart<x, y> {
|
||||
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<x, y> {
|
||||
onClick: ContextButton<x, y>["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<x, y> {
|
||||
) {
|
||||
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<x, y>(group, addprops));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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,
|
||||
|
||||
+2
-2
@@ -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(
|
||||
|
||||
+14
-14
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user