mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-03 23:56:22 -07:00
Merge pull request #59 from gochan-org/deepsource-fix-48cf22f9
Replace `if-else` with ternary operator
This commit is contained in:
commit
effdb90323
2 changed files with 3 additions and 12 deletions
|
@ -104,16 +104,12 @@ export function banSelectedPost() {
|
||||||
* @param {StaffInfo} action
|
* @param {StaffInfo} action
|
||||||
*/
|
*/
|
||||||
function menuItem(action, isCategory = false) {
|
function menuItem(action, isCategory = false) {
|
||||||
if(isCategory) {
|
return isCategory ? $("<div/>").append($("<b/>").text(action)) : $("<div/>").append(
|
||||||
return $("<div/>").append($("<b/>").text(action));
|
|
||||||
} else {
|
|
||||||
return $("<div/>").append(
|
|
||||||
$("<a/>").prop({
|
$("<a/>").prop({
|
||||||
href: `${webroot}manage?action=${action.id}`
|
href: `${webroot}manage?action=${action.id}`
|
||||||
}).text(action.title)
|
}).text(action.title)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function getAction(id) {
|
function getAction(id) {
|
||||||
for (const action of staffActions) {
|
for (const action of staffActions) {
|
||||||
|
|
|
@ -31,8 +31,7 @@ export function getUploadPostID(upload, container) {
|
||||||
// if container, upload is div.upload-container
|
// if container, upload is div.upload-container
|
||||||
// otherwise it's img or video
|
// otherwise it's img or video
|
||||||
let jqu = container? $(upload) : $(upload).parent();
|
let jqu = container? $(upload) : $(upload).parent();
|
||||||
if(insideOP(jqu)) return jqu.siblings().eq(4).text();
|
return insideOP(jqu) ? jqu.siblings().eq(4).text() : jqu.siblings().eq(3).text();
|
||||||
else return jqu.siblings().eq(3).text();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function currentBoard() {
|
export function currentBoard() {
|
||||||
|
@ -131,11 +130,7 @@ export function initPostPreviews($post = null) {
|
||||||
doClickPreview = getBooleanStorageVal("enablepostclick", true);
|
doClickPreview = getBooleanStorageVal("enablepostclick", true);
|
||||||
doHoverPreview = getBooleanStorageVal("enableposthover", false);
|
doHoverPreview = getBooleanStorageVal("enableposthover", false);
|
||||||
let $refs = null;
|
let $refs = null;
|
||||||
if($post == null) {
|
$refs = $post == null ? $("a.postref") : $post.find("a.postref");
|
||||||
$refs = $("a.postref");
|
|
||||||
} else {
|
|
||||||
$refs = $post.find("a.postref");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(doClickPreview) {
|
if(doClickPreview) {
|
||||||
$refs.on("click", expandPost);
|
$refs.on("click", expandPost);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue