From fc33735ae2ee0556e0b2523b3c16681dc1ebea4b Mon Sep 17 00:00:00 2001 From: xing Date: Thu, 2 Apr 2020 21:17:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tieba page.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tieba page.js b/tieba page.js index 90b2b42..03f50eb 100644 --- a/tieba page.js +++ b/tieba page.js @@ -1,7 +1,7 @@ // ==UserScript== // @name tieba page // @namespace https://github.com/fthvgb1/tampermonkey-script -// @version 0.986 +// @version 0.990 // @author fthvgb1 // @match https://tieba.baidu.com/* // @match https://tiebac.baidu.com/* @@ -458,12 +458,12 @@ li.addEventListener('touchend', evt => { if ((endX - startX) > 100 && Math.abs(endY - startY) <= 100) { - let url = document.querySelector('li.tl_shadow>a[data-thread-type="0"]').href; + let url = document.querySelector('li.tl_shadow>a[data-thread-type="0"]').dataset.url; window.open(url, '_blank'); } if ((startX - endX) > 100 && Math.abs(endY - startY) <= 100) { - let url = document.querySelector('li.tl_shadow>a[data-thread-type="0"]').href; - GM.openInTab(url) + location.href = document.querySelector('li.tl_shadow>a[data-thread-type="0"]').dataset.url; + //window.open(url,'self') } }) }) @@ -504,16 +504,17 @@ characterData: true }); - /*let lis = document.querySelectorAll('li.tl_shadow>a[data-thread-type="0"]'); + let lis = document.querySelectorAll('li.tl_shadow>a[data-thread-type="0"]'); if (lis.length > 0) { lis.forEach(value => { let url = value.href; value.href = 'javascript:void(0);'; + value.dataset.url = url; value.onclick = (v) => { GM.openInTab(url, true); } }) - }*/ + } }