Get & set currentMd5 outside of condition
This commit is contained in:
parent
45aee86eea
commit
04bed35cab
|
@ -31,9 +31,12 @@
|
||||||
gotBody = true;
|
gotBody = true;
|
||||||
// TODO: remove the following statement when USO pagination title is fixed
|
// TODO: remove the following statement when USO pagination title is fixed
|
||||||
document.title = document.title.replace(/^(\d+)&\w+=/, '#$1: ');
|
document.title = document.title.replace(/^(\d+)&\w+=/, '#$1: ');
|
||||||
API.findStyle({
|
const md5Url = getMeta('stylish-md5-url') || location.href;
|
||||||
md5Url: getMeta('stylish-md5-url') || location.href
|
Promise.all([
|
||||||
}).then(checkUpdatability);
|
API.findStyle({md5Url}),
|
||||||
|
getResource(md5Url)
|
||||||
|
])
|
||||||
|
.then(checkUpdatability);
|
||||||
}
|
}
|
||||||
if (document.getElementById('install_button')) {
|
if (document.getElementById('install_button')) {
|
||||||
onDOMready().then(() => {
|
onDOMready().then(() => {
|
||||||
|
@ -67,7 +70,7 @@
|
||||||
return jsonUrl + (paramsMissing ? textUrl.replace(/^[^?]+/, '') : '');
|
return jsonUrl + (paramsMissing ? textUrl.replace(/^[^?]+/, '') : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkUpdatability(installedStyle) {
|
function checkUpdatability([installedStyle, md5]) {
|
||||||
// TODO: remove the following statement when USO is fixed
|
// TODO: remove the following statement when USO is fixed
|
||||||
document.dispatchEvent(new CustomEvent('stylusFixBuggyUSOsettings', {
|
document.dispatchEvent(new CustomEvent('stylusFixBuggyUSOsettings', {
|
||||||
detail: installedStyle && installedStyle.updateUrl,
|
detail: installedStyle && installedStyle.updateUrl,
|
||||||
|
@ -78,13 +81,9 @@
|
||||||
}
|
}
|
||||||
const isCustomizable = /\?/.test(installedStyle.updateUrl);
|
const isCustomizable = /\?/.test(installedStyle.updateUrl);
|
||||||
const md5Url = getMeta('stylish-md5-url');
|
const md5Url = getMeta('stylish-md5-url');
|
||||||
|
currentMd5 = md5;
|
||||||
if (md5Url && installedStyle.md5Url && installedStyle.originalMd5) {
|
if (md5Url && installedStyle.md5Url && installedStyle.originalMd5) {
|
||||||
getResource(md5Url).then(md5 => {
|
reportUpdatable(isCustomizable || md5 !== installedStyle.originalMd5);
|
||||||
currentMd5 = md5;
|
|
||||||
reportUpdatable(
|
|
||||||
isCustomizable ||
|
|
||||||
md5 !== installedStyle.originalMd5);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
getStyleJson().then(json => {
|
getStyleJson().then(json => {
|
||||||
reportUpdatable(
|
reportUpdatable(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user