使 Firefox 和 Vivaldi 只在新标签页显示书签栏
Posted maxuewei2
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使 Firefox 和 Vivaldi 只在新标签页显示书签栏相关的知识,希望对你有一定的参考价值。
Firefox
新建
~/.mozilla/firefox/rre9emvh.default/chrome/userChrome.css
(大概不同人的 rre9emvh.default
目录会有不同的名字?)
内容如下
/*
* Bookmarks toolbar is visible only on new tab page, just like Chrome.
*
* Screenshot: https://vimeo.com/235059188
* Video: https://vimeo.com/240436456
*
* Contributor(s): https://www.reddit.com/user/AJtfM7zT4tJdaZsm and Andrei Cristian Petcu
* https://www.reddit.com/r/FirefoxCSS/comments/7evwow/show_bookmarks_toolbar_only_on_new_tab/
*/
#main-window #PersonalToolbar {
visibility: collapse !important;
}
#main-window[title^="about:newtab"] #PersonalToolbar,
#main-window[title^="New Tab"] #PersonalToolbar,
#main-window[title^="Nightly"] #PersonalToolbar,
#main-window[title^="Mozilla Firefox"] #PersonalToolbar,
#main-window[title^="Firefox"] #PersonalToolbar,
#main-window[title^="新标签页"] #PersonalToolbar,
#main-window[title^="Customize Firefox"] #PersonalToolbar {
visibility: visible !important;
}
Vivaldi
修改 /opt/vivaldi/resources/vivaldi/browser.html
,
添加以下内容
<script src="style/common.js"></script>
修改 /opt/vivaldi/resources/vivaldi/style/common.js
添加以下内容
/**
* Author: Leonardo Domingues
*/
setTimeout(function wait()
{
var adr = document.querySelector(".toolbar-addressbar.toolbar");
if (adr != null)
{
const vivaldi = window.chrome;
var bar = document.getElementsByClassName('bookmark-bar')[0];
function change_display()
{
var tab = document.querySelector('.active.webpageview');
if (tab.classList.contains('internal'))
{
bar.style.display = "flex";
}else
{
bar.style.display = "none";
}
}
vivaldi.tabs.onCreated.addListener(e => change_display());
vivaldi.tabs.onUpdated.addListener(e => change_display());
vivaldi.tabs.onActivated.addListener(e => change_display());
}
else {
setTimeout(wait, 300);
}
}, 300);
END
以上是关于使 Firefox 和 Vivaldi 只在新标签页显示书签栏的主要内容,如果未能解决你的问题,请参考以下文章