From 587feb38170affee37eda8e4a6d44fa8c4c19bc9 Mon Sep 17 00:00:00 2001 From: eight Date: Mon, 25 Sep 2017 18:21:11 +0800 Subject: [PATCH] Fix: externalLink might be null --- install-usercss/install-usercss.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/install-usercss/install-usercss.js b/install-usercss/install-usercss.js index 2429954f..f824bfa2 100644 --- a/install-usercss/install-usercss.js +++ b/install-usercss/install-usercss.js @@ -127,7 +127,7 @@ cm.setPreprocessor(data.preprocessor); // update metas - document.title = data.name; + document.title = `${installButtonLabel()} ${data.name}`; $('.install').textContent = installButtonLabel(); $('.set-update-url').title = dup && dup.updateUrl && t('installUpdateFrom', dup.updateUrl) || ''; @@ -150,9 +150,12 @@ $('.applies-to').appendChild($element({tag: 'li', textContent: pattern})) ); - $('.external-link').appendChild(externalLink()); + const externalLink = makeExternalLink(); + if (externalLink) { + $('.external-link').appendChild(); + } - function externalLink() { + function makeExternalLink() { const urls = []; if (data.homepageURL) { urls.push([data.homepageURL, t('externalHomepage')]);