From 5a486a0e3d2ddfed83e9b618c8a07471d2a6b6c0 Mon Sep 17 00:00:00 2001 From: Azero Date: 2019年4月11日 10:48:03 +0800 Subject: [PATCH 1/4] =?UTF-8?q?1.18=20=E7=BB=A7=E7=BB=AD=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ csdn.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c549db8..4b6dc6b 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ ![预览](https://raw.githubusercontent.com/Azero-NG/csdnRemoveAd/master/preview.png) ## 更新历史 +### 1.18 +- 继续修复bug + + ### 1.17 - 修复bug diff --git a/csdn.js b/csdn.js index 58349be..a1ec3df 100644 --- a/csdn.js +++ b/csdn.js @@ -1,7 +1,7 @@ // ==UserScript== // @name CSDN极致去广告 // @namespace http://tampermonkey.net/ -// @version 1.17 +// @version 1.18 // @description CSDN去广告(除了文章其他全去) // @author Azero // @match http*://blog.csdn.net/*/article/details/* @@ -12,7 +12,7 @@ (function () { 'use strict'; - currentUserName = "azero";//伪装登录 + var currentUserName = "azero";//伪装登录 //页面加载完成监听事件 document.addEventListener ("DOMContentLoaded", DOM_ContentReady); From fcc5ff091d22a6156af22c97638fc4896644ae2b Mon Sep 17 00:00:00 2001 From: Azero Date: 2019年4月11日 14:07:15 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BC=AA=E8=A3=85=E7=99=BB=E5=BD=95,?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BB=A3=E7=A0=81=E5=9D=97=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=B7=B1=E5=85=A5=E8=A7=A3=E5=86=B3,?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0watch=E5=8A=9F=E8=83=BD,=E7=9B=91=E8=A7=86cur?= =?UTF-8?q?rentusername,=E5=90=8C=E6=97=B6=E7=94=B1=E4=BA=8Etampermonkey?= =?UTF-8?q?=20grant,=E5=AF=BC=E8=87=B4=E8=BF=9B=E5=85=A5sandbox,=E9=80=9A?= =?UTF-8?q?=E8=BF=87unsafewindow=E8=A7=A3=E5=86=B3,=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E7=96=91=E9=97=AE:Object=E5=8F=98=E9=87=8F=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=B7=A8=E6=B2=99=E7=AE=B1=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ csdn.js | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b6dc6b..be55f02 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ ![预览](https://raw.githubusercontent.com/Azero-NG/csdnRemoveAd/master/preview.png) ## 更新历史 +### 1.19 +- 伪装登录,解决代码块复制问题深入解决,添加watch功能,监视currentusername,同时由于tampermonkey grant,导致进入sandbox,通过unsafewindow解决,同时疑问:Object变量可以跨沙箱? + + ### 1.18 - 继续修复bug diff --git a/csdn.js b/csdn.js index a1ec3df..3cb69a3 100644 --- a/csdn.js +++ b/csdn.js @@ -1,7 +1,7 @@ // ==UserScript== // @name CSDN极致去广告 // @namespace http://tampermonkey.net/ -// @version 1.18 +// @version 1.19 // @description CSDN去广告(除了文章其他全去) // @author Azero // @match http*://blog.csdn.net/*/article/details/* @@ -12,7 +12,43 @@ (function () { 'use strict'; - var currentUserName = "azero";//伪装登录 + //添加watch功能 + if (!Object.prototype.watch) { + Object.defineProperty(Object.prototype, "watch", { + enumerable: false + , configurable: true + , writable: false + , value: function (prop, handler) { + var + oldval = this[prop] + , newval = oldval + , getter = function () { + return newval; + } + , setter = function (val) { + oldval = newval; + return newval = handler.call(this, prop, oldval, val); + } + ; + + if (delete this[prop]) { // can't watch constants + Object.defineProperty(this, prop, { + get: getter + , set: setter + , enumerable: true + , configurable: true + }); + } + } + }); + } + //变量值锁定 + function staticValue(name,val) { + unsafeWindow.watch(name,function(id, old, cur) { + return val; + }); + } + staticValue("currentUserName","azero"); //页面加载完成监听事件 document.addEventListener ("DOMContentLoaded", DOM_ContentReady); From 92aee2c85bb6931cc522035b622ac7627eacc1b0 Mon Sep 17 00:00:00 2001 From: Azero Date: 2019年4月11日 14:19:21 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ csdn.js | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index be55f02..1edaac8 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ ![预览](https://raw.githubusercontent.com/Azero-NG/csdnRemoveAd/master/preview.png) ## 更新历史 +### 1.20 +- 修复评论不显示bug + ### 1.19 - 伪装登录,解决代码块复制问题深入解决,添加watch功能,监视currentusername,同时由于tampermonkey grant,导致进入sandbox,通过unsafewindow解决,同时疑问:Object变量可以跨沙箱? diff --git a/csdn.js b/csdn.js index 3cb69a3..cd9d9a7 100644 --- a/csdn.js +++ b/csdn.js @@ -1,7 +1,7 @@ // ==UserScript== // @name CSDN极致去广告 // @namespace http://tampermonkey.net/ -// @version 1.19 +// @version 1.20 // @description CSDN去广告(除了文章其他全去) // @author Azero // @match http*://blog.csdn.net/*/article/details/* @@ -51,9 +51,10 @@ staticValue("currentUserName","azero"); //页面加载完成监听事件 - document.addEventListener ("DOMContentLoaded", DOM_ContentReady); + // document.addEventListener ("DOMContentLoaded", DOM_ContentReady); + unsafeWindow.addEventListener ("load", pageFullyLoaded); //加载完成后运行 - function DOM_ContentReady () { + function pageFullyLoaded () { if (GM_getValue("csdnNotifi",true)==true) { window.alert("请点击网页空白处"); From d1c1bf29b45318729ffa2408f814438b196369a6 Mon Sep 17 00:00:00 2001 From: Azero Date: 2019年4月16日 11:54:44 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=94=81=E5=AE=9A=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E5=89=8D,=E5=85=88=E6=B7=BB=E5=8A=A0=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ csdn.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1edaac8..a46b0ed 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ ![预览](https://raw.githubusercontent.com/Azero-NG/csdnRemoveAd/master/preview.png) ## 更新历史 +### 1.21 +- 锁定变量前,先添加变量 + + ### 1.20 - 修复评论不显示bug diff --git a/csdn.js b/csdn.js index cd9d9a7..678d4e3 100644 --- a/csdn.js +++ b/csdn.js @@ -1,7 +1,7 @@ // ==UserScript== // @name CSDN极致去广告 // @namespace http://tampermonkey.net/ -// @version 1.20 +// @version 1.21 // @description CSDN去广告(除了文章其他全去) // @author Azero // @match http*://blog.csdn.net/*/article/details/* @@ -48,6 +48,7 @@ return val; }); } + unsafeWindow.currentUserName = "azero" staticValue("currentUserName","azero"); //页面加载完成监听事件

AltStyle によって変換されたページ (->オリジナル) /