编辑内置 Chrome 书签管理器文件夹/子文件夹自动扩展? [英] Editing Built-in Chrome Bookmarks Manager Folder/Sub-Folder Auto-Expansion?

查看:37
本文介绍了编辑内置 Chrome 书签管理器文件夹/子文件夹自动扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Chrome 中使用内置书签管理器时,左侧有一个导航窗格,其中包含所有包含书签的文件夹/子文件夹.当一个鼠标悬停在一个文件夹上,同时拖放文件夹/书签时,它会在 x 时间段(400 毫秒)后自动展开该文件夹(例如显示所有子文件夹).

When using the the built-in bookmark manager in Chrome there is a navigation pane on the left which contains all the folders/sub-folders containing bookmarks. When one mouseovers a folder while dragging/dropping a folder/bookmark it auto-expands the folder (e.g. shows all sub-folders) after x period of time (400 ms).

我想让用于控制 Chrome 在自动展开文件夹之前等待多长时间的变量可自定义.

I'd like to make the variable that controls how long Chrome waits before auto-expanding the folder customizable.

我在 Chromium 中找到了确定在拖放时自动展开文件夹之前等待多长时间的代码:

I found the code in Chromium that determines how long to wait before auto-expanding a folder on drag and drop in:

//src/chrome/浏览器/resources/bookmark_manager/js/dnd.js

相关的代码行是:

<代码>/***当指针悬停在树视图中的文件夹上时扩展文件夹的延迟* 毫秒.* @type {number}* @const*///TODO(yosin): EXPAND_FOLDER_DELAY 应遵循系统设置.400 毫秒是//取自 Windows 默认设置.var EXPAND_FOLDER_DELAY = 400;

我不知道该怎么做是通过扩展覆盖它?

What I don't know how to do is to override this via an extension?

用例:我有很多文件夹、嵌套文件夹和嵌套嵌套文件夹.我经常尝试导航到顶级文件夹,但 Google 在启动自动扩展之前的悬停时间非常短,而且很多时候我不打算扩展的文件夹最终会扩展.

Use Case: I have lots of folders and nested folders and nested-nested folders. Oftentimes I am trying to navigate to a top-level folder but Google's hover time before kicking off auto-expand is extremely short and many times folders I didn't mean to expand end up expanding.

推荐答案

为此找到相关代码做得很好.

Well done with locating the relevant code for this.

很遗憾,我认为 Chrome 扩展程序无法访问这些文件.这将需要这些变量的 API(并且您必须在更改任何设置时重新构建应用程序).

Unfortunately, I don't believe Chrome extensions can access these files. This would require an API to those variables (and you'd have to rebuild the application when changing any settings).

通过一些研究,我想出了两个选择.

I was able to come up with two options through some research.

选项 1

与扩展相比更好的解决方案(特别是如果这只是一次性覆盖)是 fork 项目并为您自己的 Chromium 自定义版本编辑该代码.此处是代码入门指南,以及构建/运行您自己的 Chromium 版本.也许如果你想出一个很好的解决方案来解决这个问题,你甚至可以提交一个补丁:) 更好的是为这些文件构建一个 API,然后你可以创建一个扩展.

A better solution compared to an extension (especially if this is just a one-time override) would be to fork the project and edit that code for your own customized version of Chromium. Here is a guide for getting started with the code, and building/running your own version of Chromium. Maybe if you come up with a good solution to this problem, you could even submit a patch :) Even better would be to build an API to those files, and then you could create an extension.

优点:您只需更改代码中的一个数字.缺点:您必须维护 Chromium 的分叉版本.

pros: you'd just have to change one number in the code. cons: you'd have to deal with maintaining a forked version of Chromium.

选项 2

创建一个覆盖页面

覆盖页面是一种将扩展程序中的 HTML 文件替换为 Google Chrome 通常提供的页面的方法.除了 HTML 之外,覆盖页面通常还有 CSS 和 JavaScript 代码.

Override pages are a way to substitute an HTML file from your extension for a page that Google Chrome normally provides. In addition to HTML, an override page usually has CSS and JavaScript code.

扩展程序可以替换书签管理器:当用户从 Chrome 菜单中选择书签管理器菜单项或在 Mac 上从书签菜单中选择书签管理器项时出现的页面.您也可以通过输入 URL chrome://bookmarks 来访问此页面.

An extension can replace Bookmark Manager: The page that appears when the user chooses the Bookmark Manager menu item from the Chrome menu or, on Mac, the Bookmark Manager item from the Bookmarks menu. You can also get to this page by entering the URL chrome://bookmarks.

使用 chrome.bookmarks,然后您可以构建一个自定义书签页面.

Using chrome.bookmarks, you could then build a customized bookmarks page.

优点:解决方案只需要一个扩展!缺点:您必须从头开始构建页面或找到其他一些复制技术.

pros: Solution only requires an extension! cons: you'd have to build the page from scratch or find some other replication technique.

一些扩展已经实现了这种方法,也许通过谷歌搜索(关键字custom"和manager"很有帮助),您也可以找到您喜欢或可以贡献的解决方案.

A number of extensions have achieved this method, and maybe through google searching (keywords "custom" and "manager" are helpful), you may also find a solution you like or can contribute to.

这篇关于编辑内置 Chrome 书签管理器文件夹/子文件夹自动扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