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

Add feature: disable highlight menu

This commit is contained in:
Michael F. Schönitzer 2018-04-08 13:11:03 +02:00
parent e4c39274a3
commit 8512fa5f25
4 changed files with 21 additions and 3 deletions

View File

@ -15,6 +15,13 @@ var makeReadable = function() {
}
};
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) {
@ -76,6 +83,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.1",
"version": "1.4.0",
"applications": {
"gecko": {

View File

@ -25,6 +25,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);