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

查看:296
本文介绍了编辑内置的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/浏览器/资源/bookmark_manager/js/dnd.js

相关的代码行是:

/** * Delay for expanding folder when pointer hovers on folder in tree view in * milliseconds. * @type {number} * @const */ // TODO(yosin): EXPAND_FOLDER_DELAY should follow system settings. 400ms is // taken from Windows default settings. var EXPAND_FOLDER_DELAY = 400;

/** * Delay for expanding folder when pointer hovers on folder in tree view in * milliseconds. * @type {number} * @const */ // TODO(yosin): EXPAND_FOLDER_DELAY should follow system settings. 400ms is // taken from Windows default settings. 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

与扩展相比(更好的解决方案是一个一次性替代),更好的解决方案是派生项目并为您自己的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天全站免登陆