思源笔记
0 篇文章
seehttps://ld246.com/article/1734109655384 版本 2//!js//查询最近 30 天创建的文档 return(async()=>{//sql 查询语句//查询过去去 30 天的文档 constsql=`SELECT*FROMblocksWHEREtype='d'ANDcreated>=strftime('%Y%m%d%H%M%S','now','localtime','-30
seehttps://ld246.com/article/1734430072051//启动时最小化到托盘//seehttps://github.com/siyuan-note/siyuan/blob/5129ad926a21176a352cf5f630e0651011bf9c83/app/src/boot/onGetConfig.ts#L115if(!localStorage.getItem('_
在数据库中实现 js 与 Sprig 模板的交互
seehttps://ld246.com/article/1734002304855 在数据库模板中可以利用 img 标签实现 js 与 Sprig 模板的交互,利用 js 来处理数据,就更方便了。比如:.action{$blocks:=queryBlocks"select*fromblockslimit1"}<span><imgsrc=""data-result='.action{toJson$blocks}'st
seehttps://ld246.com/article/1734263645595//调用示例,当 callback 返回 true 时退出,返回 false 时取消退出 functionsleep(ms){returnnewPromise(resolve=>setTimeout(resolve,ms));}listenExit(async()=>{console.log('waiting');awaitsle
seehttps://github.com/siyuan-note/siyuan/blob/5129ad926a21176a352cf5f630e0651011bf9c83/app/src/boot/onGetConfig.ts#L167require('electron').ipcRenderer.on('siyuan-open-url',(event,url)=>{console.log(eve
toolbar 被添加事件(async()=>{observeToolbar((el)=>{console.log(el,'toolbar');});//监听 toolbar 被添加 functionobserveToolbar(callback){//创建一个观察者实例并传入回调函数 constobserver=newMutationObserver((mutationsList,observer)=>{f
圣诞快乐 css
seehttps://ld246.com/article/1734435831275#barWorkspace{position:relative;}#barWorkspacespan.toolbar__text{font-weight:bold;font-size:14px;/*彩虹文字颜色*/animation:rainbow4sinfinitelinear;}#barWorkspacespan
日志模板//!jsreturn(async()=>{//获取天气 getWeather();asyncfunctiongetWeather(){//天气 apiconstweather=awaitfetch('https://wttr.in/?format=1');consttext=awaitweather.text();//显示当时的天气 render(text);//始终显示今天的天气//rende
思源如何给日记模板添加天气
seehttps://ld246.com/article/1734002304855 一,日记模板由于思源模板中无法执行 js,也就无法调用天气 api 了。所以这里可以利用 sql 查询模板变相执行 js 实现。比如这个示例模板,只需要把这段 js 放到模板里,然后模板加载时就可以显示天气了。//!jsreturn(async()=>{//获取天气 getWeather();asyncfunctiongetWeathe
seehttps://ld246.com/article/1734407382742/comment/1734440753272?r=wilsons#comments//!jsreturn(async()=>{//等待时长,默认 60 秒 constwaitForTime=60;getWeather();asyncfunctiongetWeather(){constweather=awaitfetch('