Skip to content

Commit

Permalink
fix: #89
Browse files Browse the repository at this point in the history
  • Loading branch information
MuiseDestiny committed Apr 23, 2024
1 parent bf50a85 commit 7b31cc3
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 123 deletions.
159 changes: 41 additions & 118 deletions addon/chrome/content/preferences.xhtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<linkset>
<html:link rel="localization" href="__addonRef__-preferences.ftl" />
</linkset>
<vbox
id="zotero-prefpane-__addonRef__"
onload="Zotero.__addonInstance__.hooks.onPrefsEvent('load', {window})"
>
<vbox id="zotero-prefpane-__addonRef__" onload="Zotero.__addonInstance__.hooks.onPrefsEvent('load', {window})">
<groupbox>
<label>
<html:h2 data-l10n-id="source-title"></html:h2>
Expand All @@ -14,36 +11,18 @@
<separator class="thin" />
<hbox align="center">
<label data-l10n-id="directory"></label>
<html:input
id="source-dir"
type="text"
readonly="true"
flex="1"
preference="extensions.zotero.__addonRef__.sourceDir"
style="background: none; border: none"
>
<html:input id="source-dir" type="text" readonly="true" flex="1"
preference="extensions.zotero.__addonRef__.sourceDir" style="background: none; border: none">
</html:input>
<button id="choose-source-dir" data-l10n-id="choose-dir"></button>
</hbox>
<hbox align="center">
<label data-l10n-id="read-pdf-title"></label>
<radiogroup preference="extensions.zotero.__addonRef__.readPDFtitle">
<hbox>
<radio
id="readPDFtitle-never"
data-l10n-id="readPDFtitle-never"
value="never"
/>
<radio
id="readPDFtitle-nonCJK"
data-l10n-id="readPDFtitle-nonCJK"
value="nonCJK"
/>
<radio
id="readPDFtitle-always"
data-l10n-id="readPDFtitle-always"
value="always"
/>
<radio id="readPDFtitle-never" data-l10n-id="readPDFtitle-never" value="never" />
<radio id="readPDFtitle-nonCJK" data-l10n-id="readPDFtitle-nonCJK" value="nonCJK" />
<radio id="readPDFtitle-always" data-l10n-id="readPDFtitle-always" value="always" />
</hbox>
</radiogroup>
</hbox>
Expand All @@ -58,11 +37,7 @@
<separator class="thin" />
<hbox align="center">
<label data-l10n-id="attach-type-start"></label>
<menulist
native="true"
id="attach-type"
preference="extensions.zotero.__addonRef__.attachType"
>
<menulist native="true" id="attach-type" preference="extensions.zotero.__addonRef__.attachType">
<menupopup>
<menuitem data-l10n-id="importing" value="importing" />
<menuitem data-l10n-id="linking" value="linking" />
Expand All @@ -81,14 +56,8 @@
<separator class="thin" />
<hbox align="center">
<label data-l10n-id="directory"></label>
<html:input
id="dest-dir"
type="text"
readonly="true"
flex="1"
preference="extensions.zotero.__addonRef__.destDir"
style="background: none; border: none"
>
<html:input id="dest-dir" type="text" readonly="true" flex="1"
preference="extensions.zotero.__addonRef__.destDir" style="background: none; border: none">
</html:input>
<button id="choose-dest-dir" data-l10n-id="choose-dir"></button>
</hbox>
Expand All @@ -97,40 +66,27 @@

<hbox align="center">
<label data-l10n-id="subfolder"></label>
<html:input
id="subfolder-format"
type="text"
flex="1"
preference="extensions.zotero.__addonRef__.subfolderFormat"
>
<html:input id="subfolder-format" type="text" flex="1"
preference="extensions.zotero.__addonRef__.subfolderFormat">
</html:input>
</hbox>
<checkbox
native="false"
data-l10n-id="slash-as-subfolder-delimiter"
preference="extensions.zotero.__addonRef__.slashAsSubfolderDelimiter"
/>
<checkbox native="false" data-l10n-id="slash-as-subfolder-delimiter"
preference="extensions.zotero.__addonRef__.slashAsSubfolderDelimiter" />

<separator class="thin" />

<hbox align="center">
<label data-l10n-id="filename"></label>
<button
id="file-renaming-button"
data-l10n-id="preferences-file-renaming-customize-button"
<button id="file-renaming-button" data-l10n-id="preferences-file-renaming-customize-button"
data-search-strings="preferences-file-renaming-format-title, preferences-file-renaming-format-template"
oncommand="Zotero_Preferences.navigateToPane('zotero-subpane-file-renaming')"
></button>
oncommand="Zotero_Preferences.navigateToPane('zotero-subpane-file-renaming')"></button>
</hbox>

<separator class="thin" />

