1
0
mirror of https://github.com/thebaer/MMRA synced 2024-11-13 10:11:01 +00:00

Merge branch 'master' into develop

This commit is contained in:
Matt Baer 2018-07-12 11:02:19 -04:00
commit d668d2007c
6 changed files with 80 additions and 18 deletions

View File

@ -7,17 +7,19 @@
</p>
<hr />
I've gotten a little tired of showing up to a Medium-powered site on a non-medium.com domain and getting badgered to **Sign Up!** or **Get Updates!** when I'm already a Medium user. It's also annoying to have a vertically-small reading viewport because the top and bottom nav bars don't auto-hide. I know -- _Who owns a 12.1" laptop anymore?_, right? Well... today I decided I couldn't abide that anymore, and made a browser extension to neutralize these user hostilities.
This is that browser extension. Install it [on Chrome](https://chrome.google.com/webstore/detail/kljjfejkagofbgklifblndjelgabcmig) or [on Firefox](https://addons.mozilla.org/addon/make-medium-readable-again/).
Make Medium Readable Again is a [Chrome extension](https://chrome.google.com/webstore/detail/kljjfejkagofbgklifblndjelgabcmig) and [Firefox add-on](https://addons.mozilla.org/addon/make-medium-readable-again/) that improves a reading experience ruined by user engagement tactics. Medium was actually readable once; this extension aims to help people pay attention to writers' words again instead of Medium's UX.
### Improves readability by
* Keeping the top navigation bar from sticking around
* Hiding the bottom "Get Updates" bar completely
* Shrinking massive header images
* Hiding "posts meter" bar and Upgrade header button
* Hiding "Open in App" button on mobile
* Blocking the "pardon the interruption" popup
* (Optionally) hiding the clap / share bar
* (Optionally) loading all post images up front, instead of lazy loading as you scroll
* (Optionally) disabling the popup menu that appears when selecting text
### Preview
@ -29,7 +31,7 @@ _Medium Made Readable Again_
### Contributing
Want to improve something? Your insight is welcome here! Send a pull request!
Want to improve something? Please do! Send a pull request or file an issue!
### License
@ -37,4 +39,10 @@ MIT
### Credits
I'm Matt Baer, and I'm tired of annoying, user-hostile software. So I built a publishing space called [Write.as](https://write.as) that doesn't beg you to sign up, [lets you read](https://read.write.as), and leaves out the comments, claps, and [dickbars](https://daringfireball.net/2017/06/medium_dickbars). It's great if you just want to be left alone to get your thoughts out. And if you get lonely, you can always publish straight to Medium.
I'm Matt Baer, and I'm tired of annoying, user-hostile software. Inspired by this and a time when Medium was more readable, I built a writing platform called [Write.as](https://write.as) that [works great if you never sign up](https://write.as/new), [lets you read](https://read.write.as), and leaves out the comments, claps, and [dickbars](https://daringfireball.net/2017/06/medium_dickbars). It's perfect for when you just need to get your thoughts out — and if you want to share, you can always cross-post to Medium.
### Related
Other extensions to make the internet less annoying:
* [Make Facebook Browsable](https://github.com/thebaer/MFbB)

View File

@ -8,10 +8,32 @@ var makeReadable = function() {
if (topNav) {
topNav.classList.remove('u-fixed');
}
// Remove the footer
var getUpdatesBar = document.querySelector('.js-stickyFooter');
if (getUpdatesBar) {
getUpdatesBar.style.display = 'none';
// Remove the "Pardon the interruption" popup.
// We do this with JS because the .overlay.overlay--lighter element is used
// for interactions we consent to, like the sign up / log in dialogs, so we
// don't want to obliterate them too.
// FIXME: prevent this from breaking signup/login dialogs when the popup
// is removed (it works after changing pages).
var headings = document.evaluate("//h1[contains(., 'Pardon the interruption.')]", document, null, XPathResult.ANY_TYPE, null );
var thisHeading = headings.iterateNext();
if (thisHeading != null) {
var $overlay = thisHeading.parentNode.parentNode.parentNode.parentNode;
$overlay.parentNode.removeChild($overlay);
}
// Inject remaining styles
// This check makes sure the extension works on Chrome and Firefox.
if (typeof browser === 'undefined') {
browser = chrome;
}
document.head.insertAdjacentHTML('beforeend', '<link rel="stylesheet" type="text/css" href="' + browser.runtime.getURL("medium.css") + '">');
};
var hideHighlightMenu = function() {
var bar = document.querySelector('.highlightMenu');
if (bar) {
bar.style.display = 'none';
}
// Hide "open in app" footer button (on mobile)
var openInAppBtn = document.querySelector('.js-openInAppButton');
@ -68,8 +90,9 @@ var observer = new MutationObserver(function(mutations){
var config = {attributes: true};
// Only run this on Medium sites.
if (document.querySelector('head meta[property="al:ios:app_name"][content="medium"]')) {
// This extension runs on all domains so it can Make Medium Readable Again even for publications on custom domains.
// Here we make sure the code only runs on Medium sites.
if (document.querySelector('head meta[property="al:ios:app_name"][content="medium" i]')) {
makeReadable();
shrinkHeaderImages();
@ -80,6 +103,9 @@ if (document.querySelector('head meta[property="al:ios:app_name"][content="mediu
if (items.disableLazyImages) {
disableLazyLoading();
}
if (items.hideHighlightMenu) {
hideHighlightMenu();
}
});
observer.observe(document.body, config);

View File

@ -3,7 +3,7 @@
"name": "Make Medium Readable Again",
"description": "Neutralizes annoying parts of the Medium reading experience and lets you read again.",
"version": "1.3",
"version": "1.5.1",
"applications": {
"gecko": {
@ -18,16 +18,17 @@
"icons": {
"128": "icon.png"
},
"browser_action": {
"default_icon": "icon.png"
},
"permissions": [
"storage", "https://*/*"
"storage",
"https://*/*"
],
"content_scripts": [
{
"matches": ["https://*/*"],
"js": ["content.js"]
}
],
"web_accessible_resources": [
"medium.css"
]
}

16
medium.css Normal file
View File

@ -0,0 +1,16 @@
/**
* medium.css
* Contains default styles to inject into Medium publications.
*/
.postMeterBar,
.openInAppButton,
.js-stickyFooter,
.js-upgradeMembershipAction,
.butterBar--privacy {
display: none;
}
/* Makes the page scrollable after hiding "Pardon the interruption" popup */
html.u-overflowHidden {
overflow-y: scroll !important;
}

View File

@ -11,6 +11,9 @@
#status {
font-size: 1.1em;
}
#save {
margin-right: auto;
}
</style>
</head>
<body>
@ -25,6 +28,10 @@
<input type="checkbox" id="images"> Disable lazy image loading
</label>
<label>
<input type="checkbox" id="highlight"> Disable Highlight Menu
</label>
<hr />
<h2>Default Features</h2>

View File

@ -2,9 +2,11 @@
function save_options() {
var hideDickbar = document.getElementById('dickbar').checked;
var disableLazyImages = document.getElementById('images').checked;
var hideHighlightMenu = document.getElementById('highlight').checked;
chrome.storage.sync.set({
hideDickbar: hideDickbar,
disableLazyImages: disableLazyImages
disableLazyImages: disableLazyImages,
hideHighlightMenu: hideHighlightMenu
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
@ -20,10 +22,12 @@ function save_options() {
function restore_options() {
chrome.storage.sync.get({
hideDickbar: false,
disableLazyImages: false
disableLazyImages: false,
hideHighlightMenu: false
}, function(items) {
document.getElementById('dickbar').checked = items.hideDickbar;
document.getElementById('images').checked = items.disableLazyImages;
document.getElementById('highlight').checked = items.hideHighlightMenu;
});
}
document.addEventListener('DOMContentLoaded', restore_options);