Move About pane strings and URLs to ZOTERO_CONFIG

This commit is contained in:
Dan Stillman 2021-04-19 18:19:39 -04:00
parent 749e28dc1f
commit 7065dacee8
2 changed files with 26 additions and 9 deletions

View file

@ -21,7 +21,7 @@
</div> </div>
<hbox> <hbox>
<label id="version"/> <label id="version"/>
<label id="changelog" class="zotero-text-link" href="https://www.zotero.org/support/changelog" value="&zotero.whatsNew;"/> <label id="changelog" class="zotero-text-link" value="&zotero.whatsNew;"/>
</hbox> </hbox>
<script> <script>
document.getElementById('version').textContent = Zotero.version; document.getElementById('version').textContent = Zotero.version;
@ -32,32 +32,43 @@
<p id="third-party-software"></p> <p id="third-party-software"></p>
<p id="get-involved"></p> <p id="get-involved"></p>
<script><![CDATA[ <script><![CDATA[
Components.utils.import("resource://zotero/config.js");
document.getElementById('changelog').href = ZOTERO_CONFIG.CHANGELOG_URL;
// Replace [links] in localized strings with spans with onclick handlers // Replace [links] in localized strings with spans with onclick handlers
// //
// TODO: Use helper function in common with intro text in itemTreeView.js // TODO: Use helper function in common with intro text in itemTreeView.js
document.getElementById('created-by').innerHTML = document.getElementById('created-by').innerHTML =
Zotero.Utilities.htmlSpecialChars(Zotero.getString('about.createdBy')) Zotero.Utilities.htmlSpecialChars(
Zotero.getString(
'about.createdBy',
[Zotero.appName, `[${ZOTERO_CONFIG.PRODUCER}]`]
),
)
.replace( .replace(
/\[([^\]]+)](.+)\[([^\]]+)]/, /\[([^\]]+)](.+)\[([^\]]+)]/,
`<span data-href="https://digitalscholar.org/">$1</span>` `<span data-href="${ZOTERO_CONFIG.PRODUCER_URL}">$1</span>`
+ '$2' + '$2'
+ `<span data-href="https://www.zotero.org/support/credits_and_acknowledgments">$3</span>` + `<span data-href="${ZOTERO_CONFIG.CREDITS_URL}">$3</span>`
); );
document.getElementById('third-party-software').innerHTML = document.getElementById('third-party-software').innerHTML =
Zotero.Utilities.htmlSpecialChars(Zotero.getString('about.openSource')) Zotero.Utilities.htmlSpecialChars(
Zotero.getString('about.openSource', Zotero.appName)
)
.replace( .replace(
/\[([^\]]+)](.+)\[([^\]]+)]/, /\[([^\]]+)](.+)\[([^\]]+)]/,
`<span data-href="https://www.zotero.org/support/licensing">$1</span>` `<span data-href="${ZOTERO_CONFIG.LICENSING_URL}">$1</span>`
+ '$2' + '$2'
+ `<span data-href="https://www.zotero.org/support/credits_and_acknowledgments#third-party_software">$3</span>` + `<span data-href="${ZOTERO_CONFIG.CREDITS_URL}#third-party_software">$3</span>`
); );
document.getElementById('get-involved').innerHTML = document.getElementById('get-involved').innerHTML =
Zotero.Utilities.htmlSpecialChars(Zotero.getString('about.getInvolved')) Zotero.Utilities.htmlSpecialChars(Zotero.getString('about.getInvolved'))
.replace( .replace(
/\[([^\]]+)]/, /\[([^\]]+)]/,
`<span data-href="https://www.zotero.org/getinvolved/">$1</span>` `<span data-href="${ZOTERO_CONFIG.GET_INVOLVED_URL}">$1</span>`
); );
// Activate text links // Activate text links

View file

@ -3,6 +3,8 @@ var ZOTERO_CONFIG = {
ID: 'zotero', // used for db filename, etc. ID: 'zotero', // used for db filename, etc.
CLIENT_NAME: 'Zotero', CLIENT_NAME: 'Zotero',
DOMAIN_NAME: 'zotero.org', DOMAIN_NAME: 'zotero.org',
PRODUCER: 'Digital Scholar',
PRODUCER_URL: 'https://digitalscholar.org',
REPOSITORY_URL: 'https://repo.zotero.org/repo/', REPOSITORY_URL: 'https://repo.zotero.org/repo/',
BASE_URI: 'http://zotero.org/', BASE_URI: 'http://zotero.org/',
WWW_BASE_URL: 'https://www.zotero.org/', WWW_BASE_URL: 'https://www.zotero.org/',
@ -21,7 +23,11 @@ var ZOTERO_CONFIG = {
SUPPORT_URL: "https://www.zotero.org/support/", SUPPORT_URL: "https://www.zotero.org/support/",
TROUBLESHOOTING_URL: "https://www.zotero.org/support/getting_help", TROUBLESHOOTING_URL: "https://www.zotero.org/support/getting_help",
FEEDBACK_URL: "https://forums.zotero.org/", FEEDBACK_URL: "https://forums.zotero.org/",
CONNECTORS_URL: "https://www.zotero.org/download/connectors" CONNECTORS_URL: "https://www.zotero.org/download/connectors",
CHANGELOG_URL: "https://www.zotero.org/support/changelog",
CREDITS_URL: 'https://www.zotero.org/support/credits_and_acknowledgments',
LICENSING_URL: 'https://www.zotero.org/support/licensing',
GET_INVOLVED_URL: 'https://www.zotero.org/getinvolved',
}; };
if (typeof process === 'object' && process + '' === '[object process]'){ if (typeof process === 'object' && process + '' === '[object process]'){