Skip to content

Instantly share code, notes, and snippets.

@guangtuan
Created August 25, 2018 01:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save guangtuan/a04d940a709869d07710fff331be5d47 to your computer and use it in GitHub Desktop.
Save guangtuan/a04d940a709869d07710fff331be5d47 to your computer and use it in GitHub Desktop.
clear csdn article detail
// ==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