This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tools { | |
static Macros = { | |
dice(code) { | |
code = String(code); | |
var b = createEl("button"); | |
b.replaceChildren(code); | |
b.addEventListener("click", () => { | |
app.commands.executeCommandById("obsidian-dice-roller:open-view"); | |
app.plugins.getPlugin("obsidian-dice-roller")?.view.roll(code) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict";Object.defineProperty(Array.prototype,"countWith",{configurable:!0,writable:!0,value:function value(predicate,thisArg){if(null==this)throw new TypeError("Array.prototype.countWith called on null or undefined");if("function"!=typeof predicate)throw new Error("Array.prototype.countWith predicate parameter must be a function");var length=this.length>>>0;if(0==length)return[];for(var count=0,i=0;i<length;++i)count+=!!predicate.call(thisArg,this[i],i,this);return count}}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Usage: | |
* <<animg source.jpg class imageclass class anotherclass id image42 replacement.jpg>> | |
*/ | |
Macro.add("animg", { | |
handler() { | |
if(this.args.length === 0) { | |
return this.error("No image source given."); | |
} | |
var src = this.args[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Show Responses [nobr] | |
/* assume setup.responseSheet is set to the ID of the sheet with the responses to some form */ | |
<<run setup.getSheetData(setup.responseSheet, function(data) { | |
State.variables.responses = data; | |
setPageElement("responses", "Responses"); | |
})>> | |
<div id="responses"></div> | |
:: Responses [nobr] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* <<hover>> macro - add an <abbr> element with the passage or text and optional theme | |
* | |
* Usage examples: | |
* <<hover passage "Passage Name">>Text<</hoverabbr>> | |
* <<hover passage "Passage Name" "theme">>Text<</hoverabbr>> | |
* <<hover text "Some text comes here" "optional_theme">>Text<</hoverabbr>> | |
* | |
* If "passage" and "text" aren't present, the macro tries to interpret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.chat { | |
position: absolute; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
visibility: hidden; | |
} | |
.chat.chat-open { | |
visibility: visible; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | |
/* quest holder */ | |
var quests = new Map(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* SugarCube code block to be executed later */ | |
Macro.add('handler', { | |
tags: null, | |
isAsync: true, | |
validIdRe: /^[A-Za-z_]\w*$/, | |
handler() { | |
if(this.args.length === 0) { | |
return this.error('Missing handler ID(s).'); | |
} | |
const ids = Array.from(this.args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* SugarCube code block to be executed later */ | |
Macro.add('handler', { | |
tags: null, | |
isAsync: true, | |
validIdRe: /^[A-Za-z_]\w*$/, | |
handler() { | |
if(this.args.length === 0) { | |
return this.error('Missing handler ID(s).'); | |
} | |
const ids = Array.from(this.args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Backup Event [event] | |
/* | |
PRIORITY: Number.MIN_SAFE_INTEGER | |
*/ | |
<div class="error-view"><span class="error">No valid events found. Write some?</span></div> |
NewerOlder