问题描述
我不想在我的开始屏幕上看到分散注意力的 LinkedIn 提要,我只想在我点击 LinkedIn 主页按钮时被重定向到位于 /messaging/
中的收件箱。我试图覆盖嵌入在主页按钮中的 href
标记的 <a>
属性,但它不起作用。
我还尝试了 click
事件侦听器,正如我在此处为 youtube (How can I redirect to my youtube subscription page in Greasemonkey?) 提出的类似问题中所建议的:
// ==UserScript==
// @name LinkedIn redir /Feed -> /messaging
// @match https://www.linkedin.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
if (location.pathname === '/Feed/') {
location.pathname = '/messaging/';
}
if (location.pathname === '/') {
location.pathname = '/messaging/';
}
window.addEventListener('click',e => {
const a = e.target.closest('a');
if (a && a.href === '/Feed/') {
a.href = '/messaging/';
a.className = '';
}
},true);
但这也不起作用。如果我直接访问 /messaging/
,我只会被重定向到 /Feed/
。
如何通过 Greasemonkey 自动更改主页按钮中的 href 属性以指向 /messaging/?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)