MCPcopy Create free account
hub / github.com/MathMan05/Fermi / getHTML

Method getHTML

src/webpage/file.ts:30–167  ·  view source on GitHub ↗
(temp: boolean = false, fullScreen = false, OSpoiler = false, max = 96 * 3)

Source from the content-addressed store, hash-verified

28 {
29 group: "copyLink",
30 },
31 );
32 });
33 return menu;
34 }
35 constructor(fileJSON: filejson, owner: Message | null) {
36 this.owner = owner;
37 this.id = fileJSON.id;
38 this.filename = fileJSON.filename;
39 this.content_type = fileJSON.content_type;
40 this.width = fileJSON.width;
41 this.height = fileJSON.height;
42 this.url = fileJSON.url;
43 this.proxy_url = fileJSON.proxy_url;
44 this.content_type = fileJSON.content_type;
45 this.size = fileJSON.size;
46 }
47 getHTML(temp: boolean = false, fullScreen = false, OSpoiler = false, max = 96 * 3, gallery = false): HTMLElement {
48 function makeSpoilerHTML(): HTMLElement {
49 const spoil = document.createElement("div");
50 spoil.classList.add("fSpoil");
51 const stext = document.createElement("span");
52 stext.textContent = I18n.spoiler();
53 spoil.append(stext);
54 spoil.onclick = () => spoil.remove();
55 return spoil;
56 }
57 OSpoiler ||= this.filename.startsWith("SPOILER_");
58
59 const src = this.proxy_url || this.url;
60 const url = this.refreshURL();
61
62 if (this.width && this.height) {
63 let scale = 1;
64 scale = Math.max(scale, this.width / max);
65 scale = Math.max(scale, this.height / max);
66 this.width /= scale;
67 this.height /= scale;
68 this.width ^= 0;
69 this.height ^= 0;
70 }
71 if (this.height === null) {
72 this.height = 96 * 3;
73 }
74
75 if (this.content_type.startsWith("image/")) {
76 const div = document.createElement("div");
77 const img = createImg(src, undefined, div);
78 if (this.width && this.height) {
79 img.width = this.width;
80 img.height = this.height;
81 }
82 if (!fullScreen) {
83 div.classList.add("messageimgdiv");
84 if (gallery) {
85 div.classList.add("messagegallerydiv");
86 }
87 img.onclick = () => {

Callers 9

upHTMLMethod · 0.95
makeHTMLMethod · 0.45
loadGuildMethod · 0.45
findEmojiMethod · 0.45
groupNotifsMethod · 0.45
generateHTMLMethod · 0.45
generateMessageMethod · 0.45
bindButtonEventMethod · 0.45

Calls 10

refreshURLMethod · 0.95
showMethod · 0.95
getAudioHTMLMethod · 0.95
createunknownMethod · 0.95
createImgFunction · 0.85
addMethod · 0.80
hasGifMethod · 0.80
unfavoriteGifMethod · 0.80
favoriteGifMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected