mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-24 19:59:36 +00:00
Add Vencord save support
This commit is contained in:
BIN
dist/extension.zip
vendored
BIN
dist/extension.zip
vendored
Binary file not shown.
11
dist/extension/birb.js
vendored
11
dist/extension/birb.js
vendored
@@ -976,9 +976,9 @@
|
|||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
if (chrome.runtime.lastError) {
|
if (chrome.runtime.lastError) {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
console.error(chrome.runtime.lastError);
|
error(chrome.runtime.lastError);
|
||||||
} else {
|
} else {
|
||||||
console.log("Settings saved successfully");
|
log("Settings saved successfully");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1693,6 +1693,13 @@
|
|||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.birb-sticky-note-input::placeholder {
|
||||||
|
font-family: "Monocraft", monospace !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
background-color: transparent !important;
|
||||||
|
color: rgba(0, 0, 0, 0.35) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.birb-sticky-note-input:focus {
|
.birb-sticky-note-input:focus {
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
|
|||||||
7
dist/obsidian/main.js
vendored
7
dist/obsidian/main.js
vendored
@@ -1736,6 +1736,13 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.birb-sticky-note-input::placeholder {
|
||||||
|
font-family: "Monocraft", monospace !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
background-color: transparent !important;
|
||||||
|
color: rgba(0, 0, 0, 0.35) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.birb-sticky-note-input:focus {
|
.birb-sticky-note-input:focus {
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
|
|||||||
7
dist/userscript/birb.user.js
vendored
7
dist/userscript/birb.user.js
vendored
@@ -1698,6 +1698,13 @@
|
|||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.birb-sticky-note-input::placeholder {
|
||||||
|
font-family: "Monocraft", monospace !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
background-color: transparent !important;
|
||||||
|
color: rgba(0, 0, 0, 0.35) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.birb-sticky-note-input:focus {
|
.birb-sticky-note-input:focus {
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
|
|||||||
25
dist/vencord/birb.js
vendored
25
dist/vencord/birb.js
vendored
@@ -950,15 +950,15 @@ export const Birb = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocalContext extends Context {
|
class VencordContext extends Context {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
* @returns {Promise<BirbSaveData|{}>}
|
* @returns {Promise<BirbSaveData|{}>}
|
||||||
*/
|
*/
|
||||||
async getSaveData() {
|
async getSaveData() {
|
||||||
log("Loading save data from localStorage");
|
// @ts-expect-error
|
||||||
return JSON.parse(localStorage.getItem(SAVE_KEY) ?? "{}");
|
return await Vencord.Api.DataStore.get(SAVE_KEY) ?? {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -966,14 +966,14 @@ export const Birb = () => {
|
|||||||
* @param {BirbSaveData} saveData
|
* @param {BirbSaveData} saveData
|
||||||
*/
|
*/
|
||||||
async putSaveData(saveData) {
|
async putSaveData(saveData) {
|
||||||
log("Saving data to localStorage");
|
// @ts-expect-error
|
||||||
localStorage.setItem(SAVE_KEY, JSON.stringify(saveData));
|
await Vencord.Api.DataStore.set(SAVE_KEY, saveData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
resetSaveData() {
|
resetSaveData() {
|
||||||
log("Resetting save data in localStorage");
|
// @ts-expect-error
|
||||||
localStorage.removeItem(SAVE_KEY);
|
Vencord.Api.DataStore.del(SAVE_KEY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1679,6 +1679,13 @@ export const Birb = () => {
|
|||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.birb-sticky-note-input::placeholder {
|
||||||
|
font-family: "Monocraft", monospace !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
background-color: transparent !important;
|
||||||
|
color: rgba(0, 0, 0, 0.35) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.birb-sticky-note-input:focus {
|
.birb-sticky-note-input:focus {
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
@@ -2616,7 +2623,7 @@ export const Birb = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeApplication(new LocalContext());
|
initializeApplication(new VencordContext());
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
7
dist/web/birb.js
vendored
7
dist/web/birb.js
vendored
@@ -1678,6 +1678,13 @@
|
|||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.birb-sticky-note-input::placeholder {
|
||||||
|
font-family: "Monocraft", monospace !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
background-color: transparent !important;
|
||||||
|
color: rgba(0, 0, 0, 0.35) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.birb-sticky-note-input:focus {
|
.birb-sticky-note-input:focus {
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
|
|||||||
@@ -26,6 +26,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="spacer"></div>
|
<div id="spacer"></div>
|
||||||
<!-- <script type="module" src="spritesheet-compiler.js"></script> -->
|
<!-- <script type="module" src="spritesheet-compiler.js"></script> -->
|
||||||
<script src="../dist/birb.js"></script>
|
<script src="../dist/web/birb.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -181,9 +181,9 @@ export class BrowserExtensionContext extends Context {
|
|||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
if (chrome.runtime.lastError) {
|
if (chrome.runtime.lastError) {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
console.error(chrome.runtime.lastError);
|
error(chrome.runtime.lastError);
|
||||||
} else {
|
} else {
|
||||||
console.log("Settings saved successfully");
|
log("Settings saved successfully");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -276,6 +276,33 @@ export class ObsidianContext extends Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class VencordContext extends Context {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
* @returns {Promise<BirbSaveData|{}>}
|
||||||
|
*/
|
||||||
|
async getSaveData() {
|
||||||
|
// @ts-expect-error
|
||||||
|
return await Vencord.Api.DataStore.get(SAVE_KEY) ?? {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
* @param {BirbSaveData} saveData
|
||||||
|
*/
|
||||||
|
async putSaveData(saveData) {
|
||||||
|
// @ts-expect-error
|
||||||
|
await Vencord.Api.DataStore.set(SAVE_KEY, saveData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
resetSaveData() {
|
||||||
|
// @ts-expect-error
|
||||||
|
Vencord.Api.DataStore.del(SAVE_KEY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse URL parameters into a key-value map
|
* Parse URL parameters into a key-value map
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { initializeApplication } from "../../application.js";
|
import { initializeApplication } from "../../application.js";
|
||||||
import { LocalContext } from "../../context.js";
|
import { VencordContext } from "../../context.js";
|
||||||
|
|
||||||
initializeApplication(new LocalContext());
|
initializeApplication(new VencordContext());
|
||||||
@@ -357,6 +357,13 @@
|
|||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.birb-sticky-note-input::placeholder {
|
||||||
|
font-family: "Monocraft", monospace !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
background-color: transparent !important;
|
||||||
|
color: rgba(0, 0, 0, 0.35) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.birb-sticky-note-input:focus {
|
.birb-sticky-note-input:focus {
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
|
|||||||
Reference in New Issue
Block a user