Created
March 8, 2018 18:47
-
-
Save pamelafox/85889bf65d56e93e7d26688db4cb2f83 to your computer and use it in GitHub Desktop.
Medium Feed Eater for HabitLab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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