用于在缩小版和常规 .js 或 .css 之间切换的浏览器插件

发布于 2024-12-18 01:15:06 字数 377 浏览 2 评论 0 原文

是否有浏览器插件(适用于 Firefox 或 Chrome)可以轻松地让我打开脚本文件的非缩小版本?

例如,生产网站将加载 script.min.js,但通常 script.js 也可以在同一目录中使用。 也是如此

对于某些 css 文件(style.min.css 或 style.css) ,.min 。符号似乎被使用了很多,

我并不是在寻找漂亮的打印机,就像这个问题一样: 是否有一个插件可以让我自动取消网站上包含的 Javascript?

但是对于会自动发现正确的未缩小文件的东西(其中包括评论等)

无法通​​过谷歌找到任何内容,但也许我错过了一个?

Is there a browser add-on (for firefox or chrome) that would easily let me open a non minified version of a script file?

eg, a production website would load script.min.js, but usually the script.js would also be available in the same directory.
same goes for some css files (style.min.css or style.css)

the .min. notation seems to be used quite a bit

I'm not looking for a pretty-printer, like in this question:
Is there a plugin that allows me to automatically unminify the Javascript included on a site?

but for something that would automatically discover the correct unminified file (which would include comments etc)

Couldnt find any through google, but perhaps I missed one?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

人事已非 2024-12-25 01:15:06

这是一个 书签

<a href="javascript:(function() {
  var scr=document.getElementsByTagName('script');
  var pop = [],html='';
  for (var i=0;i<scr.length;i++) {
    if (scr[i].src.indexOf('.min.js')!=-1) pop[pop.length] = scr[i].src.replace(/\.min/,'');
  }
  if (pop.length==0) html += 'No .min.js found';
  for (var i=0;i<pop.length;i++) {
    html+='<br/><a href='+pop[i]+' target=_blank>'+pop[i]+'</a>';
  }
  var div = document.createElement('div'), dst=div.style;
  dst.position='absolute';dst.top=0;dst.zIndex=9999;dst.backgroundColor='white';
  div.innerHTML=html;
  document.body.appendChild(div);
})();">unMin</a>

要激活,请将以上内容保存在带有 html 扩展名的文件中,将页面加载到浏览器并将链接拖动到链接栏

或者将 href 复制到现有书签中并重命名。

Here is a bookmarklet

<a href="javascript:(function() {
  var scr=document.getElementsByTagName('script');
  var pop = [],html='';
  for (var i=0;i<scr.length;i++) {
    if (scr[i].src.indexOf('.min.js')!=-1) pop[pop.length] = scr[i].src.replace(/\.min/,'');
  }
  if (pop.length==0) html += 'No .min.js found';
  for (var i=0;i<pop.length;i++) {
    html+='<br/><a href='+pop[i]+' target=_blank>'+pop[i]+'</a>';
  }
  var div = document.createElement('div'), dst=div.style;
  dst.position='absolute';dst.top=0;dst.zIndex=9999;dst.backgroundColor='white';
  div.innerHTML=html;
  document.body.appendChild(div);
})();">unMin</a>

To activate, save the above in a file with html extension, load the page into the browser and drag the link to the link bar

Alternatively copy the href into an existing bookmark and rename it.

泼猴你往哪里跑 2024-12-25 01:15:06

有时,恢复“未缩小”的文件并不简单,如果您连接 Javascript 和 CSS 文件进行生产,就会发生这种情况。

您可以做的就是拥有一个包含原始文件的文件夹和另一个通过脚本构建的生产文件夹。这样切换模式只需将 URL 中的 /dev/ 更改为 /dist/ 即可

Sometimes recovering an "unminified" file is not straightfoward, as can happen if you concatenate Javascript and CSS files for production.

Something you can do is have a folder containing the original files and another production folder that is build via a script. This way switching modes is just a matter of changing from /dev/ to /dist/ in the URL

长发绾君心 2024-12-25 01:15:06

YAML Debug 是一个书签,它将显示页面的所有样式表并允许您激活/停用每一项(在“样式表”选项卡中)。

您可以将其与备用样式表结合使用,即用作样式切换器的样式表(如 (1) 中所示)

<link rel="stylesheet" href="screen.min.css" type="text/css">
<link rel="alternate stylesheet" href="screen.css" type="text/css" title="Not minified">

(1) http://tantek.com/CSS/Examples/codeisfreespeech.html
转到页面,然后在 Fx/IE/Opera 或 Safari 和 Chrome 中,按 Alt 键打开旧的普通菜单,选择“显示菜单/页面样式”,最后选择“无样式选项”或“当前样式”或您添加的任何替代样式。

相当老派,但仍然有用:)

YAML Debug is a bookmarklet that will display all the stylesheets of a page and allow you to activate/deactivate each one (in the Stylesheets tab).

You can combine it with alternate stylesheets, the one used as styleswitchers (as in (1))

<link rel="stylesheet" href="screen.min.css" type="text/css">
<link rel="alternate stylesheet" href="screen.css" type="text/css" title="Not minified">

(1) http://tantek.com/CSS/Examples/codeisfreespeech.html
Go to the page and then in Fx/IE/Opera maybe Safari and Chrome, press Alt key to open the old plain menu, choose Display menu / Page style and finally no style option or current style or any alternate style you added.

Quite old school but still useful :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文