don't hardcode homepage URL, extract it from "Get Help" translation

This commit is contained in:
tophf 2017-11-21 09:48:55 +03:00
parent 8a1908b760
commit 00ead83da9

View File

@ -50,9 +50,13 @@ prefs.subscribe(['iconset'], () => updateIcon({id: undefined}, {}));
// Open FAQs page once after installation to guide new users. // Open FAQs page once after installation to guide new users.
// Do not display it in development mode. // Do not display it in development mode.
if (reason === 'install' && manifest.update_url) { if (reason === 'install' && manifest.update_url) {
setTimeout(openURL, 100, { // don't hardcode homepage URL, extract it from "Get Help" label translation
url: 'http://add0n.com/stylus.html' // TODO: add a built-in tour page in the extension
}); const getHelpHtml = chrome.i18n.getMessage('manageText').match(/<a\s+href=[^>]+/g);
const url = (getHelpHtml[1] || '').replace(/^.+?=\s*/, '').replace(/^['"]|["']$/g, '');
if (url) {
setTimeout(openURL, 100, {url});
}
} }
// reset L10N cache on update // reset L10N cache on update
if (reason === 'update') { if (reason === 'update') {