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

Add option to resize ridiculous massive headers

This commit is contained in:
Dan Berman 2017-09-02 08:04:28 -07:00
parent 2d46c48b62
commit f7db85ba31
3 changed files with 20 additions and 1 deletions

View File

@ -38,6 +38,14 @@ var disableLazyLoading = function() {
}
};
var makeViewable = function() {
var ridiculousHeaderImage = document.querySelector('figure.graf--layoutFillWidth');
if (ridiculousHeaderImage != null) {
ridiculousHeaderImage.style.maxWidth = '700px';
ridiculousHeaderImage.style.margin = '0 auto';
}
}
var observer = new MutationObserver(function(mutations){
mutations.forEach(makeReadable);
});
@ -57,6 +65,10 @@ if (metaCheck != null && metaCheck.content == "Medium") {
if (items.disableLazyImages) {
disableLazyLoading();
}
if (items.makeViewable) {
makeViewable();
}
});
observer.observe(document.querySelector('body'), config);

View File

@ -25,6 +25,10 @@
<input type="checkbox" id="images"> Disable lazy image loading
</label>
<label>
<input type="checkbox" id="ridiculousHeader"> Make ridiculous massive header images viewable
</label>
<hr />
<h2>Defaults</h2>

View File

@ -2,9 +2,11 @@
function save_options() {
var hideDickbar = document.getElementById('dickbar').checked;
var disableLazyImages = document.getElementById('images').checked;
var makeViewable = document.getElementById('ridiculousHeader').checked;
chrome.storage.sync.set({
hideDickbar: hideDickbar,
disableLazyImages: disableLazyImages
disableLazyImages: disableLazyImages,
makeViewable: makeViewable
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
@ -24,6 +26,7 @@ function restore_options() {
}, function(items) {
document.getElementById('dickbar').checked = items.hideDickbar;
document.getElementById('images').checked = items.disableLazyImages;
document.getElementById('makeViewable').checked = items.makeViewable;
});
}
document.addEventListener('DOMContentLoaded', restore_options);