简体   繁体   English

隐藏chrome-extension:在“开发人员工具”脚本选项卡中

[英]Hide chrome-extension: in “Developer Tools” Scripts tab

When I debug javascript-code in Chrome I use the Scripts tab in the Developer tools. 当我在Chrome中调试javascript代码时,我使用Developer工具中的Scripts选项卡。 In the list of scripts(the drop-down) a lot of extensions are listed on this form: 在脚本列表(下拉列表)中,此表单中列出了许多扩展:

  • chrome-extension://lfhsdjklfhaslkfhuwklshdfjkash/path/to/script.js 镀铬的扩展://lfhsdjklfhaslkfhuwklshdfjkash/path/to/script.js
  • chrome-extension://lfhsdjklfhaslkfhuwklshdfjkash/path/to/another/script.js 镀铬的扩展://lfhsdjklfhaslkfhuwklshdfjkash/path/to/another/script.js
  • and so on 等等

I've got around 20-30 such lines and that is pretty annoying when I just want to see my own scripts. 我有大约20-30条这样的线条,当我只想看到自己的脚本时,这非常烦人。

Is it possible to hide these lines but keep the scripts from the current web page? 是否可以隐藏这些行但是保留当前网页的脚本?

Chrome now has built in user profile support. Chrome现在内置了用户个人资料支持。 Create yourself a new profile with the extensions you need: https://support.google.com/chrome/answer/2364824?hl=en 使用您需要的扩展程序为自己创建新的个人资料: https//support.google.com/chrome/answer/2364824?hl = zh-CN

The first option will be to disable all your extensions... not so cool... 第一个选项是禁用所有扩展程序......不是很酷......

If you find the chrome-extensions scripts very irritating, you can create yourself a developer profile with no extensions (or a minimal set of extensions) for debugging your scripts. 如果您发现chrome-extensions脚本非常烦人,您可以自己创建一个没有扩展(或一组最小扩展)的开发人员配置文件来调试脚本。 Explanation for windows: Windows解释:

  • Duplicate your "Google Chrome" shortcut (by ctrl+dragging it) 复制“Google Chrome”快捷方式(通过ctrl +拖动它)
  • Rename the new shortcut to "Chrome Dev Profile". 将新快捷方式重命名为“Chrome Dev Profile”。
  • Right click it -> Properties 右键单击它 - >属性
  • (Choose a path for your profile dir. You don't need to create it. For example: c:\\users\\udi\\profiles\\chromedevprofile ) (选择配置文件目录的路径。您无需创建它。例如:c:\\ users \\ udi \\ profiles \\ chromedevprofile)
  • Add to the "Target" field, following the path to chrome.exe: 按照chrome.exe的路径添加到“目标”字段:

    --user-data-dir=c:\\users\\udi\\profiles\\chromedevprofile (with your path of course). --user-data-dir=c:\\users\\udi\\profiles\\chromedevprofile (当然是您的路径)。

  • Launch it (and grab a coffee or wait a minute or so for the hamsters). 启动它(并抢一杯咖啡或等待一分钟左右的仓鼠)。

  • Now you have a second chrome profile running. 现在,您正在运行第二个chrome配置文件。 You will see there is no history, bookmarks, extensions etc. Don't panic, you still have all of them in your normal profile. 您将看到没有历史记录,书签,扩展等。不要惊慌,您仍然将所有这些都放在正常的配置文件中。
  • Optional: You would probably want to change the way this chrome looks to get a bit confused. 可选:您可能希望更改此chrome看起来有点混淆的方式。 Install a theme from here: https://tools.google.com/chrome/intl/en/themes/index.html 从此处安装主题: https//tools.google.com/chrome/intl/zh-CN/themes/index.html
  • Use this profile for debugging. 使用此配置文件进行调试。 :-) :-)
  • (You can also keep your debugging bookmarks in the bookmark toolbar for easy access without disturbing your regular bookmarks toolbar. Same for debugging oriented extensions.) (您还可以将调试书签保留在书签工具栏中,以便于访问而不会打扰常规书签工具栏。与调试导向扩展相同。)

(I think the question isn't accurate/relevant today; it's been almost five years. I don't see a “ Scripts tab” on my Chromium, and there is no drop-down for scripts in the Sources tab. In fact, “sources” and “content scripts” appear now separately in Sources , and that probably solves the original issue.) (我认为今天的问题不准确/相关;已经差不多五年了。我的Chromium上没有看到“ Scripts”选项卡,而且Sources选项卡中的脚本没有下拉。事实上, “源”和“内容脚本”现在单独出现在 ,而且可能解决原来的问题。)

I stumbled upon this question looking for something very similar, and I had to figure out the solution, so I'm sharing it for those who arrive here like me: 我偶然发现这个问题寻找非常相似的东西,我不得不弄清楚解决方案,所以我就像那些像我一样来到这里的人分享它:

How to hide extensions in the Network tab : 如何在“ 网络”标签中隐藏扩展程序

Use the filter text field to exclude extension scripts. 使用过滤器文本字段排除扩展脚本。 Three ideas: 三个想法:

  • larger-than:1 (best solution). larger-than:1 (最佳解决方案)。
  • If all the resources you care about share protocol: scheme:https or scheme:http . 如果您关心的所有资源共享协议: scheme:httpsscheme:http
  • If all the resources you care about come from the same type of TLD: domain:*.com (eg). 如果您关心的所有资源都来自相同类型的TLD: domain:*.com (例如)。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM