Skip to content

Commit 983c63a

Browse files
committed
Shortened numeric comparisons
1 parent 564f6f7 commit 983c63a

5 files changed

Lines changed: 15 additions & 15 deletions

File tree

block-quora-poe/block-quora-poe.user.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// @description:zh-TW 阻止 AI + Quora 的推廣/贊助答案
1414
// @author Adam Lui
1515
// @namespace https://github.com/adamlui
16-
// @version 2025.9.6
16+
// @version 2025.9.6.1
1717
// @license MIT
1818
// @icon https://cdn.jsdelivr.net/gh/adamlui/userscripts@f3e6bf0/assets/images/icons/sites/quora/icon64.png
1919
// @match *://*.quora.com/*
@@ -415,7 +415,7 @@
415415
document.removeEventListener('keydown', handlers.dismiss.key) // prevent memory leaks
416416

417417
// Check for pending alerts in queue
418-
if (alertQueue.length > 0) {
418+
if (alertQueue.length) {
419419
const nextAlert = document.getElementById(alertQueue[0])
420420
setTimeout(() => {
421421
nextAlert.style.display = ''
@@ -445,7 +445,7 @@
445445
elems = [...text.matchAll(reTags)]
446446

447447
// Process 1st element to render
448-
if (elems.length > 0) {
448+
if (elems.length) {
449449
const elem = elems[0],
450450
[tagContent, tagName, tagAttrs, tagText] = elem.slice(0, 4),
451451
tagNode = document.createElement(tagName) ; tagNode.textContent = tagText

github/github-star-history/github-star-history.user.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// @description:zh-TW 將明星曆史圖表添加到 GitHub 存儲庫的側邊欄
1414
// @author Adam Lui
1515
// @namespace https://github.com/adamlui
16-
// @version 2025.9.6
16+
// @version 2025.9.6.1
1717
// @license MIT
1818
// @icon data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%2248%22%20height=%2248%22%20viewBox=%220%200%2048%2048%22%3E%3Cstyle%3E:root%7B--fill:%23000%7D@media%20(prefers-color-scheme:dark)%7B:root%7B--fill:%23fff%7D%7D%3C/style%3E%3Cpath%20fill=%22var(--fill)%22%20d=%22M24%201.9a21.6%2021.6%200%200%200-6.8%2042.2c1%20.2%201.8-.9%201.8-1.8v-2.9c-6%201.3-7.9-2.9-7.9-2.9a6.5%206.5%200%200%200-2.2-3.2c-2-1.4.1-1.3.1-1.3a4.3%204.3%200%200%201%203.3%202c1.7%202.9%205.5%202.6%206.7%202.1a5.4%205.4%200%200%201%20.5-2.9C12.7%2032%209%2028%209%2022.6a10.7%2010.7%200%200%201%202.9-7.6%206.2%206.2%200%200%201%20.3-6.4%208.9%208.9%200%200%201%206.4%202.9%2015.1%2015.1%200%200%201%205.4-.8%2017.1%2017.1%200%200%201%205.4.7%209%209%200%200%201%206.4-2.8%206.5%206.5%200%200%201%20.4%206.4%2010.7%2010.7%200%200%201%202.8%207.6c0%205.4-3.7%209.4-10.5%2010.6a5.4%205.4%200%200%201%20.5%202.9v6.2a1.8%201.8%200%200%200%201.9%201.8A21.7%2021.7%200%200%200%2024%201.9Z%22/%3E%3C/svg%3E
1919
// @icon64 data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%2264%22%20height=%2264%22%20viewBox=%220%200%2048%2048%22%3E%3Cstyle%3E:root%7B--fill:%23000%7D@media%20(prefers-color-scheme:dark)%7B:root%7B--fill:%23fff%7D%7D%3C/style%3E%3Cpath%20fill=%22var(--fill)%22%20d=%22M24%201.9a21.6%2021.6%200%200%200-6.8%2042.2c1%20.2%201.8-.9%201.8-1.8v-2.9c-6%201.3-7.9-2.9-7.9-2.9a6.5%206.5%200%200%200-2.2-3.2c-2-1.4.1-1.3.1-1.3a4.3%204.3%200%200%201%203.3%202c1.7%202.9%205.5%202.6%206.7%202.1a5.4%205.4%200%200%201%20.5-2.9C12.7%2032%209%2028%209%2022.6a10.7%2010.7%200%200%201%202.9-7.6%206.2%206.2%200%200%201%20.3-6.4%208.9%208.9%200%200%201%206.4%202.9%2015.1%2015.1%200%200%201%205.4-.8%2017.1%2017.1%200%200%201%205.4.7%209%209%200%200%201%206.4-2.8%206.5%206.5%200%200%201%20.4%206.4%2010.7%2010.7%200%200%201%202.8%207.6c0%205.4-3.7%209.4-10.5%2010.6a5.4%205.4%200%200%201%20.5%202.9v6.2a1.8%201.8%200%200%200%201.9%201.8A21.7%2021.7%200%200%200%2024%201.9Z%22/%3E%3C/svg%3E
@@ -348,7 +348,7 @@
348348
document.removeEventListener('keydown', handlers.dismiss.key) // prevent memory leaks
349349

350350
// Check for pending alerts in queue
351-
if (alertQueue.length > 0) {
351+
if (alertQueue.length) {
352352
const nextAlert = document.getElementById(alertQueue[0])
353353
setTimeout(() => {
354354
nextAlert.style.display = ''
@@ -394,7 +394,7 @@
394394
elems = [...text.matchAll(reTags)]
395395

396396
// Process 1st element to render
397-
if (elems.length > 0) {
397+
if (elems.length) {
398398
const elem = elems[0],
399399
[tagContent, tagName, tagAttrs, tagText] = elem.slice(0, 4),
400400
tagNode = document.createElement(tagName) ; tagNode.textContent = tagText

github/github-widescreen/github-widescreen.user.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// @description:zh-TW 自動隱藏 GitHub 上引人注目的側面板
1414
// @author Adam Lui
1515
// @namespace https://github.com/adamlui
16-
// @version 2025.9.6
16+
// @version 2025.9.6.1
1717
// @license MIT
1818
// @icon data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%2248%22%20height=%2248%22%20viewBox=%220%200%2048%2048%22%3E%3Cstyle%3E:root%7B--fill:%23000%7D@media%20(prefers-color-scheme:dark)%7B:root%7B--fill:%23fff%7D%7D%3C/style%3E%3Cpath%20fill=%22var(--fill)%22%20d=%22M24%201.9a21.6%2021.6%200%200%200-6.8%2042.2c1%20.2%201.8-.9%201.8-1.8v-2.9c-6%201.3-7.9-2.9-7.9-2.9a6.5%206.5%200%200%200-2.2-3.2c-2-1.4.1-1.3.1-1.3a4.3%204.3%200%200%201%203.3%202c1.7%202.9%205.5%202.6%206.7%202.1a5.4%205.4%200%200%201%20.5-2.9C12.7%2032%209%2028%209%2022.6a10.7%2010.7%200%200%201%202.9-7.6%206.2%206.2%200%200%201%20.3-6.4%208.9%208.9%200%200%201%206.4%202.9%2015.1%2015.1%200%200%201%205.4-.8%2017.1%2017.1%200%200%201%205.4.7%209%209%200%200%201%206.4-2.8%206.5%206.5%200%200%201%20.4%206.4%2010.7%2010.7%200%200%201%202.8%207.6c0%205.4-3.7%209.4-10.5%2010.6a5.4%205.4%200%200%201%20.5%202.9v6.2a1.8%201.8%200%200%200%201.9%201.8A21.7%2021.7%200%200%200%2024%201.9Z%22/%3E%3C/svg%3E
1919
// @icon64 data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%2264%22%20height=%2264%22%20viewBox=%220%200%2048%2048%22%3E%3Cstyle%3E:root%7B--fill:%23000%7D@media%20(prefers-color-scheme:dark)%7B:root%7B--fill:%23fff%7D%7D%3C/style%3E%3Cpath%20fill=%22var(--fill)%22%20d=%22M24%201.9a21.6%2021.6%200%200%200-6.8%2042.2c1%20.2%201.8-.9%201.8-1.8v-2.9c-6%201.3-7.9-2.9-7.9-2.9a6.5%206.5%200%200%200-2.2-3.2c-2-1.4.1-1.3.1-1.3a4.3%204.3%200%200%201%203.3%202c1.7%202.9%205.5%202.6%206.7%202.1a5.4%205.4%200%200%201%20.5-2.9C12.7%2032%209%2028%209%2022.6a10.7%2010.7%200%200%201%202.9-7.6%206.2%206.2%200%200%201%20.3-6.4%208.9%208.9%200%200%201%206.4%202.9%2015.1%2015.1%200%200%201%205.4-.8%2017.1%2017.1%200%200%201%205.4.7%209%209%200%200%201%206.4-2.8%206.5%206.5%200%200%201%20.4%206.4%2010.7%2010.7%200%200%201%202.8%207.6c0%205.4-3.7%209.4-10.5%2010.6a5.4%205.4%200%200%201%20.5%202.9v6.2a1.8%201.8%200%200%200%201.9%201.8A21.7%2021.7%200%200%200%2024%201.9Z%22/%3E%3C/svg%3E
@@ -338,7 +338,7 @@
338338
document.removeEventListener('keydown', handlers.dismiss.key) // prevent memory leaks
339339

340340
// Check for pending alerts in queue
341-
if (alertQueue.length > 0) {
341+
if (alertQueue.length) {
342342
const nextAlert = document.getElementById(alertQueue[0])
343343
setTimeout(() => {
344344
nextAlert.style.display = ''
@@ -358,7 +358,7 @@
358358
'button[aria-expanded="true"][data-testid], '
359359
// Hide File Tree button in diff views
360360
+ 'button[id^="hide"]:not([hidden])'))
361-
if (hideBtns.length > 0) // click if needed
361+
if (hideBtns.length) // click if needed
362362
hideBtns.forEach(btn => { btn.click() })
363363
}
364364

@@ -394,7 +394,7 @@
394394
elems = [...text.matchAll(reTags)]
395395

396396
// Process 1st element to render
397-
if (elems.length > 0) {
397+
if (elems.length) {
398398
const elem = elems[0],
399399
[tagContent, tagName, tagAttrs, tagText] = elem.slice(0, 4),
400400
tagNode = document.createElement(tagName) ; tagNode.textContent = tagText

utils/bump/resources.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
userJSfiles.forEach(userJSfilePath => {
5656
const userJScontent = fs.readFileSync(userJSfilePath, 'utf-8'),
5757
resURLs = [...userJScontent.matchAll(new RegExp(regEx.jsURL.source, 'gm'))].map(match => match[1])
58-
if (resURLs.length > 0) { urlMap[userJSfilePath] = resURLs ; resCnt += resURLs.length }
58+
if (resURLs?.length) { urlMap[userJSfilePath] = resURLs ; resCnt += resURLs.length }
5959
})
6060
bump.log.success(`${resCnt} potentially bumpable resource(s) found.`)
6161

@@ -119,8 +119,8 @@
119119
}
120120

121121
// Log final summary
122-
bump.log[urlsUpdatedCnt > 0 ? 'success' : 'info'](
123-
`\n${ urlsUpdatedCnt > 0 ? 'Success! ' : '' }${
122+
bump.log[urlsUpdatedCnt ? 'success' : 'info'](
123+
`\n${ urlsUpdatedCnt ? 'Success! ' : '' }${
124124
urlsUpdatedCnt} resource(s) bumped across ${filesUpdatedCnt} file(s).`
125125
)
126126

youtube-classic/youtube-classic.user.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name YouTube™ Classic 📺 — (Remove rounded design + Return YouTube dislikes)
3-
// @version 2025.9.2
3+
// @version 2025.9.6
44
// @author Adam Lui, Magma_Craft, Anarios, JRWR, Fuim & hoothin
55
// @namespace https://github.com/adamlui
66
// @description Reverts YouTube to its classic design (before all the rounded corners & hidden dislikes) + redirects YouTube Shorts
@@ -1692,7 +1692,7 @@
16921692
const btnStyle = document.createElement('style')
16931693
btnStyle.type = 'text/css' ; btnStyle.textContent = css
16941694
const heads = document.getElementsByTagName('head'),
1695-
btnStyleParent = heads.length > 0 ? heads[0] : document.documentElement
1695+
btnStyleParent = heads.length ? heads[0] : document.documentElement
16961696
btnStyleParent.appendChild(btnStyle)
16971697
})()
16981698

0 commit comments

Comments
 (0)