mirror of
https://github.com/thebaer/MMRA
synced 2024-11-13 10:11:01 +00:00
Merge branch 'master' into 7
This commit is contained in:
commit
d683353f52
@ -10,6 +10,7 @@ This is that Chrome extension. [Install it here](https://chrome.google.com/webst
|
|||||||
* Keeping the top navigation bar from sticking around
|
* Keeping the top navigation bar from sticking around
|
||||||
* Hiding the bottom "Get Updates" bar completely
|
* Hiding the bottom "Get Updates" bar completely
|
||||||
* (Optionally) hiding the clap / share bar
|
* (Optionally) hiding the clap / share bar
|
||||||
|
* (Optionally) loading all post images up front, instead of lazy loading as you scroll
|
||||||
|
|
||||||
### Preview
|
### Preview
|
||||||
|
|
||||||
|
@ -16,8 +16,26 @@ var makeReadable = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var hideDickbar = function() {
|
var hideDickbar = function() {
|
||||||
document.querySelector('.js-postShareWidget').style.display = 'none';
|
var dickbar = document.querySelector('.js-postShareWidget');
|
||||||
document.querySelector('footer > .container:first-child').style.display = 'none';
|
if (dickbar != null) {
|
||||||
|
dickbar.style.display = 'none';
|
||||||
|
}
|
||||||
|
var footerDickbar = document.querySelector('footer > .container:first-child');
|
||||||
|
if (footerDickbar != null) {
|
||||||
|
footerDickbar.style.display = 'none';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var disableLazyLoading = function() {
|
||||||
|
var hiddenMedia = document.querySelectorAll('.js-progressiveMedia-inner');
|
||||||
|
if (hiddenMedia == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (var i=0; i<hiddenMedia.length; i++) {
|
||||||
|
var template = document.createElement('template');
|
||||||
|
template.innerHTML = hiddenMedia[i].textContent;
|
||||||
|
hiddenMedia[i].parentNode.appendChild(template.content.firstChild);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var observer = new MutationObserver(function(mutations){
|
var observer = new MutationObserver(function(mutations){
|
||||||
@ -36,6 +54,9 @@ if (metaCheck != null && metaCheck.content == "Medium") {
|
|||||||
if (items.hideDickbar) {
|
if (items.hideDickbar) {
|
||||||
hideDickbar();
|
hideDickbar();
|
||||||
}
|
}
|
||||||
|
if (items.disableLazyImages) {
|
||||||
|
disableLazyLoading();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
observer.observe(document.querySelector('body'), target);
|
observer.observe(document.querySelector('body'), target);
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
<input type="checkbox" id="dickbar"> Hide sharing dickbar
|
<input type="checkbox" id="dickbar"> Hide sharing dickbar
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" id="images"> Disable lazy image loading
|
||||||
|
</label>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<h2>Defaults</h2>
|
<h2>Defaults</h2>
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
// Saves options to chrome.storage
|
// Saves options to chrome.storage
|
||||||
function save_options() {
|
function save_options() {
|
||||||
var hideDickbar = document.getElementById('dickbar').checked;
|
var hideDickbar = document.getElementById('dickbar').checked;
|
||||||
|
var disableLazyImages = document.getElementById('images').checked;
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
hideDickbar: hideDickbar
|
hideDickbar: hideDickbar,
|
||||||
|
disableLazyImages: disableLazyImages
|
||||||
}, function() {
|
}, function() {
|
||||||
// Update status to let user know options were saved.
|
// Update status to let user know options were saved.
|
||||||
var status = document.getElementById('status');
|
var status = document.getElementById('status');
|
||||||
@ -17,9 +19,11 @@ function save_options() {
|
|||||||
// stored in chrome.storage.
|
// stored in chrome.storage.
|
||||||
function restore_options() {
|
function restore_options() {
|
||||||
chrome.storage.sync.get({
|
chrome.storage.sync.get({
|
||||||
hideDickbar: false
|
hideDickbar: false,
|
||||||
|
disableLazyImages: false
|
||||||
}, function(items) {
|
}, function(items) {
|
||||||
document.getElementById('dickbar').checked = items.hideDickbar;
|
document.getElementById('dickbar').checked = items.hideDickbar;
|
||||||
|
document.getElementById('images').checked = items.disableLazyImages;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
document.addEventListener('DOMContentLoaded', restore_options);
|
document.addEventListener('DOMContentLoaded', restore_options);
|
||||||
|
Loading…
Reference in New Issue
Block a user