From f4e9817cc91187360d507581701773c46db6e183 Mon Sep 17 00:00:00 2001 From: Ludwig Patzold Date: Tue, 20 Aug 2024 12:38:17 +0200 Subject: [PATCH] added self-plug --- .DS_Store | Bin 6148 -> 10244 bytes .vscode/settings.json | 2 +- addon/chrome/content/preferences.xhtml | 6 ++++++ addon/locale/en-US/preferences.ftl | 3 ++- addon/prefs.js | 3 ++- scripts/build.mjs | 2 +- scripts/start.mjs | 4 ++-- src/hooks.ts | 4 ++++ 8 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.DS_Store b/.DS_Store index 081290bdfedb47218b4129d2205e7acdd8978d09..6fa3ef50cf630441ab4d59235fc68f9af0b20439 100644 GIT binary patch literal 10244 zcmeHMS!^3c82zf9>D4`?Rduufa7mDr?0|lI(2bns_kSk|}6mUQR2XxVP33 zz0_mCV_-f5?Cf3wQPAjT=bhh~Behd(`ke<3&C!fyoJsej|6Xj;G@Mj(^L3Ppic1!i z%B6Cdd^kLAXTqsyD(!SclLuL8z_!g;HXn@*8G0t7R(0A|Dr#7Ik^>A)CzV6PhNan= z4m)jW4#$SY16h%kh`MrmdQ;oxhG1*kOha(GrMa!GA=uK=ym4kmk*jOhZS9Xtm9$5T8WpI4I6Gr%o8*K3JVhRBt6U-zUfSLin%VT$PVg@>|86pGXLO^Z)C)X+g8{( ztw+=)4o!9s7563eDVpTrxNW8rmJ?Ac;!!i6Hlr!M-87l9Gm_FzrdaNPV<%IcTrr}m zX-DtZNza(lyGWa$m8_+{$&_JR&XAsTNY;j$`8YtiP+lEaefPc1_ieeqbJy;^tBdbg zqWUU*Rl`$;W5i5-Fk@(`@zJOg*DcMk#tx7*St;X~p(m9JY)}TQXhOfLE?d50<(+Fk#x*Bkv3AN)LK~<@2K(LrKs=7hcxQs9$RBAYW#`6#=lmU53>5sq)w@*_SO08 z6*VdkI5cF@M5Aw=qB_dJ1ev^muJ^Ucs-_H@(U@+Es*S$QvbtLto)RM$m6g8jvN964 z6A2oOBkDr_4q5$FKEhty8+B5Ble(4dQpmqkmJc}N(WKs&A&1K%9+YK1X;jZ3-I|fI zlbns-8oz&(HPxJ`GMhBal7i_=^PPnT;$^MnX3f4clsXqS6$`Ha^@Trl}oFtSJl=vuHUeA$D9cXi_02WuJLkv&9icD zuY8sZZB2NQFEB_3t)E=TnbcC|c=A=IT@&;L)DkjzQCzc@ii^nHMe&~cKtPqq%S5qh zUBIUnkq;>x+geXWbPF3d`Fv_Id6Rgy%}+&e3!!#uhWUp4*RAwCybbTdCAdsh`Zat5 z-@(raxCqP1Dpz5UEOQO6CChBa_1KDSxE*(3J9dzr_TpaLhx@S~58`2r;8Bc{m7179 z3p03%EcGF>)id}AK8lawvv>}l#~1KLZnJOT`2s8K$+tp$Ki>)qRsP2d4nXR@Yoy1x(ULA`TOjj*)&Np=@4mg5%)K z-(KJ^1uc{pw6Fk9Vk>m+n-%D%v9&`N>>=4iy)Ia>rE3L>Xb5YcY7d!?$20R8l25xT#ibVH=?Eb%d z;s5_{??HOK_ZaXPxFrKv+!gNXAeHPHw@{niwFfC4rN{!)n-!8nDB;)fB>8nb71(ur t9Yv<=UefS<$gP_dlEX=d!%2$U{J;Ir0Pp + + + + ko-fi.com/ludwigpatzold + + diff --git a/addon/locale/en-US/preferences.ftl b/addon/locale/en-US/preferences.ftl index 1f96e3a..1a639f3 100644 --- a/addon/locale/en-US/preferences.ftl +++ b/addon/locale/en-US/preferences.ftl @@ -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. \ No newline at end of file +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 \ No newline at end of file diff --git a/addon/prefs.js b/addon/prefs.js index c6691d9..008d1fe 100644 --- a/addon/prefs.js +++ b/addon/prefs.js @@ -2,4 +2,5 @@ pref("__prefsPrefix__.deleteAttachments", false); pref("__prefsPrefix__.enhancedTypography", true); pref("__prefsPrefix__.input", "Google Books API Key"); -pref("__prefsPrefix__.fetchPublisher", false); \ No newline at end of file +pref("__prefsPrefix__.fetchPublisher", false); +pref("__prefsPrefix__.disablePlug", false); \ No newline at end of file diff --git a/scripts/build.mjs b/scripts/build.mjs index c747a9d..81cb90e 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -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; diff --git a/scripts/start.mjs b/scripts/start.mjs index 118b5a0..16e3fb4 100644 --- a/scripts/start.mjs +++ b/scripts/start.mjs @@ -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; diff --git a/src/hooks.ts b/src/hooks.ts index 3fb2ee5..a7c426d 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -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")