17166
8
5
1
基于https://7qingc.com/thread-154.htm的脚本进行修改,主要是删除了手机版向下滑动时弹出的“下载APP”的遮罩层,实现的可能不是很好,我是后端,不是专业前端
现在不好使了,我看下能更新下不
//@name 知乎直接看
//@match zhihu.com
// m-script-end
// @run-at document-start
// @type bookmarklet
(function () {
/* 判断是否该执行 */
const whiteList = ['zhihu.com'];
const hostname = window.location.hostname;
const key = encodeURIComponent('谷花泰:知乎直接看:执行判断');
const result = whiteList.some(site => {
if (hostname.match(site)) {
return true;
}
return false;
});
if (!result || window[key]) {
return;
};
window[key] = true;
/* 代码正文 */
Object.defineProperties(window.navigator, {
'userAgent': {
enumerable: true,
value: 'Mozilla/5.0 (Windows Phone 10)'
},
'appVersion': {
enumerable: true,
value: '5.0 (Windows Phone 10)'
},
'platform': {
enumerable: true,
value: 'Win32'
}
});
//删除下载APP的遮罩层提示
window.onload = function(){
//获取遮罩层节点
var blocks = document.getElementsByClassName("Card DownloadGuide DownloadGuide-block");
var i;
for(i = 0; i < blocks.length; ++i){
var block = blocks[i];
block.parentNode.removeChild(block);
}
};
})();