{"id":16764035,"url":"https://github.com/novlan1/chrome-plugin-auto-open-page","last_synced_at":"2025-03-16T11:11:50.045Z","repository":{"id":103581334,"uuid":"521879635","full_name":"novlan1/chrome-plugin-auto-open-page","owner":"novlan1","description":"自定打开网页的chrome插件","archived":false,"fork":false,"pushed_at":"2024-02-01T16:08:26.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T23:11:47.540Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/novlan1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-08-06T07:37:26.000Z","updated_at":"2023-11-02T15:14:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"2e19a251-7cf3-4bfb-9fe3-3df1a0ed4895","html_url":"https://github.com/novlan1/chrome-plugin-auto-open-page","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novlan1%2Fchrome-plugin-auto-open-page","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novlan1%2Fchrome-plugin-auto-open-page/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novlan1%2Fchrome-plugin-auto-open-page/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novlan1%2Fchrome-plugin-auto-open-page/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/novlan1","download_url":"https://codeload.github.com/novlan1/chrome-plugin-auto-open-page/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243858056,"owners_count":20359269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T05:24:18.537Z","updated_at":"2025-03-16T11:11:50.022Z","avatar_url":"https://github.com/novlan1.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chrome-plugin-auto-open-page\n\n自动打开网页的chrome插件\n\n\n_____\n\n\n需要自己提前写好env.local.js文件，格式如env.js，主要是注入以下几个变量：\n\n```ts\n// 监听URL\nvar WATCH_URL = ''; \n\n// 点击元素\nvar CLICK_ELEMENT = '';\n\n// 自动关闭的URL\nvar AUTO_CLOSE_URL = '';\n```\n\n其中 CLICK_ELEMENT内容 会被 `document.querySelector` 使用来获取元素。下面是 querySelector 几种常见的用法。\n\n\n1. 获取带有foo或bar样式的首个元素\n\n```js\ndocument.querySelector('.foo, .bar');\n```\n\n2. 获取带有 data-info 属性的元素\n\n```js\ndocument.querySelector('[data-info]');\n```\n\n3. 获取带有 data-info 属性的 p 元素\n\n```js\ndocument.querySelector('p[data-info]');\n```\n\n4. 获取带有 data-info 为 foo 属性的 p 元素\n\n```js\ndocument.querySelector('p[data-info=foo]');\n```\n\n或者获取 id 为 my-element 的 p 元素\n\n```js\nlet el  = document.querySelector(\"p[id='my-element']\")\n```\n\n\n\n5. 获取第 3 个 class 为 article-item 的元素\n\n\n```js\ndocument.querySelector('.article_item:nth-child(3)')\n\n// 第一个\ndocument.querySelector('.article_item:first-child')\n\n// 最后一个\ndocument.querySelector('.article_item:last-child')\n```\n\n6. 获取不具有某属性的节点\n\n```ts\n\u003cdiv class=\"whatFor?\" \u003e\u003c/div\u003e\n\n// 合法用法，注意not后面的内容被小括号包裹\ndocument.querySelector(\"div:not([uuid])\");\n\n// 获取\ndocument.querySelector(\"div:not([uuid=1])\");\n\n// 或者\ndocument.querySelector(\":not([uuid])\");\n```\n\n\n参考：\n1. https://www.runoob.com/cssref/css-selectors.html\n2. https://www.runoob.com/jsref/met-element-queryselector.html\n3. https://www.jianshu.com/p/2e1d5c92f9c4\n4. https://xiaoguoping.blog.csdn.net/article/details/51531469\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovlan1%2Fchrome-plugin-auto-open-page","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnovlan1%2Fchrome-plugin-auto-open-page","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovlan1%2Fchrome-plugin-auto-open-page/lists"}