Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.0.3 代码审改 #374

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addon/chrome/content/icons/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<linkset>
<html:link rel="localization" href="__addonRef__-preferences.ftl" />
<html:link rel="localization" href="__addonRef__-preferences-main.ftl" />
<html:link
xmlns:html="http://www.w3.org/1999/xhtml"
rel="stylesheet"
Expand All @@ -8,7 +8,7 @@
</linkset>
<!-- 元数据抓取 -->
<groupbox
onload="Zotero.__addonInstance__.hooks.onPrefsEvent('load', { window });"
onload="Zotero.__addonInstance__.hooks.onPrefsWindowLoad(window);"
>
<label><html:h2 data-l10n-id="pref-group-metadata"></html:h2></label>
<checkbox
Expand All @@ -20,21 +20,15 @@
<checkbox
id="zotero-prefpane-__addonRef__-autoupdate"
native="true"
preference="autoupdate"
preference="autoUpdateMetadata"
data-l10n-id="label-autoupdate-metadata"
/>
<checkbox
id="zotero-prefpane-__addonRef__-zhnamesplit"
native="true"
preference="zhnamesplit"
preference="zhNameSplit"
data-l10n-id="label-zhnamesplit"
/>
<!-- <checkbox
id="zotero-prefpane-__addonRef__-rename"
native="true"
preference="rename"
data-l10n-id="label-rename"
/> -->
<hbox flex="2" class="inputbox">
<menulist
id="zotero-prefpane-__addonRef__-namepattern-menulist"
Expand All @@ -52,14 +46,14 @@
type="text"
class="auto_width"
id="zotero-prefpane-__addonRef__-namepattern-input"
preference="namepattern"
preference="namePattern"
>
</html:input>
<html:input
type="text"
class="auto_width hidden"
id="zotero-prefpane-__addonRef__-namepatternCustom-input"
preference="namepatternCustom"
preference="namePatternCustom"
>
</html:input>
<image
Expand Down Expand Up @@ -120,7 +114,7 @@
<!-- 转换器 -->
<groupbox>
<label><html:h2 data-l10n-id="pref-group-translators"></html:h2></label>
<hbox alien="center">
<hbox align="center">
<checkbox
id="zotero-prefpane-__addonRef__-autoUpdateTranslators"
native="true"
Expand Down
112 changes: 112 additions & 0 deletions addon/chrome/content/preferences-translators.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0"?>
<!-- prettier-ignore -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!-- prettier-ignore -->
<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?>
<!-- prettier-ignore -->
<?xml-stylesheet href="chrome://zotero-platform/content/zotero-react-client.css" type="text/css"?>
<!-- prettier-ignore -->
<?xml-stylesheet href="chrome://zotero-platform/content/zotero.css" type="text/css"?>
<!-- prettier-ignore -->
<!DOCTYPE html>
<html
id="__addonRef__-translators"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
windowtype="__addonRef__:translators"
>
<head>
<title data-l10n-id="title"></title>
<meta charset="utf-8" />
<xul:linkset>
<link rel="localization" href="zotero.ftl" />
<link rel="localization" href="__addonRef__-preferences-translators.ftl" />
</xul:linkset>
<xul:keyset>
<xul:key id="key_close" key="W" modifiers="accel" oncommand="window.close()"/>
</xul:keyset>
<script>
document.addEventListener("DOMContentLoaded", (ev) => {
Services.scriptloader.loadSubScript(
"chrome://zotero/content/include.js",
this,
);
window.arguments[0]._initPromise.resolve();
});
</script>
<style>
html,
body {
margin: 0;
min-width: 800px;
min-height: 400px;
height: 100%;
}
header, footer {
display: flex;
align-items: center;
height: 50px;
padding: 0 10px;
}
toolbar, toolbar > hbox {
width: 100%;
}
.toolbarbutton-text{
margin-left: 4px;
}
main {
width: 100%;
height: calc(100% - 2*50px);
background: var(--material-background);
}
#table-container {
height: 100%;
width: 100%;
}
#translators-table {
height: 100%;
}
footer {
justify-content: space-between;
}
footer > * {
display: flex;
gap: 6px;
}
#links > .zotero-text-link {
margin: 0 5px;
}
footer > * > :first-child {
margin-left: 0;
}
footer > * > :last-child {
margin-right: 0;
}
</style>
</head>
<body>
<header xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<toolbar class="zotero-toolbar toolbar toolbar-primary">
<hbox align="center">
<toolbarbutton id="github-link" class="zotero-tb-button" data-l10n-id="github-link" image="chrome://__addonRef__/content/icons/github.svg" />
<spacer flex="1"></spacer>
<search-textbox id="search-box" data-l10n-id="search-box" data-l10n-attrs="placeholder" timeout="1" style="padding: 0;"/>
</hbox>
</toolbar>
</header>
<main>
<div id="table-container"></div>
</main>
<footer>
<div id="buttons" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里声明命名空间是刻意的吗?

Copy link
Collaborator Author

@jiaojiaodubai jiaojiaodubai Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

刻意的,button 在两个命名空间里都有,在此明示之。

<button id="request-new-translator" data-l10n-id="request-new-translator" />
<button id="report-translator-bug" data-l10n-id="report-translator-bug" />
</div>
<div id="links" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label data-l10n-id="how-to-update-translators" class="zotero-text-link"/>
<label data-l10n-id="translators-dashboard" class="zotero-text-link"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<label data-l10n-id="how-to-update-translators" class="zotero-text-link"/>
<label data-l10n-id="translators-dashboard" class="zotero-text-link"/>
<label data-l10n-id="how-to-update-translators" class="zotero-text-link" is="zotero-text-link"/>
<label data-l10n-id="translators-dashboard" class="zotero-text-link" is="zotero-text-link"/>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我注意到这个 is 了,但是我写的时候并没有发现这个 is 对 UI 有什么实质影响,所以本着不增加多余代码的原则去掉了。现在经过搜索,发现一些 scss 在用,我会马上保持这个一致性。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只有带有这个 is 属性的文本链接才能拉起浏览器。

</div>
</footer>
</body>
</html>
214 changes: 0 additions & 214 deletions addon/chrome/content/translators.xhtml

This file was deleted.

Loading