diff options
author | Dessalines <tyhou13@gmx.com> | 2020-04-14 15:43:58 -0400 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-04-14 15:43:58 -0400 |
commit | f040dac647d50c97e3f9ab8058563a7fe0f29261 (patch) | |
tree | 1f2ee1ad37757fc9ce963ae5d110bfcc9874fd3d /ui/src/utils.ts | |
parent | 26ad37a8c0450214ffe1cf4d6a3cfd3a37b3e6d9 (diff) |
Initial post-listing community non-local.
Diffstat (limited to 'ui/src/utils.ts')
-rw-r--r-- | ui/src/utils.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ui/src/utils.ts b/ui/src/utils.ts index 8ecef19b..e2310960 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -109,11 +109,11 @@ export const md = new markdown_it({ typographer: true, }) .use(markdown_it_container, 'spoiler', { - validate: function(params: any) { + validate: function (params: any) { return params.trim().match(/^spoiler\s+(.*)$/); }, - render: function(tokens: any, idx: any) { + render: function (tokens: any, idx: any) { var m = tokens[idx].info.trim().match(/^spoiler\s+(.*)$/); if (tokens[idx].nesting === 1) { @@ -129,7 +129,7 @@ export const md = new markdown_it({ defs: objectFlip(emojiShortName), }); -md.renderer.rules.emoji = function(token, idx) { +md.renderer.rules.emoji = function (token, idx) { return twemoji.parse(token[idx].content); }; @@ -275,7 +275,7 @@ export function debounce( let timeout: any; // Calling debounce returns a new anonymous function - return function() { + return function () { // reference the context and args for the setTimeout function var context = this, args = arguments; @@ -291,7 +291,7 @@ export function debounce( clearTimeout(timeout); // Set the new timeout - timeout = setTimeout(function() { + timeout = setTimeout(function () { // Inside the timeout function, clear the timeout variable // which will let the next execution run when in 'immediate' mode timeout = null; @@ -823,3 +823,7 @@ function hsl(num: number) { function randomHsl() { return `hsla(${Math.random() * 360}, 100%, 50%, 1)`; } + +export function hostname(url: string): string { + return new URL(url).hostname; +} |