更新
2022-10-18 更新 1,修复效果二的 BUG。更新 2,效果二添加“提及”的自动展开
2022-10-20 更新 2,解决效果二偶尔不显示的问题
2022-10-23 更新 3,点击反链按钮的时候,再次尝试生成小按钮
效果一
展开速度就取决于你的电脑性能了
使用方法
找到自己主题的 theme.js,把以下代码贴到最后即可。
// 反链全部展开图标
var barSearch = document.getElementById("barSearch");
barSearch.insertAdjacentHTML(
"beforebegin",
'<div id="backlink_allexpand"class="toolbar__item b3-tooltips b3-tooltips__se" aria-label="反链一键展开" ></div>'
);
let backLinkAllExpand = document.getElementById("backlink_allexpand");
backLinkAllExpand.innerHTML = `<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="1280.000000pt" height="1194.000000pt" viewBox="0 0 1280.000000 1194.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.15, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,1194.000000) scale(0.100000,-0.100000)"
fill="#FFFFFF" stroke="none">
<path d="M3075 11863 c-622 -387 -1140 -833 -1582 -1363 -925 -1106 -1440
-2454 -1489 -3900 l-7 -200 2241 0 2242 0 0 45 c0 234 89 587 206 815 160 313
417 597 695 766 l60 36 -33 58 c-196 345 -2204 3819 -2208 3819 -3 -1 -59 -34
-125 -76z"/>
<path d="M9534 11832 c-33 -59 -533 -927 -1112 -1929 -579 -1003 -1053 -1827
-1054 -1832 -2 -5 43 -40 99 -77 378 -255 652 -631 778 -1069 34 -118 62 -286
71 -419 l7 -106 2240 0 2240 0 -7 200 c-68 1986 -1022 3787 -2631 4969 -147
108 -552 373 -568 371 -1 0 -29 -49 -63 -108z"/>
<path d="M6210 7666 c-470 -85 -824 -366 -995 -790 -159 -397 -112 -829 130
-1197 63 -95 239 -271 335 -334 224 -148 452 -218 715 -218 165 -1 230 9 380
54 207 64 367 161 526 319 144 143 236 288 304 478 237 664 -121 1403 -790
1630 -49 17 -124 38 -165 47 -102 22 -344 28 -440 11z"/>
<path d="M5436 4731 c-11 -20 -1530 -2652 -1843 -3194 -206 -356 -376 -654
-379 -661 -7 -17 76 -67 311 -186 731 -370 1474 -583 2326 -667 249 -24 844
-24 1098 1 845 81 1594 296 2326 666 235 119 318 169 311 186 -4 11 -1949
3386 -2168 3762 l-60 103 -53 -30 c-82 -47 -251 -116 -363 -149 -175 -53 -334
-75 -532 -76 -320 -1 -588 60 -864 199 -58 29 -108 50 -110 46z"/>
</g>
</svg>`;
backLinkAllExpand.addEventListener(
"click",
function (e) {
var list = document.querySelector(
"div.backlinkList.fn__flex-1 > ul"
).children;
for (var i = 0; i < list.length; i++) {
if (list[i].nextSibling && (list[i].nextSibling.tagName == "LI" || list[i].nextSibling.className.indexOf("fn__none")) > -1) {
list[i].click();
}
if (i == list.length - 1) {
list[i].click();
}
}
},
false
);
backLinkAllExpand.addEventListener(
"click",
function (e) {
e.stopPropagation();
},
false
);
效果二
使用方法
找到自己主题的 theme.js,把以下代码贴到最后即可。
document
.querySelector("div.dock span[data-type=backlink]")
.addEventListener("click", function () {
setTimeout(setAllExpand(), 500);
});
var setAllExpand = function () {
if (document.getElementById("backlink_allexpand")) {
return;
}
// 反链全部展开图标
var barSearch = document.querySelector(
".sy__backlink span[data-type=collapse]"
);
barSearch.insertAdjacentHTML(
"beforebegin",
`<span id="backlink_allexpand" data-type="collapse_expand" style="width:22px;height:22px;padding-right:2px;" class="block__icon b3-tooltips b3-tooltips__sw" aria-label="反链一键展开"><svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="1280.000000pt" height="1194.000000pt" viewBox="0 0 1280.000000 1194.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.15, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,1194.000000) scale(0.100000,-0.100000)"
fill="#00000" stroke="none">
<path d="M3075 11863 c-622 -387 -1140 -833 -1582 -1363 -925 -1106 -1440
-2454 -1489 -3900 l-7 -200 2241 0 2242 0 0 45 c0 234 89 587 206 815 160 313
417 597 695 766 l60 36 -33 58 c-196 345 -2204 3819 -2208 3819 -3 -1 -59 -34
-125 -76z"/>
<path d="M9534 11832 c-33 -59 -533 -927 -1112 -1929 -579 -1003 -1053 -1827
-1054 -1832 -2 -5 43 -40 99 -77 378 -255 652 -631 778 -1069 34 -118 62 -286
71 -419 l7 -106 2240 0 2240 0 -7 200 c-68 1986 -1022 3787 -2631 4969 -147
108 -552 373 -568 371 -1 0 -29 -49 -63 -108z"/>
<path d="M6210 7666 c-470 -85 -824 -366 -995 -790 -159 -397 -112 -829 130
-1197 63 -95 239 -271 335 -334 224 -148 452 -218 715 -218 165 -1 230 9 380
54 207 64 367 161 526 319 144 143 236 288 304 478 237 664 -121 1403 -790
1630 -49 17 -124 38 -165 47 -102 22 -344 28 -440 11z"/>
<path d="M5436 4731 c-11 -20 -1530 -2652 -1843 -3194 -206 -356 -376 -654
-379 -661 -7 -17 76 -67 311 -186 731 -370 1474 -583 2326 -667 249 -24 844
-24 1098 1 845 81 1594 296 2326 666 235 119 318 169 311 186 -4 11 -1949
3386 -2168 3762 l-60 103 -53 -30 c-82 -47 -251 -116 -363 -149 -175 -53 -334
-75 -532 -76 -320 -1 -588 60 -864 199 -58 29 -108 50 -110 46z"/>
</g>
</svg></span>`
);
let backLinkAllExpand = document.getElementById("backlink_allexpand");
backLinkAllExpand.addEventListener(
"click",
function (e) {
var list = document.querySelector(
"div.backlinkList.fn__flex-1 > ul"
).children;
for (var i = 0; i < list.length; i++) {
if (
list[i].nextSibling &&
(list[i].nextSibling.tagName == "LI" ||
list[i].nextSibling.className.indexOf("fn__none")) > -1
) {
list[i].click();
}
if (i == list.length - 1) {
list[i].click();
}
}
},
false
);
backLinkAllExpand.addEventListener(
"click",
function (e) {
e.stopPropagation();
},
false
);
// 提及全部展开图标
var barSearch = document.querySelector(
".sy__backlink span[data-type=mCollapse]"
);
barSearch.insertAdjacentHTML(
"beforebegin",
`<span id="m_backlink_allexpand" data-type="collapse_expand" style="width:22px;height:22px;padding-right:2px;" class="block__icon b3-tooltips b3-tooltips__sw" aria-label="提及一键展开"><svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="1280.000000pt" height="1194.000000pt" viewBox="0 0 1280.000000 1194.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.15, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,1194.000000) scale(0.100000,-0.100000)"
fill="#00000" stroke="none">
<path d="M3075 11863 c-622 -387 -1140 -833 -1582 -1363 -925 -1106 -1440
-2454 -1489 -3900 l-7 -200 2241 0 2242 0 0 45 c0 234 89 587 206 815 160 313
417 597 695 766 l60 36 -33 58 c-196 345 -2204 3819 -2208 3819 -3 -1 -59 -34
-125 -76z"/>
<path d="M9534 11832 c-33 -59 -533 -927 -1112 -1929 -579 -1003 -1053 -1827
-1054 -1832 -2 -5 43 -40 99 -77 378 -255 652 -631 778 -1069 34 -118 62 -286
71 -419 l7 -106 2240 0 2240 0 -7 200 c-68 1986 -1022 3787 -2631 4969 -147
108 -552 373 -568 371 -1 0 -29 -49 -63 -108z"/>
<path d="M6210 7666 c-470 -85 -824 -366 -995 -790 -159 -397 -112 -829 130
-1197 63 -95 239 -271 335 -334 224 -148 452 -218 715 -218 165 -1 230 9 380
54 207 64 367 161 526 319 144 143 236 288 304 478 237 664 -121 1403 -790
1630 -49 17 -124 38 -165 47 -102 22 -344 28 -440 11z"/>
<path d="M5436 4731 c-11 -20 -1530 -2652 -1843 -3194 -206 -356 -376 -654
-379 -661 -7 -17 76 -67 311 -186 731 -370 1474 -583 2326 -667 249 -24 844
-24 1098 1 845 81 1594 296 2326 666 235 119 318 169 311 186 -4 11 -1949
3386 -2168 3762 l-60 103 -53 -30 c-82 -47 -251 -116 -363 -149 -175 -53 -334
-75 -532 -76 -320 -1 -588 60 -864 199 -58 29 -108 50 -110 46z"/>
</g>
</svg></span>`
);
let mBackLinkAllExpand = document.getElementById("m_backlink_allexpand");
mBackLinkAllExpand.addEventListener(
"click",
function (e) {
var list = document.querySelector(
"div.backlinkMList.fn__flex-1 > ul"
).children;
for (var i = 0; i < list.length; i++) {
if (
list[i].nextSibling &&
(list[i].nextSibling.tagName == "LI" ||
list[i].nextSibling.className.indexOf("fn__none")) > -1
) {
list[i].click();
}
if (i == list.length - 1) {
list[i].click();
}
}
},
false
);
mBackLinkAllExpand.addEventListener(
"click",
function (e) {
e.stopPropagation();
},
false
);
};
setTimeout(setAllExpand(), 500);
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于