coffee init

main
Mel 3 years ago
parent ca474b839e
commit 7636445ed5

@ -22,5 +22,7 @@
"obsidian-itinerary",
"customjs",
"obsidian42-brat",
"code-block-copy"
"code-block-copy",
"obsidian-crypto-lookup",
"obsidian-lineup-builder"
]

@ -0,0 +1,895 @@
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// node_modules/numeral/numeral.js
var require_numeral = __commonJS({
"node_modules/numeral/numeral.js"(exports, module2) {
(function(global, factory) {
if (typeof define === "function" && define.amd) {
define(factory);
} else if (typeof module2 === "object" && module2.exports) {
module2.exports = factory();
} else {
global.numeral = factory();
}
})(exports, function() {
var numeral2, _, VERSION = "2.0.6", formats = {}, locales = {}, defaults = {
currentLocale: "en",
zeroFormat: null,
nullFormat: null,
defaultFormat: "0,0",
scalePercentBy100: true
}, options = {
currentLocale: defaults.currentLocale,
zeroFormat: defaults.zeroFormat,
nullFormat: defaults.nullFormat,
defaultFormat: defaults.defaultFormat,
scalePercentBy100: defaults.scalePercentBy100
};
function Numeral(input, number) {
this._input = input;
this._value = number;
}
numeral2 = function(input) {
var value, kind, unformatFunction, regexp;
if (numeral2.isNumeral(input)) {
value = input.value();
} else if (input === 0 || typeof input === "undefined") {
value = 0;
} else if (input === null || _.isNaN(input)) {
value = null;
} else if (typeof input === "string") {
if (options.zeroFormat && input === options.zeroFormat) {
value = 0;
} else if (options.nullFormat && input === options.nullFormat || !input.replace(/[^0-9]+/g, "").length) {
value = null;
} else {
for (kind in formats) {
regexp = typeof formats[kind].regexps.unformat === "function" ? formats[kind].regexps.unformat() : formats[kind].regexps.unformat;
if (regexp && input.match(regexp)) {
unformatFunction = formats[kind].unformat;
break;
}
}
unformatFunction = unformatFunction || numeral2._.stringToNumber;
value = unformatFunction(input);
}
} else {
value = Number(input) || null;
}
return new Numeral(input, value);
};
numeral2.version = VERSION;
numeral2.isNumeral = function(obj) {
return obj instanceof Numeral;
};
numeral2._ = _ = {
numberToFormat: function(value, format, roundingFunction) {
var locale = locales[numeral2.options.currentLocale], negP = false, optDec = false, leadingCount = 0, abbr = "", trillion = 1e12, billion = 1e9, million = 1e6, thousand = 1e3, decimal = "", neg = false, abbrForce, abs, min, max, power, int, precision, signed, thousands, output;
value = value || 0;
abs = Math.abs(value);
if (numeral2._.includes(format, "(")) {
negP = true;
format = format.replace(/[\(|\)]/g, "");
} else if (numeral2._.includes(format, "+") || numeral2._.includes(format, "-")) {
signed = numeral2._.includes(format, "+") ? format.indexOf("+") : value < 0 ? format.indexOf("-") : -1;
format = format.replace(/[\+|\-]/g, "");
}
if (numeral2._.includes(format, "a")) {
abbrForce = format.match(/a(k|m|b|t)?/);
abbrForce = abbrForce ? abbrForce[1] : false;
if (numeral2._.includes(format, " a")) {
abbr = " ";
}
format = format.replace(new RegExp(abbr + "a[kmbt]?"), "");
if (abs >= trillion && !abbrForce || abbrForce === "t") {
abbr += locale.abbreviations.trillion;
value = value / trillion;
} else if (abs < trillion && abs >= billion && !abbrForce || abbrForce === "b") {
abbr += locale.abbreviations.billion;
value = value / billion;
} else if (abs < billion && abs >= million && !abbrForce || abbrForce === "m") {
abbr += locale.abbreviations.million;
value = value / million;
} else if (abs < million && abs >= thousand && !abbrForce || abbrForce === "k") {
abbr += locale.abbreviations.thousand;
value = value / thousand;
}
}
if (numeral2._.includes(format, "[.]")) {
optDec = true;
format = format.replace("[.]", ".");
}
int = value.toString().split(".")[0];
precision = format.split(".")[1];
thousands = format.indexOf(",");
leadingCount = (format.split(".")[0].split(",")[0].match(/0/g) || []).length;
if (precision) {
if (numeral2._.includes(precision, "[")) {
precision = precision.replace("]", "");
precision = precision.split("[");
decimal = numeral2._.toFixed(value, precision[0].length + precision[1].length, roundingFunction, precision[1].length);
} else {
decimal = numeral2._.toFixed(value, precision.length, roundingFunction);
}
int = decimal.split(".")[0];
if (numeral2._.includes(decimal, ".")) {
decimal = locale.delimiters.decimal + decimal.split(".")[1];
} else {
decimal = "";
}
if (optDec && Number(decimal.slice(1)) === 0) {
decimal = "";
}
} else {
int = numeral2._.toFixed(value, 0, roundingFunction);
}
if (abbr && !abbrForce && Number(int) >= 1e3 && abbr !== locale.abbreviations.trillion) {
int = String(Number(int) / 1e3);
switch (abbr) {
case locale.abbreviations.thousand:
abbr = locale.abbreviations.million;
break;
case locale.abbreviations.million:
abbr = locale.abbreviations.billion;
break;
case locale.abbreviations.billion:
abbr = locale.abbreviations.trillion;
break;
}
}
if (numeral2._.includes(int, "-")) {
int = int.slice(1);
neg = true;
}
if (int.length < leadingCount) {
for (var i = leadingCount - int.length; i > 0; i--) {
int = "0" + int;
}
}
if (thousands > -1) {
int = int.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1" + locale.delimiters.thousands);
}
if (format.indexOf(".") === 0) {
int = "";
}
output = int + decimal + (abbr ? abbr : "");
if (negP) {
output = (negP && neg ? "(" : "") + output + (negP && neg ? ")" : "");
} else {
if (signed >= 0) {
output = signed === 0 ? (neg ? "-" : "+") + output : output + (neg ? "-" : "+");
} else if (neg) {
output = "-" + output;
}
}
return output;
},
stringToNumber: function(string) {
var locale = locales[options.currentLocale], stringOriginal = string, abbreviations = {
thousand: 3,
million: 6,
billion: 9,
trillion: 12
}, abbreviation, value, i, regexp;
if (options.zeroFormat && string === options.zeroFormat) {
value = 0;
} else if (options.nullFormat && string === options.nullFormat || !string.replace(/[^0-9]+/g, "").length) {
value = null;
} else {
value = 1;
if (locale.delimiters.decimal !== ".") {
string = string.replace(/\./g, "").replace(locale.delimiters.decimal, ".");
}
for (abbreviation in abbreviations) {
regexp = new RegExp("[^a-zA-Z]" + locale.abbreviations[abbreviation] + "(?:\\)|(\\" + locale.currency.symbol + ")?(?:\\))?)?$");
if (stringOriginal.match(regexp)) {
value *= Math.pow(10, abbreviations[abbreviation]);
break;
}
}
value *= (string.split("-").length + Math.min(string.split("(").length - 1, string.split(")").length - 1)) % 2 ? 1 : -1;
string = string.replace(/[^0-9\.]+/g, "");
value *= Number(string);
}
return value;
},
isNaN: function(value) {
return typeof value === "number" && isNaN(value);
},
includes: function(string, search) {
return string.indexOf(search) !== -1;
},
insert: function(string, subString, start) {
return string.slice(0, start) + subString + string.slice(start);
},
reduce: function(array, callback) {
if (this === null) {
throw new TypeError("Array.prototype.reduce called on null or undefined");
}
if (typeof callback !== "function") {
throw new TypeError(callback + " is not a function");
}
var t = Object(array), len = t.length >>> 0, k = 0, value;
if (arguments.length === 3) {
value = arguments[2];
} else {
while (k < len && !(k in t)) {
k++;
}
if (k >= len) {
throw new TypeError("Reduce of empty array with no initial value");
}
value = t[k++];
}
for (; k < len; k++) {
if (k in t) {
value = callback(value, t[k], k, t);
}
}
return value;
},
multiplier: function(x) {
var parts = x.toString().split(".");
return parts.length < 2 ? 1 : Math.pow(10, parts[1].length);
},
correctionFactor: function() {
var args = Array.prototype.slice.call(arguments);
return args.reduce(function(accum, next) {
var mn = _.multiplier(next);
return accum > mn ? accum : mn;
}, 1);
},
toFixed: function(value, maxDecimals, roundingFunction, optionals) {
var splitValue = value.toString().split("."), minDecimals = maxDecimals - (optionals || 0), boundedPrecision, optionalsRegExp, power, output;
if (splitValue.length === 2) {
boundedPrecision = Math.min(Math.max(splitValue[1].length, minDecimals), maxDecimals);
} else {
boundedPrecision = minDecimals;
}
power = Math.pow(10, boundedPrecision);
output = (roundingFunction(value + "e+" + boundedPrecision) / power).toFixed(boundedPrecision);
if (optionals > maxDecimals - boundedPrecision) {
optionalsRegExp = new RegExp("\\.?0{1," + (optionals - (maxDecimals - boundedPrecision)) + "}$");
output = output.replace(optionalsRegExp, "");
}
return output;
}
};
numeral2.options = options;
numeral2.formats = formats;
numeral2.locales = locales;
numeral2.locale = function(key) {
if (key) {
options.currentLocale = key.toLowerCase();
}
return options.currentLocale;
};
numeral2.localeData = function(key) {
if (!key) {
return locales[options.currentLocale];
}
key = key.toLowerCase();
if (!locales[key]) {
throw new Error("Unknown locale : " + key);
}
return locales[key];
};
numeral2.reset = function() {
for (var property in defaults) {
options[property] = defaults[property];
}
};
numeral2.zeroFormat = function(format) {
options.zeroFormat = typeof format === "string" ? format : null;
};
numeral2.nullFormat = function(format) {
options.nullFormat = typeof format === "string" ? format : null;
};
numeral2.defaultFormat = function(format) {
options.defaultFormat = typeof format === "string" ? format : "0.0";
};
numeral2.register = function(type, name, format) {
name = name.toLowerCase();
if (this[type + "s"][name]) {
throw new TypeError(name + " " + type + " already registered.");
}
this[type + "s"][name] = format;
return format;
};
numeral2.validate = function(val, culture) {
var _decimalSep, _thousandSep, _currSymbol, _valArray, _abbrObj, _thousandRegEx, localeData, temp;
if (typeof val !== "string") {
val += "";
if (console.warn) {
console.warn("Numeral.js: Value is not string. It has been co-erced to: ", val);
}
}
val = val.trim();
if (!!val.match(/^\d+$/)) {
return true;
}
if (val === "") {
return false;
}
try {
localeData = numeral2.localeData(culture);
} catch (e) {
localeData = numeral2.localeData(numeral2.locale());
}
_currSymbol = localeData.currency.symbol;
_abbrObj = localeData.abbreviations;
_decimalSep = localeData.delimiters.decimal;
if (localeData.delimiters.thousands === ".") {
_thousandSep = "\\.";
} else {
_thousandSep = localeData.delimiters.thousands;
}
temp = val.match(/^[^\d]+/);
if (temp !== null) {
val = val.substr(1);
if (temp[0] !== _currSymbol) {
return false;
}
}
temp = val.match(/[^\d]+$/);
if (temp !== null) {
val = val.slice(0, -1);
if (temp[0] !== _abbrObj.thousand && temp[0] !== _abbrObj.million && temp[0] !== _abbrObj.billion && temp[0] !== _abbrObj.trillion) {
return false;
}
}
_thousandRegEx = new RegExp(_thousandSep + "{2}");
if (!val.match(/[^\d.,]/g)) {
_valArray = val.split(_decimalSep);
if (_valArray.length > 2) {
return false;
} else {
if (_valArray.length < 2) {
return !!_valArray[0].match(/^\d+.*\d$/) && !_valArray[0].match(_thousandRegEx);
} else {
if (_valArray[0].length === 1) {
return !!_valArray[0].match(/^\d+$/) && !_valArray[0].match(_thousandRegEx) && !!_valArray[1].match(/^\d+$/);
} else {
return !!_valArray[0].match(/^\d+.*\d$/) && !_valArray[0].match(_thousandRegEx) && !!_valArray[1].match(/^\d+$/);
}
}
}
}
return false;
};
numeral2.fn = Numeral.prototype = {
clone: function() {
return numeral2(this);
},
format: function(inputString, roundingFunction) {
var value = this._value, format = inputString || options.defaultFormat, kind, output, formatFunction;
roundingFunction = roundingFunction || Math.round;
if (value === 0 && options.zeroFormat !== null) {
output = options.zeroFormat;
} else if (value === null && options.nullFormat !== null) {
output = options.nullFormat;
} else {
for (kind in formats) {
if (format.match(formats[kind].regexps.format)) {
formatFunction = formats[kind].format;
break;
}
}
formatFunction = formatFunction || numeral2._.numberToFormat;
output = formatFunction(value, format, roundingFunction);
}
return output;
},
value: function() {
return this._value;
},
input: function() {
return this._input;
},
set: function(value) {
this._value = Number(value);
return this;
},
add: function(value) {
var corrFactor = _.correctionFactor.call(null, this._value, value);
function cback(accum, curr, currI, O) {
return accum + Math.round(corrFactor * curr);
}
this._value = _.reduce([this._value, value], cback, 0) / corrFactor;
return this;
},
subtract: function(value) {
var corrFactor = _.correctionFactor.call(null, this._value, value);
function cback(accum, curr, currI, O) {
return accum - Math.round(corrFactor * curr);
}
this._value = _.reduce([value], cback, Math.round(this._value * corrFactor)) / corrFactor;
return this;
},
multiply: function(value) {
function cback(accum, curr, currI, O) {
var corrFactor = _.correctionFactor(accum, curr);
return Math.round(accum * corrFactor) * Math.round(curr * corrFactor) / Math.round(corrFactor * corrFactor);
}
this._value = _.reduce([this._value, value], cback, 1);
return this;
},
divide: function(value) {
function cback(accum, curr, currI, O) {
var corrFactor = _.correctionFactor(accum, curr);
return Math.round(accum * corrFactor) / Math.round(curr * corrFactor);
}
this._value = _.reduce([this._value, value], cback);
return this;
},
difference: function(value) {
return Math.abs(numeral2(this._value).subtract(value).value());
}
};
numeral2.register("locale", "en", {
delimiters: {
thousands: ",",
decimal: "."
},
abbreviations: {
thousand: "k",
million: "m",
billion: "b",
trillion: "t"
},
ordinal: function(number) {
var b = number % 10;
return ~~(number % 100 / 10) === 1 ? "th" : b === 1 ? "st" : b === 2 ? "nd" : b === 3 ? "rd" : "th";
},
currency: {
symbol: "$"
}
});
(function() {
numeral2.register("format", "bps", {
regexps: {
format: /(BPS)/,
unformat: /(BPS)/
},
format: function(value, format, roundingFunction) {
var space = numeral2._.includes(format, " BPS") ? " " : "", output;
value = value * 1e4;
format = format.replace(/\s?BPS/, "");
output = numeral2._.numberToFormat(value, format, roundingFunction);
if (numeral2._.includes(output, ")")) {
output = output.split("");
output.splice(-1, 0, space + "BPS");
output = output.join("");
} else {
output = output + space + "BPS";
}
return output;
},
unformat: function(string) {
return +(numeral2._.stringToNumber(string) * 1e-4).toFixed(15);
}
});
})();
(function() {
var decimal = {
base: 1e3,
suffixes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
}, binary = {
base: 1024,
suffixes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
};
var allSuffixes = decimal.suffixes.concat(binary.suffixes.filter(function(item) {
return decimal.suffixes.indexOf(item) < 0;
}));
var unformatRegex = allSuffixes.join("|");
unformatRegex = "(" + unformatRegex.replace("B", "B(?!PS)") + ")";
numeral2.register("format", "bytes", {
regexps: {
format: /([0\s]i?b)/,
unformat: new RegExp(unformatRegex)
},
format: function(value, format, roundingFunction) {
var output, bytes = numeral2._.includes(format, "ib") ? binary : decimal, suffix = numeral2._.includes(format, " b") || numeral2._.includes(format, " ib") ? " " : "", power, min, max;
format = format.replace(/\s?i?b/, "");
for (power = 0; power <= bytes.suffixes.length; power++) {
min = Math.pow(bytes.base, power);
max = Math.pow(bytes.base, power + 1);
if (value === null || value === 0 || value >= min && value < max) {
suffix += bytes.suffixes[power];
if (min > 0) {
value = value / min;
}
break;
}
}
output = numeral2._.numberToFormat(value, format, roundingFunction);
return output + suffix;
},
unformat: function(string) {
var value = numeral2._.stringToNumber(string), power, bytesMultiplier;
if (value) {
for (power = decimal.suffixes.length - 1; power >= 0; power--) {
if (numeral2._.includes(string, decimal.suffixes[power])) {
bytesMultiplier = Math.pow(decimal.base, power);
break;
}
if (numeral2._.includes(string, binary.suffixes[power])) {
bytesMultiplier = Math.pow(binary.base, power);
break;
}
}
value *= bytesMultiplier || 1;
}
return value;
}
});
})();
(function() {
numeral2.register("format", "currency", {
regexps: {
format: /(\$)/
},
format: function(value, format, roundingFunction) {
var locale = numeral2.locales[numeral2.options.currentLocale], symbols = {
before: format.match(/^([\+|\-|\(|\s|\$]*)/)[0],
after: format.match(/([\+|\-|\)|\s|\$]*)$/)[0]
}, output, symbol, i;
format = format.replace(/\s?\$\s?/, "");
output = numeral2._.numberToFormat(value, format, roundingFunction);
if (value >= 0) {
symbols.before = symbols.before.replace(/[\-\(]/, "");
symbols.after = symbols.after.replace(/[\-\)]/, "");
} else if (value < 0 && (!numeral2._.includes(symbols.before, "-") && !numeral2._.includes(symbols.before, "("))) {
symbols.before = "-" + symbols.before;
}
for (i = 0; i < symbols.before.length; i++) {
symbol = symbols.before[i];
switch (symbol) {
case "$":
output = numeral2._.insert(output, locale.currency.symbol, i);
break;
case " ":
output = numeral2._.insert(output, " ", i + locale.currency.symbol.length - 1);
break;
}
}
for (i = symbols.after.length - 1; i >= 0; i--) {
symbol = symbols.after[i];
switch (symbol) {
case "$":
output = i === symbols.after.length - 1 ? output + locale.currency.symbol : numeral2._.insert(output, locale.currency.symbol, -(symbols.after.length - (1 + i)));
break;
case " ":
output = i === symbols.after.length - 1 ? output + " " : numeral2._.insert(output, " ", -(symbols.after.length - (1 + i) + locale.currency.symbol.length - 1));
break;
}
}
return output;
}
});
})();
(function() {
numeral2.register("format", "exponential", {
regexps: {
format: /(e\+|e-)/,
unformat: /(e\+|e-)/
},
format: function(value, format, roundingFunction) {
var output, exponential = typeof value === "number" && !numeral2._.isNaN(value) ? value.toExponential() : "0e+0", parts = exponential.split("e");
format = format.replace(/e[\+|\-]{1}0/, "");
output = numeral2._.numberToFormat(Number(parts[0]), format, roundingFunction);
return output + "e" + parts[1];
},
unformat: function(string) {
var parts = numeral2._.includes(string, "e+") ? string.split("e+") : string.split("e-"), value = Number(parts[0]), power = Number(parts[1]);
power = numeral2._.includes(string, "e-") ? power *= -1 : power;
function cback(accum, curr, currI, O) {
var corrFactor = numeral2._.correctionFactor(accum, curr), num = accum * corrFactor * (curr * corrFactor) / (corrFactor * corrFactor);
return num;
}
return numeral2._.reduce([value, Math.pow(10, power)], cback, 1);
}
});
})();
(function() {
numeral2.register("format", "ordinal", {
regexps: {
format: /(o)/
},
format: function(value, format, roundingFunction) {
var locale = numeral2.locales[numeral2.options.currentLocale], output, ordinal = numeral2._.includes(format, " o") ? " " : "";
format = format.replace(/\s?o/, "");
ordinal += locale.ordinal(value);
output = numeral2._.numberToFormat(value, format, roundingFunction);
return output + ordinal;
}
});
})();
(function() {
numeral2.register("format", "percentage", {
regexps: {
format: /(%)/,
unformat: /(%)/
},
format: function(value, format, roundingFunction) {
var space = numeral2._.includes(format, " %") ? " " : "", output;
if (numeral2.options.scalePercentBy100) {
value = value * 100;
}
format = format.replace(/\s?\%/, "");
output = numeral2._.numberToFormat(value, format, roundingFunction);
if (numeral2._.includes(output, ")")) {
output = output.split("");
output.splice(-1, 0, space + "%");
output = output.join("");
} else {
output = output + space + "%";
}
return output;
},
unformat: function(string) {
var number = numeral2._.stringToNumber(string);
if (numeral2.options.scalePercentBy100) {
return number * 0.01;
}
return number;
}
});
})();
(function() {
numeral2.register("format", "time", {
regexps: {
format: /(:)/,
unformat: /(:)/
},
format: function(value, format, roundingFunction) {
var hours = Math.floor(value / 60 / 60), minutes = Math.floor((value - hours * 60 * 60) / 60), seconds = Math.round(value - hours * 60 * 60 - minutes * 60);
return hours + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds);
},
unformat: function(string) {
var timeArray = string.split(":"), seconds = 0;
if (timeArray.length === 3) {
seconds = seconds + Number(timeArray[0]) * 60 * 60;
seconds = seconds + Number(timeArray[1]) * 60;
seconds = seconds + Number(timeArray[2]);
} else if (timeArray.length === 2) {
seconds = seconds + Number(timeArray[0]) * 60;
seconds = seconds + Number(timeArray[1]);
}
return Number(seconds);
}
});
})();
return numeral2;
});
}
});
// main.ts
__export(exports, {
CRYPTONATOR_API: () => CRYPTONATOR_API,
default: () => CryptoLookup
});
var import_obsidian2 = __toModule(require("obsidian"));
var import_numeral = __toModule(require_numeral());
// crypto-modal.ts
var import_obsidian = __toModule(require("obsidian"));
var CryptoModal = class extends import_obsidian.Modal {
constructor(app, defaultTarget, onSubmit) {
super(app);
this.target = defaultTarget;
this.onSubmit = onSubmit;
}
onOpen() {
const { contentEl } = this;
contentEl.createEl("h1", { text: "Select crypto base and target" });
new import_obsidian.Setting(contentEl).setName("Base").addText((text) => text.setValue(this.base).onChange((value) => {
this.base = value;
}));
new import_obsidian.Setting(contentEl).setName("Target").addText((text) => text.setValue(this.target).onChange((value) => {
this.target = value;
}));
new import_obsidian.Setting(contentEl).addButton((btn) => btn.setButtonText("Lookup").setCta().onClick(() => {
this.close();
this.onSubmit(this.base, this.target);
}));
}
onClose() {
let { contentEl } = this;
contentEl.empty();
}
};
// main.ts
var CRYPTONATOR_API = "https://api.cryptonator.com/api";
var DEFAULT_SETTINGS = {
defaultBase: "BTC",
defaultTarget: "USD"
};
var CryptoLookup = class extends import_obsidian2.Plugin {
getCurrencyTicker(base, target) {
return __async(this, null, function* () {
const data = yield (0, import_obsidian2.request)({
url: `${CRYPTONATOR_API}/ticker/${base}-${target}`
});
return JSON.parse(data);
});
}
getCurrencyListAsJson() {
return __async(this, null, function* () {
return yield (0, import_obsidian2.request)({
url: `${CRYPTONATOR_API}/currencies`
});
});
}
onload() {
return __async(this, null, function* () {
yield this.loadSettings();
const adapter = this.app.vault.adapter;
const dir = this.manifest.dir;
yield (() => __async(this, null, function* () {
const path = (0, import_obsidian2.normalizePath)(`${dir}/currencies.json`);
if (yield adapter.exists(path)) {
const currencies = yield adapter.read(path);
this.currencies = JSON.parse(currencies).rows;
} else {
try {
const currencyText = yield this.getCurrencyListAsJson();
yield adapter.write(path, currencyText);
this.currencies = JSON.parse(currencyText).rows;
} catch (error) {
const text = "The JSON file could not be read.";
new import_obsidian2.Notice(text);
console.error(error);
}
}
}))();
this.addCommand({
id: "insert-default-crypto-ticker",
name: "Insert Default Crypto Ticker",
editorCallback: (editor) => __async(this, null, function* () {
if (!this.settings.defaultBase || !this.settings.defaultTarget) {
new import_obsidian2.Notice("Cannot use this command without default base and target in settings");
} else {
const base = this.settings.defaultBase;
const target = this.settings.defaultTarget;
const currencyTicker = yield this.getCurrencyTicker(base.toLocaleLowerCase(), target.toLocaleLowerCase());
const extendedCryptoTicker = `${base}:${target} price = ${(0, import_numeral.default)(currencyTicker.ticker.price).format("0,00.00")}`;
editor.replaceSelection(extendedCryptoTicker);
}
})
});
this.addCommand({
id: "insert-default-crypto-ticker-extended",
name: "Insert Default Crypto Ticker Extended",
editorCallback: (editor) => __async(this, null, function* () {
if (!this.settings.defaultBase || !this.settings.defaultTarget) {
new import_obsidian2.Notice("Cannot use this command without default base and target in settings");
} else {
const base = this.settings.defaultBase;
const target = this.settings.defaultTarget;
const currencyTicker = yield this.getCurrencyTicker(base.toLocaleLowerCase(), target.toLocaleLowerCase());
const formattedTimestamp = window.moment(currencyTicker.timestamp * 1e3).format("YYYY-MM-DDTHH:mm:ss");
const extendedCryptoTicker = `${base}:${target} price = ${(0, import_numeral.default)(currencyTicker.ticker.price).format("0,00.00")}, volume = ${(0, import_numeral.default)(currencyTicker.ticker.volume).format("0,00.00")}, change = ${(0, import_numeral.default)(currencyTicker.ticker.change).format("0,00.00")} on ${formattedTimestamp}`;
editor.replaceSelection(extendedCryptoTicker);
}
})
});
this.addCommand({
id: "insert-selected-crypto-ticker",
name: "Insert Selected Crypto Ticker",
editorCallback: (editor) => __async(this, null, function* () {
const onSubmit = (base, target) => __async(this, null, function* () {
const currencyTicker = yield this.getCurrencyTicker(base.toLocaleLowerCase(), target.toLocaleLowerCase());
const extendedCryptoTicker = `${base}:${target} price = ${(0, import_numeral.default)(currencyTicker.ticker.price).format("0,00.00")}`;
editor.replaceSelection(extendedCryptoTicker);
});
new CryptoModal(this.app, "USD", onSubmit).open();
})
});
this.addCommand({
id: "insert-selected-crypto-ticker-extended",
name: "Insert Selected Crypto Ticker Extended",
editorCallback: (editor) => __async(this, null, function* () {
const onSubmit = (base, target) => __async(this, null, function* () {
const currencyTicker = yield this.getCurrencyTicker(base.toLocaleLowerCase(), target.toLocaleLowerCase());
const formattedTimestamp = window.moment(currencyTicker.timestamp * 1e3).format("YYYY-MM-DDTHH:mm:ss");
const extendedCryptoTicker = `${base}:${target} price = ${(0, import_numeral.default)(currencyTicker.ticker.price).format("0,00.00")}, volume = ${(0, import_numeral.default)(currencyTicker.ticker.volume).format("0,00.00")}, change = ${(0, import_numeral.default)(currencyTicker.ticker.change).format("0,00.00")} on ${formattedTimestamp}`;
editor.replaceSelection(extendedCryptoTicker);
});
new CryptoModal(this.app, "USD", onSubmit).open();
})
});
this.addSettingTab(new CryptoLookupSettingTab(this.app, this));
});
}
onunload() {
}
loadSettings() {
return __async(this, null, function* () {
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
});
}
saveSettings() {
return __async(this, null, function* () {
yield this.saveData(this.settings);
});
}
};
var CryptoLookupSettingTab = class extends import_obsidian2.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
let { containerEl } = this;
containerEl.empty();
containerEl.createEl("h2", { text: "Crypto Lookup Defaults" });
new import_obsidian2.Setting(containerEl).setName("Base Currency").setDesc("Default currency we want the price of").addText((text) => text.setPlaceholder("BTC").setValue(this.plugin.settings.defaultBase).onChange((value) => __async(this, null, function* () {
this.plugin.settings.defaultBase = value;
yield this.plugin.saveSettings();
})));
new import_obsidian2.Setting(containerEl).setName("Target Currency").setDesc("Default target currency to convert base currency into").addText((text) => text.setPlaceholder("USD").setValue(this.plugin.settings.defaultTarget).onChange((value) => __async(this, null, function* () {
this.plugin.settings.defaultTarget = value;
yield this.plugin.saveSettings();
})));
}
};
/*! @preserve
* numeral.js
* version : 2.0.6
* author : Adam Draper
* license : MIT
* http://adamwdraper.github.com/Numeral-js/
*/

