Show available new release in popup (click icon)

Example:
Bypass Paywalls Clean v1.6.3.1
Options | GitHub | New release v1.6.3.x
This commit is contained in:
magnolia1234 2020-02-21 18:31:48 +01:00 committed by GitHub
parent f9286092db
commit e21a47021a
2 changed files with 19 additions and 3 deletions

View File

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html>
<body>
<div style="width:150px;">Bypass Paywalls Clean
<br><a href="options.html">Options</a> | <a href="https://github.com/magnolia1234/bypass-paywalls-chrome-clean/blob/master/README.md" target=”_blank”>GitHub</a> | <span id="version"></span></div>
<div style="width:225px;"><strong>Bypass Paywalls Clean <span id="version"></span></strong>
<br><a href="options.html">Options</a> | <a href="https://github.com/magnolia1234/bypass-paywalls-chrome-clean/blob/master/README.md" target=”_blank”>GitHub</a> | <strong><span id="version_new"></span></strong></div>
<script src="version.js"></script>
</body>
</html>

View File

@ -1,3 +1,19 @@
var manifestData = chrome.runtime.getManifest();
var versionString = 'v' + manifestData.version;
document.getElementById('version').innerText = versionString;
document.getElementById('version').innerText = versionString;
const manifest_new = 'https://raw.githubusercontent.com/magnolia1234/bypass-paywalls-chrome-clean/master/manifest.json';
fetch(manifest_new)
.then(response => {
if (response.ok) {
response.json().then(json => {
var version_new = json['version'];
if (version_new > manifestData.version) {
versionString_new = 'New release v' + version_new;
} else {
versionString_new = 'Latest release';
}
document.getElementById('version_new').innerText = versionString_new;
})
}
});