Skip to content

Instantly share code, notes, and snippets.

@pamelafox
Created March 8, 2018 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pamelafox/85889bf65d56e93e7d26688db4cb2f83 to your computer and use it in GitHub Desktop.
Save pamelafox/85889bf65d56e93e7d26688db4cb2f83 to your computer and use it in GitHub Desktop.
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