diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9d08a1a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.eslintrc.js b/.eslintrc.js index cc01bd7..1c06210 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,37 +1,41 @@ module.exports = { - extends: ["eslint:recommended", "plugin:prettier/recommended"], - env: { - browser: true, - node: true, - commonjs: true, - es2021: true, + extends: ["eslint:recommended", "plugin:prettier/recommended"], + env: { + browser: true, + node: true, + commonjs: true, + es2021: true, + }, + parserOptions: { + requireConfigFile: false, + ecmaVersion: 2020, + sourceType: "module", + }, + overrides: [ + { + files: ["*.ts"], + parser: "@typescript-eslint/parser", + plugins: ["@typescript-eslint"], + extends: ["plugin:@typescript-eslint/recommended"], }, - parserOptions: { - requireConfigFile: false, - ecmaVersion: 2020, - sourceType: "module", - }, - overrides: [ - { - files: ["*.ts"], - parser: "@typescript-eslint/parser", - plugins: ["@typescript-eslint"], - extends: ["plugin:@typescript-eslint/recommended"], - }, - ], - ignorePatterns: ["node_modules", "build", "dist", "coverage"], - rules: { - // 分号 - "semi": "error", - // 对象键值引号样式保持一致 - "quote-props": ["error", "consistent-as-needed"], - // 箭头函数允许单参数不带括号 - "arrow-parens": ["error", "as-needed"], - // no var - "no-var": "error", - // const - "prefer-const": "error", - // 允许console - "no-console": "off", + { + files: ["*.tsx"], + parser: "@typescript-eslint/parser", + plugins: ["react", "react-hooks", "@typescript-eslint/eslint-plugin"], + extends: ["plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended"], }, + ], + ignorePatterns: ["node_modules", "build", "dist", "coverage", "public"], + rules: { + "semi": "error", + "quote-props": ["error", "consistent-as-needed"], + "arrow-parens": ["error", "as-needed"], + "no-var": "error", + "prefer-const": "error", + "no-console": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/ban-ts-ignore": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/consistent-type-imports": "error", + }, }; diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..7ef6393 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,31 @@ +## 问题描述 + + + + + + +## 项目所属 + + + +- [ ] Copy +- [ ] Force Copy +- [ ] Copy Currency +- [ ] Site Director +- [ ] Water Mark +- [ ] Captcha +- [ ] Expansion +- [ ] Completion +- [ ] Unknown + +## 相关链接 + + + + + + +## 预期表现 + + diff --git a/.github/workflows/deploy-scripts.yml b/.github/workflows/deploy-scripts.yml new file mode 100644 index 0000000..44d1ed8 --- /dev/null +++ b/.github/workflows/deploy-scripts.yml @@ -0,0 +1,38 @@ +name: deploy-scripts gh-pages + +on: + push: + branches: + - master + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + persist-credentials: false + + - name: install node-v16 + uses: actions/setup-node@v3 + with: + node-version: '16.16.0' + + - name: install dependencies + run: | + node -v + npm install -g pnpm@8.11.0 + pnpm --filter=\!force-copy --registry=https://registry.npmjs.org/ install + + - name: build project + run: | + pnpm run build:scripts + + - name: deploy + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: dist diff --git a/.gitignore b/.gitignore index 200851a..aeb167a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,30 @@ -backup -node_modules -*.log -.DS_Store \ No newline at end of file +# base +backup +node_modules +*.log +.DS_Store +.idea +*.zip + +# dependencies +node_modules +.pnp +.pnp.js + +# testing +coverage + +# production +build +dist + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..995ecba --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +registry=https://registry.npmmirror.com/ +# strict-peer-dependencies=false diff --git a/.prettierrc.js b/.prettierrc.js index d1058de..1531a4c 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,18 +1,18 @@ module.exports = { - "printWidth": 100, // 指定代码长度,超出换行 - "tabWidth": 4, // tab 键的宽度 - "useTabs": false, // 不使用tab - "semi": true, // 结尾加上分号 - "singleQuote": false, // 使用单引号 - "quoteProps": "preserve", // 不要求对象字面量属性是否使用引号包裹 - "jsxSingleQuote": false, // jsx 语法中使用单引号 - "trailingComma": "es5", // 确保对象的最后一个属性后有逗号 - "bracketSpacing": true, // 大括号有空格 { name: 'rose' } - "jsxBracketSameLine": false, // 在多行JSX元素的最后一行追加 > - "arrowParens": "avoid", // 箭头函数,单个参数不强制添加括号 - "requirePragma": false, // 是否严格按照文件顶部的特殊注释格式化代码 - "insertPragma": false, // 是否在格式化的文件顶部插入Pragma标记,以表明该文件被prettier格式化过了 - "proseWrap": "preserve", // 按照文件原样折行 - "htmlWhitespaceSensitivity": "ignore", // html文件的空格敏感度,控制空格是否影响布局 - "endOfLine": "lf" // 结尾是 \n \r \n\r auto -} \ No newline at end of file + "printWidth": 100, + "tabWidth": 2, + "useTabs": false, + "semi": true, + "singleQuote": false, + "quoteProps": "preserve", + "jsxSingleQuote": false, + "trailingComma": "es5", + "bracketSpacing": true, + "jsxBracketSameLine": false, + "arrowParens": "avoid", + "requirePragma": false, + "insertPragma": false, + "proseWrap": "preserve", + "htmlWhitespaceSensitivity": "ignore", + "endOfLine": "lf", +}; diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..520fbe8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.words": [ + "rspack" + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 9181d40..2f79f34 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,152 @@ # TKScript -`TamperMonkey` 油猴插件,`GreasyFork`[主页链接](https://greasyfork.org/zh-CN/users/584991-windrunnermax)。 +
+GitHub +| +GreasyFork +| +FirefoxAddOns +| +ChromeWebStore +| +BLOG +
-* `dist`: 打包后模块。 -* `src/copy`: 文本选中复制。 -* `src/expansion`: 自动展开阅读全文。 -* `src/captcha`: 强智教务系统验证码识别。 -* `src/site-director`: 去除链接跳转页面。 -* `src/completion`: 阿里矢量图标库添加`HTTP`按钮。 +`GreaseMonkey`油猴脚本与`BrowserAddon`浏览器扩展,如果觉得不错,点个`star`吧 😁 -`copy`与`site-director`脚本需`rollup`打包使用,其他脚本引入即可。 + +## Install + +使用油猴脚本需要首先安装`GreaseMonkey/TamperMonkey`扩展,版本库中有如下脚本,可以直接点击安装按钮进行安装,浏览器扩展程序直接在浏览器相关应用市场安装即可。 + +| 名称 | +详情 | +安装 | +简介 | +
|---|---|---|---|
| 文本选中复制 | +详情 | ++安装 +| +备用 + | +解除网站不允许复制的限制,需要适配新的网站可提issue。 |
+
| 文本选中复制-通用 | +详情 | ++安装 +| +备用 + | +文本选中复制通用处理版本,具体使用方式请查阅详情。 | +
| Force Copy | +详情 | ++安装 +| +备用 + | +浏览器扩展程序,集成文本选中复制与通用能力。 | +
| 跳转链接直达 | +详情 | ++安装 +| +备用 + | +去掉确定跳转链接页面,用于谷歌、知乎、CSDN、简书等。 |
+
| 移除页面水印 | +详情 | ++安装 +| +备用 + | +移除常见网页的水印,请自行处理@match到匹配地址。 |
+
| 移除 DevTools 拦截器 | +详情 | ++安装 +| +备用 + | +移除调试器拦截器,防止浏览器DevTools被拦截。 |
+
| 自动展开阅读全文 | +详情 | ++安装 +| +备用 + | +展开阅读全文,用于CSDN、知乎等。 |
+
| 强智教务验证码识别 | +详情 | ++安装 +| +备用 + | +自动填写强智的验证码,请自行处理@match到匹配地址。 |
+
阿里图标库HTTP |
+详情 | ++安装 +| +备用 + | +添加HTTP按钮,简化手动填写。 |
+