Skip to content

Instantly share code, notes, and snippets.

View Moyf's full-sized avatar

Moy Moyf

  • HangZhou
View GitHub Profile
@Moyf
Moyf / Beautified separator style.css
Last active April 24, 2025 16:30
Beautified separator style for Obsidian
/* Moy OB 基础样式调节 */
/* Created: 2025-04-03 */
/* 注释文本变小 */
.cm-comment {
font-size: 0.8em;
opacity: 0.8;
}
// Example
/**
```dataviewjs
dv.view("mediaViewInFolder", {
folder: "_global/emotion",
showTitle: true,
title: "My Emotion",
pagination: 9,
addAlt: true,
exclude: ["bad"],
@Moyf
Moyf / FolderSearch 文件夹搜索.md
Last active October 4, 2025 04:50
TP脚本:搜索文件夹 FolderSearch (English version is below)

<%* // 获取所有文件夹路径 let folders = app.vault.getAllFolders(); // 过滤掉根目录 folders = folders.filter(folder => folder.path !== "/");

const autoCollapse = true;

// 准备用于显示的文件夹名称和对应的路径 const folderPaths = folders.map(f => f.path);

@Moyf
Moyf / 0_Introduction.md
Last active April 4, 2025 18:34
[NTB×TP] Share some useful scripts that I use with NTB 😇

(1) ReOrder Tasks

This action will reorder the tasks near the cursor (or select Chinese version) based on the current cursor position, and put the completed tasks at the bottom.

(2) Cancel Task

This is a utility function done by the

@Moyf
Moyf / Moy-Grid Background.css
Last active August 3, 2025 02:20
Obsidian Grid Background (网格背景)
/* Moy-网格背景 */
/* 更新日期:2024.10.31 */
/* 用来显示两种样式的背景:网格 & 网点 */
/* 2024.10.30 v1.1 改成默认所有页面都生效(网格) */
/* 2024.11.01 v1.2 只影响中间窗格 */
/* 原始代码来自:https://spacexcode.com/blog/pure-css-grid-line/ */
/* 亦有参考:https://forum-zh.obsidian.md/t/topic/37076 */
// ========================================
// 作者:Moy
// 日期:2024.08.05
// 版本:1.0.0
// ========================================
// 注意:该脚本只在文件名为 yyyy-MM-dd 日期格式(如 2024-08-05)的笔记内有效
// 如果你的 DailyNote 有别的命名格式,自行下方的 yyyy-MM-dd
const curNoteName = dv.current().file.name;
const dateFormat = "yyyy-MM-dd"
@Moyf
Moyf / LiteDatabase-en.js
Last active October 27, 2025 15:47
DVJS Code - Lite Database for Obsidian
const useList = false;
const curNote = dv.current();
if (!curNote){
dv.span("The current document is not loaded, please reopen it.");
return;
}
let tarFile = await app.vault.getAbstractFileByPath(curNote.file.path);
// Get the meta data of the current file
const curFileMeta = app.metadataCache.getFileCache(tarFile);
const headings = curFileMeta.headings;
@Moyf
Moyf / Moy-Link Optimize.css
Created July 31, 2024 16:12
Obsidian CSS: Optimize the link editing experience
@Moyf
Moyf / MakeItDone
Last active December 26, 2024 05:41
TP Script: Add done and finished date into Frontmatter (Property)
<%*
/*
- Author: Moy
- Create Time: 2024-07-30
- Description: 这是一个用来修改当前文件的元数据的范例脚本
- Version: 1.0
*/
// 配置项
@Moyf
Moyf / DataviewJS.md
Last active September 1, 2025 09:26
[Obsidian] Dataviewjs code for Obsidian to query specific term in current note

最简版本:

```dataviewjs
await dv.view("queryTermInFile", { term: "💡" })
```

最多选项版本: [term::💡] [info::灵感摘录]