diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..f72beb8 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +ko_fi: cssnr diff --git a/.github/workflows/labeler.yaml b/.github/workflows/labeler.yaml new file mode 100644 index 0000000..eb36453 --- /dev/null +++ b/.github/workflows/labeler.yaml @@ -0,0 +1,48 @@ +name: "PR Labeler" + +on: + pull_request_target: + +jobs: + labeler: + name: "Labeler" + runs-on: ubuntu-latest + timeout-minutes: 5 + + permissions: + pull-requests: write + issues: write + + steps: + - name: "Checkout Configs" + uses: actions/checkout@v5 + with: + repository: cssnr/configs + ref: master + path: .configs + sparse-checkout-cone-mode: false + sparse-checkout: | + labels/** + + - name: "Debug" + continue-on-error: true + run: | + echo "::group::labels.yaml" + cat .configs/labels/labels.yaml + echo "::endgroup::" + + echo "::group::labeler.yaml" + cat .configs/labels/labeler.yaml + echo "::endgroup::" + + - name: "Label Creator" + continue-on-error: true + uses: cssnr/label-creator-action@v1 + with: + file: .configs/labels/labels.yaml + + - name: "Labeler" + uses: actions/labeler@v6 + with: + sync-labels: true + configuration-path: .configs/labels/labeler.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..d74313d --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,53 @@ +name: "Lint" + +on: + workflow_dispatch: + pull_request: + branches: [master] + push: + branches: [master] + +jobs: + lint: + name: "Lint" + runs-on: ubuntu-latest + timeout-minutes: 5 + if: ${{ !contains(github.event.head_commit.message, '#nolint') }} + + steps: + - name: "Checkout" + uses: actions/checkout@v5 + + - name: "Prettier" + if: ${{ !cancelled() }} + run: | + echo "::group::Install" + npm install prettier + echo "::endgroup::" + npx prettier --check . + + - name: "Yamllint" + if: ${{ !cancelled() }} + env: + CONFIG: "{extends: relaxed, ignore: [node_modules/], rules: {line-length: {max: 119}}}" + run: | + echo "::group::List Files" + yamllint -d '${{ env.CONFIG }}' --list-files . + echo "::endgroup::" + yamllint -d '${{ env.CONFIG }}' . + + - name: "Actionlint" + if: ${{ !cancelled() }} + run: | + echo "::group::Download" + loc=$(curl -sI https://github.com/rhysd/actionlint/releases/latest | grep -i '^location:') + echo "loc: ${loc}" + tag=$(echo "${loc}" | sed -E 's|.*/tag/v?(.*)|\1|' | tr -d '\t\r\n') + echo "tag: ${tag}" + url="https://github.com/rhysd/actionlint/releases/latest/download/actionlint_${tag}_linux_amd64.tar.gz" + echo "url: ${url}" + curl -sL "${url}" | tar xz -C "${RUNNER_TEMP}" actionlint + file "${RUNNER_TEMP}/actionlint" + "${RUNNER_TEMP}/actionlint" --version + echo "::endgroup::" + "${RUNNER_TEMP}/actionlint" -color -verbose -shellcheck= -pyflakes= diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..cd26c30 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,17 @@ +# IDE +.idea/ +.vscode/ + +# Tools +.ruff_cache/ +.mypy_cache/ +.pytest_cache/ +eslint_report.json + +# Build +dist/ +node_modules/ +.github/disabled/ + +# Files +.github/pull_request_template.md diff --git a/.prettierrc.json b/.prettierrc.json index 10671f1..4541eb0 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -2,6 +2,7 @@ "trailingComma": "es5", "semi": false, "singleQuote": true, + "printWidth": 90, "overrides": [ { "files": ["**/*.html", "**/*.yaml", "**/*.yml"], @@ -10,7 +11,7 @@ } }, { - "files": ["**/*.js"], + "files": ["**/*.js", "**/*.mjs", "**/*.css", "**/*.scss"], "options": { "tabWidth": 4 } diff --git a/README.md b/README.md index 6b8ddbd..148b6cc 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ -[![GitHub Last Commit](https://img.shields.io/github/last-commit/cssnr/browser-scripts?logo=github&logoColor=white&label=updated)](https://github.com/cssnr/browser-scripts/graphs/commit-activity) -[![GitHub Top Language](https://img.shields.io/github/languages/top/cssnr/browser-scripts?logo=htmx&logoColor=white)](https://github.com/cssnr/browser-scripts) -[![GitHub Org Stars](https://img.shields.io/github/stars/cssnr?style=flat&logo=github&logoColor=white&label=org%20stars)](https://cssnr.github.io/) +[![GitHub Last Commit](https://img.shields.io/github/last-commit/cssnr/browser-scripts?logo=github&label=updated)](https://github.com/cssnr/browser-scripts/pulse) +[![GitHub Contributors](https://img.shields.io/github/contributors-anon/cssnr/browser-scripts?logo=github)](https://github.com/cssnr/browser-scripts/graphs/contributors) +[![GitHub Repo Size](https://img.shields.io/github/repo-size/cssnr/browser-scripts?logo=bookstack&logoColor=white&label=repo%20size)](https://github.com/cssnr/browser-scripts?tab=readme-ov-file#readme) +[![GitHub Top Language](https://img.shields.io/github/languages/top/cssnr/browser-scripts?logo=htmx)](https://github.com/cssnr/browser-scripts/tree/master/src) +[![GitHub Discussions](https://img.shields.io/github/discussions/cssnr/browser-scripts?logo=github)](https://github.com/cssnr/browser-scripts/discussions) +[![GitHub Forks](https://img.shields.io/github/forks/cssnr/browser-scripts?style=flat&logo=github)](https://github.com/cssnr/browser-scripts/forks) +[![GitHub Repo Stars](https://img.shields.io/github/stars/cssnr/browser-scripts?style=flat&logo=github)](https://github.com/cssnr/browser-scripts/stargazers) +[![GitHub Org Stars](https://img.shields.io/github/stars/cssnr?style=flat&logo=github&label=org%20stars)](https://cssnr.github.io/) [![Discord](https://img.shields.io/discord/899171661457293343?logo=discord&logoColor=white&label=discord&color=7289da)](https://discord.gg/wXy6m2X8wY) +[![Ko-fi](https://img.shields.io/badge/Ko--fi-72a5f2?logo=kofi&label=support)](https://ko-fi.com/cssnr) # Browser Scripts -## Table of Contents - - [Overview](#overview) - [Requirements](#requirements) - [User Scripts](#user-scripts) @@ -45,12 +49,12 @@ User Styles (css) require a browser addon to manage such as Stylus. ## Discord Plugins -| Name | Description | -| ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | -| [Bypass Link Warning](https://raw.githubusercontent.com/cssnr/browser-scripts/master/discord/BypassLinkWarning.plugin.js) | Bypass Discord Leaving Site Warning on Links | +| Name | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| [Bypass Link Warning](https://raw.githubusercontent.com/cssnr/browser-scripts/master/discord/BypassLinkWarning.plugin.js) | MOVED TO: [smashedr/bypass-links-dialog](https://github.com/smashedr/bypass-links-dialog) | -> [!IMPORTANT] -> These are not user scripts, they are Discord scripts and require [Better Discord](https://betterdiscord.app/). +> [!WARNING] +> This has moved here: https://github.com/smashedr/bypass-links-dialog --- diff --git a/asn/asn.user.css b/asn/asn.user.css index f0b9839..663a0a4 100644 --- a/asn/asn.user.css +++ b/asn/asn.user.css @@ -10,30 +10,53 @@ body { background: #848484; } - td.list, th.list, th.defaultheader, th.updates, td.listmain, td.listmain_nohover, .infobox_highlight, td.listdata { + td.list, + th.list, + th.defaultheader, + th.updates, + td.listmain, + td.listmain_nohover, + .infobox_highlight, + td.listdata { color: white; - border-top: 1px solid #FFF; - border-bottom: 1px solid #FFF; + border-top: 1px solid #fff; + border-bottom: 1px solid #fff; } - body, div.pagenumbers a, .navigation a:link, label, td.listnoline { + body, + div.pagenumbers a, + .navigation a:link, + label, + td.listnoline { color: white; } .infobox { background-color: #222; } - table, #page-wrap, .navigation, .navigation ul li, table tr.listmain td { + table, + #page-wrap, + .navigation, + .navigation ul li, + table tr.listmain td { background-color: #313131; } - table tr.list:hover td, table tr:hover td.list, td.listdata:hover, tbody tr:hover td.listdata { - background-color:#474747 + table tr.list:hover td, + table tr:hover td.list, + td.listdata:hover, + tbody tr:hover td.listdata { + background-color: #474747; } a { color: #0f0; } - a:visited, .trail a:link, .trail a:visited, div.alertbox a { + a:visited, + .trail a:link, + .trail a:visited, + div.alertbox a { color: #f0f; } - div.navigation img, div.alertbox, div#noprint { + div.navigation img, + div.alertbox, + div#noprint { display: none; } /* diff --git a/asn/asn.user.js b/asn/asn.user.js index 231b95d..18cbf14 100644 --- a/asn/asn.user.js +++ b/asn/asn.user.js @@ -13,10 +13,7 @@ window.addEventListener('load', () => { highlightTableRows() - if ( - document.URL.includes('/wikibase/') || - document.URL.includes('/database/') - ) { + if (document.URL.includes('/wikibase/') || document.URL.includes('/database/')) { updateEntryTable() updateLastUpdated() } diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..74cf080 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,21 @@ +import js from '@eslint/js' + +export default [ + js.configs.recommended, + { + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + settings: { + env: { + node: true, + es2021: true, + }, + }, + rules: { + 'no-undef': 'off', + 'no-extra-semi': 'off', + }, + }, +] diff --git a/faa/faa.user.js b/faa/faa.user.js index a25eef7..9775bf6 100644 --- a/faa/faa.user.js +++ b/faa/faa.user.js @@ -11,9 +11,7 @@ // ==/UserScript== window.addEventListener('load', () => { - let element = document.querySelector( - '[data-label="Mode S Code (Base 16 / Hex)"]' - ) + let element = document.querySelector('[data-label="Mode S Code (Base 16 / Hex)"]') if (element) { const hex = element.textContent const link = document.createElement('a') diff --git a/imdb/imdb-show-all.user.js b/imdb/imdb-show-all.user.js index 3d6f037..2ebf1c5 100644 --- a/imdb/imdb-show-all.user.js +++ b/imdb/imdb-show-all.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name IMDb Auto Show All // @description Automatically show all titles for actors. -// @version 20240521 +// @version 20250112 // @author shane // @namespace https://github.com/cssnr/browser-scripts // @updateURL https://github.com/cssnr/browser-scripts/raw/master/imdb/imdb-show-all.user.js @@ -12,7 +12,19 @@ // ==/UserScript== window.addEventListener('load', () => { - let showMore = document.querySelector('.ipc-see-more__button') - console.info('Activating See all...') - showMore?.click() + const showMore = document.querySelector('.ipc-see-more__button') + if (!showMore) return + + const observer = new IntersectionObserver( + (entries) => { + if (entries[0].isIntersecting) { + observer.disconnect() + console.info('Clicking See all...') + showMore.click() + } + }, + { threshold: 1.0 } + ) + + observer.observe(showMore) }) diff --git a/simpleflying/simpleflying.user.js b/simpleflying/simpleflying.user.js index d946b94..258c124 100644 --- a/simpleflying/simpleflying.user.js +++ b/simpleflying/simpleflying.user.js @@ -21,8 +21,7 @@ window.addEventListener('load', () => { // console.log(`${name}: ${value}`) if (name === 'unauthenicatedArticleLimitReached') { if (value === 'true') { - document.cookie = - 'unauthenicatedArticleLimitReached=false; path=/' + document.cookie = 'unauthenicatedArticleLimitReached=false; path=/' console.log('Reset Article Limit') } } else if (name === 'articlesRead') {