Skip to content

Commit

Permalink
🔖 v2.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Achuan-2 committed Jul 17, 2024
1 parent 5e2a66e commit f94af18
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 2.1.9 / 2024-07-18
✨ link icon 功能优化
- 锚文本为数字不显示 link icon
- 锚文本为*不显示 link icon
- 锚文本被[]包裹,不显示 link icon


## 2.1.8 / 2024-07-17
- 💄 优化Dark主题透明图片大图预览
- 💄 优化Dark主题的加粗文字样式:设置为青绿色
Expand Down
6 changes: 6 additions & 0 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@

## 🚀最近更新

2.1.9 / 2024-07-18
✨ link icon 功能优化
- 锚文本为数字不显示 link icon
- 锚文本为*不显示 link icon
- 锚文本被[]包裹,不显示 link icon

2.1.8 / 2024-07-17
- 💄 优化Dark主题透明图片大图预览
- 💄 优化Dark主题的加粗文字样式:设置为青绿色
Expand Down
2 changes: 1 addition & 1 deletion style/module/link_icon.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.protyle-wysiwyg [data-node-id] span[data-type~='a']:not(:empty)::before,
.protyle-wysiwyg [data-node-id] span[data-type~='a']:not([custom-link-icon='true']):not(:empty)::before,
.protyle-wysiwyg [data-node-id] span[data-type~='url']:not(:empty)::before,
.av__celltext--url::before,
.b3-typography a:not(:empty)::before,
Expand Down
45 changes: 37 additions & 8 deletions theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,27 +757,56 @@ function ViewMonitor(event) {
设置思源块属性(id, attrs);
}

function link_icon_filter() {
let spans = document.querySelectorAll('span[data-type="a"]');
spans.forEach(span => {
const isWrappedInBracketsOrNumber = /\[.+?\]|^\d+$/.test(span.textContent);
if (span.textContent === '*' || isWrappedInBracketsOrNumber) {
span.setAttribute('custom-link-icon', 'true');
}
else {
span.removeAttribute('custom-link-icon');
}
});
}

/**++++++++++++++++++++++++++++++++主题功能执行:按需调用++++++++++++++++++++++++++++++ */
window.theme.timerIds = [];

(async () => {
// 各种列表转 xx
ClickMonitor();
/* 创建主题按钮 */
create_theme_button();

const linkIconFilterInterval = setInterval(link_icon_filter, 100);
window.theme.timerIds.push(linkIconFilterInterval);

})();

function clearAllTimers() {
window.theme.timerIds.forEach(timerId => {
clearInterval(timerId);
});
// 清空数组
window.theme.timerIds.length = 0;
}

window.destroyTheme = () => {
// 删除主题切换按钮
const themeButton = document.getElementById(window.theme.IDs.BUTTON_TOOLBAR_CHANGE_COLOR);
if (themeButton) {
themeButton.remove();
}
// 删除主题加载的额外配色css
// 删除主题加载的额外配色 css
let css_link = document.getElementById(window.theme.IDs.STYLE_COLOR);
if (css_link) {
css_link.remove();
}

// 删除列表转导图功能
window.removeEventListener('mouseup', MenuShow);
};

(async () => {
//各种列表转xx
ClickMonitor();
/*创建主题按钮 */
create_theme_button();
})();
clearAllTimers();

};
2 changes: 1 addition & 1 deletion theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Tsundoku",
"author": "Achuan-2",
"url": "https://github.com/Achuan-2/siyuan-themes-tsundoku",
"version": "2.1.8",
"version": "2.1.9",
"displayName": {
"default": "Tsundoku",
"zh_CN": "積読"
Expand Down

0 comments on commit f94af18

Please sign in to comment.