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-12-22 11:31:24 -05:00
commit 0103eb4334
10 changed files with 195 additions and 12 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Author</key>
<string>Matt Baer</string>
<key>Builder Version</key>
<string>12605.2.8</string>
<key>CFBundleDisplayName</key>
<string>Make Medium Readable Again</string>
<key>CFBundleIdentifier</key>
<string>com.abunchtell.mmra</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>1.5</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>Content</key>
<dict>
<key>Scripts</key>
<dict>
<key>Start</key>
<array>
<string>content.js</string>
</array>
</dict>
<key>Stylesheets</key>
<array>
<string>medium.css</string>
</array>
</dict>
<key>Description</key>
<string>Make Medium less annoying</string>
<key>DeveloperIdentifier</key>
<string>TPPAB4YBA6</string>
<key>ExtensionInfoDictionaryVersion</key>
<string>1.0</string>
<key>Permissions</key>
<dict>
<key>Website Access</key>
<dict>
<key>Include Secure Pages</key>
<true/>
<key>Level</key>
<string>All</string>
</dict>
</dict>
<key>Website</key>
<string>https://github.com/thebaer/MMRA</string>
</dict>
</plist>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array/>
</plist>

View File

@ -0,0 +1,107 @@
//
// Make Medium Readable Again
//
var makeReadable = function() {
// Un-position:fixed the top nav bar
var topNav = document.querySelector('.metabar.u-fixed');
if (topNav) {
topNav.classList.remove('u-fixed');
}
// 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';
}
};
var hideDickbar = function() {
var dickbar = document.querySelector('.js-postShareWidget');
if (dickbar) {
dickbar.style.display = 'none';
}
var footerDickbar = document.querySelector('footer > .container:first-child');
if (footerDickbar) {
footerDickbar.style.display = 'none';
}
};
var disableLazyLoading = function() {
// Get all <noscript> tags accompanying dynamically-loading <img>s
var hiddenMedia = document.querySelectorAll('noscript.js-progressiveMedia-inner');
if (hiddenMedia.length === 0) {
return;
}
for (var i=0; i<hiddenMedia.length; i++) {
// Create new <img> element from the one in <noscript> and add it in.
// This is certainly a roundabout way of doing things, but I didn't want to
// spend more time reverse-engineering Medium's lazy-loading code.
var img = new Image();
var srcMatch = hiddenMedia[i].textContent.match(/src="(https:\/\/[^"]+)"/);
if (srcMatch != null) {
img.src = srcMatch[1];
img.className = hiddenMedia[i].textContent.match(/class="([^"]+)"/)[1];
hiddenMedia[i].parentNode.appendChild(img);
}
}
};
var shrinkHeaderImages = function() {
var ridiculousHeaderImage = document.querySelector('figure.graf--layoutFillWidth');
if (ridiculousHeaderImage) {
ridiculousHeaderImage.style.maxWidth = '700px';
ridiculousHeaderImage.style.margin = '0 auto';
}
}
var observer = new MutationObserver(function(mutations){
mutations.forEach(function(){
makeReadable();
shrinkHeaderImages();
});
});
var config = {attributes: true};
// 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();
chrome.storage.sync.get(null, function(items) {
if (items.hideDickbar) {
hideDickbar();
}
if (items.disableLazyImages) {
disableLazyLoading();
}
if (items.hideHighlightMenu) {
hideHighlightMenu();
}
});
observer.observe(document.body, config);
}

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

@ -1,13 +1,21 @@
<p align="center">
<img src="https://baer.works/image/MMRA-marquee.png" alt="Make Medium Readable Again" />
</p>
<p align="center">
<a href="https://chrome.google.com/webstore/detail/kljjfejkagofbgklifblndjelgabcmig"><img src="https://baer.works/image/CWS.png" alt="Available in the Chrome Web Store" /></a>
<a href="https://addons.mozilla.org/addon/make-medium-readable-again/"><img src="https://baer.works/image/AMO.png" alt="Get the Firefox Add-on" /></a>
<a href="https://safari-extensions.apple.com/details/?id=com.abunchtell.mmra-TPPAB4YBA6"><img src="https://baer.works/image/safari.png" alt="Get the Safari Extension" /></a>
</p>
<p align="center">
<a href="https://chrome.google.com/webstore/detail/kljjfejkagofbgklifblndjelgabcmig"><img src="https://img.shields.io/chrome-web-store/v/kljjfejkagofbgklifblndjelgabcmig.svg?logo=google%20chrome&label=Chrome" alt="Available in the Chrome Web Store" /></a>
<a href="https://addons.mozilla.org/addon/make-medium-readable-again"><img src="https://img.shields.io/amo/v/make-medium-readable-again.svg?logo=mozilla%20firefox&label=Firefox" alt="Get the Firefox Add-on" /></a>
</p>
<hr />
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.
Make Medium Readable Again is a [Chrome extension](https://chrome.google.com/webstore/detail/kljjfejkagofbgklifblndjelgabcmig), [Firefox add-on](https://addons.mozilla.org/addon/make-medium-readable-again/) and [Safari extension](https://safari-extensions.apple.com/details/?id=com.abunchtell.mmra-TPPAB4YBA6) 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

View File

@ -27,19 +27,14 @@ var makeReadable = function() {
if (typeof browser === 'undefined') {
browser = chrome;
}
document.head.insertAdjacentHTML('beforeend', '<link rel="stylesheet" type="text/css" href="' + browser.runtime.getURL("medium.css") + '">');
var mediumCSS = browser.runtime.getURL("medium.css");
if (document.querySelector('head link[href="' + mediumCSS + '"]') == null) {
document.head.insertAdjacentHTML('beforeend', '<link rel="stylesheet" type="text/css" href="' + mediumCSS + '">');
}
};
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');
if (openInAppBtn) {
openInAppBtn.style.display = 'none';
}
document.head.insertAdjacentHTML('beforeend', '<style type="text/css">.highlightMenu { display: none; }</style>');
};
var hideDickbar = function() {

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.5.1",
"version": "1.5.2",
"applications": {
"gecko": {