Add obsidian plugin unloading

This commit is contained in:
Idrees Hassan committed 2025-11-13 17:20:04 -05:00
1 parent e99a61a4c6
commit 40169dd474
8 files changed
+20 -8

No files matched your search

+6
View File
@@ -165,6 +165,12 @@ module.exports = class MyPlugin extends Plugin {
onload() { onload() {
${birbJs} ${birbJs}
} }
onunload() {
// Remove the birb when the plugin is unloaded
document.getElementById('birb')?.remove();
console.log('Pocket Bird unloaded!');
}
};` };`
// Create main.js with plugin code // Create main.js with plugin code
+1 -1
View File
@@ -1902,7 +1902,7 @@
insertModal(`${birdBirb()} Mode`, message); insertModal(`${birdBirb()} Mode`, message);
}), }),
new Separator(), new Separator(),
new MenuItem("2025.11.13.1", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.1"); }, false), new MenuItem("2025.11.13.2", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.2"); }, false),
]; ];
const styleElement = document.createElement("style"); const styleElement = document.createElement("style");
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -1902,7 +1902,7 @@
insertModal(`${birdBirb()} Mode`, message); insertModal(`${birdBirb()} Mode`, message);
}), }),
new Separator(), new Separator(),
new MenuItem("2025.11.13.1", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.1"); }, false), new MenuItem("2025.11.13.2", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.2"); }, false),
]; ];
const styleElement = document.createElement("style"); const styleElement = document.createElement("style");
+1 -1
View File
@@ -2,7 +2,7 @@
"manifest_version": 3, "manifest_version": 3,
"name": "Pocket Bird", "name": "Pocket Bird",
"description": "It's a pet bird in your browser, what more could you want?", "description": "It's a pet bird in your browser, what more could you want?",
"version": "2025.11.13.1", "version": "2025.11.13.2",
"homepage_url": "https://idreesinc.com", "homepage_url": "https://idreesinc.com",
"icons": { "icons": {
"48": "images/icons/transparent/48x48x1.png", "48": "images/icons/transparent/48x48x1.png",
+8 -2
View File
@@ -1906,7 +1906,7 @@ module.exports = class MyPlugin extends Plugin {
insertModal(`${birdBirb()} Mode`, message); insertModal(`${birdBirb()} Mode`, message);
}), }),
new Separator(), new Separator(),
new MenuItem("2025.11.13.1", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.1"); }, false), new MenuItem("2025.11.13.2", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.2"); }, false),
]; ];
const styleElement = document.createElement("style"); const styleElement = document.createElement("style");
@@ -2698,4 +2698,10 @@ module.exports = class MyPlugin extends Plugin {
})(); })();
} }
};
onunload() {
// Remove the birb when the plugin is unloaded
document.getElementById('birb')?.remove();
console.log('Pocket Bird unloaded!');
}
};
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"id": "pocket-bird", "id": "pocket-bird",
"name": "Pocket Bird", "name": "Pocket Bird",
"version": "2025.11.13.1", "version": "2025.11.13.2",
"minAppVersion": "0.15.0", "minAppVersion": "0.15.0",
"description": "It's a pet bird in your Obsidian, what more could you want?", "description": "It's a pet bird in your Obsidian, what more could you want?",
"author": "Idrees Hassan", "author": "Idrees Hassan",
+2 -2
View File
@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Pocket Bird // @name Pocket Bird
// @namespace https://idreesinc.com // @namespace https://idreesinc.com
// @version 2025.11.13.1 // @version 2025.11.13.2
// @description It's a bird that hops around your web browser, the future is here // @description It's a bird that hops around your web browser, the future is here
// @author Idrees // @author Idrees
// @downloadURL https://github.com/IdreesInc/Pocket-Bird/raw/refs/heads/main/dist/userscript/birb.user.js // @downloadURL https://github.com/IdreesInc/Pocket-Bird/raw/refs/heads/main/dist/userscript/birb.user.js
@@ -1916,7 +1916,7 @@
insertModal(`${birdBirb()} Mode`, message); insertModal(`${birdBirb()} Mode`, message);
}), }),
new Separator(), new Separator(),
new MenuItem("2025.11.13.1", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.1"); }, false), new MenuItem("2025.11.13.2", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.2"); }, false),
]; ];
const styleElement = document.createElement("style"); const styleElement = document.createElement("style");