Move html files (#1375)

* Move background.html to /

* Move context.html to /

* Move info.html to /

* Move legal.html to /

* Move permissions.html to /

* Move pitch-accents-preview.html to /

* Move popup-preview.html to /

* Move search.html to /

* Move settings.html to /

* Move settings2.html to /

* Move template-renderer.html to /

* Move welcome.html to /

* Move float.html to /

* Move display-templates.html to /
This commit is contained in:
toasted-nutbread 2021-02-12 23:03:15 -05:00 committed by GitHub
parent 4f13de2835
commit 4053d9b2fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 45 additions and 45 deletions

View File

@ -25,10 +25,10 @@
"128": "images/icon128.png" "128": "images/icon128.png"
}, },
"default_title": "Yomichan", "default_title": "Yomichan",
"default_popup": "bg/context.html" "default_popup": "context.html"
}, },
"background": { "background": {
"page": "bg/background.html", "page": "background.html",
"persistent": true "persistent": true
}, },
"content_scripts": [ "content_scripts": [
@ -66,12 +66,12 @@
], ],
"minimum_chrome_version": "57.0.0.0", "minimum_chrome_version": "57.0.0.0",
"options_ui": { "options_ui": {
"page": "bg/settings2.html", "page": "settings.html",
"open_in_tab": true "open_in_tab": true
}, },
"sandbox": { "sandbox": {
"pages": [ "pages": [
"bg/template-renderer.html" "template-renderer.html"
], ],
"content_security_policy": "sandbox allow-scripts; default-src 'self'; script-src 'self' 'unsafe-eval'" "content_security_policy": "sandbox allow-scripts; default-src 'self'; script-src 'self' 'unsafe-eval'"
}, },
@ -111,8 +111,8 @@
} }
}, },
"web_accessible_resources": [ "web_accessible_resources": [
"fg/float.html", "float.html",
"bg/template-renderer.html" "template-renderer.html"
], ],
"content_security_policy": "default-src 'self'; style-src 'self' 'unsafe-inline'; media-src *; connect-src *" "content_security_policy": "default-src 'self'; style-src 'self' 'unsafe-inline'; media-src *; connect-src *"
}, },
@ -174,7 +174,7 @@
{"action": "move", "path": ["web_accessible_resources_old"], "newPath": ["web_accessible_resources", 0, "resources"]} {"action": "move", "path": ["web_accessible_resources_old"], "newPath": ["web_accessible_resources", 0, "resources"]}
], ],
"excludeFiles": [ "excludeFiles": [
"bg/background.html", "background.html",
"bg/js/native-simple-dom-parser.js" "bg/js/native-simple-dom-parser.js"
] ]
}, },
@ -185,7 +185,7 @@
{ {
"action": "remove", "action": "remove",
"path": ["web_accessible_resources"], "path": ["web_accessible_resources"],
"item": "bg/template-renderer.html" "item": "template-renderer.html"
}, },
{ {
"action": "delete", "action": "delete",

View File

@ -559,7 +559,7 @@ class Backend {
} }
async _onApiGetDisplayTemplatesHtml() { async _onApiGetDisplayTemplatesHtml() {
return await this._fetchAsset('/mixed/display-templates.html'); return await this._fetchAsset('/display-templates.html');
} }
_onApiGetZoom(params, sender) { _onApiGetZoom(params, sender) {
@ -678,7 +678,7 @@ class Backend {
} }
async _onApiIsTabSearchPopup({tabId}) { async _onApiIsTabSearchPopup({tabId}) {
const baseUrl = chrome.runtime.getURL('/bg/search.html'); const baseUrl = chrome.runtime.getURL('/search.html');
const tab = typeof tabId === 'number' ? await this._checkTabUrl(tabId, (url) => url.startsWith(baseUrl)) : null; const tab = typeof tabId === 'number' ? await this._checkTabUrl(tabId, (url) => url.startsWith(baseUrl)) : null;
return (tab !== null); return (tab !== null);
} }
@ -728,7 +728,7 @@ class Backend {
async _onCommandOpenSearchPage(params) { async _onCommandOpenSearchPage(params) {
const {mode='existingOrNewTab', query} = params || {}; const {mode='existingOrNewTab', query} = params || {};
const baseUrl = chrome.runtime.getURL('/bg/search.html'); const baseUrl = chrome.runtime.getURL('/search.html');
const queryParams = {}; const queryParams = {};
if (query && query.length > 0) { queryParams.query = query; } if (query && query.length > 0) { queryParams.query = query; }
const queryString = new URLSearchParams(queryParams).toString(); const queryString = new URLSearchParams(queryParams).toString();
@ -822,7 +822,7 @@ class Backend {
async _getOrCreateSearchPopup2() { async _getOrCreateSearchPopup2() {
// Reuse same tab // Reuse same tab
const baseUrl = chrome.runtime.getURL('/bg/search.html'); const baseUrl = chrome.runtime.getURL('/search.html');
if (this._searchPopupTabId !== null) { if (this._searchPopupTabId !== null) {
const tab = await this._checkTabUrl(this._searchPopupTabId, (url) => url.startsWith(baseUrl)); const tab = await this._checkTabUrl(this._searchPopupTabId, (url) => url.startsWith(baseUrl));
if (tab !== null) { if (tab !== null) {
@ -1821,17 +1821,17 @@ class Backend {
} }
async _openWelcomeGuidePage() { async _openWelcomeGuidePage() {
await this._createTab(chrome.runtime.getURL('/bg/welcome.html')); await this._createTab(chrome.runtime.getURL('/welcome.html'));
} }
async _openInfoPage() { async _openInfoPage() {
await this._createTab(chrome.runtime.getURL('/bg/info.html')); await this._createTab(chrome.runtime.getURL('/info.html'));
} }
async _openSettingsPage(mode) { async _openSettingsPage(mode) {
const {useSettingsV2} = this._options.global; const {useSettingsV2} = this._options.global;
const manifest = chrome.runtime.getManifest(); const manifest = chrome.runtime.getManifest();
const url = chrome.runtime.getURL(useSettingsV2 ? '/bg/settings2.html' : manifest.options_ui.page); const url = chrome.runtime.getURL(useSettingsV2 ? '/settings.html' : manifest.options_ui.page);
switch (mode) { switch (mode) {
case 'existingOrNewTab': case 'existingOrNewTab':
if (useSettingsV2) { if (useSettingsV2) {

View File

@ -32,17 +32,17 @@ class DisplayController {
this._showExtensionInfo(manifest); this._showExtensionInfo(manifest);
this._setupEnvironment(); this._setupEnvironment();
this._setupButtonEvents('.action-open-search', 'openSearchPage', chrome.runtime.getURL('/bg/search.html')); this._setupButtonEvents('.action-open-search', 'openSearchPage', chrome.runtime.getURL('/search.html'));
this._setupButtonEvents('.action-open-info', 'openInfoPage', chrome.runtime.getURL('/bg/info.html')); this._setupButtonEvents('.action-open-info', 'openInfoPage', chrome.runtime.getURL('/info.html'));
const optionsFull = await api.optionsGetFull(); const optionsFull = await api.optionsGetFull();
this._optionsFull = optionsFull; this._optionsFull = optionsFull;
this._setupHotkeys(); this._setupHotkeys();
const optionsPageUrl = optionsFull.global.useSettingsV2 ? '/bg/settings2.html' : manifest.options_ui.page; const optionsPageUrl = optionsFull.global.useSettingsV2 ? '/settings.html' : manifest.options_ui.page;
this._setupButtonEvents('.action-open-settings', 'openSettingsPage', chrome.runtime.getURL(optionsPageUrl)); this._setupButtonEvents('.action-open-settings', 'openSettingsPage', chrome.runtime.getURL(optionsPageUrl));
this._setupButtonEvents('.action-open-permissions', null, chrome.runtime.getURL('/bg/permissions.html')); this._setupButtonEvents('.action-open-permissions', null, chrome.runtime.getURL('/permissions.html'));
const {profiles, profileCurrent} = optionsFull; const {profiles, profileCurrent} = optionsFull;
const primaryProfile = (profileCurrent >= 0 && profileCurrent < profiles.length) ? profiles[profileCurrent] : null; const primaryProfile = (profileCurrent >= 0 && profileCurrent < profiles.length) ? profiles[profileCurrent] : null;

View File

@ -80,7 +80,7 @@ class PopupPreviewController {
customOuterCss.addEventListener('input', this._onCustomOuterCssChange.bind(this), false); customOuterCss.addEventListener('input', this._onCustomOuterCssChange.bind(this), false);
this._settingsController.on('optionsContextChanged', this._onOptionsContextChange.bind(this)); this._settingsController.on('optionsContextChanged', this._onOptionsContextChange.bind(this));
frame.src = '/bg/popup-preview.html'; frame.src = '/popup-preview.html';
frame.id = 'settings-popup-preview-frame'; frame.id = 'settings-popup-preview-frame';
container.appendChild(frame); container.appendChild(frame);

View File

@ -21,7 +21,7 @@ class TemplateRendererProxy {
this._frameNeedsLoad = true; this._frameNeedsLoad = true;
this._frameLoading = false; this._frameLoading = false;
this._frameLoadPromise = null; this._frameLoadPromise = null;
this._frameUrl = chrome.runtime.getURL('/bg/template-renderer.html'); this._frameUrl = chrome.runtime.getURL('/template-renderer.html');
this._invocations = new Set(); this._invocations = new Set();
} }

View File

@ -256,7 +256,7 @@ class Popup extends EventDispatcher {
frame.removeAttribute('srcdoc'); frame.removeAttribute('srcdoc');
this._observeFullscreen(true); this._observeFullscreen(true);
this._onFullscreenChanged(); this._onFullscreenChanged();
const url = chrome.runtime.getURL('/fg/float.html'); const url = chrome.runtime.getURL('/float.html');
if (useSecurePopupFrameUrl) { if (useSecurePopupFrameUrl) {
frame.contentDocument.location.href = url; frame.contentDocument.location.href = url;
} else { } else {

View File

@ -47,7 +47,7 @@
<li>Information and downloadable dictionaries: <a href="https://foosoft.net/projects/yomichan/" rel="noreferrer noopener">Homepage</a></li> <li>Information and downloadable dictionaries: <a href="https://foosoft.net/projects/yomichan/" rel="noreferrer noopener">Homepage</a></li>
<li>Source code, bug reporting, and feedback: <a href="https://github.com/FooSoft/yomichan" rel="noreferrer noopener">Github</a></li> <li>Source code, bug reporting, and feedback: <a href="https://github.com/FooSoft/yomichan" rel="noreferrer noopener">Github</a></li>
<li>Release notes: <a href="https://github.com/FooSoft/yomichan/releases" rel="noreferrer noopener" data-href-format="https://github.com/FooSoft/yomichan/releases/tag/{version}" id="release-notes-this-version-link">This version</a> | <a href="https://github.com/FooSoft/yomichan/releases" rel="noreferrer noopener">All versions</a></li> <li>Release notes: <a href="https://github.com/FooSoft/yomichan/releases" rel="noreferrer noopener" data-href-format="https://github.com/FooSoft/yomichan/releases/tag/{version}" id="release-notes-this-version-link">This version</a> | <a href="https://github.com/FooSoft/yomichan/releases" rel="noreferrer noopener">All versions</a></li>
<li>More extension information: <a href="/bg/permissions.html">Permissions</a> | <a href="/bg/legal.html">Licenses</a></li> <li>More extension information: <a href="/permissions.html">Permissions</a> | <a href="/legal.html">Licenses</a></li>
</ul> </ul>
</div></div></div></div> </div></div></div></div>
</div> </div>

View File

@ -24,10 +24,10 @@
"128": "images/icon128.png" "128": "images/icon128.png"
}, },
"default_title": "Yomichan", "default_title": "Yomichan",
"default_popup": "bg/context.html" "default_popup": "context.html"
}, },
"background": { "background": {
"page": "bg/background.html", "page": "background.html",
"persistent": true "persistent": true
}, },
"content_scripts": [ "content_scripts": [
@ -65,12 +65,12 @@
], ],
"minimum_chrome_version": "57.0.0.0", "minimum_chrome_version": "57.0.0.0",
"options_ui": { "options_ui": {
"page": "bg/settings2.html", "page": "settings.html",
"open_in_tab": true "open_in_tab": true
}, },
"sandbox": { "sandbox": {
"pages": [ "pages": [
"bg/template-renderer.html" "template-renderer.html"
], ],
"content_security_policy": "sandbox allow-scripts; default-src 'self'; script-src 'self' 'unsafe-eval'" "content_security_policy": "sandbox allow-scripts; default-src 'self'; script-src 'self' 'unsafe-eval'"
}, },
@ -110,8 +110,8 @@
} }
}, },
"web_accessible_resources": [ "web_accessible_resources": [
"fg/float.html", "float.html",
"bg/template-renderer.html" "template-renderer.html"
], ],
"content_security_policy": "default-src 'self'; style-src 'self' 'unsafe-inline'; media-src *; connect-src *" "content_security_policy": "default-src 'self'; style-src 'self' 'unsafe-inline'; media-src *; connect-src *"
} }

View File

@ -23,7 +23,7 @@
<div class="alert alert-danger"> <div class="alert alert-danger">
This is the old version of the settings page, it will be removed in the next version. This is the old version of the settings page, it will be removed in the next version.
Please use <a href="/bg/settings2.html">the new settings page</a> Please use <a href="/settings.html">the new settings page</a>
and feel free to share any feedback and feel free to share any feedback
<a href="https://github.com/FooSoft/yomichan/issues/1000" target="_blank" rel="noopener noreferrer">on Github</a>. <a href="https://github.com/FooSoft/yomichan/issues/1000" target="_blank" rel="noopener noreferrer">on Github</a>.
</div> </div>
@ -212,7 +212,7 @@
</div> </div>
<div class="checkbox options-advanced"> <div class="checkbox options-advanced">
<label><input type="checkbox" data-setting="global.useSettingsV2" data-scope="global"> Use the <a href="/bg/settings2.html">v2 settings page</a> by default</label> <label><input type="checkbox" data-setting="global.useSettingsV2" data-scope="global"> Use the <a href="/settings.html">v2 settings page</a> by default</label>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -1269,7 +1269,7 @@
</div> </div>
<div class="pull-right bottom-links"> <div class="pull-right bottom-links">
<small><span id="extension-info"></span> &bull; <a href="search.html">Search</a> &bull; <a href="https://foosoft.net/projects/yomichan/" target="_blank" rel="noopener">Homepage</a> &bull; <a href="legal.html">Legal</a></small> <small><span id="extension-info"></span> &bull; <a href="/search.html">Search</a> &bull; <a href="https://foosoft.net/projects/yomichan/" target="_blank" rel="noopener">Homepage</a> &bull; <a href="/legal.html">Legal</a></small>
</div> </div>
</div> </div>

View File

@ -49,7 +49,7 @@
}' }'
><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> ><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
</span><span class="outline-item-label">Advanced</span></label> </span><span class="outline-item-label">Advanced</span></label>
<a href="/bg/info.html" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="question-mark"></span></span><span class="outline-item-label">About Yomichan</span></a> <a href="/info.html" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="question-mark"></span></span><span class="outline-item-label">About Yomichan</span></a>
</div> </div>
</div></div> </div></div>
</div> </div>
@ -67,7 +67,7 @@
<div class="settings-item-label"> <div class="settings-item-label">
<strong>Notice:</strong> <strong>Notice:</strong>
This settings page is planned to replace This settings page is planned to replace
<a href="/bg/settings.html">the old settings page</a>.<br> <a href="/settings-old.html">the old settings page</a>.<br>
Questions, comments, and other feedback is welcome and can be shared Questions, comments, and other feedback is welcome and can be shared
<a href="https://github.com/FooSoft/yomichan/issues/1000" target="_blank" rel="noopener noreferrer">on Github</a>. <a href="https://github.com/FooSoft/yomichan/issues/1000" target="_blank" rel="noopener noreferrer">on Github</a>.
</div> </div>
@ -214,7 +214,7 @@
</div></div> </div></div>
<div class="settings-item"><div class="settings-item-inner"> <div class="settings-item"><div class="settings-item-inner">
<div class="settings-item-left"> <div class="settings-item-left">
<div class="settings-item-label">Show the <a href="welcome.html" target="_blank" rel="noopener">welcome guide</a> on browser startup</div> <div class="settings-item-label">Show the <a href="/welcome.html" target="_blank" rel="noopener">welcome guide</a> on browser startup</div>
</div> </div>
<div class="settings-item-right"> <div class="settings-item-right">
<label class="toggle"><input type="checkbox" data-setting="general.showGuide"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> <label class="toggle"><input type="checkbox" data-setting="general.showGuide"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
@ -726,7 +726,7 @@
Pitch accents for terms and expressions can be shown if a dictionary supporting pitch accents is installed. Pitch accents for terms and expressions can be shown if a dictionary supporting pitch accents is installed.
There are currently three different ways that pitch accents can be presented: There are currently three different ways that pitch accents can be presented:
</p> </p>
<iframe data-src="/bg/pitch-accents-preview.html" id="pitch-accents-preview-frame" class="defer-load-iframe" data-parent-distance="1"></iframe> <iframe data-src="/pitch-accents-preview.html" id="pitch-accents-preview-frame" class="defer-load-iframe" data-parent-distance="1"></iframe>
<p> <p>
<a class="more-toggle" data-parent-distance="3">Less&hellip;</a> <a class="more-toggle" data-parent-distance="3">Less&hellip;</a>
</p> </p>
@ -1769,7 +1769,7 @@
<div class="content-right"> <div class="content-right">
<div class="preview-sidebar"><div class="preview-sidebar-inner"> <div class="preview-sidebar"><div class="preview-sidebar-inner">
<div class="preview-frame-container"> <div class="preview-frame-container">
<iframe src="/bg/popup-preview.html" class="preview-frame" id="popup-preview-frame"></iframe> <iframe src="/popup-preview.html" class="preview-frame" id="popup-preview-frame"></iframe>
</div> </div>
</div></div> </div></div>
</div> </div>

View File

@ -32,15 +32,15 @@
</div></div></div> </div></div></div>
<div class="settings-item-children settings-item-children-group"> <div class="settings-item-children settings-item-children-group">
<div class="settings-item"><div class="settings-item-inner"><div class="settings-item-left"><div class="settings-item-label"> <div class="settings-item"><div class="settings-item-inner"><div class="settings-item-left"><div class="settings-item-label">
The <img src="/images/cog.svg" class="inline-icon" alt=""> <em>cog</em> button will open the <a href="settings2.html" target="_blank" rel="noopener">Settings</a> page. The <img src="/images/cog.svg" class="inline-icon" alt=""> <em>cog</em> button will open the <a href="/settings.html" target="_blank" rel="noopener">Settings</a> page.
</div></div></div></div> </div></div></div></div>
<div class="settings-item"><div class="settings-item-inner"><div class="settings-item-left"><div class="settings-item-label"> <div class="settings-item"><div class="settings-item-inner"><div class="settings-item-left"><div class="settings-item-label">
The <img src="/images/magnifying-glass.svg" class="inline-icon" alt=""> <em>magnifying glass</em> button will open the <a href="/bg/search.html" target="_blank" rel="noopener">Search</a> page, The <img src="/images/magnifying-glass.svg" class="inline-icon" alt=""> <em>magnifying glass</em> button will open the <a href="/search.html" target="_blank" rel="noopener">Search</a> page,
enabling text and terms to be looked up using the installed dictionaries. enabling text and terms to be looked up using the installed dictionaries.
This can even be used in offline mode! This can even be used in offline mode!
</div></div></div></div> </div></div></div></div>
<div class="settings-item"><div class="settings-item-inner"><div class="settings-item-left"><div class="settings-item-label"> <div class="settings-item"><div class="settings-item-inner"><div class="settings-item-left"><div class="settings-item-label">
The <img src="/images/question-mark-circle.svg" class="inline-icon" alt=""> <em>question mark</em> button will open the <a href="/bg/info.html" target="_blank" rel="noopener">Information</a> page, The <img src="/images/question-mark-circle.svg" class="inline-icon" alt=""> <em>question mark</em> button will open the <a href="/info.html" target="_blank" rel="noopener">Information</a> page,
which has some helpful information and links about Yomichan. which has some helpful information and links about Yomichan.
</div></div></div></div> </div></div></div></div>
</div> </div>
@ -51,7 +51,7 @@
Several downloadable dictionaries can be found on the <a href="https://foosoft.net/projects/yomichan/#dictionaries" target="_blank" rel="noopener noreferrer">Yomichan homepage</a>, Several downloadable dictionaries can be found on the <a href="https://foosoft.net/projects/yomichan/#dictionaries" target="_blank" rel="noopener noreferrer">Yomichan homepage</a>,
allowing you to choose the dictionaries most relevant for you. allowing you to choose the dictionaries most relevant for you.
Dictionaries can be configured using the button below, Dictionaries can be configured using the button below,
or later from the the <a href="settings2.html" rel="noopener">Settings</a> page. or later from the the <a href="/settings.html" rel="noopener">Settings</a> page.
</div></div></div> </div></div></div>
<div class="settings-item-children settings-item-children-group"> <div class="settings-item-children settings-item-children-group">
<div class="settings-item settings-item-button" data-modal-action="show,dictionaries"><div class="settings-item-inner"> <div class="settings-item settings-item-button" data-modal-action="show,dictionaries"><div class="settings-item-inner">
@ -82,7 +82,7 @@
</div> </div>
<div class="settings-item"> <div class="settings-item">
<div class="settings-item-inner"><div class="settings-item-left"><div class="settings-item-label"> <div class="settings-item-inner"><div class="settings-item-left"><div class="settings-item-label">
This startup notification can be turned off using the options below, or later from the <a href="settings2.html" rel="noopener">Settings</a> page. This startup notification can be turned off using the options below, or later from the <a href="/settings.html" rel="noopener">Settings</a> page.
</div></div></div> </div></div></div>
</div> </div>
</div> </div>
@ -165,7 +165,7 @@
</select> </select>
</div> </div>
</div></div> </div></div>
<a href="settings2.html" rel="noopener" class="settings-item settings-item-button"><div class="settings-item-inner"> <a href="/settings.html" rel="noopener" class="settings-item settings-item-button"><div class="settings-item-inner">
<div class="settings-item-left"> <div class="settings-item-left">
<div class="settings-item-label">More customization options are available on the Settings page</div> <div class="settings-item-label">More customization options are available on the Settings page</div>
</div> </div>
@ -234,7 +234,7 @@
<div class="settings-item"><div class="settings-item-inner"> <div class="settings-item"><div class="settings-item-inner">
<div class="settings-item-left"> <div class="settings-item-left">
<div class="settings-item-label"> <div class="settings-item-label">
More dictionary settings are available on the <a href="settings2.html" rel="noopener">Settings</a> page More dictionary settings are available on the <a href="/settings.html" rel="noopener">Settings</a> page
</div> </div>
</div> </div>
</div></div> </div></div>

View File

@ -50,7 +50,7 @@ function main() {
const extDirName = 'ext'; const extDirName = 'ext';
const extDir = path.join(rootDir, extDirName); const extDir = path.join(rootDir, extDirName);
const scripts = getAllHtmlScriptPaths(path.join(extDir, 'bg', 'background.html')); const scripts = getAllHtmlScriptPaths(path.join(extDir, 'background.html'));
convertBackgroundScriptsToServiceWorkerScripts(scripts); convertBackgroundScriptsToServiceWorkerScripts(scripts);
const importedScripts = []; const importedScripts = [];