mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-30 03:40:39 +00:00
revert whitespace changes
This commit is contained in:
parent
5ae00abb2a
commit
26ea18ded7
1 changed files with 9 additions and 9 deletions
18
ui/src/utils.ts
vendored
18
ui/src/utils.ts
vendored
|
@ -75,11 +75,11 @@ export function mdToHtml(text: string) {
|
||||||
return {__html: md.render(text)};
|
return {__html: md.render(text)};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUnixTime(text: string): number {
|
export function getUnixTime(text: string): number {
|
||||||
return text ? new Date(text).getTime()/1000 : undefined;
|
return text ? new Date(text).getTime()/1000 : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addTypeInfo<T>(arr: Array<T>, name: string): Array<{type_: string, data: T}> {
|
export function addTypeInfo<T>(arr: Array<T>, name: string): Array<{type_: string, data: T}> {
|
||||||
return arr.map(e => {return {type_: name, data: e}});
|
return arr.map(e => {return {type_: name, data: e}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,9 +89,9 @@ export function canMod(user: User, modIds: Array<number>, creator_id: number, on
|
||||||
let yourIndex = modIds.findIndex(id => id == user.id);
|
let yourIndex = modIds.findIndex(id => id == user.id);
|
||||||
if (yourIndex == -1) {
|
if (yourIndex == -1) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// onSelf +1 on mod actions not for yourself, IE ban, remove, etc
|
// onSelf +1 on mod actions not for yourself, IE ban, remove, etc
|
||||||
modIds = modIds.slice(0, yourIndex+(onSelf ? 0 : 1));
|
modIds = modIds.slice(0, yourIndex+(onSelf ? 0 : 1));
|
||||||
return !modIds.includes(creator_id);
|
return !modIds.includes(creator_id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -174,9 +174,9 @@ export function debounce(func: any, wait: number = 500, immediate: boolean = fal
|
||||||
// and not already in a timeout then the answer is: Yes
|
// and not already in a timeout then the answer is: Yes
|
||||||
var callNow = immediate && !timeout;
|
var callNow = immediate && !timeout;
|
||||||
|
|
||||||
// This is the basic debounce behaviour where you can call this
|
// This is the basic debounce behaviour where you can call this
|
||||||
// function several times, but it will only execute once
|
// function several times, but it will only execute once
|
||||||
// [before or after imposing a delay].
|
// [before or after imposing a delay].
|
||||||
// Each time the returned function is called, the timer starts over.
|
// Each time the returned function is called, the timer starts over.
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ export function debounce(func: any, wait: number = 500, immediate: boolean = fal
|
||||||
// Check if the function already ran with the immediate flag
|
// Check if the function already ran with the immediate flag
|
||||||
if (!immediate) {
|
if (!immediate) {
|
||||||
// Call the original function with apply
|
// Call the original function with apply
|
||||||
// apply lets you define the 'this' object as well as the arguments
|
// apply lets you define the 'this' object as well as the arguments
|
||||||
// (both captured before setTimeout)
|
// (both captured before setTimeout)
|
||||||
func.apply(context, args);
|
func.apply(context, args);
|
||||||
}
|
}
|
||||||
|
@ -247,6 +247,6 @@ export function setTheme(theme: string = 'darkly') {
|
||||||
styleSheet.removeAttribute("disabled");
|
styleSheet.removeAttribute("disabled");
|
||||||
} else {
|
} else {
|
||||||
styleSheet.setAttribute("disabled", "disabled");
|
styleSheet.setAttribute("disabled", "disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue