diff options
Diffstat (limited to 'src/renderer/gameserver/socialLink.ts')
-rw-r--r-- | src/renderer/gameserver/socialLink.ts | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/src/renderer/gameserver/socialLink.ts b/src/renderer/gameserver/socialLink.ts index b56fab0..9c7e353 100644 --- a/src/renderer/gameserver/socialLink.ts +++ b/src/renderer/gameserver/socialLink.ts @@ -1,24 +1,28 @@ import { shell } from "electron"; export class socialLink { - constructor( - public icon: string,// has to be one from font awesome -https://fontawesome.com/icons - public tooltip: string, - public url: string - ) { } - - getHTML(): HTMLElement { - //<button onclick="sv.openSocialLink(this)" socialLink="abc"><i class="fa fa-user"></i></button><br> - const element = document.createElement('button'); - element.onclick = () => { this.open() }; - element.innerHTML = `<i class="${this.icon}"></i>`; - element.title = this.tooltip; - return element; - } - - open() { - console.log("A link was clicked!", this.url); - if (this.url) - shell.openExternal(this.url.indexOf("://") !== -1 ? this.url : `https://${this.url}`); - } - }
\ No newline at end of file + constructor( + public icon: string, // has to be one from font awesome -https://fontawesome.com/icons + public tooltip: string, + public url: string + ) {} + + getHTML(): HTMLElement { + //<button onclick="sv.openSocialLink(this)" socialLink="abc"><i class="fa fa-user"></i></button><br> + const element = document.createElement("button"); + element.onclick = () => { + this.open(); + }; + element.innerHTML = `<i class="${this.icon}"></i>`; + element.title = this.tooltip; + return element; + } + + open() { + console.log("A link was clicked!", this.url); + if (this.url) + shell.openExternal( + this.url.indexOf("://") !== -1 ? this.url : `https://${this.url}` + ); + } +} |