16 | 骚神库元素定位助手
17 | 18 | 19 | 20 | 21 |23 |
☕ 请骚神库作者喝可乐 [微信]
24 |
| 复制 DrissionPage 语法 | 14 |
| 复制 XPath 语法 | 17 |
| 复制CSS的语法 | 20 |
| 按键帮助 | 23 |
12 |
13 | 骚神库DP助手 7.6正式版
14 |19 | 20 |
38 | 39 | 40 | 41 |
42 | 43 | 44 |
45 | 46 | 📌骚神网 47 | 48 | 49 | 📌DrissionPage 官网 50 | 51 |
52 | 53 | ☕请作者喝可乐 54 | 55 |
56 |
使用帮助:按F8 复制鼠标所在处元素语法
57 |使用帮助:按F9 深度扫描 定位动态元素
58 |
18 | 骚神库元素定位助手 5.1 测试版
19 | 20 | 21 |27 | 28 |
72 | 73 | 74 | 75 |
76 | 打开代码生成助手 77 | 78 | 79 | 80 | 81 |
82 |
使用帮助:按F8 复制鼠标所在处元素语法
83 |使用帮助:按F9 深度扫描 定位动态元素
84 |23 | 24 |
115 |
116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 |
125 | 126 | 127 | 128 | 129 |
16 | 骚神-JS逆向助手
17 | 18 | 19 | 20 | 21 |23 | 24 |
JS逆向助手 1.0版本
26 | 27 | 28 |117 | 118 | 119 | 120 | 121 | 123 | 124 | 126 | 127 |
128 | 129 | 130 | 131 | 132 | 133 |
16 | 骚神代码助手
17 | 18 | 19 | 20 | 21 |23 | 24 |
代码生成助手 1.2版本
26 |119 | 120 | 121 | 122 | 123 | 125 | 126 | 128 | 129 |
130 | 131 | 132 | 133 | 134 | 135 |
元素 150 | const br = document.createElement("br"); 151 | this.alertBox.appendChild(br); 152 | } 153 | 154 | createSaveButton() { 155 | const saveButton = document.createElement("button"); 156 | saveButton.textContent = "保存"; 157 | saveButton.style.marginTop = "10px"; 158 | saveButton.style.marginRight = "10px"; 159 | saveButton.onclick = () => { 160 | this.alertBox.style.display='none'; 161 | //设置元素定位选项 162 | window.flag.set(this.ele_config.getSelectedEleString()); 163 | 164 | AutoDismissAlert("定位配置信息已经保存",1000); 165 | }; 166 | this.alertBox.appendChild(saveButton); 167 | } 168 | createCancelButton() { 169 | const cancelButton = document.createElement("button"); 170 | cancelButton.textContent = "取消"; 171 | cancelButton.style.marginTop = "10px"; 172 | cancelButton.style.marginRight = "10px"; 173 | cancelButton.onclick = () => { 174 | this.alertBox.style.display='none'; 175 | 176 | 177 | }; 178 | this.alertBox.appendChild(cancelButton); 179 | } 180 | 181 | showAlertBox() { 182 | document.body.appendChild(this.alertBox); 183 | } 184 | show(){ 185 | this.alertBox.style.display ="block"; 186 | 187 | } 188 | hide(){ 189 | this.alertBox.style.display = "none"; 190 | } 191 | } 192 | 193 | // 使用示例 194 | const selectAlert = new SelectAlert(); 195 | selectAlert.hide(); 196 | 197 | 198 | -------------------------------------------------------------------------------- /元素定位助手/元素定位助手/Saossionpage_ele_helper_4.7/LICENSE: -------------------------------------------------------------------------------- 1 | 木兰宽松许可证, 第2版 2 | 3 | 木兰宽松许可证, 第2版 4 | 2020年1月 http://license.coscl.org.cn/MulanPSL2 5 | 6 | 7 | 您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束: 8 | 9 | 0. 定义 10 | 11 | “软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。 12 | 13 | “贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。 14 | 15 | “贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。 16 | 17 | “法人实体”是指提交贡献的机构及其“关联实体”。 18 | 19 | “关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。 20 | 21 | 1. 授予版权许可 22 | 23 | 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。 24 | 25 | 2. 授予专利许可 26 | 27 | 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。 28 | 29 | 3. 无商标许可 30 | 31 | “本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。 32 | 33 | 4. 分发限制 34 | 35 | 您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。 36 | 37 | 5. 免责声明与责任限制 38 | 39 | “软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。 40 | 41 | 6. 语言 42 | “本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。 43 | 44 | 条款结束 45 | 46 | 如何将木兰宽松许可证,第2版,应用到您的软件 47 | 48 | 如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步: 49 | 50 | 1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字; 51 | 52 | 2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中; 53 | 54 | 3, 请将如下声明文本放入每个源文件的头部注释中。 55 | 56 | Copyright (c) [Year] [name of copyright holder] 57 | [Software Name] is licensed under Mulan PSL v2. 58 | You can use this software according to the terms and conditions of the Mulan PSL v2. 59 | You may obtain a copy of Mulan PSL v2 at: 60 | http://license.coscl.org.cn/MulanPSL2 61 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 62 | See the Mulan PSL v2 for more details. 63 | 64 | 65 | Mulan Permissive Software License,Version 2 66 | 67 | Mulan Permissive Software License,Version 2 (Mulan PSL v2) 68 | January 2020 http://license.coscl.org.cn/MulanPSL2 69 | 70 | Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions: 71 | 72 | 0. Definition 73 | 74 | Software means the program and related documents which are licensed under this License and comprise all Contribution(s). 75 | 76 | Contribution means the copyrightable work licensed by a particular Contributor under this License. 77 | 78 | Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License. 79 | 80 | Legal Entity means the entity making a Contribution and all its Affiliates. 81 | 82 | Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity. 83 | 84 | 1. Grant of Copyright License 85 | 86 | Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not. 87 | 88 | 2. Grant of Patent License 89 | 90 | Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken. 91 | 92 | 3. No Trademark License 93 | 94 | No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4. 95 | 96 | 4. Distribution Restriction 97 | 98 | You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software. 99 | 100 | 5. Disclaimer of Warranty and Limitation of Liability 101 | 102 | THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 103 | 104 | 6. Language 105 | 106 | THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL. 107 | 108 | END OF THE TERMS AND CONDITIONS 109 | 110 | How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software 111 | 112 | To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps: 113 | 114 | i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner; 115 | 116 | ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package; 117 | 118 | iii Attach the statement to the appropriate annotated syntax at the beginning of each source file. 119 | 120 | 121 | Copyright (c) [Year] [name of copyright holder] 122 | [Software Name] is licensed under Mulan PSL v2. 123 | You can use this software according to the terms and conditions of the Mulan PSL v2. 124 | You may obtain a copy of Mulan PSL v2 at: 125 | http://license.coscl.org.cn/MulanPSL2 126 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 127 | See the Mulan PSL v2 for more details. 128 | -------------------------------------------------------------------------------- /元素定位助手/元素定位助手/Saossionpage_ele_helper_5.2/LICENSE: -------------------------------------------------------------------------------- 1 | 木兰宽松许可证, 第2版 2 | 3 | 木兰宽松许可证, 第2版 4 | 2020年1月 http://license.coscl.org.cn/MulanPSL2 5 | 6 | 7 | 您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束: 8 | 9 | 0. 定义 10 | 11 | “软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。 12 | 13 | “贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。 14 | 15 | “贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。 16 | 17 | “法人实体”是指提交贡献的机构及其“关联实体”。 18 | 19 | “关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。 20 | 21 | 1. 授予版权许可 22 | 23 | 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。 24 | 25 | 2. 授予专利许可 26 | 27 | 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。 28 | 29 | 3. 无商标许可 30 | 31 | “本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。 32 | 33 | 4. 分发限制 34 | 35 | 您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。 36 | 37 | 5. 免责声明与责任限制 38 | 39 | “软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。 40 | 41 | 6. 语言 42 | “本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。 43 | 44 | 条款结束 45 | 46 | 如何将木兰宽松许可证,第2版,应用到您的软件 47 | 48 | 如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步: 49 | 50 | 1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字; 51 | 52 | 2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中; 53 | 54 | 3, 请将如下声明文本放入每个源文件的头部注释中。 55 | 56 | Copyright (c) [Year] [name of copyright holder] 57 | [Software Name] is licensed under Mulan PSL v2. 58 | You can use this software according to the terms and conditions of the Mulan PSL v2. 59 | You may obtain a copy of Mulan PSL v2 at: 60 | http://license.coscl.org.cn/MulanPSL2 61 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 62 | See the Mulan PSL v2 for more details. 63 | 64 | 65 | Mulan Permissive Software License,Version 2 66 | 67 | Mulan Permissive Software License,Version 2 (Mulan PSL v2) 68 | January 2020 http://license.coscl.org.cn/MulanPSL2 69 | 70 | Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions: 71 | 72 | 0. Definition 73 | 74 | Software means the program and related documents which are licensed under this License and comprise all Contribution(s). 75 | 76 | Contribution means the copyrightable work licensed by a particular Contributor under this License. 77 | 78 | Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License. 79 | 80 | Legal Entity means the entity making a Contribution and all its Affiliates. 81 | 82 | Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity. 83 | 84 | 1. Grant of Copyright License 85 | 86 | Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not. 87 | 88 | 2. Grant of Patent License 89 | 90 | Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken. 91 | 92 | 3. No Trademark License 93 | 94 | No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4. 95 | 96 | 4. Distribution Restriction 97 | 98 | You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software. 99 | 100 | 5. Disclaimer of Warranty and Limitation of Liability 101 | 102 | THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 103 | 104 | 6. Language 105 | 106 | THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL. 107 | 108 | END OF THE TERMS AND CONDITIONS 109 | 110 | How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software 111 | 112 | To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps: 113 | 114 | i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner; 115 | 116 | ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package; 117 | 118 | iii Attach the statement to the appropriate annotated syntax at the beginning of each source file. 119 | 120 | 121 | Copyright (c) [Year] [name of copyright holder] 122 | [Software Name] is licensed under Mulan PSL v2. 123 | You can use this software according to the terms and conditions of the Mulan PSL v2. 124 | You may obtain a copy of Mulan PSL v2 at: 125 | http://license.coscl.org.cn/MulanPSL2 126 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 127 | See the Mulan PSL v2 for more details. 128 | -------------------------------------------------------------------------------- /元素定位助手/元素定位助手/Saossionpage_ele_helper_5.2/background.js: -------------------------------------------------------------------------------- 1 | // 检查是否已存在具有相同 ID 的菜单项,如果有就清空 2 | chrome.contextMenus.removeAll( 3 | ); 4 | 5 | // 创建新的右键菜单 6 | create_right_menu(); 7 | 8 | function create_right_menu() { 9 | 10 | chrome.contextMenus.create({ 11 | id: "F9", 12 | title: "刷新定位", 13 | contexts: ["all"] 14 | }); 15 | 16 | chrome.contextMenus.create({ 17 | id: "copyDP_simple", 18 | title: "复制 Drissionpage精简语法", 19 | contexts: ["all"] 20 | }); 21 | chrome.contextMenus.create({ 22 | id: "copyDP", 23 | title: "复制 Drissionpage完整语法", 24 | contexts: ["all"] 25 | }); 26 | chrome.contextMenus.create({ 27 | id: "copyXpath", 28 | title: "复制 Xpath语法", 29 | contexts: ["all"] 30 | }); 31 | 32 | chrome.contextMenus.create({ 33 | id: "fingerPrint", 34 | title: "指纹检测", 35 | contexts: ["all"], 36 | 37 | }); 38 | 39 | // 创建第二级子菜单项1 40 | chrome.contextMenus.create({ 41 | id: "copy", 42 | title: "复制", 43 | contexts: ["all"] 44 | }); 45 | chrome.contextMenus.create({ 46 | id: "copy_code", 47 | title: "启动代码", 48 | contexts: ["all"], 49 | parentId: "copy" 50 | }); 51 | chrome.contextMenus.create({ 52 | id: "cookie", 53 | title: "网页cookie", 54 | contexts: ["all"], 55 | parentId: "copy" 56 | 57 | }); 58 | chrome.contextMenus.create({ 59 | id: "copy_input", 60 | title: "input()语法", 61 | contexts: ["editable"], 62 | parentId: "copy" 63 | }); 64 | chrome.contextMenus.create({ 65 | id: "copy_click", 66 | title: "click()语法", 67 | contexts: ["all"], 68 | parentId: "copy" 69 | }); 70 | chrome.contextMenus.create({ 71 | id: "copy_ua", 72 | title: "网页UA", 73 | contexts: ["all"], 74 | parentId: "copy" 75 | }); 76 | 77 | // 创建第二级子菜单项1 78 | chrome.contextMenus.create({ 79 | id: "sub_setup", 80 | title: "设置", 81 | contexts: ["all"] 82 | }); 83 | chrome.contextMenus.create({ 84 | id: "switch_ele_window", 85 | title: "🔵元素浮窗开关", 86 | contexts: ["all"], 87 | parentId: "sub_setup" 88 | 89 | }); 90 | chrome.contextMenus.create({ 91 | id: "set_ele_window", 92 | title: "🔵元素定位设置", 93 | contexts: ["all"], 94 | parentId: "sub_setup" 95 | 96 | }); 97 | // 创建第二级子菜单项2 98 | chrome.contextMenus.create({ 99 | id: "more", 100 | title: "更多", 101 | contexts: ["all"] 102 | }); 103 | chrome.contextMenus.create({ 104 | id: "vip", 105 | title: "解析当前网页视频", 106 | contexts: ["all"], 107 | parentId: "more" 108 | }); 109 | chrome.contextMenus.create({ 110 | id: "exe_js", 111 | title: "js代码调试", 112 | contexts: ["all"], 113 | parentId: "more" 114 | }); 115 | chrome.contextMenus.create({ 116 | id: "get_img", 117 | title: "获取所有图片地址", 118 | contexts: ["all"], 119 | parentId: "more" 120 | }); 121 | chrome.contextMenus.create({ 122 | id: "download_video", 123 | title: "视频解析下载", 124 | contexts: ["all"], 125 | parentId: "more" 126 | }); 127 | 128 | } 129 | 130 | // 根据菜单项ID调用不同的函数 131 | chrome.contextMenus.onClicked.addListener(function(info, tab) { 132 | const functions = { 133 | "copyDP_simple": showElementDP_simple, 134 | "copyDP": showElementDP, 135 | "copyXpath": showElementXpath, 136 | "F9": refresh, 137 | "vip": parserVideo, 138 | "copy_input": copy_ele_and_input, 139 | "copy_click": copy_ele_and_click, 140 | "cookie": getCookie, 141 | "fingerPrint": scan_finger_print_, 142 | "switch_ele_window": info_show_switch_, 143 | "set_ele_window": set_ele_loc, 144 | "copy_code": copy_init_code, 145 | "copy_ua": getUA, 146 | "exe_js": exe_js, 147 | "get_img": getAllImageLinks, 148 | "download_video": download_video 149 | 150 | }; 151 | 152 | const func = functions[info.menuItemId]; 153 | if (func) { 154 | chrome.scripting.executeScript({ 155 | target: { 156 | tabId: tab.id 157 | }, 158 | function: func 159 | }); 160 | } else { 161 | console.error("Unsupported menu item ID:", info.menuItemId); 162 | } 163 | }); 164 | 165 | // 监听函数 166 | 167 | // 监听来自 tool.js Script 的消息 168 | chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { 169 | // 如果消息包含标题信息 170 | if (message.ele_count) { 171 | // 更新右键菜单的二级菜单名 172 | chrome.contextMenus.update("F9", { 173 | title: `刷新定位(已定位${message.ele_count}个元素)` 174 | }); 175 | } 176 | }); 177 | 178 | // 工具库 函数 179 | 180 | function getCookie() { 181 | main_app.copyToClipboard(document.cookie); 182 | alert('网页的cookie已经复制到剪贴板 \n' + document.cookie); 183 | 184 | } 185 | function scan_finger_print_() { 186 | window.open("https://ip77.net/", "_blank"); 187 | 188 | } 189 | 190 | function getUA() { 191 | main_app.copyToClipboard(navigator.userAgent); 192 | 193 | alert('网页的UA已经复制到剪贴板 \n' + navigator.userAgent); 194 | } 195 | 196 | function exe_js() { 197 | main_app.execute_js(); 198 | 199 | } 200 | function showElementDP_simple() { 201 | main_app.extractInfoAndAlert_simple(); 202 | 203 | } 204 | 205 | function showElementDP() { 206 | main_app.extractInfoAndAlert(); 207 | } 208 | 209 | function showElementXpath() { 210 | main_app.copyElementXPath(); 211 | } 212 | function copy_ele_and_input() { 213 | main_app.extractInfoAndAlert_simple_input(); 214 | } 215 | 216 | function copy_ele_and_click() { 217 | main_app.extractInfoAndAlert_simple_click(); 218 | } 219 | 220 | function refresh() { 221 | main_app.addClickEventToInputs(); 222 | alert('-✔️骚神库元素定位插件- \n 插件已经深度解析,并重新定位动态元素!!'); 223 | 224 | } 225 | 226 | function refresh_init() { 227 | main_app.addClickEventToInputs(); 228 | main_app.listen_for_mousemove(); 229 | 230 | } 231 | 232 | //------------ 233 | function parserVideo() { 234 | // 获取当前网页的网址 235 | var currentURL = window.location.href; 236 | // 拼接新的网址 237 | var newURL = "https://jx.jsonplayer.com/player/?url=" + window.location.href; 238 | 239 | // 在新标签页中打开新网址 240 | window.open(newURL, "_blank"); 241 | } 242 | 243 | function info_show_switch_() { 244 | info_show_switch(); 245 | } 246 | function set_ele_loc() { 247 | selectAlert.show(); 248 | } 249 | 250 | function download_video() { 251 | main_app.download_video(); 252 | 253 | } 254 | 255 | function copy_init_code() { 256 | // copyToClipboard(init_code); 257 | navigator.clipboard.writeText(init_code); 258 | // AutoDismissAlert('已经复制 \n'+init_code,2000); 259 | alert('当前网页启动代码已经复制 \n' + init_code); 260 | } 261 | function getAllImageLinks() { 262 | // 获取当前网页中所有的图片元素 263 | const images = document.getElementsByTagName('img'); 264 | 265 | // 创建一个空数组来存储图片链接地址 266 | const imageLinks = []; 267 | 268 | // 遍历所有图片元素,提取图片链接地址并添加到数组中 269 | for (let i = 0; i < images.length; i++) { 270 | const image = images[i]; 271 | const src = image.src; 272 | // 获取图片链接地址 273 | imageLinks.push(src); 274 | // 将链接地址添加到数组中 275 | } 276 | 277 | // 创建一个新的 div 元素 278 | const div = document.createElement('div'); 279 | div.id = 'img_url'; 280 | // 设置 div 元素的 id 属性为 img_url 281 | 282 | // 将图片链接转换成带链接的 标签并添加到 div 元素中 283 | imageLinks.forEach(link=>{ 284 | const a = document.createElement('a'); 285 | a.href = link; 286 | // 设置 标签的 href 属性为图片链接地址 287 | a.textContent = link; 288 | // 设置 标签的文本内容为图片链接地址 289 | div.appendChild(a); 290 | // 将 标签添加到 div 元素中 291 | div.appendChild(document.createElement('br')); 292 | // 添加一个换行 293 | } 294 | ); 295 | 296 | // 将新创建的 div 元素插入到 body 中 297 | document.body.appendChild(div); 298 | 299 | // 打印出获取到的所有图片链接地址 300 | console.log("当前网页所有图片链接地址:"); 301 | console.log(imageLinks); 302 | 303 | // 返回图片链接数组(可选) 304 | return imageLinks; 305 | } 306 | -------------------------------------------------------------------------------- /元素定位助手/元素定位助手/Saossionpage_ele_helper_4.7/content.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | // add_tag_to_body('script','tool',innerHtmlContent_script); //添加功能脚本标签 8 | // 把工具函数注入到网页 9 | injectCustomJs(); 10 | 11 | //初始化 插件本地存储变量 ‘show_div' 12 | 13 | if (typeof window.localStorage.getItem('is_init') !== 'undefined') { 14 | console.log('window.localStorage.is_init 存在'); 15 | } else { 16 | console.log('window.localStorage.is_init 不存在,初始化 插件本地存储变量 '); 17 | 18 | // 将布尔值 false 存储到 localStorage 中 19 | window.localStorage.setItem('is_init', 'true'); 20 | 21 | chrome.storage.local.set({ show_div: '显示' }, function () { 22 | if (chrome.runtime.lastError) { 23 | console.error("存储出现错误:" + chrome.runtime.lastError); 24 | } else { 25 | console.log("存储成功"); 26 | } 27 | }); 28 | } 29 | 30 | 31 | //############################监听部分 32 | 33 | var element_hover_color='rgba(255, 0, 0, 0.5)'; 34 | 35 | 36 | 37 | 38 | 39 | // -------------------------------------------创建导航信息栏 40 | 41 | function createNavbar() { 42 | // 获取当前网页的标题 43 | const pageTitle = document.title; 44 | 45 | // 创建导航栏元素 46 | const navbar = document.createElement('div'); 47 | // navbar.classList.add('navbar2'); 48 | navbar.id='daohanglan'; 49 | 50 | 51 | 52 | // 创建导航栏文本元素 53 | const navText = document.createElement('span'); 54 | navText.textContent = '骚神库元素语法自动显示插件'; 55 | navText.id = 'show'; 56 | 57 | 58 | 59 | 60 | // 将文本添加到导航栏中 61 | navbar.appendChild(navText); 62 | 63 | // 将导航栏添加到页面的 body 元素中 64 | document.body.insertBefore(navbar, document.body.firstChild); 65 | 66 | //初始化导航栏的位置 67 | togglePosition(); 68 | 69 | 70 | } 71 | 72 | // 调用函数创建导航栏 73 | createNavbar(); 74 | 75 | 76 | 77 | 78 | // -------------------------------工具函数 79 | 80 | //检查字符串是否为空 81 | function isBlankString(str) { 82 | return str.trim().length === 0; 83 | } 84 | // 检查是否包含特殊字符 85 | function containsString(str) { 86 | return str.includes('href') || str.includes('src'); 87 | } 88 | 89 | //打印某个元素的所有属性值 90 | function printElementAttributesAsString(element) { 91 | // 检查输入是否是一个元素 92 | if (!(element instanceof Element)) { 93 | console.error('输入必须是一个HTML元素'); 94 | return; 95 | } 96 | 97 | // 获取元素的所有属性 98 | var attrs = element.attributes; 99 | 100 | // 初始化一个空字符串用于存储属性 101 | var attributesString = ''; 102 | 103 | // 遍历所有属性并将它们的名称和值拼接到字符串中 104 | for (var i = 0; i < attrs.length; i++) { 105 | var attrName = attrs[i].name; 106 | var attrValue = attrs[i].value; 107 | //特殊情况处理 108 | if (containsString(attrName)) continue; 109 | if (isBlankString(attrValue)) continue; 110 | // 如果使用了 element_hover_color 颜色,则跳过该属性 111 | if (attrName.includes('style') && attrValue.includes( element_hover_color )) continue; 112 | if (attrValue.length > 25 && attrName != "class") { 113 | attributesString += "@@" + attrName + "^" + attrValue.slice(0, 20); 114 | } else { 115 | // 拼接属性名和属性值,属性之间用空格分隔 116 | attributesString += "@@" + attrName + "=" + attrValue; 117 | } 118 | 119 | 120 | 121 | } 122 | 123 | // 打印最终的属性字符串 124 | //console.log(attributesString.trim()); // 使用trim()移除尾部的空格 125 | return attributesString.trim(); 126 | } 127 | 128 | 129 | 130 | //添加监听 131 | function addClickEventToInputs() { 132 | // 获取所有输入框元素 133 | var inputElements = document.querySelectorAll('a,li,img,input,button'); 134 | //var inputElements = document.querySelectorAll('*'); 135 | 136 | // 暂存元素定位信息 137 | let info = ""; 138 | var theEle = {style: {},elementRect: {left: 0, top: 0}}; 139 | 140 | // 为每个输入框元素添加点击事件监听器 141 | inputElements.forEach(function (inputElement) { 142 | // 添加鼠标经过事件监听器 143 | inputElement.addEventListener('mouseover', function (event) { 144 | // 如果当前元素已经高亮,则取消高亮 145 | if ('backgroundColor' in theEle.style && theEle.style.backgroundColor == element_hover_color){ 146 | theEle.style.backgroundColor = ''; 147 | // delete theEle.style; // 这句没效果 148 | } 149 | // 经过元素时给元素加个高亮 150 | this.style.backgroundColor = element_hover_color; 151 | // 暂存当前元素 152 | theEle = this; 153 | 154 | // 以下是获取元素定位语法功能 155 | var attrib_info = printElementAttributesAsString(inputElement); 156 | 157 | var Name = "tag:" + inputElement.tagName.toLowerCase(); 158 | 159 | var text = inputElement.innerText; 160 | 161 | 162 | if (isBlankString(text)) { 163 | text = ""; 164 | } else { 165 | 166 | if (text.length <= 15) text = "@@text()=" + text; 167 | else text = "@@text()^" + text.slice(0,10); 168 | 169 | } 170 | 171 | window.XPath_info="xpath:"+getElementXPath(inputElement); 172 | 173 | window.anotherGlobalVar = Name + attrib_info + text; 174 | 175 | info ="按alt+1 复制XPath-->@@"+window.XPath_info+"
"+ "按F8复制元素语法-->@@" + Name + attrib_info + text ; 176 | 177 | // info =info +"
"+"按alt+1 复制XPath-->@@"+window.XPath_info; 178 | 179 | 180 | }); 181 | 182 | }); 183 | 184 | // 监听鼠标移动事件 185 | document.addEventListener('mousemove', function(event) { 186 | 187 | // 设置 daohanglan 是否隐藏 188 | chrome.storage.local.get('show_div', function (result) { 189 | if (chrome.runtime.lastError) { 190 | // 处理错误的情况 191 | console.error("发生错误:" + chrome.runtime.lastError); 192 | 193 | } else { 194 | 195 | 196 | if (result.show_div == '隐藏') { 197 | document.getElementById('daohanglan').style.display = "none"; 198 | } else { 199 | document.getElementById('daohanglan').style.display = "block"; 200 | } 201 | 202 | } 203 | }); 204 | 205 | // 边缘碰撞检测 206 | 207 | let daohanglan = document.getElementById("daohanglan"); 208 | 209 | 210 | setTimeout(function () { 211 | 212 | // 定义常量以避免重复的数字字面量 213 | const OFFSET = 300; 214 | const pianyi = 20; 215 | // 获取元素的宽度(包括边框、内边距和滚动条) 216 | let width = daohanglan.offsetWidth; 217 | 218 | // 获取元素的高度(包括边框、内边距和滚动条) 219 | let height = daohanglan.offsetHeight; 220 | 221 | 222 | if (event.clientX < window.outerWidth -width-40) { 223 | // 根据 event.clientX 设置 daohanglan 元素的 left 属性 224 | daohanglan.style.left = (event.clientX + pianyi) + "px"; 225 | } else { 226 | daohanglan.style.left =(event.clientX - pianyi-width) + "px"; 227 | 228 | } 229 | 230 | // daohanglan.style.top = (event.pageY + pianyi) + "px"; 231 | if (event.pageY < window.outerHeight - height - 40) { 232 | 233 | daohanglan.style.top = (event.pageY + pianyi) + "px"; 234 | } else { 235 | 236 | daohanglan.style.top = (event.pageY-pianyi -height) + "px"; 237 | } 238 | 239 | 240 | 241 | 242 | 243 | }, 0); // 延迟1000毫秒(即1秒) 244 | // 245 | // 为了计算元素内坐标,获取当前元素的位置 246 | // elementRect = theEle.getBoundingClientRect(); 247 | // let eleX = (event.clientX-elementRect.left).toFixed(4); 248 | // let eleY = (event.clientY-elementRect.top).toFixed(4); 249 | xyInfoDoc = "全局坐标 x:" + event.clientX + ",y:" + event.clientY + "
"; 250 | // xyInfoEle = "元素内坐标 x:"+eleX+",y:"+eleY+"
"; 251 | 252 | // 将坐标信息、定位语法 显示到页面上 253 | let F9_info='按F9 定位动态元素'+"
"; 254 | 255 | 256 | 257 | document.getElementById('show').textContent = xyInfoDoc + F9_info + info; 258 | format_the_text(); 259 | }) 260 | } 261 | 262 | 263 | 264 | function format_the_text(){ 265 | // 获取包含文本的 span 元素 266 | let spanElement = document.getElementById('show'); 267 | 268 | // 获取 span 元素内的文本内容 269 | let textContent = spanElement.textContent; 270 | 271 | // 使用 @@ 进行分割 272 | let lines = textContent.split('@@'); 273 | 274 | // 创建一个新的文本内容 275 | let newContent = ''; 276 | lines.forEach(function(line, index) { 277 | // 添加换行符 278 | if (index > 0) { 279 | newContent += '
'; 280 | } 281 | // 添加当前行文本 282 | newContent += line; 283 | }); 284 | 285 | // 更新 span 元素的内容为新的文本内容 286 | spanElement.innerHTML = newContent; 287 | } 288 | 289 | 290 | 291 | // 鼠标 悬浮 监听 调用函数,添加事件 292 | addClickEventToInputs(); 293 | 294 | 295 | 296 | 297 | // 监听导航栏 进行位置变换 298 | document.getElementById("daohanglan").addEventListener("click", function() { 299 | 300 | togglePosition(); 301 | // alert(" 你切换了 元素语法信息导航栏 的位置"); 302 | 303 | 304 | }); 305 | 306 | 307 | 308 | 309 | 310 | 311 | // 监听 F8 F9 按键 alt +1 312 | document.addEventListener('keydown', function(event) { 313 | // 检查是否按下了f8键(keyCode为18) 314 | if (event.keyCode === 119) { 315 | // 打印当前网页标题 316 | //console.log('Current page title: ' + document.title); 317 | extractInfoAndAlert(); 318 | 319 | } 320 | // 检查是否按下了f9键(keyCode为120) 321 | if (event.keyCode === 120) { 322 | // 打印当前网页标题 323 | addClickEventToInputs(); 324 | alert('-骚神库元素定位插件- \n 你按下了F9键\n 插件已经深度解析,重新定位动态元素!!'); 325 | } 326 | 327 | if (event.altKey && (event.key === "1" || event.keyCode === 49)) { 328 | // 在这里执行按下 alt + 1 后的操作 329 | copyElementXPath(); 330 | copyToClipboard(window.XPath_info); 331 | } 332 | 333 | }); 334 | 335 | 336 | // 获取元素的XPath 337 | function getElementXPath(element) { 338 | if (element && element.id) { 339 | return 'id("' + element.id + '")'; 340 | } else { 341 | let paths = []; 342 | for (; element && element.nodeType == Node.ELEMENT_NODE; element = element.parentNode) { 343 | let index = 0; 344 | let siblings = element.parentNode.childNodes; 345 | for (let i = 0; i < siblings.length; i++) { 346 | let sibling = siblings[i]; 347 | if (sibling == element) { 348 | index++; 349 | break; 350 | } 351 | } 352 | let tagName = element.nodeName.toLowerCase(); 353 | let pathIndex = (index ? "[" + (index+1) + "]" : ""); 354 | paths.splice(0, 0, tagName + pathIndex); 355 | } 356 | return paths.length ? "/" + paths.join("/") : null; 357 | } 358 | } 359 | 360 | // 复制元素的XPath 361 | function copyElementXPath() { 362 | alert("已经复制下面XPath语法到剪贴板 \n"+window.XPath_info); 363 | 364 | } 365 | 366 | 367 | 368 | // 提取元素语法内容 并弹窗提示 369 | function extractInfoAndAlert(){ 370 | 371 | 372 | // var tishi2=document.getElementById('show').textContent.substring(13) 373 | tishi2=window.anotherGlobalVar; 374 | copyToClipboard(tishi2); 375 | 376 | alert('已经复制该语法到剪贴板 '+tishi2); 377 | 378 | } 379 | 380 | 381 | 382 | 383 | 384 | // 复制到剪贴板操作 385 | function copyToClipboard(text) { 386 | var tempInput = document.createElement("input"); // 创建临时输入框元素 387 | 388 | tempInput.value = text; // 将输入的文本赋给临时输入框 389 | document.body.appendChild(tempInput); // 将临时输入框添加到页面中 390 | 391 | tempInput.select(); // 选中临时输入框中的文本 392 | document.execCommand("copy"); // 执行复制操作 393 | 394 | document.body.removeChild(tempInput); // 删除临时输入框 395 | } 396 | 397 | 398 | // 切换导航栏位置 399 | function togglePosition() { 400 | var daohanglan = document.getElementById("daohanglan"); 401 | 402 | if (daohanglan.style.left !== '') { 403 | daohanglan.style.removeProperty('left'); 404 | daohanglan.style.right = "0px"; 405 | 406 | 407 | } else { 408 | daohanglan.style.removeProperty('right'); 409 | daohanglan.style.left = "0px"; 410 | 411 | 412 | } 413 | } 414 | 415 | 416 | // 向页面注入JS 417 | function injectCustomJs(jsPath) { 418 | jsPath = jsPath || 'js/inject.js'; 419 | var temp = document.createElement('script'); 420 | temp.setAttribute('type', 'text/javascript'); 421 | // 获得的地址类似:chrome-extension://ihcokhadfjfchaeagdoclpnjdiokfakg/js/inject.js 422 | temp.src = chrome.runtime.getURL(jsPath); 423 | temp.onload = function() { 424 | // 放在页面不好看,执行完后移除掉 425 | this.parentNode.removeChild(this); 426 | }; 427 | document.body.appendChild(temp); 428 | } 429 | 430 | 431 | 432 | -------------------------------------------------------------------------------- /元素定位助手/元素定位助手/Saossionpage_ele_helper_5.2/content.js: -------------------------------------------------------------------------------- 1 | // 骚神库 DP_helper 2 | 3 | 4 | //----------封装主函数 5 | class MainApp{ 6 | constructor() { 7 | this.init(); 8 | 9 | } 10 | 11 | async init(){ 12 | 13 | var self=this; 14 | 15 | this.createNavbar();//调用函数创建导航栏 默认隐藏 16 | this.toggleDiv(); 17 | 18 | 19 | // ----------------监听导航栏 进行位置变换 20 | $('#daohanglan').on('click', function() { 21 | togglePosition(); 22 | }); 23 | 24 | 25 | this.listen_mousemove_to_update_div(); //监听鼠标移动 26 | 27 | 28 | // 监听按键 F2 F8 F9 alt+1 29 | $(document).keydown(function(event) { 30 | switch (event.keyCode) { 31 | case 119: // F8键 32 | self.extractInfoAndAlert(); 33 | break; 34 | case 113: // F2键 35 | self.extractInfoAndAlert_simple(); 36 | break; 37 | case 120: // F9键 38 | alert('-✔️骚神库元素定位插件- \n 网页已经刷新定位\n 插件已经深度解析,重新定位动态元素!!'); 39 | break; 40 | case 49: // 数字键1 41 | if (event.altKey) { 42 | self.copyElementXPath(); 43 | } 44 | break; 45 | } 46 | }); 47 | } 48 | 49 | 50 | // -------------------------------------------创建导航信息栏 51 | 52 | createNavbar() { 53 | // 获取当前网页的标题 54 | const pageTitle = document.title; 55 | 56 | // 创建导航栏元素 57 | const navbar = document.createElement('div'); 58 | // navbar.classList.add('navbar2'); 59 | navbar.id='daohanglan'; 60 | 61 | 62 | // 创建导航栏文本元素 63 | const navText = document.createElement('span'); 64 | navText.textContent = '骚神库元素语法自动显示插件'; 65 | navText.id = 'show'; 66 | 67 | // 将文本添加到导航栏中 68 | navbar.appendChild(navText); 69 | 70 | // 将导航栏添加到页面的 body 元素中 71 | document.body.insertBefore(navbar, document.body.firstChild); 72 | 73 | //初始化导航栏的位置 74 | this.togglePosition(); 75 | 76 | } 77 | // -------------切换div隐藏 78 | async toggleDiv(){ 79 | chrome.storage.local.get('show_div', function (result) { 80 | var newState = result.show_div ; 81 | 82 | if (newState == '隐藏') { 83 | document.getElementById('daohanglan').style.display = "none"; 84 | } else { 85 | document.getElementById('daohanglan').style.display = "block"; 86 | } 87 | }); 88 | 89 | } 90 | 91 | 92 | // -------------------------------工具函数 93 | 94 | // 是否是空字符 95 | isBlankString(str) { 96 | if (str && typeof str === 'string') { 97 | return str.trim().length === 0; 98 | } else { 99 | return true; // 将空值、null 和 undefined 视为“空字符串” 100 | } 101 | } 102 | 103 | // 检查是否包含特殊字符 104 | containsString(str) { 105 | return str.includes('href') || str.includes('src'); 106 | } 107 | 108 | //打印某个元素的所有属性值 109 | printElementAttributesAsString(element) { 110 | // 初始化一个空字符串用于存储属性 111 | var attributesString = ''; 112 | 113 | // 检查输入是否是一个元素 114 | if (!(element instanceof Element)) { 115 | // console.error('输入必须是一个HTML元素'); 116 | return '当前位置无法解析元素'; 117 | } 118 | 119 | // 获取元素的所有属性 120 | var attrs = element.attributes; 121 | 122 | 123 | // 遍历所有属性并将它们的名称和值拼接到字符串中 124 | for (var i = 0; i < attrs.length; i++) { 125 | var attrName = attrs[i].name; 126 | var attrValue = attrs[i].value; 127 | //特殊情况处理 128 | if (this.containsString(attrName)) continue; 129 | if (this.isBlankString(attrValue)) continue; 130 | // 如果使用了 element_hover_color 颜色,则跳过该属性 131 | if (attrName.includes('style') && attrValue.includes( this.element_hover_color )) continue; 132 | if (attrValue.length > 25 && attrName != "class") { 133 | attributesString += "@@" + attrName + "^" + attrValue.slice(0, 20); 134 | } else { 135 | // 拼接属性名和属性值,属性之间用空格分隔 136 | attributesString += "@@" + attrName + "=" + attrValue; 137 | } 138 | 139 | 140 | 141 | } 142 | 143 | // 打印最终的属性字符串 144 | //console.log(attributesString.trim()); // 使用trim()移除尾部的空格 145 | return attributesString.trim(); 146 | } 147 | 148 | //打印某个元素的 精简属性值 149 | printElementAttributesAsString_simple(element) { 150 | // 检查输入是否是一个元素 151 | if (!(element instanceof Element)) { 152 | console.log('输入必须是一个HTML元素'); 153 | return '必须是一个HTML元素'; 154 | } 155 | 156 | // 获取元素的所有属性 157 | var attrs = element.attributes; 158 | 159 | // 初始化一个空字符串用于存储属性 160 | var attributesString = ''; 161 | if (element.hasAttribute('id')){ 162 | attributesString = "@@id=" + element.id; 163 | return attributesString.trim(); 164 | 165 | } 166 | if (element.classList.length > 0) { 167 | // 元素具有 class 属性 168 | let classValue = element.classList.value; // 获取所有 class 值,以字符串形式返回 169 | attributesString = "@@class=" + classValue; 170 | return attributesString.trim(); 171 | 172 | } 173 | 174 | // 检查元素是否有innerText,并返回其值 175 | if (element.innerText !== null && element.innerText !== undefined) { 176 | let innerTextValue = element.innerText; 177 | attributesString = "@@text()=" + innerTextValue; 178 | return attributesString.trim(); 179 | } 180 | 181 | 182 | 183 | // 打印最终的属性字符串 184 | //console.log(attributesString.trim()); // 使用trim()移除尾部的空格 185 | return attributesString.trim(); 186 | } 187 | 188 | 189 | 190 | // 提取某个元素的属性信息 191 | async extract_attri_info_to_div(inputElement) { 192 | // 暂存元素定位信息 193 | let info = ""; 194 | var theEle = { style: {}, elementRect: { left: 0, top: 0 } }; 195 | 196 | // inputElement.addEventListener('mouseover', function() { this.style.backgroundColor ='';this.style.fontWeight = 'bold';}); 197 | // inputElement.addEventListener('mouseout', function() { this.style.backgroundColor ='';this.style.fontWeight = 'normal';}); 198 | if (!(inputElement instanceof Element)) { 199 | console.log('输入必须是一个HTML元素'); 200 | window.info='当前位置是非元素' 201 | return ; 202 | } 203 | 204 | 205 | 206 | 207 | // 暂存当前元素 208 | theEle = this; 209 | let self=this; 210 | 211 | // 以下是获取元素定位语法功能 212 | var attrib_info = self.printElementAttributesAsString(inputElement); 213 | var attrib_info_simple = self.printElementAttributesAsString_simple(inputElement); 214 | 215 | var Name = "tag:" + inputElement.tagName.toLowerCase(); 216 | 217 | var text = inputElement.innerText; 218 | 219 | 220 | if (self.isBlankString(text)) { 221 | text = ""; 222 | } else { 223 | 224 | if (text.length <= 15) text = "@@text()=" + text; 225 | else text = "@@text()^" + text.slice(0, 10); 226 | 227 | } 228 | 229 | window.XPath_info = "xpath:" + self.getElementXPath(inputElement); 230 | 231 | window.anotherGlobalVar = Name + attrib_info + text; 232 | window.anotherGlobalVar_simple = Name + attrib_info_simple; 233 | 234 | window.info = "🔹按alt+1 复制XPath-->@@" + window.XPath_info + "
" + "🔹按F2复制精简语法
🔹按F8复制完整语法--> @@" + Name + attrib_info + text; 235 | 236 | 237 | } 238 | 239 | 240 | 241 | sleep(ms) { 242 | // 创建一个新的Promise对象,并将resolve作为回调函数传入 243 | return new Promise(resolve => setTimeout(resolve, ms)); 244 | // 调用setTimeout函数,设置延迟时间为ms毫秒,延迟时间结束后调用resolve回调函数 245 | } 246 | 247 | //------------监听鼠标移动 248 | listen_mousemove_to_update_div(){ 249 | let self=this; 250 | document.addEventListener('mousemove', async function(event) { 251 | //提取信息 252 | var hoveredElement = document.elementFromPoint(event.clientX, event.clientY); 253 | 254 | 255 | // await self.sleep(1000); 256 | 257 | await self.extract_attri_info_to_div(hoveredElement); 258 | 259 | 260 | 261 | // 边缘碰撞检测 262 | 263 | let daohanglan = document.getElementById("daohanglan"); 264 | 265 | 266 | setTimeout(function () { 267 | 268 | // 定义常量以避免重复的数字字面量 269 | const OFFSET = 300; 270 | const pianyi = 20; 271 | // 获取元素的宽度(包括边框、内边距和滚动条) 272 | let width = daohanglan.offsetWidth; 273 | 274 | // 获取元素的高度(包括边框、内边距和滚动条) 275 | let height = daohanglan.offsetHeight; 276 | 277 | 278 | if (event.clientX < window.outerWidth -width-40) { 279 | // 根据 event.clientX 设置 daohanglan 元素的 left 属性 280 | daohanglan.style.left = (event.clientX + pianyi) + "px"; 281 | } else { 282 | daohanglan.style.left =(event.clientX - pianyi-width) + "px"; 283 | 284 | } 285 | 286 | // daohanglan.style.top = (event.pageY + pianyi) + "px"; 287 | if (event.pageY < window.outerHeight - height - 40) { 288 | 289 | daohanglan.style.top = (event.pageY + pianyi) + "px"; 290 | } else { 291 | 292 | daohanglan.style.top = (event.pageY-pianyi -height) + "px"; 293 | } 294 | 295 | 296 | 297 | 298 | 299 | }, 0); // 延迟1000毫秒(即1秒) 300 | 301 | // 获取鼠标位置 302 | var mouseX = event.clientX + window.screenX; 303 | var mouseY = event.clientY + window.screenY; 304 | // 为了计算元素内坐标,获取当前元素的位置 305 | 306 | 307 | var xyInfoDoc1 = "浏览器坐标 x:" + event.clientX + ",y:" + event.clientY + "
"; 308 | var xyInfoDoc2 = "屏幕坐标 x:" + mouseX + ",y:" + mouseY + "
"; 309 | 310 | // xyInfoEle = "元素内坐标 x:"+eleX+",y:"+eleY+"
"; 311 | 312 | // 将坐标信息、定位语法 显示到页面上 313 | var F9_info='🔹按F9 刷新定位'+"
"; 314 | 315 | 316 | document.getElementById('show').textContent = xyInfoDoc1+xyInfoDoc2 + F9_info + window.info; 317 | 318 | 319 | 320 | 321 | // 获取包含文本的 span 元素 322 | let spanElement = document.getElementById('show'); 323 | 324 | // 获取 span 元素内的文本内容 325 | let textContent = spanElement.textContent; 326 | 327 | // 使用 @@ 进行分割 328 | let lines = textContent.split('@@'); 329 | 330 | // 创建一个新的文本内容 331 | let newContent = ''; 332 | lines.forEach(function(line, index) { 333 | if (line.includes('tag')) { 334 | line = 'tag:' + line.split(':')[1] + ''; 335 | } 336 | // 添加换行符 337 | if (index > 0) { 338 | newContent += '
'; 339 | } 340 | // 添加当前行文本 341 | newContent += line; 342 | }); 343 | 344 | // 更新 span 元素的内容为新的文本内容 345 | spanElement.innerHTML = newContent; 346 | 347 | 348 | 349 | 350 | }); 351 | 352 | 353 | } 354 | // -------------------格式化字符串 355 | 356 | 357 | format_the_text(id){ 358 | // 获取包含文本的 span 元素 359 | let spanElement = document.getElementById(id); 360 | 361 | // 获取 span 元素内的文本内容 362 | let textContent = spanElement.textContent; 363 | 364 | // 使用 @@ 进行分割 365 | let lines = textContent.split('@@'); 366 | 367 | // 创建一个新的文本内容 368 | let newContent = ''; 369 | lines.forEach(function(line, index) { 370 | // 添加换行符 371 | if (index > 0) { 372 | newContent += '
'; 373 | } 374 | // 添加当前行文本 375 | newContent += line; 376 | }); 377 | 378 | // 更新 span 元素的内容为新的文本内容 379 | spanElement.innerHTML = newContent; 380 | } 381 | // ----------------获取到元素相对于电脑显示器的坐标 382 | getElementAbsolutePosition(ele) { 383 | // 获取元素 384 | // let element = ele; 385 | 386 | if (!ele) { 387 | console.error("未找到指定ID的元素"); 388 | return null; 389 | } 390 | 391 | // 获取元素相对于视口的位置 392 | var rect = ele.getBoundingClientRect(); 393 | 394 | // 计算元素相对于电脑显示器的坐标 395 | var x = rect.left + window.scrollX; 396 | var y = rect.top + window.scrollY; 397 | 398 | return { x: x, y: y }; 399 | } 400 | 401 | 402 | 403 | 404 | 405 | // 获取元素的XPath 406 | getElementXPath(element) { 407 | if (element && element.id) { 408 | return 'id("' + element.id + '")'; 409 | } else { 410 | let paths = []; 411 | for (; element && element.nodeType == Node.ELEMENT_NODE; element = element.parentNode) { 412 | let index = 0; 413 | let siblings = element.parentNode.childNodes; 414 | for (let i = 0; i < siblings.length; i++) { 415 | let sibling = siblings[i]; 416 | if (sibling == element) { 417 | index++; 418 | break; 419 | } 420 | } 421 | let tagName = element.nodeName.toLowerCase(); 422 | let pathIndex = (index ? "[" + (index+1) + "]" : ""); 423 | paths.splice(0, 0, tagName + pathIndex); 424 | } 425 | return paths.length ? "/" + paths.join("/") : null; 426 | } 427 | } 428 | 429 | // 复制元素的XPath 430 | copyElementXPath() { 431 | this.copyToClipboard(window.XPath_info); 432 | alert("✔️已经复制下面XPath语法到剪贴板 \n"+window.XPath_info); 433 | 434 | } 435 | 436 | 437 | 438 | // 提取元素语法内容 并弹窗提示 439 | extractInfoAndAlert(){ 440 | 441 | let tishi2=window.anotherGlobalVar; 442 | this.copyToClipboard(tishi2); 443 | 444 | alert('✔️已经复制该语法到剪贴板 \n'+tishi2); 445 | 446 | } 447 | extractInfoAndAlert_simple(){ 448 | 449 | let tishi2=window.anotherGlobalVar_simple; 450 | this.copyToClipboard(tishi2); 451 | 452 | alert('✔️已经复制该精简语法到剪贴板 \n'+tishi2); 453 | 454 | } 455 | 456 | extractInfoAndAlert_simple_input(){ 457 | let result = prompt("输入框里要输入的内容:", "1234"); 458 | if (result !== null) { 459 | // 用户点击了确认按钮,result 是用户输入的值 460 | var tishi2=`page.ele('${window.anotherGlobalVar_simple}').input('${result}')` ; 461 | this.copyToClipboard(tishi2); 462 | } else { 463 | // 用户点击了取消按钮或关闭了对话框 464 | } 465 | 466 | alert('✔️已经复制该精简语法到剪贴板 \n'+tishi2); 467 | 468 | } 469 | 470 | execute_js() { 471 | let result = prompt("输入你要执行的js语句:", "alert('123');"); 472 | if (result !== null && result.trim() !== "") { 473 | try { 474 | // 使用 try...catch 捕获可能出现的错误 475 | eval(result); 476 | } catch (error) { 477 | // 如果执行出错,显示错误信息 478 | alert('执行出错:' + error); 479 | } 480 | } else { 481 | // 用户点击了取消按钮或输入为空 482 | alert('执行不成功!'); 483 | } 484 | } 485 | 486 | extractInfoAndAlert_simple_click(){ 487 | 488 | let tishi2=`page.ele('${window.anotherGlobalVar_simple}').click()` ; 489 | this.copyToClipboard(tishi2); 490 | 491 | alert('✔️已经复制该精简语法到剪贴板 \n'+tishi2); 492 | 493 | } 494 | 495 | 496 | 497 | // 复制到剪贴板操作 498 | copyToClipboard(text) { 499 | navigator.clipboard.writeText(text); 500 | } 501 | 502 | 503 | // 切换导航栏位置 504 | togglePosition() { 505 | var daohanglan = document.getElementById("daohanglan"); 506 | 507 | if (daohanglan.style.left !== '') { 508 | daohanglan.style.removeProperty('left'); 509 | daohanglan.style.right = "0px"; 510 | 511 | 512 | } else { 513 | daohanglan.style.removeProperty('right'); 514 | daohanglan.style.left = "0px"; 515 | 516 | 517 | } 518 | } 519 | 520 | 521 | // 向页面注入JS 522 | injectCustomJs(jsPath) { 523 | jsPath = jsPath || 'js/inject.js'; 524 | var temp = document.createElement('script'); 525 | temp.setAttribute('type', 'text/javascript'); 526 | // 获得的地址类似:chrome-extension://ihcokhadfjfchaeagdoclpnjdiokfakg/js/inject.js 527 | temp.src = chrome.runtime.getURL(jsPath); 528 | temp.onload = function() { 529 | // 放在页面不好看,执行完后移除掉 530 | this.parentNode.removeChild(this); 531 | }; 532 | document.body.appendChild(temp); 533 | } 534 | 535 | 536 | 537 | 538 | // 获取当前网页中所有的图片元素 539 | getAllImageLinksTo(id) { 540 | const images = this.getElementsByName(['img','source','audio']); 541 | // const images = document.getElementsByTagName('img'); 542 | 543 | // 创建一个空数组来存储图片链接地址 544 | const imageLinks = []; 545 | 546 | // 遍历所有图片元素,提取图片链接地址并添加到数组中 547 | for (let i = 0; i < images.length; i++) { 548 | const image = images[i]; 549 | const src = image.src; // 获取图片链接地址 550 | imageLinks.push(src); // 将链接地址添加到数组中 551 | } 552 | 553 | // 获取 id 为 'img_url' 的 div 元素 554 | let div = document.getElementById('img_url'); 555 | 556 | // 如果该 div 元素不存在,则创建一个新的 div 元素 557 | if (!div) { 558 | div = document.createElement('div'); 559 | div.id = 'img_url'; // 设置 div 元素的 id 属性为 img_url 560 | document.getElementById(id).appendChild(div); // 将新创建的 div 元素插入到指定 id 的父元素中 561 | } 562 | 563 | // 获取该 div 中已存在的所有链接 564 | const existingLinks = div.querySelectorAll('a'); 565 | const existingLinkUrls = Array.from(existingLinks).map(link => link.href); 566 | 567 | // 将图片链接转换成带链接的 标签并添加到 div 元素中(如果链接不存在) 568 | imageLinks.forEach(link => { 569 | if (!existingLinkUrls.includes(link)) { 570 | const a = document.createElement('a'); 571 | a.href = link; // 设置 标签的 href 属性为图片链接地址 572 | // 设置 标签的文本内容为图片链接地址 ☑️ 573 | if(link.includes('.mp4')) {a.textContent = '🔷 ' + link;} 574 | else if(link.includes('.m4a')){a.textContent = '🔶 ' + link;} 575 | else{a.textContent = '✅* ' + link;} 576 | 577 | 578 | a.target = '_blank'; 579 | div.appendChild(a); // 将 标签添加到 div 元素中 580 | div.appendChild(document.createElement('br')); // 添加一个换行 581 | } 582 | }); 583 | 584 | 585 | // 返回图片链接数组(可选) 586 | return imageLinks; 587 | } 588 | 589 | getElementsByName(tagNames) { 590 | let elements = []; 591 | 592 | // 遍历标签名称数组 593 | tagNames.forEach(tagName => { 594 | // 获取指定标签名称的所有元素 595 | const elems = Array.from(document.getElementsByTagName(tagName)); 596 | // 将获取到的元素数组合并到结果数组中 597 | elements = elements.concat(elems); 598 | }); 599 | 600 | return elements; 601 | } 602 | 603 | 604 | download_video() { 605 | // 获取包含 shadow root 的元素 606 | const toolbarShadow = document.getElementById('video_download_toolbar_shadow'); 607 | 608 | // 如果找到了元素 609 | if (toolbarShadow) { 610 | // 获取 shadow root 611 | const shadowRoot = toolbarShadow.shadowRoot; 612 | 613 | // 如果存在 shadow root 614 | if (shadowRoot) { 615 | // 在 shadow root 中查询所有 img 元素 616 | const imgElements = shadowRoot.querySelectorAll('img'); 617 | 618 | // 遍历所有的 img 元素 619 | imgElements.forEach(imgElement => { 620 | // 获取每个 img 元素的 src 属性 621 | const src = imgElement.getAttribute('src'); 622 | // 检查 src 属性中是否包含 'download' 字符串 623 | if (src.includes('download')) { 624 | // 如果包含,执行点击操作 625 | imgElement.click(); 626 | } 627 | console.log(src); 628 | } 629 | ); 630 | } 631 | } else { 632 | console.log('没有找到下载按钮!') 633 | alert('该功能仅适用于 星愿浏览器!!') 634 | } 635 | 636 | } 637 | 638 | 639 | } 640 | 641 | //创建主程序对象 642 | var main_app=new MainApp(); 643 | 644 | 645 | // ------------------遮罩层类 646 | class OverlayElement { 647 | constructor(id,iframe_src) { 648 | // 创建遮罩层元素 649 | this.element = document.createElement('div'); 650 | 651 | this.element.id = id; 652 | // 将遮罩层添加到 body 中 653 | document.body.appendChild(this.element); 654 | // 设置默认样式 655 | this.setStyle(); 656 | // 设置点击事件监听器 657 | this.element.addEventListener('click', () => this.switch_show_hide()); 658 | // 获取插件id 659 | this.pluginId=chrome.runtime.id; 660 | this.iframeSrc=chrome.runtime.getURL('code_helper.html'); 661 | // 设置遮罩层内嵌的网页 662 | this.iframeID=id+'_iframe'; 663 | this.iframeInnerText = ` 664 |
-
764 |
- 骚 765 |
- 神 766 |
- 库 767 | 768 | 769 |