拓宽firefox的图像属性对话框(以及如何搜索firefox源代码)

在Firefox中,当您右键单击图像以查看其“属性”对话框时,几乎每次位置URL都会延伸到小对话框中看不见的地方。当我的图像属性检查同事问我是否有办法永久扩大该对话框时,我被难住了,多个MozillaZine搜索失败了。...

Image for article titled Widen Firefox's image properties dialog (plus how to search the Firefox source code)

在Firefox中,当您右键单击图像以查看其“属性”对话框时,几乎每次位置URL都会延伸到小对话框中看不见的地方。当我的图像属性检查同事问我是否有办法永久扩大该对话框时,我被难住了,多个MozillaZine搜索失败了。

幸运的是,我的Firefox好友Mark Pilgrim找到了答案:

使用style定义XUL样式:

@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);window#metadata { width: 60em !important; }

太好了,它工作了!本着教女人钓鱼的精神,马克详细介绍了他是如何通过浏览器的源代码找到答案的。跳转之后,他透露了搜索Firefox内部的秘密。

马克描述了查找他可以改变什么样式来扩大对话框的过程,并说这是一种常见的模式,更多的Firefox调整者应该知道。警告:这些说明是为那些愿意卷起袖子,把手伸进Firefox内脏弄脏的人准备的。你已经被警告了。

以下是马克为找到这条线索所做的:

  • Mozilla Cross-Reference lets you search the Firefox source code
  • Search for "alternate text" (no quotes), because this is a phrase that appears in the dialog that probably doesn't appear in very many places in the source code
  • The search for "alternate text" shows that, as predicted, the phrase only appears in a few places.
  • Ignore anything that is just a source code comment (// or /* */ or #).
  • Ignore anything in /editor (that's Composer) or /suite (that's Seamonkey).
  • In this case that only leaves a few hits in /browser, specifically /browser/locales/en-US, and both of them are .dtd files. That's a good sign — all end-user-visible text in Firefox is localized in .dtd files, so this means we've found a place where the phrase "alternate text" is used in the UI somewhere.
  • There are two matches within /browser/locales/en-US: metaData.dtd and pageInfo.dtd. Generally each .dtd file is specific to a particular window or dialog. On a hunch, I guessed (correctly) that pageInfo.dtd was used in the Tools/Page Info dialog, and metaData.dtd was used in the properties dialog that we're looking for.
  • The metaData.dtd search result shows that the phrase "Alternate text" is defined as the entity &image-alt.label;. So I did a new lxr search for "image-alt.label".
  • A search for image-alt.label shows exactly 4 results. 2 are in /suite, which we ignore. 1 is the .dtd file that we just came from, and the other is a .xul file. That's the one we want.
  • metaData.xul has a grid with rows like "image-url", "image-type", "image-size", "image-filesize", "image-alt", and "image-desc". Sound familiar? You don't need to know a lot about XUL to guess (correctly) that you've found the dialog you want to hack.
  • OK, now look at the top of the file. The root element is <window>, and we're in luck: it has a unique ID "metadata". It also defines its initial dimensi*** in the style attribute: width: 40em, height: 10em.
  • Now we whip out Stylish and write a new style. Insert the XUL namespace (from the "Insert" dropdown button), and try window#metadata { width: 60em }. Save the style. Stylish styles take effect immediately, so test it by right-clicking an image and selecting "Properties". Lo and behold, we've done it! You can adjust the final width to taste, of course — now that you know the window ID, you can apply any CSS styles you like.

现在,我的朋友们,这就是公开源码的美丽和魔力。谢谢你,马克!

  • 发表于 2021-08-01 12:36
  • 阅读 ( 171 )
  • 分类:互联网

你可能感兴趣的文章

如何在firefox中管理新的标签页

...将站点添加为顶部“站点”区域中的互动程序。在显示的对话框中输入新站点的名称和URL,然后单击“添加”。 ...

  • 发布于 2021-03-11 23:12
  • 阅读 ( 231 )

最好的firefox插件

Firefox以其插件而闻名,这是有充分理由的:它们可以让你的浏览器做任何事情。但是哪些插件是最有用的呢?以下是我们认为最好的插件,它们做什么,以及在哪里可以找到它们。 ...

  • 发布于 2021-03-14 07:47
  • 阅读 ( 201 )

如何在chrome和firefox中为书签添加注释

... 在“编辑书签”对话框中将注释添加到名称中,然后单击“保存”。 ...

  • 发布于 2021-03-22 18:18
  • 阅读 ( 442 )

firefox标签的15个高级用户必备技巧

...果该项的值为文本字符串或数字,请双击该项以打开一个对话框,从中可以更改该值。 ...

  • 发布于 2021-03-25 16:57
  • 阅读 ( 330 )

谷歌删除的5项搜索功能(以及如何恢复)

...的功能之一,所以每个人都会很高兴有了它。不幸的是,Firefox扩展还不支持这一点。 ...

  • 发布于 2021-03-25 22:21
  • 阅读 ( 215 )

如何查看所有浏览器中安装的扩展列表

...者右击扩展名并从弹出菜单中选择“属性”。 “属性”对话框显示与主程序窗口上的列相同的所有信息。“属性”对话框的有用之处在于可以选择和复制信息。例如,如果要转到扩展的主页,可以选择主页URL值并将其粘贴到浏...

  • 发布于 2021-04-09 15:03
  • 阅读 ( 184 )

如何将web浏览器重置为其默认设置

...,您将看到重置浏览器设置按钮。 将显示“重置设置”对话框,告诉您重置设置将执行的操作。如果确定要重置Chrome设置,请单击“重置”。 注意:您也可以只**chrome://settings/resetProfileSettings设置进入Chrome的地址栏,打开重置...

  • 发布于 2021-04-09 15:10
  • 阅读 ( 192 )

如何在firefox的侧边栏中加载网站

...,然后从弹出菜单中选择“属性”。 在书签的“属性”对话框中,单击“在侧边栏中加载此书签”复选框,使该框中有一个复选标记。然后,单击“保存”。 单击书签栏上的书签可在左侧的侧边栏中打开该站点。您可以使用...

  • 发布于 2021-04-09 17:41
  • 阅读 ( 83 )

如何自定义橙色firefox菜单按钮的外观

...了ChromEdit Plus,发现它安全可靠。 将显示“软件安装”对话框。单击“立即安装”,直到倒计时结束后才可用。 注意:您可以更改安装按钮的倒计时长度,但我们不建议禁用它。 必须重新启动Firefox才能完成安装。单击弹出对...

  • 发布于 2021-04-12 02:56
  • 阅读 ( 219 )

充分利用firefox的最佳提示和调整

Firefox是在Windows、Linux和Mac OS X上运行的比较流行的web浏览器之一。Firefox有许多内置的、有用的功能,您可以安装许多扩展来扩展其功能。 我们已经介绍了Firefox的很多功能,并在下面提供了一些文章的链接,这些文章介绍了可...

  • 发布于 2021-04-12 12:03
  • 阅读 ( 205 )
sduebf284
sduebf284

0 篇文章

相关推荐