Created
August 25, 2018 01:53
-
-
Save guangtuan/a04d940a709869d07710fff331be5d47 to your computer and use it in GitHub Desktop.
clear csdn article detail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name clear csdn article detail | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://blog.csdn.net/*/article/details/* | |
// @grant none | |
// ==/UserScript== | |
const selectorsToHide = [ | |
'body > div.pulllog-box', | |
'body > div.box-box-large > a', | |
'body > div.pulllog-box', | |
'body > div.box-box-aways > a', | |
'#mainBox > aside', | |
'body > div.pulllog-box', | |
'#loginWrap', | |
'#csdn-toolbar', | |
'body > div.pulllog-box > div', | |
'#mainBox > main > div.p4course_target', | |
'#mainBox > main > div.recommend-box > div.p4courset3_target._4paradigm_box.recommend-item-box.clearfix', | |
'#mainBox > main > div.recommend-box > div.recommend-item-box.type_hot_word', | |
'body > div.tool-box > ul', | |
'#reportContent' | |
]; | |
function eventFire(el, etype){ | |
if (el.fireEvent) { | |
el.fireEvent('on' + etype); | |
} else { | |
var evObj = document.createEvent('Events'); | |
evObj.initEvent(etype, true, false); | |
el.dispatchEvent(evObj); | |
} | |
}; | |
function hide(selector) { | |
setTimeout(() => { | |
document.querySelector(selector).style.display = 'none'; | |
}); | |
} | |
(function() { | |
'use strict'; | |
// Your code here... | |
console.log('start clear'); | |
selectorsToHide.forEach(selector => hide(selector)); | |
setTimeout(() => { | |
document.querySelector('#mainBox > main').style.width = '1200px'; | |
document.querySelector('body').style.background = '#000000'; | |
eventFire(document.querySelector('#btn-readmore'), 'click'); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment