🔧 Updated Plugin from Gemmy to Granite (#7)

This commit is contained in:
Rebbecca Bishop 2023-08-10 22:16:39 -05:00 committed by GitHub
parent cc1c66599f
commit ea9f8d2016
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 212 additions and 213 deletions

View file

@ -1,13 +1,13 @@
# Granite, the Goal Reinforcing And Note Improving Tiny Entity
Inspired by the saintly [Gemmy](https://github.com/ericaxu/gemmy), the Obsidian TTRPG Community has taken Gemmy on an adventure through time and space. She's met dragons, owlbears, robots, aliens, and so many interesting beings. Many of them have have decided to join her on the quest for the most sarcastic, the most scathing, and sometimes, the most helpful reactions to
Inspired by the saintly [Gemmy](https://github.com/ericaxu/gemmy), the Obsidian TTRPG Community has taken Gemmy on an adventure through time and space. She's met dragons, owl-bears, robots, aliens and so many interesting beings. Some of them have decided to join her on the quest for the most sarcastic, the most scathing, and sometimes, the most helpful reactions to writing in Obsidian. But she's not alone as her arch-rival, Granite, who also has been gathering friends on her quest, will stop at nothing to be the most helpful, the most encouraging, and the most annoying of them all.
## Features
### Multiple Characters
- Gemmy, the original [Obsidian](https://www.obsidian.md/) Shard whom has all new quotes.
- Granite, Gemmy's rival in all things unhelpful. She'll not stop until that purple shard succumbs to the power of her words. (:sparkles: Coming Soon)
- Drake, the dashing and devious dragon who loves mothing more than to talk about dice. (:sparkles: Coming Soon)
- Gemmy, the original [Obsidian](https://www.obsidian.md/) Shard who has all new quotes and is now 100% even more unhelpful.
- Granite, Gemmy's rival in all things. She'll not stop until that purple shard succumbs to the power of her words. (:sparkles: Coming Soon)
- Drake, the dashing and devious dragon who loves nothing more than to talk about dice. (:sparkles: Coming Soon)
### Random Quotes
@ -51,10 +51,9 @@ The Obsidian Team released original Gemmy April 1st, 2023. The Obsidian TTRPG Co
Credits for the Original, saintly [Gemmy](https://github.com/ericaxu/gemmy) go to [ericaxu](https://github.com/ericaxu). With special thanks to [Rigmarole](https://rigmarolestudio.com/) for creating and animating the original Gemmy. Additional Credit is given to the talented Obsidian mods team, including Argentum, CawlinTeffid, cotmax, Eleanor Konik, Koala, Leah, Rigmarole, Ryanamurphy & WhiteNoise.
The code is code for Original Gemmy is licensed under the [MIT license](https://mit-license.org), whereas the Gemmy character is under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/) license. The Obsidian TTRPG Community will extend Gemmy_TTRPG under the MIT License for code, and CC BY 3.0 license for the character and any alterations respectively.
The code is code for Original Gemmy is licensed under the [MIT license](https://mit-license.org), whereas the Gemmy character is under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/) license. The Obsidian TTRPG Community will extend Granite under the MIT License for code, and CC BY 3.0 license for the character and any alterations respectively.
### Logos
The pre-sharded Obsidian Logo is adapted from:
[Crystal shard icon](https://icon-icons.com/icon/Crystal-Shard/88819) By [Chanut is Industries](https://icon-icons.com/users/W52nHhY3W1VlvwyJTwS4d/icon-sets/)

View file

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View file

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View file

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View file

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 150 KiB

View file

Before

Width:  |  Height:  |  Size: 221 KiB

After

Width:  |  Height:  |  Size: 221 KiB

View file

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

View file

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View file

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View file

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View file

Before

Width:  |  Height:  |  Size: 237 KiB

After

Width:  |  Height:  |  Size: 237 KiB

View file

Before

Width:  |  Height:  |  Size: 195 KiB

After

Width:  |  Height:  |  Size: 195 KiB

View file

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

156
main.js

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,9 @@
{
"id": "gemmy_ttrpg",
"name": "Gemmy TTRPG",
"id": "granite_helper",
"name": "Granite",
"version": "1.1.0",
"minAppVersion": "0.19.0",
"description": "2023 April Fool's plugin, transported into your TTRPG setting",
"description": "A Goal Reinforcing And Note Improving Tiny Entity",
"author": "Obsidian, and the Obsidian TTRPG Community",
"authorUrl": "https://github.com/Obsidian-TTRPG-Community/gemmy_ttrpg",
"fundingUrl": "",

View file

@ -1,7 +1,7 @@
{
"name": "@obsidian-ttrpg-community/gemmy-for-ttrpgs",
"version": "1.1.0",
"description": "Our favorite sassy Obsidian Shard, flavoured for TTRPG.",
"description": "The 2023 Obsidian April Fool's plugin, unshackled and expanded.",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",

View file

@ -1,23 +1,23 @@
import GemmyPlugin from './main';
import GranitePlugin from './main';
import { AnimationSourceType } from './Setting';
// Original Animations
import EMERGE_MOTION_ORIGINAL from '../animations/original/gemmy_emerge.gif';
import POP_MOTION_ORIGINAL from '../animations/original/gemmy_pop.gif';
import DISAPPEAR_MOTION_ORIGINAL from '../animations/original/gemmy_disappear.gif';
import ANGRY_MOTION_ORIGINAL from '../animations/original/gemmy_angry.gif';
import LOOK_MOTION_ORIGINAL from '../animations/original/gemmy_lookAround.gif';
import IDLE_MOTION_ORIGINAL from '../animations/original/gemmy_idle.gif';
import DISAPPOINT_IMG_ORIGINAL from '../animations/original/gemmy_disappoint.gif';
import EMERGE_MOTION_GEMMY from '../animations/gemmy/gemmy_emerge.gif';
import POP_MOTION_GEMMY from '../animations/gemmy/gemmy_pop.gif';
import DISAPPEAR_MOTION_GEMMY from '../animations/gemmy/gemmy_disappear.gif';
import ANGRY_MOTION_GEMMY from '../animations/gemmy/gemmy_angry.gif';
import LOOK_MOTION_GEMMY from '../animations/gemmy/gemmy_lookAround.gif';
import IDLE_MOTION_GEMMY from '../animations/gemmy/gemmy_idle.gif';
import DISAPPOINT_IMG_GEMMY from '../animations/gemmy/gemmy_disappoint.gif';
// Draconic Animations
import EMERGE_MOTION_DRACONIC from '../animations/draconic/gemmy_emerge.gif';
import POP_MOTION_DRACONIC from '../animations/draconic/gemmy_pop.gif';
import DISAPPEAR_MOTION_DRACONIC from '../animations/draconic/gemmy_disappear.gif';
import ANGRY_MOTION_DRACONIC from '../animations/draconic/gemmy_angry.gif';
import LOOK_MOTION_DRACONIC from '../animations/draconic/gemmy_lookAround.gif';
import IDLE_MOTION_DRACONIC from '../animations/draconic/gemmy_idle.gif';
import DISAPPOINT_IMG_DRACONIC from '../animations/draconic/gemmy_disappoint.gif';
import EMERGE_MOTION_DRAKE from '../animations/drake/drake_emerge.gif';
import POP_MOTION_DRAKE from '../animations/drake/drake_pop.gif';
import DISAPPEAR_MOTION_DRAKE from '../animations/drake/drake_disappear.gif';
import ANGRY_MOTION_DRAKE from '../animations/drake/drake_angry.gif';
import LOOK_MOTION_DRAKE from '../animations/drake/drake_lookAround.gif';
import IDLE_MOTION_DRAKE from '../animations/drake/drake_idle.gif';
import DISAPPOINT_IMG_DRAKE from '../animations/drake/drake_disappoint.gif';
export enum AnimationType {
EMERGE = 'emerge',
@ -30,47 +30,47 @@ export enum AnimationType {
}
export class Animations {
public readonly plugin: GemmyPlugin;
public readonly plugin: GranitePlugin;
// the mappings from an animation type to an actual image file for the draconic gemmy
public readonly draconicAnimationMap: Record<AnimationType, string>;
// the mappings from an animation type to an actual image file for the original gemmy
public readonly originalAnimationMap: Record<AnimationType, string>;
// the mappings from an animation type to an actual image file for the drakeling
public readonly drakeAnimationMap: Record<AnimationType, string>;
// the mappings from an animation type to an actual image file for the granite
public readonly gemmyAnimationMap: Record<AnimationType, string>;
// maps an animation source to the corresponding animation map
public readonly animationSourceMap: Record<AnimationSourceType, Record<AnimationType, string>>;
constructor(plugin: GemmyPlugin) {
constructor(plugin: GranitePlugin) {
this.plugin = plugin;
this.draconicAnimationMap = {
[AnimationType.EMERGE]: EMERGE_MOTION_DRACONIC,
[AnimationType.POP_MOTION]: POP_MOTION_DRACONIC,
[AnimationType.DISAPPEAR_MOTION]: DISAPPEAR_MOTION_DRACONIC,
[AnimationType.ANGRY_MOTION]: ANGRY_MOTION_DRACONIC,
[AnimationType.LOOK_MOTION]: LOOK_MOTION_DRACONIC,
[AnimationType.IDLE_MOTION]: IDLE_MOTION_DRACONIC,
[AnimationType.DISAPPOINT_IMG]: DISAPPOINT_IMG_DRACONIC,
this.drakeAnimationMap = {
[AnimationType.EMERGE]: EMERGE_MOTION_DRAKE,
[AnimationType.POP_MOTION]: POP_MOTION_DRAKE,
[AnimationType.DISAPPEAR_MOTION]: DISAPPEAR_MOTION_DRAKE,
[AnimationType.ANGRY_MOTION]: ANGRY_MOTION_DRAKE,
[AnimationType.LOOK_MOTION]: LOOK_MOTION_DRAKE,
[AnimationType.IDLE_MOTION]: IDLE_MOTION_DRAKE,
[AnimationType.DISAPPOINT_IMG]: DISAPPOINT_IMG_DRAKE,
};
this.originalAnimationMap = {
[AnimationType.EMERGE]: EMERGE_MOTION_ORIGINAL,
[AnimationType.POP_MOTION]: POP_MOTION_ORIGINAL,
[AnimationType.DISAPPEAR_MOTION]: DISAPPEAR_MOTION_ORIGINAL,
[AnimationType.ANGRY_MOTION]: ANGRY_MOTION_ORIGINAL,
[AnimationType.LOOK_MOTION]: LOOK_MOTION_ORIGINAL,
[AnimationType.IDLE_MOTION]: IDLE_MOTION_ORIGINAL,
[AnimationType.DISAPPOINT_IMG]: DISAPPOINT_IMG_ORIGINAL,
this.gemmyAnimationMap = {
[AnimationType.EMERGE]: EMERGE_MOTION_GEMMY,
[AnimationType.POP_MOTION]: POP_MOTION_GEMMY,
[AnimationType.DISAPPEAR_MOTION]: DISAPPEAR_MOTION_GEMMY,
[AnimationType.ANGRY_MOTION]: ANGRY_MOTION_GEMMY,
[AnimationType.LOOK_MOTION]: LOOK_MOTION_GEMMY,
[AnimationType.IDLE_MOTION]: IDLE_MOTION_GEMMY,
[AnimationType.DISAPPOINT_IMG]: DISAPPOINT_IMG_GEMMY,
};
this.animationSourceMap = {
[AnimationSourceType.DRACTONIC]: this.draconicAnimationMap,
[AnimationSourceType.ORIGINAL]: this.originalAnimationMap,
[AnimationSourceType.DRAKE]: this.drakeAnimationMap,
[AnimationSourceType.GEMMY]: this.gemmyAnimationMap,
};
}
/**
* Plays a gemmy animation in the currently selected animation source type inside an element.
* Plays a granite animation in the currently selected animation source type inside an element.
*
* @param el the element to play the animation in
* @param animation the animation to play

View file

@ -1,60 +1,60 @@
import { Animations, AnimationType } from './Animations';
import GemmyPlugin from './main';
import { GEMMY_IDLE_QUOTES, WRITING_MODE_QUOTES } from './Quotes';
import GranitePlugin from './main';
import { GRANITE_IDLE_QUOTES, WRITING_MODE_QUOTES } from './quotes/Quotes';
const BUBBLE_DURATION: number = 5000;
export enum GemmyState {
export enum GraniteState {
VISIBLE = 'VISIBLE',
INVISIBLE = 'INVISIBLE',
DISAPPEARING = 'DISAPPEARING',
APPEARING = 'APPEARING',
}
export class Gemmy {
public readonly plugin: GemmyPlugin;
export class Granite {
public readonly plugin: GranitePlugin;
private readonly animations: Animations;
gemmyEl: HTMLElement;
graniteEl: HTMLElement;
imageEl: HTMLElement;
state: GemmyState;
state: GraniteState;
inWritingMode: boolean = false;
idleTimeout: number;
writingModeTimeout: number;
constructor(plugin: GemmyPlugin) {
constructor(plugin: GranitePlugin) {
this.plugin = plugin;
this.animations = new Animations(this.plugin);
this.state = GemmyState.INVISIBLE;
this.state = GraniteState.INVISIBLE;
this.createGemmyEl();
this.createGraniteEl();
this.startNextIdleTimeout();
}
createGemmyEl() {
this.gemmyEl = createDiv('gemmy-container');
this.gemmyEl.setAttribute('aria-label-position', 'top');
this.gemmyEl.setAttribute('aria-label-delay', '0');
this.gemmyEl.setAttribute('aria-label-classes', 'gemmy-tooltip');
createGraniteEl() {
this.graniteEl = createDiv('granite-container');
this.graniteEl.setAttribute('aria-label-position', 'top');
this.graniteEl.setAttribute('aria-label-delay', '0');
this.graniteEl.setAttribute('aria-label-classes', 'granite-tooltip');
this.imageEl = this.gemmyEl.createEl('img', {});
this.imageEl = this.graniteEl.createEl('img', {});
this.gemmyEl.addEventListener('mouseenter', () => {
this.graniteEl.addEventListener('mouseenter', () => {
// ignore mouse events in writing mode
if (this.inWritingMode) {
return;
}
this.saySomething(GEMMY_IDLE_QUOTES, true);
this.saySomething(GRANITE_IDLE_QUOTES, true);
this.idleTimeout && clearTimeout(this.idleTimeout);
});
this.gemmyEl.addEventListener('mouseleave', () => {
this.graniteEl.addEventListener('mouseleave', () => {
// ignore mouse events in writing mode
if (this.inWritingMode) {
return;
@ -64,18 +64,18 @@ export class Gemmy {
this.startNextIdleTimeout();
});
this.gemmyEl.hidden = true;
document.body.appendChild(this.gemmyEl);
this.graniteEl.hidden = true;
document.body.appendChild(this.graniteEl);
}
async appear(): Promise<void> {
if (this.state === GemmyState.APPEARING || this.state === GemmyState.VISIBLE) {
if (this.state === GraniteState.APPEARING || this.state === GraniteState.VISIBLE) {
return;
}
// show him
this.state = GemmyState.APPEARING;
this.gemmyEl.hidden = false;
this.state = GraniteState.APPEARING;
this.graniteEl.hidden = false;
// Quicker if we're in writing mode
if (this.inWritingMode) {
@ -84,11 +84,11 @@ export class Gemmy {
await sleep(1800);
// another animation overrode this animation, so we quit
if (this.state !== GemmyState.APPEARING) {
if (this.state !== GraniteState.APPEARING) {
return;
}
this.state = GemmyState.VISIBLE;
this.state = GraniteState.VISIBLE;
this.saySomething(WRITING_MODE_QUOTES, true);
} else {
this.animations.play(this.imageEl, AnimationType.EMERGE);
@ -96,43 +96,43 @@ export class Gemmy {
await sleep(3800);
// another animation overrode this animation, so we quit
if (this.state !== GemmyState.APPEARING) {
if (this.state !== GraniteState.APPEARING) {
return;
}
this.state = GemmyState.VISIBLE;
this.state = GraniteState.VISIBLE;
this.animations.play(this.imageEl, AnimationType.IDLE_MOTION);
}
}
async disappear(): Promise<void> {
// don't make gemmy disappear while he is already leaving
if (this.state === GemmyState.DISAPPEARING || this.state === GemmyState.INVISIBLE) {
// don't make granite disappear while they are already leaving
if (this.state === GraniteState.DISAPPEARING || this.state === GraniteState.INVISIBLE) {
return;
}
this.state = GemmyState.DISAPPEARING;
this.state = GraniteState.DISAPPEARING;
if (this.idleTimeout) window.clearTimeout(this.idleTimeout);
if (this.writingModeTimeout) window.clearTimeout(this.writingModeTimeout);
this.animations.play(this.imageEl, AnimationType.DISAPPEAR_MOTION);
// remote tooltip
this.gemmyEl.dispatchEvent(new MouseEvent('mouseout', { bubbles: true, clientX: 10, clientY: 10 }));
this.graniteEl.dispatchEvent(new MouseEvent('mouseout', { bubbles: true, clientX: 10, clientY: 10 }));
await sleep(1300);
// another animation overrode this animation, so we quit
if (this.state !== GemmyState.DISAPPEARING) {
if (this.state !== GraniteState.DISAPPEARING) {
return;
}
this.state = GemmyState.INVISIBLE;
this.gemmyEl.hidden = true;
this.state = GraniteState.INVISIBLE;
this.graniteEl.hidden = true;
}
async reset(): Promise<void> {
if (this.state === GemmyState.DISAPPEARING || this.state === GemmyState.INVISIBLE) {
if (this.state === GraniteState.DISAPPEARING || this.state === GraniteState.INVISIBLE) {
await this.appear();
}
@ -144,7 +144,7 @@ export class Gemmy {
return;
}
if (this.state !== GemmyState.DISAPPEARING && this.state !== GemmyState.INVISIBLE) {
if (this.state !== GraniteState.DISAPPEARING && this.state !== GraniteState.INVISIBLE) {
this.disappear();
}
this.setWritingModeTimeout();
@ -191,21 +191,21 @@ export class Gemmy {
return;
}
this.saySomething(GEMMY_IDLE_QUOTES, false);
this.saySomething(GRANITE_IDLE_QUOTES, false);
this.startNextIdleTimeout();
}, randomizedTimeout);
}
async saySomething(quotes: string[], persistent: boolean): Promise<void> {
if (this.state !== GemmyState.VISIBLE) {
if (this.state !== GraniteState.VISIBLE) {
return;
}
const randomThing = quotes[Math.floor(Math.random() * quotes.length)];
this.gemmyEl.setAttr('aria-label', randomThing);
this.gemmyEl.setAttr('aria-label-position', 'top');
this.gemmyEl.dispatchEvent(new MouseEvent('mouseover', { bubbles: true, clientX: 10, clientY: 10 }));
this.graniteEl.setAttr('aria-label', randomThing);
this.graniteEl.setAttr('aria-label-position', 'top');
this.graniteEl.dispatchEvent(new MouseEvent('mouseover', { bubbles: true, clientX: 10, clientY: 10 }));
if (this.inWritingMode) {
this.animations.play(this.imageEl, AnimationType.ANGRY_MOTION);
@ -220,7 +220,7 @@ export class Gemmy {
if (!persistent) {
await sleep(BUBBLE_DURATION);
this.gemmyEl.dispatchEvent(new MouseEvent('mouseout', { bubbles: true, clientX: 10, clientY: 10 }));
this.graniteEl.dispatchEvent(new MouseEvent('mouseout', { bubbles: true, clientX: 10, clientY: 10 }));
this.animations.play(this.imageEl, AnimationType.IDLE_MOTION);
}
}

View file

@ -1,30 +1,30 @@
import { App, PluginSettingTab, Setting } from 'obsidian';
import GemmyPlugin from './main';
import GranitePlugin from './main';
export enum AnimationSourceType {
ORIGINAL = 'original',
DRACTONIC = 'draconic',
GEMMY = 'gemmy',
DRAKE = 'drake',
}
export interface GemmySettings {
export interface GraniteSettings {
// Add the animationSource property to the settings interface
animationSource: AnimationSourceType;
// how often does Gemmy talk in idle mode, in minutes
// how often does Granite talk in idle mode, in minutes
idleTalkFrequency: number;
// the number of minutes you must write before Gemmy appears to mock you
// the number of minutes you must write before Granite appears to mock you
writingModeGracePeriod: number;
}
export const DEFAULT_SETTINGS: GemmySettings = {
animationSource: AnimationSourceType.ORIGINAL,
export const DEFAULT_SETTINGS: GraniteSettings = {
animationSource: AnimationSourceType.GEMMY,
idleTalkFrequency: 1,
writingModeGracePeriod: 1,
};
export class GemmySettingTab extends PluginSettingTab {
plugin: GemmyPlugin;
export class GraniteSettingsTab extends PluginSettingTab {
plugin: GranitePlugin;
constructor(app: App, plugin: GemmyPlugin) {
constructor(app: App, plugin: GranitePlugin) {
super(app, plugin);
this.plugin = plugin;
}
@ -36,19 +36,19 @@ export class GemmySettingTab extends PluginSettingTab {
new Setting(containerEl)
.setName('Animation Source')
.setDesc('Choose the source of Gemmy animations.')
.setDesc('Choose the source of Granite animations.')
.addDropdown(dropdown =>
dropdown
.addOption(AnimationSourceType.ORIGINAL, 'Original')
.addOption(AnimationSourceType.DRACTONIC, 'Draconic')
.addOption(AnimationSourceType.GEMMY, 'Gemmy')
.addOption(AnimationSourceType.DRAKE, 'Drake')
.setValue(this.plugin.settings.animationSource)
.onChange(async value => {
// Explicitly cast the value to the correct type
const animationSource = value as AnimationSourceType;
this.plugin.settings.animationSource = animationSource;
// Show Gemmy with the new animations after changing the source
this.plugin.gemmy.reset();
// Show Granite with the new animations after changing the source
this.plugin.granite.reset();
await this.plugin.saveSettings();
}),
@ -56,7 +56,7 @@ export class GemmySettingTab extends PluginSettingTab {
new Setting(containerEl)
.setName('Idle talk frequency')
.setDesc('How often does Gemmy speak when idle, in minutes.')
.setDesc('How often does Granite speak when idle, in minutes.')
.addSlider(slider =>
slider
.setLimits(5, 60, 5)
@ -70,7 +70,7 @@ export class GemmySettingTab extends PluginSettingTab {
new Setting(containerEl)
.setName('Writing mode grace period')
.setDesc('How soon Gemmy starts to get disappointed after you stop tying in writing mode, in seconds.')
.setDesc('How soon Granite starts to get disappointed after you stop tying in writing mode, in seconds.')
.addSlider(slider =>
slider
.setLimits(5, 180, 5)

View file

@ -1,29 +1,29 @@
import { debounce, Plugin } from 'obsidian';
import { DEFAULT_SETTINGS, GemmySettings, GemmySettingTab } from './Setting';
import { Gemmy } from './Gemmy';
import { DEFAULT_SETTINGS, GraniteSettings, GraniteSettingsTab } from './Setting';
import { Granite } from './Granite';
export default class GemmyPlugin extends Plugin {
settings: GemmySettings;
gemmy: Gemmy;
export default class GranitePlugin extends Plugin {
settings: GraniteSettings;
granite: Granite;
async onload() {
await this.loadSettings();
this.gemmy = new Gemmy(this);
this.granite = new Granite(this);
this.addCommand({
id: 'show',
name: 'Show Gemmy',
name: 'Show Granite',
callback: () => {
this.gemmy.appear();
this.granite.appear();
},
});
this.addCommand({
id: 'hide',
name: 'Hide Gemmy',
name: 'Hide Granite',
callback: () => {
this.gemmy.disappear();
this.granite.disappear();
},
});
@ -31,7 +31,7 @@ export default class GemmyPlugin extends Plugin {
id: 'enter-writing-mode',
name: 'Enter writing mode',
callback: () => {
this.gemmy.enterWritingMode();
this.granite.enterWritingMode();
},
});
@ -39,28 +39,28 @@ export default class GemmyPlugin extends Plugin {
id: 'leave-writing-mode',
name: 'Leave writing mode',
callback: () => {
this.gemmy.leaveWritingMode();
this.granite.leaveWritingMode();
},
});
// This adds a settings tab so the user can configure various aspects of the plugin
this.addSettingTab(new GemmySettingTab(this.app, this));
this.addSettingTab(new GraniteSettingsTab(this.app, this));
// debounce editor-change event on workspace
this.registerEvent(
this.app.workspace.on(
'editor-change',
debounce(() => {
this.gemmy.onEditorChange();
this.granite.onEditorChange();
}, 500),
),
);
this.app.workspace.onLayoutReady(() => this.gemmy.appear());
this.app.workspace.onLayoutReady(() => this.granite.appear());
}
onunload() {
this.gemmy.disappear();
this.granite.disappear();
}
async loadSettings() {

View file

@ -1,4 +1,4 @@
export const GEMMY_IDLE_QUOTES = [
export const GRANITE_IDLE_QUOTES = [
"You can't arrest us! We already ate the evidence!",
"Don't ever split the party!",
'If you kill a hive mind, is that murder or genocide?',

View file

@ -8,22 +8,22 @@ If your plugin does not need CSS, delete this file.
*/
:root {
--gemmy-size: 80px;
--granite-size: 80px;
}
.gemmy-container {
.granite-container {
position: fixed;
bottom: 60px;
right: 30px;
}
.gemmy-container img {
width: var(--gemmy-size);
height: var(--gemmy-size);
border-radius: var(--gemmy-size);
.granite-container img {
width: var(--granite-size);
height: var(--granite-size);
border-radius: var(--granite-size);
}
.gemmy-tooltip {
.granite-tooltip {
--background-modifier-message: var(--background-primary);
color: var(--text-normal);
font-size: var(--font-ui-medium);