一些优化
当前为
// ==UserScript==
// @name Feedly 优化
// @namespace https://feedly.com
// @version 2024.08.10
// @description 一些优化
// @author Ejin
// @match https://feedly.com/*
// @grant none
// ==/UserScript==
// 2024.08.10 优化左侧UI,将上方无用导航链接移至下方
// 2024.07.14 弱化存档分类的加粗,隐藏未读数。
// 2024.02.23 First-read,跳转到第一个已读项
(function() {
'use strict';
setInterval(()=>{//1.route
// 1.1 First-read
if(location.href.indexOf("feedly.com/i/subscription/feed") != -1){
if(document.querySelector(".detail+.list-tags") != null
&& document.querySelector(".detail+.list-tags").innerHTML.indexOf("First-read") == -1 ){
document.querySelector(".detail+.list-tags").innerHTML += "<a href='javascript:;' id='First-read'>/First-read</a>";
document.getElementById("First-read").addEventListener('click',()=>{
var FunID=setInterval(()=>{//First-read Function
document.getElementById("First-read").style.display="none";
if(document.querySelector("html").getAttribute("FunURL") != null){
if(document.querySelector("html").getAttribute("FunURL") != location.href){
clearInterval(document.querySelector("html").getAttribute("FunID"));
document.querySelector("html").removeAttribute("FunID");
document.querySelector("html").removeAttribute("FunURL");
return;
}
}
if(document.querySelectorAll(".EntryTitle").length > 0){
if(document.querySelectorAll(".EntryTitle--read").length==0){
document.querySelectorAll(".EntryTitle")[document.querySelectorAll(".EntryTitle").length-1].scrollIntoView();
} else {
document.querySelectorAll(".EntryTitle--read")[0].scrollIntoView();
clearInterval(document.querySelector("html").getAttribute("FunID"));
document.querySelector("html").removeAttribute("FunID");
document.querySelector("html").removeAttribute("FunURL");
}
}
},1000);//setInterval
document.querySelector("html").setAttribute("FunID",FunID);
document.querySelector("html").setAttribute("FunURL",location.href);
});
}
} //end 1.1
},500);//end 1.route
// 2.弱化存档分类的加粗,隐藏未读数。
setInterval(() => {
if(document.querySelector('div[aria-label^="Mark 存档"')){
if(document.querySelector('div[aria-label^="Mark 存档"').style.opacity==""){
// 寻找存档文件夹的最上层元素
var parEle=document.querySelector('div[aria-label^="Mark 存档"');
var parKey='<div id="user/';
if(parEle.parentElement.innerHTML.split(parKey).length > 1){
} else {
parEle=parEle.parentElement;
if(parEle.parentElement.innerHTML.split(parKey).length > 1){
} else {
parEle=parEle.parentElement;
if(parEle.parentElement.innerHTML.split(parKey).length > 1){
} else {
parEle=parEle.parentElement;
if(parEle.parentElement.innerHTML.split(parKey).length > 1){
} else {
parEle=parEle.parentElement;
if(parEle.parentElement.innerHTML.split(parKey).length > 1){
} else {
return;
}
}
}
}
}
//隐藏未读数
parEle.onmouseover=()=>{
document.querySelector('div[aria-label^="Mark 存档"').style.opacity="1";
};
parEle.onmouseout=()=>{
document.querySelector('div[aria-label^="Mark 存档"').style.opacity="0.2";
};
parEle.onmouseout();
//取消加粗
document.querySelectorAll(".LeftnavListRow__text--bold").forEach(item=>{
if(item.innerHTML=="存档"){
item.className=item.className.replace("LeftnavListRow__text--bold","");
}
});
// 顺便帮忙处理returnALL类别的加粗和未读数
document.querySelectorAll(".LeftnavListRow__text--bold").forEach(item=>{
if(item.innerHTML=="returnALL"){
item.className=item.className.replace("LeftnavListRow__text--bold","");
}
});
document.querySelector('div[aria-label^="Mark returnALL"').style.display="none";
}
}
}, 10000);// end
// 3.避免标记已读后自动跳转到存档类别
setInterval(() => {
// returnALL类别或者URL包含returnALL
if(location.href.indexOf("returnALL") != -1
|| document.querySelector("#header-title").innerHTML == "returnALL"){
document.querySelectorAll("span").forEach(ele=>{
if(ele.innerHTML=="All"){
ele.click();
}
});
}
}, 1500);// end
// 4.优化左侧UI,将上方无用导航链接移至下方
var optimizetimeid=setInterval(() => {
if(document.querySelector('div[title="Today"]')
&& document.querySelector('div[title="Recently Read"]')){
//判断存在上方导航链接和下方导航链接
var nav_top=document.querySelector('div[title="Today"]').parentElement;
var nav_foot=document.querySelector('div[title="Recently Read"]').parentElement;
var j=0;
nav_foot.children[0].style.borderTop = '1px solid #ccc';//原下方导航栏最上面加一个横线
for(var i=nav_top.children.length-1;i > -1;i--){
nav_foot.insertBefore(nav_top.children[0],nav_foot.children[j]);
j++;
}
nav_top.remove();
clearInterval(optimizetimeid);
}
}, 1000);
})(); //end all