//
// Make Medium Readable Again
//

var makeReadable = function() {
	// Un-position:fixed the top nav bar
	var topNav = document.querySelector('.metabar.u-fixed');
	if (topNav != null) {
		topNav.classList.remove('u-fixed');
	}
	// Remove the footer
	var getUpdatesBar = document.querySelector('.js-stickyFooter');
	if (getUpdatesBar != null) {
		getUpdatesBar.style.display = 'none';
	}
};

var hideDickbar = function() {
	document.querySelector('.js-postShareWidget').style.display = 'none';
	document.querySelector('footer > .container:first-child').style.display = 'none';
};

// Only run this on Medium sites. 
// Ensure that by checking for <meta property="al:ios:app_name" content="Medium"> in the document <head />
var metaCheck = document.head.querySelector('meta[property="al:ios:app_name"]');
if (metaCheck != null && metaCheck.content == "Medium") {
	makeReadable();

	chrome.storage.sync.get(null, function(items) {
		if (items.hideDickbar) {
			hideDickbar();
		}
	});
}

@@ -575,16 +575,147 @@
 e';%0A%7D;%0A%0A
+var observer = new MutationObserver(function(mutations)%7B%0A%09mutations.forEach(makeReadable);%09%0A%7D);%0A%0Avar config = %7Battributes: true%7D;%0A%0A
 // Only 
@@ -1107,11 +1107,71 @@
 %09%09%7D%0A%09%7D);
+%0A%0A%09observer.observe(document.querySelector('body'), target);
 %0A%7D%0A

use mutation observer to watch for body change & remove footer