mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
Added localizeHtmlPage
This commit is contained in:
parent
7244ca8f5e
commit
42dcdb40cf
1 changed files with 22 additions and 1 deletions
23
utils.js
23
utils.js
|
@ -38,4 +38,25 @@ function getYouTubeVideoID(url) {
|
|||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function localizeHtmlPage()
|
||||
{
|
||||
//Localize by replacing __MSG_***__ meta tags
|
||||
var objects = document.getElementsByTagName('html');
|
||||
for (var j = 0; j < objects.length; j++)
|
||||
{
|
||||
var obj = objects[j];
|
||||
|
||||
var valStrH = obj.innerHTML.toString();
|
||||
var valNewH = valStrH.replace(/__MSG_(\w+)__/g, function(match, v1)
|
||||
{
|
||||
return v1 ? chrome.i18n.getMessage(v1) : "";
|
||||
});
|
||||
|
||||
if(valNewH != valStrH)
|
||||
{
|
||||
obj.innerHTML = valNewH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue