Skip to content

Commit

Permalink
release: 1.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
HananoshikaYomaru committed Dec 15, 2023
1 parent f1f001c commit a16644b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "better-plugins-page",
"name": "Better Plugins Page",
"version": "1.0.12",
"version": "1.0.13",
"minAppVersion": "0.15.0",
"description": "Better Plugins Page for Obsidian, add filtering and hiding to the page",
"author": "HananoshikaYomaru",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-better-plugins-page",
"version": "1.0.12",
"version": "1.0.13",
"description": "Better Plugins Page for Obsidian, add filtering and hiding to the page",
"main": "main.js",
"scripts": {
Expand Down
43 changes: 29 additions & 14 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ export default class BetterPluginsPagePlugin extends Plugin {
.find(".community-item-downloads-text")
.text()
.replace(/,/g, "");
const itemDownloads = parseInt(downloadsText, 10);
const itemDownloads = downloadsText
? parseInt(downloadsText, 10)
: 0;

if (
(downloadCountCompare === "greater" &&
Expand Down Expand Up @@ -364,7 +366,11 @@ export default class BetterPluginsPagePlugin extends Plugin {

const notes = this.app.vault
.getMarkdownFiles()
.filter((file) => file.basename === pluginName);
.filter(
(file) =>
file.basename.toLocaleLowerCase() ===
pluginName.toLocaleLowerCase()
);
if (notes.length === 0) return null;
if (notes.length > 1) {
this.noticeManager.createNotice(
Expand Down Expand Up @@ -414,20 +420,29 @@ export default class BetterPluginsPagePlugin extends Plugin {
);

button.addEventListener("click", async () => {
if (!note) {
const newNote = await this.app.vault.create(
`${pluginName}.md`,
""
try {
if (!note) {
const newNote = await this.app.vault.create(
`${pluginName}.md`,
""
);
this.app.workspace.getLeaf().openFile(newNote);
} else {
this.app.workspace.getLeaf().openFile(note);
}

const closeButton = $(
".modal-container .modal-close-button"
) as JQuery<HTMLButtonElement>;
closeButton.trigger("click");
} catch (e) {
console.error(e);
this.noticeManager.createNotice(
"Failed to create note. Please check the console for more details.",
5000,
"error"
);
this.app.workspace.getLeaf().openFile(newNote);
} else {
this.app.workspace.getLeaf().openFile(note);
}

const closeButton = $(
".modal-container .modal-close-button"
) as JQuery<HTMLButtonElement>;
closeButton.trigger("click");
});

communityModalButtonContainer.appendChild(button);
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"1.0.9": "0.15.0",
"1.0.10": "0.15.0",
"1.0.11": "0.15.0",
"1.0.12": "0.15.0"
"1.0.12": "0.15.0",
"1.0.13": "0.15.0"
}

0 comments on commit a16644b

Please sign in to comment.