Skip to content

Commit

Permalink
added self-plug
Browse files Browse the repository at this point in the history
  • Loading branch information
theRatramnus committed Aug 20, 2024
1 parent e3909a7 commit f4e9817
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 6 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"editor.formatOnType": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
}
}
6 changes: 6 additions & 0 deletions addon/chrome/content/preferences.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
preference="extensions.zotero.__addonRef__.input"
></html:input>
</hbox>
<hbox>
<checkbox id="zotero-prefpane-__addonRef__-disablePlug" preference="extensions.zotero.__addonRef__.disablePlug" />
<html:label for="zotero-prefpane-__addonRef__-disablePlug" data-l10n-id="pref-plug"></html:label>
<a href="ko-fi.com/ludwigpatzold">ko-fi.com/ludwigpatzold</a>
</hbox>

</vbox>
</groupbox>
</vbox>
Expand Down
3 changes: 2 additions & 1 deletion addon/locale/en-US/preferences.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ pref-input = Google Books API Key
pref-fetchPublisher =
.label = Fetch Publisher Info from Google Books
pref-help = { $name } Build { $version } { $time }
pref-typography-tooltip = Works for every title of a newly downloaded item & the authors and collection title of chapters.
pref-typography-tooltip = Works for every title of a newly downloaded item & the authors and collection title of chapters.
pref-plug = Disable self-plug (message in the "extra" field) for
3 changes: 2 additions & 1 deletion addon/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
pref("__prefsPrefix__.deleteAttachments", false);
pref("__prefsPrefix__.enhancedTypography", true);
pref("__prefsPrefix__.input", "Google Books API Key");
pref("__prefsPrefix__.fetchPublisher", false);
pref("__prefsPrefix__.fetchPublisher", false);
pref("__prefsPrefix__.disablePlug", false);
2 changes: 1 addition & 1 deletion scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { env, exit } from "process";
import replaceInFile from "replace-in-file";
const { replaceInFileSync } = replaceInFile;
import details from "../package.json" assert { type: "json" };
import details from "../package.json" with { type: "json" };

const { name, author, description, homepage, version, config } = details;

Expand Down
4 changes: 2 additions & 2 deletions scripts/start.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { execSync } from "child_process";
import { exit } from "process";
import { existsSync, writeFileSync, readFileSync, mkdirSync } from "fs";
import path from "path";
import details from "../package.json" assert { type: "json" };
import cmd from "./zotero-cmd.json" assert { type: "json" };
import details from "../package.json" with { type: "json" };
import cmd from "./zotero-cmd.json" with { type: "json" };

const { addonID } = details.config;
const { zoteroBinPath, profilePath, dataDir } = cmd.exec;
Expand Down
4 changes: 4 additions & 0 deletions src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ async function processChapter(chapter: Zotero.Item, url: string){
})


//plug
if(!(getPref("disablePlug") as boolean)){
chapter.setField("extra", "Did the plugin save you time? Please consider supporting the project: https://ko-fi.com/ludwigpatzold. Thank you! \n This message can be turned off in the preference pane.")
}

//save
ztoolkit.log("finished updating fields, now saving")
Expand Down

0 comments on commit f4e9817

Please sign in to comment.