Skip to content

Instantly share code, notes, and snippets.

View Moyf's full-sized avatar

Moy Moyf

  • HangZhou
View GitHub Profile
@Moyf
Moyf / Moy-Vertical Tabs.css
Last active April 21, 2025 02:48
Obsidian CSS: Vertical Tabs
/* Moy Vertical Tabs.css */
/* 2025-04-14 */
/* Extracted from MicroMike theme: https://github.com/ThisTheThe/MicroMike */
/* More snippets available: https://github.com/ThisTheThe/MicroMike/tree/main/Snippets */
/* Modified by @PandaNoSleep with thanks! */
/* Better experience when used with: */
/* Floating Sidebar: https://forum-zh.obsidian.md/t/topic/32602 */

<%* // 获取编辑器实例 const editor = app.workspace.activeEditor.editor;

// 获取当前行 const cursor = editor.getCursor(); const line = editor.getLine(cursor.line);

// 1. 将普通文本或普通列表转换成未完成的任务 if (!/^[\s]*- [[ x-]]/.test(line)) {

@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 March 17, 2025 11:40
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 May 5, 2025 19:55
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 January 17, 2025 06:55
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