虽然曾经旗帜鲜明质疑 反向链接包含子块 这个功能(幸好 D 大加了开关),现在发现偶尔确实要到这个功能排除信息干扰。又不想进入设置里开关,所以有这个需求:
- 在右上角添加开关
反向链接包含子块按钮 - 用大写
F表示开启;用小写f表示关闭
当前默认是开启状态
虽然曾经旗帜鲜明质疑 反向链接包含子块 这个功能(幸好 D 大加了开关),现在发现偶尔确实要到这个功能排除信息干扰。又不想进入设置里开关,所以有这个需求:
反向链接包含子块 按钮F 表示开启;用小写 f 表示关闭当前默认是开启状态
// toolbar快速开关“反向链接包含子块”
// see https://ld246.com/article/1760340608107
(async ()=>{
// 不支持手机版
if(isMobile()) return;
// 添加toolbar按钮
whenElementExist('#toolbar .fn__ellipsis').then((el)=>{
if(!el) return;
const text = window.siyuan.config.editor.backlinkContainChildren ? 'F' : 'f';
const aria = window.siyuan.config.editor.backlinkContainChildren ? '关闭' : '开启';
const html = `<div data-menu="true" id="backlinkContainChildren" class="toolbar__item ariaLabel" aria-label="${aria}“反向链接包含子块”" data-location="right">${text}</div>`;
el.insertAdjacentHTML('afterend', html);
const btn = el.nextElementSibling;
btn.addEventListener('click', async (event) => {
if(window.siyuan.config.editor.backlinkContainChildren) {
// 关闭
window.siyuan.config.editor.backlinkContainChildren = false;
const res = await requestApi('/api/setting/setEditor', window.siyuan.config.editor);
if(!res || res.code !== 0) {
window.siyuan.config.editor.backlinkContainChildren = true;
showMessage('设置失败', false);
return;
}
btn.textContent = 'f';
btn.setAttribute('aria-label', '开启“反向链接包含子块”');
const tooltip = document.querySelector("#tooltip");
if(tooltip) {
tooltip.innerHTML = '开启“反向链接包含子块”';
}
} else {
// 开启
window.siyuan.config.editor.backlinkContainChildren = true;
const res = await requestApi('/api/setting/setEditor', window.siyuan.config.editor);
if(!res || res.code !== 0) {
window.siyuan.config.editor.backlinkContainChildren = false;
showMessage('设置失败', false);
return;
}
btn.textContent = 'F';
btn.setAttribute('aria-label', '关闭“反向链接包含子块”');
const tooltip = document.querySelector("#tooltip");
if(tooltip) {
tooltip.innerHTML = '关闭“反向链接包含子块”';
}
}
});
});
function showMessage(message, isError = false, delay = 7000) {
return fetch('/api/notification/' + (isError ? 'pushErrMsg' : 'pushMsg'), {
"method": "POST",
"body": JSON.stringify({"msg": message, "timeout": delay})
});
}
async function requestApi(url, data, method = 'POST') {
return await (await fetch(url, {method: method, body: JSON.stringify(data||{})})).json();
}
function whenElementExist(selector, node = document, timeout = 5000) {
return new Promise((resolve, reject) => {
const start = Date.now();
function check() {
let el;
try {
el = typeof selector === 'function'
? selector()
: node.querySelector(selector);
} catch (err) {
return resolve(null);
}
if (el) {
resolve(el);
} else if (Date.now() - start >= timeout) {
resolve(null);
} else {
requestAnimationFrame(check);
}
}
check();
});
}
function isMobile() {
return !!document.getElementById("sidebar");
}
})();
// toolbar快速开关“反向链接包含子块”
// see https://ld246.com/article/1760340608107
(async ()=>{
// 不支持手机版
if(isMobile()) return;
// 添加toolbar按钮
whenElementExist('#toolbar .fn__ellipsis').then((el)=>{
if(!el) return;
const text = window.siyuan.config.editor.backlinkContainChildren ? 'F' : 'f';
const aria = window.siyuan.config.editor.backlinkContainChildren ? '关闭' : '开启';
const html = `<div data-menu="true" id="backlinkContainChildren" class="toolbar__item ariaLabel" aria-label="${aria}“反向链接包含子块”" data-location="right">${text}</div>`;
el.insertAdjacentHTML('afterend', html);
const btn = el.nextElementSibling;
btn.addEventListener('click', async (event) => {
if(window.siyuan.config.editor.backlinkContainChildren) {
// 关闭
window.siyuan.config.editor.backlinkContainChildren = false;
const res = await requestApi('/api/setting/setEditor', window.siyuan.config.editor);
if(!res || res.code !== 0) {
window.siyuan.config.editor.backlinkContainChildren = true;
showMessage('设置失败', false);
return;
}
btn.textContent = 'f';
btn.setAttribute('aria-label', '开启“反向链接包含子块”');
const tooltip = document.querySelector("#tooltip");
if(tooltip) {
tooltip.innerHTML = '开启“反向链接包含子块”';
}
} else {
// 开启
window.siyuan.config.editor.backlinkContainChildren = true;
const res = await requestApi('/api/setting/setEditor', window.siyuan.config.editor);
if(!res || res.code !== 0) {
window.siyuan.config.editor.backlinkContainChildren = false;
showMessage('设置失败', false);
return;
}
btn.textContent = 'F';
btn.setAttribute('aria-label', '关闭“反向链接包含子块”');
const tooltip = document.querySelector("#tooltip");
if(tooltip) {
tooltip.innerHTML = '关闭“反向链接包含子块”';
}
}
});
});
function showMessage(message, isError = false, delay = 7000) {
return fetch('/api/notification/' + (isError ? 'pushErrMsg' : 'pushMsg'), {
"method": "POST",
"body": JSON.stringify({"msg": message, "timeout": delay})
});
}
async function requestApi(url, data, method = 'POST') {
return await (await fetch(url, {method: method, body: JSON.stringify(data||{})})).json();
}
function whenElementExist(selector, node = document, timeout = 5000) {
return new Promise((resolve, reject) => {
const start = Date.now();
function check() {
let el;
try {
el = typeof selector === 'function'
? selector()
: node.querySelector(selector);
} catch (err) {
return resolve(null);
}
if (el) {
resolve(el);
} else if (Date.now() - start >= timeout) {
resolve(null);
} else {
requestAnimationFrame(check);
}
}
check();
});
}
function isMobile() {
return !!document.getElementById("sidebar");
}
})();
单点登录(Single Sign On)是目前比较流行的企业业务整合的解决方案之一。SSO 的定义是在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的应用系统。
快应用 是基于手机硬件平台的新型应用形态;标准是由主流手机厂商组成的快应用联盟联合制定;快应用标准的诞生将在研发接口、能力接入、开发者服务等层面建设标准平台;以平台化的生态模式对个人开发者和企业开发者全品类开放。
NetBeans 是一个始于 1997 年的 Xelfi 计划,本身是捷克布拉格查理大学的数学及物理学院的学生计划。此计划延伸而成立了一家公司进而发展这个商用版本的 NetBeans IDE,直到 1999 年 Sun 买下此公司。Sun 于次年(2000 年)六月将 NetBeans IDE 开源,直到现在 NetBeans 的社群依然持续增长。
百度应用引擎(Baidu App Engine)提供了 PHP、Java、Python 的执行环境,以及云存储、消息服务、云数据库等全面的云服务。它可以让开发者实现自动地部署和管理应用,并且提供动态扩容和负载均衡的运行环境,让开发者不用考虑高成本的运维工作,只需专注于业务逻辑,大大降低了开发者学习和迁移的成本。
星云链是一个开源公链,业内简单的将其称为区块链上的谷歌。其实它不仅仅是区块链搜索引擎,一个公链的所有功能,它基本都有,比如你可以用它来开发部署你的去中心化的 APP,你可以在上面编写智能合约,发送交易等等。3 分钟快速接入星云链 (NAS) 测试网
OpenStack 是一个云操作系统,通过数据中心可控制大型的计算、存储、网络等资源池。所有的管理通过前端界面管理员就可以完成,同样也可以通过 Web 接口让最终用户部署资源。
frp 是一个可用于内网穿透的高性能的反向代理应用,支持 TCP、UDP、 HTTP 和 HTTPS 协议。
Python 是一种面向对象、直译式电脑编程语言,具有近二十年的发展历史,成熟且稳定。它包含了一组完善而且容易理解的标准库,能够轻松完成很多常见的任务。它的语法简捷和清晰,尽量使用无异义的英语单词,与其它大多数程序设计语言使用大括号不一样,它使用缩进来定义语句块。
jsDelivr 是一个开源的 CDN 服务,可为 npm 包、GitHub 仓库提供免费、快速并且可靠的全球 CDN 加速服务。
深度学习(Deep Learning)是机器学习的分支,是一种试图使用包含复杂结构或由多重非线性变换构成的多个处理层对数据进行高层抽象的算法。
Sublime Text 是一款可以用来写代码、写文章的文本编辑器。支持代码高亮、自动完成,还支持通过插件进行扩展。
TensorFlow 是一个采用数据流图(data flow graphs),用于数值计算的开源软件库。节点(Nodes)在图中表示数学操作,图中的线(edges)则表示在节点间相互联系的多维数据数组,即张量(tensor)。
发布对别人有帮助的原创内容是最好的 SEO 方式。
找到自己的位置,萌新烦恼少。
Wide 是一款基于 Web 的 Go 语言 IDE。通过浏览器就可以进行 Go 开发,并有代码自动完成、查看表达式、编译反馈、Lint、实时结果输出等功能。
欢迎访问我们运维的实例: https://wide.b3log.org
Eclipse 是一个开放源代码的、基于 Java 的可扩展开发平台。就其本身而言,它只是一个框架和一组服务,用于通过插件组件构建开发环境。
子曰:“工欲善其事,必先利其器。”
Jeffrey Chen 制作的思源笔记主题,项目仓库:https://github.com/TCOTC/Whisper
iOS 是由苹果公司开发的移动操作系统,最早于 2007 年 1 月 9 日的 Macworld 大会上公布这个系统,最初是设计给 iPhone 使用的,后来陆续套用到 iPod touch、iPad 以及 Apple TV 等产品上。iOS 与苹果的 Mac OS X 操作系统一样,属于类 Unix 的商业操作系统。
有点意思就行了
ZooKeeper 是一个分布式的,开放源码的分布式应用程序协调服务,是 Google 的 Chubby 一个开源的实现,是 Hadoop 和 HBase 的重要组件。它是一个为分布式应用提供一致性服务的软件,提供的功能包括:配置维护、域名服务、分布式同步、组服务等。
Microsoft Windows 是美国微软公司研发的一套操作系统,它问世于 1985 年,起初仅仅是 Microsoft-DOS 模拟环境,后续的系统版本由于微软不断的更新升级,不但易用,也慢慢的成为家家户户人们最喜爱的操作系统。
Scala 是一门多范式的编程语言,集成面向对象编程和函数式编程的各种特性。
ZeroNet 是一个基于比特币加密技术和 BT 网络技术的去中心化的、开放开源的网络和交流系统。
Kubernetes 是 Google 开源的一个容器编排引擎,它支持自动化部署、大规模可伸缩、应用容器化管理。