Make help page localisable and make up to date

Closes https://github.com/ajayyy/SponsorBlock/issues/509
This commit is contained in:
Ajay Ramachandran
2021-08-20 02:00:15 -04:00
parent bea943dc96
commit b3336a218e
8 changed files with 89 additions and 29 deletions

View File

@@ -35,7 +35,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
chrome.tabs.create({url: chrome.runtime.getURL('options/options.html' + (request.hash ? '#' + request.hash : ''))});
return;
case "openHelp":
chrome.tabs.create({url: chrome.runtime.getURL('help/index_en.html')});
chrome.tabs.create({url: chrome.runtime.getURL('help/index.html')});
return;
case "openPage":
chrome.tabs.create({url: chrome.runtime.getURL(request.url)});
@@ -74,7 +74,7 @@ chrome.runtime.onInstalled.addListener(function () {
// If there is no userID, then it is the first install.
if (!userID){
//open up the install page
chrome.tabs.create({url: chrome.extension.getURL("/help/index_en.html")});
chrome.tabs.create({url: chrome.extension.getURL("/help/index.html")});
//generate a userID
const newUserID = utils.generateUserID();

View File

@@ -151,8 +151,6 @@ class CategorySkipOptionsComponent extends React.Component<CategorySkipOptionsPr
const optionNames = ["disable", "showOverlay", "manualSkip", "autoSkip"];
console.log(getCategoryActionType(this.props.category))
for (const optionName of optionNames) {
elements.push(
<option key={optionName} value={optionName}>

View File

@@ -1,8 +1,16 @@
import Config from "./config";
import { showDonationLink } from "./utils/configUtils";
import Utils from "./utils";
const utils = new Utils();
window.addEventListener('DOMContentLoaded', init);
async function init() {
utils.localizeHtmlPage();
await utils.wait(() => Config.config !== null);
if (!showDonationLink()) {
document.getElementById("sbDonate").style.display = "none";
}

View File

@@ -261,7 +261,6 @@ export default class Utils {
const objects = document.getElementsByClassName("sponsorBlockPageBody")[0].children;
for (let j = 0; j < objects.length; j++) {
const obj = objects[j];
const localizedMessage = this.getLocalizedMessage(obj.innerHTML.toString());
if (localizedMessage) obj.innerHTML = localizedMessage;
}