Add clickable web browser settings links (#1481)

This commit is contained in:
toasted-nutbread 2021-03-02 22:46:26 -05:00 committed by GitHub
parent 3fe825cf30
commit 65c20382d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -20,6 +20,7 @@
* PermissionsToggleController * PermissionsToggleController
* PersistentStorageController * PersistentStorageController
* SettingsController * SettingsController
* SettingsDisplayController
*/ */
async function setupEnvironmentInfo() { async function setupEnvironmentInfo() {
@ -69,6 +70,13 @@ function setupPermissionsToggles() {
node.textContent = chrome.runtime.getURL('/'); node.textContent = chrome.runtime.getURL('/');
} }
const extensionId = chrome.runtime.id;
const idPattern = /\{id\}/g;
for (const node of document.querySelectorAll('.extension-settings-link[data-special-url]')) {
const {specialUrl} = node.dataset;
node.dataset.specialUrl = `${specialUrl}`.replace(idPattern, extensionId);
}
await yomichan.prepare(); await yomichan.prepare();
setupEnvironmentInfo(); setupEnvironmentInfo();
@ -99,6 +107,9 @@ function setupPermissionsToggles() {
await promiseTimeout(100); await promiseTimeout(100);
document.documentElement.dataset.loaded = 'true'; document.documentElement.dataset.loaded = 'true';
const settingsDisplayController = new SettingsDisplayController(settingsController, null);
settingsDisplayController.prepare();
} catch (e) { } catch (e) {
log.error(e); log.error(e);
} }

View File

@ -129,7 +129,7 @@
When enabled, Yomichan is able to scan text and show definitions in private/incognito web browser windows. When enabled, Yomichan is able to scan text and show definitions in private/incognito web browser windows.
</p> </p>
<p> <p>
This option can be configured from the web browser's extension settings pages. This option can be configured from the web browser's <a class="extension-settings-link" data-special-url="chrome://extensions/?id={id}">extension settings pages</a>.
</p> </p>
</div> </div>
</div> </div>
@ -145,7 +145,7 @@
When enabled, Yomichan is able to scan text and show definitions on local HTML files located using the <code>file://*</code> scheme. When enabled, Yomichan is able to scan text and show definitions on local HTML files located using the <code>file://*</code> scheme.
</p> </p>
<p data-show-for-browser="chrome edge"> <p data-show-for-browser="chrome edge">
This option can be configured from the web browser's extension settings pages. This option can be configured from the web browser's <a class="extension-settings-link" data-special-url="chrome://extensions/?id={id}">extension settings pages</a>.
</p> </p>
</div> </div>
</div> </div>
@ -193,9 +193,11 @@
<script src="/js/data/permissions-util.js"></script> <script src="/js/data/permissions-util.js"></script>
<script src="/js/dom/document-focus-controller.js"></script> <script src="/js/dom/document-focus-controller.js"></script>
<script src="/js/dom/html-template-collection.js"></script> <script src="/js/dom/html-template-collection.js"></script>
<script src="/js/dom/selector-observer.js"></script>
<script src="/js/pages/settings/permissions-toggle-controller.js"></script> <script src="/js/pages/settings/permissions-toggle-controller.js"></script>
<script src="/js/pages/settings/persistent-storage-controller.js"></script> <script src="/js/pages/settings/persistent-storage-controller.js"></script>
<script src="/js/pages/settings/settings-controller.js"></script> <script src="/js/pages/settings/settings-controller.js"></script>
<script src="/js/pages/settings/settings-display-controller.js"></script>
<script src="/js/pages/permissions-main.js"></script> <script src="/js/pages/permissions-main.js"></script>