Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Medium Feed Eater for HabitLab
const $ = require('jquery');
require_component('habitlab-logo-v2');
require_component('paper-button');
function removeFeed() {
var re = new RegExp('medium.com\/\??.*$');
if (!re.test(window.location.href)) {
return;
}
$('.streamItem').css('display', 'none');
$('body').append('<style>.metabar-inner { display:none; } .streamItem { display: none;}</style>');
}
function showFeed() {
$('#habitlab_container').remove();
$('body').append('<style>.metabar-inner { display:block; } .streamItem { display: block;}</style>');
}
var container = $('<div style="text-align: center;" id="habitlab_container"></div>');
var habitlab_logo = $('<habitlab-logo-v2></habitlab-logo-v2>');
var cheatButton = $('<paper-button>').text('Show stories this one time').css({
'background-color': '#415D67',
'color': 'white',
'box-shadow': '2px 2px 2px #888888'
});
container.append([cheatButton, '<br><br>', habitlab_logo])
cheatButton.on('click', () => {
showFeed()
})
removeFeed();
$('.js-homeStream').append(container);
window.on_intervention_disabled = () => {
showFeed();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.