<label data-l10n-id="preferences-file-renaming-format-instructions-more">
<label
is="zotero-text-link"
href="https://www.zotero.org/support/file_renaming"
data-l10n-name="file-renaming-format-help-link"
></label>
<label is="zotero-text-link" href="https://www.zotero.org/support/file_renaming"
data-l10n-name="file-renaming-format-help-link"></label>
</label>
</vbox>
</groupbox>
Expand All @@ -141,46 +97,29 @@
<vbox align="start">
<hbox style="display: inline-block">
<label data-l10n-id="attach-new-file-shortcut"></label>
<html:input
type="text"
class="shortcut"
style="width: 8em"
preference="extensions.zotero.__addonRef__.attachNewFile.shortcut"
>
<html:input type="text" class="shortcut" style="width: 8em"
preference="extensions.zotero.__addonRef__.attachNewFile.shortcut">
</html:input>
</hbox>
<hbox style="display: inline-block">
<label data-l10n-id="match-attachment-shortcut"></label>
<html:input
type="text"
class="shortcut"
style="width: 8em"
preference="extensions.zotero.__addonRef__.matchAttachment.shortcut"
>
<html:input type="text" class="shortcut" style="width: 8em"
preference="extensions.zotero.__addonRef__.matchAttachment.shortcut">
</html:input>
</hbox>
<checkbox
native="true"
data-l10n-id="auto-rename"
preference="extensions.zotero.autoRenameFiles"
/>
<checkbox
native="true"
data-l10n-id="auto-move"
preference="extensions.zotero.__addonRef__.autoMove"
/>
<checkbox
native="true"
data-l10n-id="auto-remove-empty-folder"
preference="extensions.zotero.__addonRef__.autoRemoveEmptyFolder"
/>
<hbox style="display: inline-block">
<label data-l10n-id="rename-shortcut"></label>
<html:input type="text" class="shortcut" style="width: 8em"
preference="extensions.zotero.__addonRef__.attachNewFile.shortcut">
</html:input>
</hbox>
<checkbox native="true" data-l10n-id="auto-rename" preference="extensions.zotero.autoRenameFiles" />
<checkbox native="true" data-l10n-id="auto-move" preference="extensions.zotero.__addonRef__.autoMove" />
<checkbox native="true" data-l10n-id="auto-remove-empty-folder"
preference="extensions.zotero.__addonRef__.autoRemoveEmptyFolder" />
<hbox align="center">
<label data-l10n-id="file-types"></label>
<html:input
type="text"
flex="1"
preference="extensions.zotero.__addonRef__.fileTypes"
>
<html:input type="text" flex="1" preference="extensions.zotero.__addonRef__.fileTypes">
</html:input>
</hbox>
</vbox>
Expand All @@ -192,38 +131,22 @@
<vbox align="start">
<label data-l10n-id="about-intro"></label>
<separator class="thin" />
<label
style="margin-inline: 6px 5px; text-decoration: none"
is="zotero-text-link"
href="https://github.com/MuiseDestiny/zotero-attanger"
class="zotero-text-link"
>
<label style="margin-inline: 6px 5px; text-decoration: none" is="zotero-text-link"
href="https://github.com/MuiseDestiny/zotero-attanger" class="zotero-text-link">
⭐ Star it
</label>
<label
style="margin-inline: 6px 5px; text-decoration: none"
is="zotero-text-link"
href="https://github.com/MuiseDestiny"
class="zotero-text-link"
>
<label style="margin-inline: 6px 5px; text-decoration: none" is="zotero-text-link"
href="https://github.com/MuiseDestiny" class="zotero-text-link">
🔍 See author's Github
</label>
<label
style="margin-inline: 6px 5px; text-decoration: none"
is="zotero-text-link"
href="https://space.bilibili.com/13557814"
class="zotero-text-link"
>
<label style="margin-inline: 6px 5px; text-decoration: none" is="zotero-text-link"
href="https://space.bilibili.com/13557814" class="zotero-text-link">
📺 See author's Bilibili
</label>
<label
style="margin-inline: 6px 5px; text-decoration: none"
is="zotero-text-link"
href="https://gitee.com/MuiseDestiny/plugins"
class="zotero-text-link"
>
<label style="margin-inline: 6px 5px; text-decoration: none" is="zotero-text-link"
href="https://gitee.com/MuiseDestiny/plugins" class="zotero-text-link">
🎊 See Pro plugins
</label>
</vbox>
</groupbox>
</vbox>
</vbox>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zotero-attanger",
"version": "1.1.9",
"version": "1.2.0",
"description": "Attanger for Zotero",
"config": {
"addonName": "Zotero Attanger",
Expand Down Expand Up @@ -134,4 +134,4 @@
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
}
}
}
}
2 changes: 1 addition & 1 deletion src/modules/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ export async function moveFile(attItem: Zotero.Item) {
// @ts-ignore 未添加属性
Zotero.File.getValidFileName = _getValidFileName;
ztoolkit.log("subfolder", subfolder);
destDir = PathUtils.normalize(PathUtils.joinRelative(destDir, subfolder));
destDir = PathUtils.joinRelative(destDir, subfolder);
}
const sourcePath = (await attItem.getFilePathAsync()) as string;
if (!sourcePath) return;
Expand Down
2 changes: 1 addition & 1 deletion update-beta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"[email protected]": {
"updates": [
{
"version": "1.1.9",
"version": "1.2.0",
"update_link": "https://github.com/muisedestiny/zotero-attanger/releases/latest/download/zotero-attanger.xpi",
"applications": {
"zotero": {
Expand Down
2 changes: 1 addition & 1 deletion update.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"[email protected]": {
"updates": [
{
"version": "1.1.9",
"version": "1.2.0",
"update_link": "https://github.com/muisedestiny/zotero-attanger/releases/latest/download/zotero-attanger.xpi",
"applications": {
"zotero": {
Expand Down

0 comments on commit 7b31cc3

Please sign in to comment.