@ -0,0 +1 @@
{"id":"obsidian-crypto-lookup","name":"Crypto Lookup","version":"0.0.2","minAppVersion":"0.12.0","description":"A plugin for Obsidian which uses the Cryptonator API to pull back prices for crypto in a target currency","author":"Andrew Lombardi","authorUrl":"https://mysticcoders.com","isDesktopOnly":false}

@ -0,0 +1,4 @@
/* Sets all the text color to red! */
/*body {*/
/* color: red;*/
/*}*/

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
{"id":"obsidian-lineup-builder","name":"Lineup Builder","version":"1.0.0","minAppVersion":"0.12.0","description":"Build football lineups in Obsidian.","author":"James Fallon","authorUrl":"https://github.com/James-Fallon","isDesktopOnly":false}

@ -1,5 +1,7 @@
{
"pluginList": [
"James-Fallon/obsidian-lineup-builder",
"kinabalu/obsidian-crypto-lookup",
"joethei/obsidian-rss"
],
"updateAtStartup": false

@ -9,7 +9,7 @@
"state": {
"type": "markdown",
"state": {
"file": "01.01 Life Orga/Finances.md",
"file": "03.03 Food & Wine/!!Wine.md",
"mode": "preview"
}
}
@ -68,7 +68,7 @@
"state": {
"type": "backlink",
"state": {
"file": "01.01 Life Orga/Finances.md",
"file": "03.03 Food & Wine/!!Wine.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@ -107,15 +107,15 @@
},
"active": "c252d60ecbda6bb3",
"lastOpenFiles": [
"01.01 Life Orga/Finances.md",
"06.02 Investments/Crypto Tasks.md",
"01.01 Life Orga/IT & Computer.md",
"05.02 Networks/VPS Console Dialogue.md",
"03.03 Food & Wine/!!Wine.md",
"03.03 Food & Wine/!!Coffee.md",
"03.03 Food & Wine/Maison Olivier Chanzy Chassagne-Montrachet 1er Cru.md",
"03.03 Food & Wine/Brazil Assodantas.md",
"03.03 Food & Wine/!!Wine 1.md",
"00.01 Admin/Templates/Template Wine 1.md",
"05.02 Networks/Server VPN.md",
"05.02 Networks/Server Cloud.md",
"05.01 Computer setup/Applications.md",
"05.02 Networks/mfxm Website Scope.md",
"05.02 Networks/Server Tools.md",
"01.01 Life Orga/Personal projects.md",
"01.01 Life Orga/Lifestyle.md"
"00.01 Admin/Test sheet.md",
"01.01 Life Orga/Finances.md"
]
}

@ -0,0 +1,77 @@
---
Tag: ["Crisp", "Powerful", "Apricot", "Peach", "Mango", "Oak"]
Date: <% tp.date.now("YYYY-MM-DD") %>
DocType: "Coffee"
Hierarchy: "NonRoot"
TimeStamp:
location:
CollapseMetaTable: Yes
Source:
cssclass: recipeTable
Coffee:
Brand:
Type:
Roast:
Strength:
Country:
---
parent::
---
&emsp;
```button
name Save
type command
action Save current file
id Save
```
^button-<% tp.file.title %>NSave
# <% tp.file.title %>
&emsp;
```ad-abstract
title: Summary
collapse: open
Description
```
&emsp;
```toc
style: number
```
&emsp;
---
&emsp;
### Summary
&emsp;
| |
|-|-
| **Coffee type**: | `$=dv.current().Coffee.Type`
| **Strength**: | `$=dv.current().Coffee.Strength`
| **Country**: | `$=dv.current().Coffee.Country`
| **Roast**: | `$=dv.current().Coffee.Roast`
| **Brand**: | `$=dv.current().Coffee.Brand`
&emsp;
---
&emsp;
### Notes
&emsp;

@ -9,6 +9,11 @@ ChildrenType: ["Note", "Task", "Recipe"]
&emsp;
&emsp;
```lineup
formation: 433
players: Donnarumma,Bernat,Marquinhos,Kimpembe,Hakimi,Villeneuve,Verratti,St Hilaire,MBappe,Solanet,Messi
```
```dataviewjs
const {shoppingFunc} = customJS
shoppingFunc.getItems2Change({app: app, dv: dv, luxon: luxon, that:this, theme: "to0"})

@ -302,6 +302,16 @@ class globalFunc {
break;
case 'Coffee':
switch(TableT) {
default:
TempData = ["Name", "Coffee type", "Strength", "Country", "Roast", "Notes", "Brand"]
break;
}
break;
}
return TempData
@ -394,7 +404,17 @@ class globalFunc {
TempData = [p.file.link, this.GetPoint(p, DataT, "type"), this.GetPoint(p, DataT, "vintage"), this.toEmoji(this.GetPoint(p, DataT, "country")), this.GetPoint(p, DataT, "subregion"), this.GetPoint(p, DataT, "appellation")]
break;
case 'extended':
TempData = [p.file.link, this.GetPoint(p, DataT, "type"), this.GetPoint(p, DataT, "vintage"), this.toEmoji(this.GetPoint(p, DataT, "country")), this.GetPoint(p, DataT, "region"), this.GetPoint(p, DataT, "subregion"), this.GetPoint(p, DataT, "appellation"), this.GetPoint(p, DataT, "vineyard"), this.GetPoint(p, DataT, "variety"), this.GetPoint(p, DataT, "producer")]
TempData = [p.file.link, this.GetPoint(p, DataT, "type"), this.GetPoint(p, DataT, "vintage"), this.toEmoji(this.GetPoint(p, DataT, "country")), this.GetPoint(p, DataT, "region"), this.GetPoint(p, DataT, "subregion"), this.GetPoint(p, DataT, "appellation"), this.GetPoint(p, DataT, "vineyard"), this.GetPoint(p, DataT, "varietal"), this.GetPoint(p, DataT, "producer")]
break;
}
break;
case 'Coffee':
switch(TableT) {
default:
TempData = [p.file.link, this.GetPoint(p, DataT, "type"), this.GetPoint(p, DataT, "strength"), this.toEmoji(this.GetPoint(p, DataT, "country")), this.GetPoint(p, DataT, "roast"), this.GetPoint(p, "main", "tag"), this.GetPoint(p, DataT, "brand")]
break;
}
@ -492,6 +512,9 @@ class globalFunc {
case 'Nordics':
tempresult = "🇸🇪"
break;
case 'Brazil':
tempresult = "🇧🇷"
break;
case 'Pub':
tempresult = "🍺"
break;
@ -527,6 +550,7 @@ class globalFunc {
case 'prodtype':
case 'disktype':
case 'winetype':
case 'coffeetype':
result = this.GetPoint(pobj, DocType, "type")
break;
case 'style':
@ -643,6 +667,15 @@ class globalFunc {
case 'designation':
result = this.GetPoint(pobj, DocType, "designation")
break;
case 'brand':
result = this.GetPoint(pobj, DocType, "brand")
break;
case 'roast':
result = this.GetPoint(pobj, DocType, "roast")
break;
case 'strength':
result = this.GetPoint(pobj, DocType, "strength")
break;
}
return result
}
@ -950,6 +983,28 @@ class globalFunc {
}
break;
case 'Coffee':
switch(dPoint) {
case 'brand':
result = pobj.Coffee.Brand
break;
case 'roast':
result = pobj.Coffee.Roast
break;
case 'country':
result = pobj.Coffee.Country
break;
case 'type':
result = pobj.Coffee.Type
break;
case 'strength':
result = pobj.Coffee.Strength
break;
}
break;
}
return result

@ -0,0 +1,4 @@
const {globalFunc} = customJS
let {dateadded, coffeetype, brand, roast, strength, theme, country} = input;
dv.el('t', "<b>🔎 search terms:</b> \n• " + globalFunc.buildToPrint([dateadded, coffeetype, brand, roast, strength, theme, country], ["note written", "type of coffee", "brand", "roast", "strength", "notes", "country"], "\n• "));

@ -0,0 +1,6 @@
let {dateadded, coffeetype, brand, roast, strength, theme, country} = input;
const {globalFunc} = customJS
const DataType = 'Coffee'
//let templacetype = globalFunc.Get1stArg(placetype)
return globalFunc.getTable(dv, DataType, ["note written", "type of coffee", "brand", "roast", "strength", "notes", "country"], [dateadded, coffeetype, brand, roast, strength, theme, country], 0)

@ -0,0 +1,167 @@
---
QPDate:
QPcoffeetype: Arabica
QProast:
QPstrengtg:
QPbrand:
QPtheme:
QPcountry:
cssclass: recipeTable
Alias: ["Coffee"]
Tag: ["Morning"]
Date: 2021-10-26
DocType: "Personal"
ChildrenType: ["Product", "Coffee"]
Hierarchy: "Root"
location:
CollapseMetaTable: Yes
---
Parent:: [[Lifestyle]]
---
^Top
&emsp;
```button
name Create Note
type append template
action NewFile
id CreateNote
```
^button-CoffeeNewNote
```button
name Save
type command
action Save current file
id Save
```
^button-CoffeeSave
&emsp;
# Folder map
&emsp;
```ad-abstract
title: Summary
collapse: open
This note enables to navigate in the Coffee section and find any Note in this Vault by Note or Tag
```
&emsp;
```toc
style: number
```
&emsp;
---
&emsp;
### Search
[[#^Top|TOP]]
&emsp;
```button
name Search Coffees
type command
action MetaEdit: Run MetaEdit
id EditMetaData
```
&emsp;
```dataviewjs
dv.view("00.01 Admin/dv-views/print_coffeesearch", {dateadded: dv.current().QPDate, coffeetype: dv.current().QPcoffeetype, roast: dv.current().QProast, brand: dv.current().QPbrand, strength: dv.current().QPstrength, theme: dv.current().QPtheme, country: dv.current().QPcountry})
```
&emsp;
```dataviewjs
dv.view("00.01 Admin/dv-views/query_coffee", {dateadded: dv.current().QPDate, type: dv.current().QPcoffeetype, roast: dv.current().QProast, brand: dv.current().QPbrand, strength: dv.current().QPstrength, theme: dv.current().QPtheme, country: dv.current().QPcountry})
```
&emsp;
---
&emsp;
### Navigation
&emsp;
#### By type
[[#^Top|TOP]]
##### Arabica
&emsp;
```dataviewjs
dv.view("00.01 Admin/dv-views/query_coffee", {type: "Arabica"})
```
&emsp;
---
&emsp;
#### By Geography
[[#^Top|TOP]]
##### Brazil
&emsp;
```dataviewjs
dv.view("00.01 Admin/dv-views/query_coffee", {country: "Brazil"})
```
&emsp;
---
&emsp;
### Tag Navigation
[[#^Top|TOP]]
&emsp;
```dataview
Table without id tags as "Tags" From "03.03 Food & Wine"
Where DocType = "Coffee"
Flatten file.tags as tags
Group by tags
```
&emsp;
---
&emsp;
### High Level tasks
[[#^Top|TOP]]
&emsp;
```tasks
not done
path includes 03.03
sort by due
hide backlink
hide task count
```
&emsp;
&emsp;

@ -0,0 +1,77 @@
---
Tag: ["Nutty", "Cocoa", "Hazelnut", "Fruity"]
Date: 2021-10-31
DocType: "Coffee"
Hierarchy: "NonRoot"
TimeStamp:
location:
CollapseMetaTable: Yes
Source:
cssclass: recipeTable
Coffee:
Brand: "Waitrose"
Type: "Arabica"
Roast: "Medium-dark"
Strength: 4
Country: Brazil
---
parent:: [[!!Coffee|Coffee]]
---
&emsp;
```button
name Save
type command
action Save current file
id Save
```
^button-BrazilAssodantasNSave
# Brazil Assodantas
&emsp;
```ad-abstract
title: Summary
collapse: open
Description
```
&emsp;
```toc
style: number
```
&emsp;
---
&emsp;
### Summary
&emsp;
| |
|-|-
| **Coffee type**: | `$=dv.current().Coffee.Type`
| **Strength**: | `$=dv.current().Coffee.Strength`
| **Country**: | `$=dv.current().Coffee.Country`
| **Roast**: | `$=dv.current().Coffee.Roast`
| **Brand**: | `$=dv.current().Coffee.Brand`
&emsp;
---
&emsp;
### Notes
&emsp;
Loading…
Cancel
Save