From f17c4e92b8d199599b91379493b8970a3cbd5e21 Mon Sep 17 00:00:00 2001 From: zytomorrow Date: Fri, 8 Jan 2021 14:31:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AE=80=E9=98=85(simpread)=20=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E7=BE=8E=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/simpread/changelog.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/routes/simpread/changelog.js b/lib/routes/simpread/changelog.js index dfa3f8a14..9665b4cb5 100644 --- a/lib/routes/simpread/changelog.js +++ b/lib/routes/simpread/changelog.js @@ -2,7 +2,7 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); module.exports = async (ctx) => { - const url = 'https://simpread.pro/changelog.html'; + const url = 'http://ksria.com/simpread/changelog.html'; const response = await got.get(url); const data = response.data; const $ = cheerio.load(data); @@ -41,17 +41,26 @@ module.exports = async (ctx) => { version_type = 'Firefox'; } + // detail + const text_color = { + important: '#9c27b0', + add: '#4caf50', + change: '#ffc107', + fix: '#f44336', + complete: '#03a9f4', + }; $(detail) .find('li') .map((index, item) => { - const level = $(item).find('span').attr('class'); + let span_class = $(item).find('span').attr('class'); const text = $(item).find('span').html(); $(item).find('span').remove(); - if (level !== undefined) { - if (level.indexOf('empty') !== -1) { + if (span_class !== undefined) { + span_class = span_class.split(' '); + if (span_class[1] === 'empty') { $(item).wrap(''); } else { - $(item).prepend(`${text}: `); + $(item).prepend(`${text}: `); } } return {};