mirror of
https://github.com/kurakart/garble-text.git
synced 2026-07-22 05:40:32 +00:00
38 lines
772 B
TypeScript
38 lines
772 B
TypeScript
import "./css/image-blur.css";
|
|
import "./css/ungarble-on-hover.css";
|
|
import { App, Plugin } from 'obsidian';
|
|
|
|
export default class GarbleText extends Plugin {
|
|
private isGarbled: boolean = false;
|
|
|
|
async onload() {
|
|
console.log('loading Garble Text plugin');
|
|
|
|
this.addCommand({
|
|
id: "toggle-garble-text",
|
|
name: "Toggle Garble Text",
|
|
callback: () => {
|
|
if (this.isGarbled) this.ungarble();
|
|
else this.garble();
|
|
|
|
this.isGarbled = !this.isGarbled;
|
|
}
|
|
});
|
|
|
|
//TODO: garble with regex
|
|
}
|
|
|
|
onunload() {
|
|
this.isGarbled = false;
|
|
this.ungarble();
|
|
console.log('Garble Text unloaded');
|
|
}
|
|
|
|
garble() {
|
|
this.app.garbleText();
|
|
}
|
|
|
|
ungarble() {
|
|
this.app.dom.appContainerEl.removeClass('is-text-garbled');
|
|
}
|
|
}
|