Skip to content

Instantly share code, notes, and snippets.

@DesignStreaks
Last active May 12, 2016 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DesignStreaks/7665853 to your computer and use it in GitHub Desktop.
Save DesignStreaks/7665853 to your computer and use it in GitHub Desktop.
Format a CodeProject article.
(function () {
var styles = 'body,p,li,tr,td,th,dd,dt {font-size:12px;margin:0px;} h1{font-size:24px !important;} h2{font-size:20px !important;margin-bottom: 0px;margin-top:4px;} h3 {} h4{margin-bottom:4px} code{font-size:10pt !important;} pre{font-size:8pt !important;} img{max-width:50% !important;height:auto !important;} .article .summary {padding-top:0;} .author-wrapper{min-height:0;padding-left:0;}';
if (document.createStyleSheet) {
document.createStyleSheet("javascript:'" + styles + "'");
} else {
var newSS = document.createElement('link');
newSS.rel = 'stylesheet';
newSS.href = 'data:text/css,' + escape(styles);
document.getElementsByTagName("head")[0].appendChild(newSS);
};
var remove = (function (s) {
var e = document.querySelector(s);
if (e === null)
return;
e.parentNode.removeChild(e);
});
var removeAll = (function (s) {
while (e = document.querySelector(s)) {
if (e === null)
return;
console.log('Removing: ' + e);
e.parentNode.removeChild(e);
}
});
var removeByContent = (function (s, c) {
var ns = document.querySelectorAll(s);
for (var i = ns.length - 1; i > 0; --i) {
var e = ns[i];
if (e.innerText == c) {
console.log('Removing: ' + e);
e.parentNode.removeChild(e);
}
}
});
remove('.page-background>table:nth-child(1)');
remove('.sub-headerbar');
remove('.article-nav');
remove('.container-breadcrumb');
remove('.container-article-parts>tbody>tr>td:nth-child(3)');
remove('.container-article-parts>tbody>tr>td:nth-child(1)');
remove('.container-article>h2');
remove('.container-article>a');
remove('.container-article>div:nth-child(2)');
remove('.voting-bar');
remove('.clearfix');
remove('.rrssb-buttons');
remove('.research');
remove('.padded-top');
remove('.container');
remove('#ctl00_AboutHeading');
remove('#ctl00_RelatedLibrary_RelatedResults_ctl00_header');
removeAll('form>div:last-child');
removeAll('p.small-text');
removeByContent('h2', 'Share');
removeAll('#ctl00_CurRat');
removeAll('#ctl00_confirmError');
removeAll('.download');
remove('.also-read');
remove('bottom-promo');
removeByContent('h2', 'Comments and Discussions');
remove('#_MessageBoardctl00_MessageBoard');
remove('.author-wrapper .pic-wrapper');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment