Skip to content

Instantly share code, notes, and snippets.

@pfeilbr
Last active May 14, 2020 15:40
Show Gist options
  • Save pfeilbr/7d828b65bd49a048e7aa3d587a91001e to your computer and use it in GitHub Desktop.
Save pfeilbr/7d828b65bd49a048e7aa3d587a91001e to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name AWS Blog Article Focus
// @namespace http://aws.amazon.com/
// @version 0.1
// @description remove extra content from AWS blog articles
// @author Brian Pfeil
// @match https://aws.amazon.com/blogs/*
// @grant none
// @updateURL https://gist.githubusercontent.com/pfeilbr/7d828b65bd49a048e7aa3d587a91001e/raw/aws-blog-article-focus.js
// @downloadURL https://gist.githubusercontent.com/pfeilbr/7d828b65bd49a048e7aa3d587a91001e/raw/aws-blog-article-focus.js
// ==/UserScript==
(function() {
'use strict';
const focusPageContent = () => {
// remove fat header content
document.querySelector('#aws-page-header').remove();
document.querySelector('body > div:nth-child(1)').remove();
document.querySelector('#aws-page-content > div.aws-blog-related-posts').remove();
// shrink top margin
document.querySelector('#aws-page-content').style.marginTop = '10px';
// remove right sidebar content
document.querySelector('#aws-page-content > div > div').remove();
// increase content width to fill page more
document.querySelector('#aws-page-content > div > main').style.width = "80%";
}
document.addEventListener('keyup', (e) => {
if (e.key === 'f') {
console.log(`tampermonkey script: focusing page content. triggered by pressing "${e.key}" key`);
focusPageContent();
}
}, false)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment