Skip to content

Instantly share code, notes, and snippets.

<%*
let dueDateStr = await tp.system.prompt("Enter Date", "Tomorrow");
let parseResult;
let parseResultLink;
let myString = '';
if(dueDateStr) {
let findDays = dueDateStr.split(';');
let myDateStr = findDays[0];
if(myDateStr) {
let nlDatesPlugin = this.app.plugins.getPlugin('nldates-obsidian');
<%*
const search = app.workspace.getLeavesOfType("search")[0];
search.view.setSortOrder("byCreatedTime");
search.view.setCollapseAll(false);
search.view.setExtraContext(true);
const dnp = tp.date.now('YYYY-MM-DD');
const dnp2 = tp.date.now('YYYY_MM_DD');
let myString = `((file:${dnp2} task-todo:"[ ]") OR ((/Due Date: .*\\[\\[${dnp}\\]\\].*/ OR /due date: \\[[0-9, -]*${dnp}[0-9, -]*\\]/) task-todo:"[ ]") OR (file:${dnp} task-todo:"[ ]") OR (task-todo:"${dnp}") OR section:(/^\#.*${dnp}/ "[ ]") OR section:(/^\#.*${dnp}/ section:("[ ]"))) -file:("weekly review")`;
search.view.setQuery(`${myString}`);
app.workspace.revealLeaf(search);
@GitMurf
GitMurf / obsidian.templater.search.dnp.backlinks.js
Created September 23, 2021 19:45
obsidian.templater.search.dnp.backlinks.js
<%*
const curPane = document.querySelector(`.mod-active.workspace-leaf`);
let isMax = false;
if(curPane) {
if(curPane.style.minWidth) {
if(curPane.style.minWidth === `100%`){isMax = true}
}
}
const rootPanesCont = document.querySelector(`.workspace-split.mod-root`);
:root {
/* Vertical Masonry */
--leaf-height: 480px;
--scroll-width: 20px;
/* Horizontal Masonry */
/* Split Screen: 930px ... Thirds: 570px or 600px (main ext monitor) */
--leaf-width: 600px;
--leaf-height-child: 700px;
}
<%*
const openInNewPane = false; //If false, will save link to clipboard
const folderName = `refactor`;
const firstVal = await tp.system.prompt("First thought to add to the new note");
//Client name
const files = await app.vault.getMarkdownFiles();
const links = [];
const finalLinkArr = [];
files.forEach(file => {
<%*
//v1.0
let cmEditorAct = this.app.workspace.activeLeaf.view.editor;
let curLine = cmEditorAct.getCursor().line;
cmEditorAct.setSelection({ line: curLine, ch: 0 }, { line: curLine, ch: 9999 });
let dueDateStr = await tp.system.prompt("Due Date");
let parseResult;
let parseResultLink;
if(dueDateStr) {