From 541aaeba47285f884d2bd0008e1b149c298a2981 Mon Sep 17 00:00:00 2001 From: xing Date: Thu, 9 Apr 2020 18:09:09 +0800 Subject: [PATCH] fix a bug --- tieba page.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tieba page.js b/tieba page.js index 817153f..adfc7c1 100644 --- a/tieba page.js +++ b/tieba page.js @@ -37,7 +37,7 @@ let ssr = decodeURIComponent(url); let x = ssr.split('/'); let id = x[x.length - 1]; - value.outerHTML = `
gif
`; + value.outerHTML = `
gif
`; }) } } @@ -410,8 +410,14 @@ let x = img.src.split('/'); let u = x[x.length - 1]; let i = document.querySelector(`img[data-url="${u}"]`); - if (i && i.src !== img.src) { + + if (i && i.src !== img.src && i.dataset.type === 'gif') { i.src = img.src; + } else if (i && i.src !== img.src && !i.dataset.type) { + i.src = img.src; + i.addEventListener('click', evt => { + i.src = i.parentNode.dataset.url; + }); } } }