Skip to content

Instantly share code, notes, and snippets.

@andrewiankidd
Last active November 8, 2016 16:18
Show Gist options
  • Save andrewiankidd/cf6d3b32a3cfe070618f7bf6dc868139 to your computer and use it in GitHub Desktop.
Save andrewiankidd/cf6d3b32a3cfe070618f7bf6dc868139 to your computer and use it in GitHub Desktop.
crappy userscript to hide twitter clickbait and optionally everything cos life can be tough
// ==UserScript==
// @name FuckThis (twittertoolbox)
// @namespace http://andrewiankidd.co.uk
// @version 0.1
// @description ayyylmao
// @author AK
// @match *twitter.com*
// @require http://code.jquery.com/jquery-latest.js
// @grant GM_addStyle
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
(function() {
'use strict';
var checkedet = GM_getValue("checkedet");
var checkedcb = GM_getValue("checkedcb");
//show ui
$('li.dm-nav').after("<li class='dm-nav'><a role='button' href='#' class='js-tooltip js-dynamic-tooltip' data-placement='bottom'><span class='Icon Icon--large'><input class='showhideft' style='height:18px;width:18px;' type='checkbox'></span><span id='fttext' class='text'>FuckThis</span></a></li>");
$('div.BannersContainer').after("<div class='ftcontainer' style='display:none;padding:5px;border-radius:2.5px;font-size:12pt;height:48px;line-height:12pt;font-weight:bold;color:white;margin-bottom:5px;background:repeating-linear-gradient(45deg,transparent,transparent 10px,#f2b968 10px,#f2b968 20px),linear-gradient(to bottom,#f0ad4e,#f0ad4e);'><br><input type='checkbox' class='hideeverythingyn' "+ checkedet +"> fuck everything <input type='checkbox' class='hideclickbaityn' "+ checkedcb +"> fuck clickbait<br></div>");
//manage if the checkbox is un/checked by user
$('input.showhideft').change(function(){
if($('input.showhideft').is(':checked'))
{
console.log('----------showing controlpanel');
GM_addStyle ( "div.ftcontainer{ display:block!important; }" );
$('span#fttext').text('Fuck That');
} else {
console.log('----------hiding controlpanel');
GM_addStyle ( "div.ftcontainer{ display:none!important; }" );
$('span#fttext').text('Fuck This');
}
});
$('input.hideeverythingyn').change(function(){
if($('input.hideeverythingyn').is(':checked'))
{
console.log('----------remembering checked status');
GM_setValue("checkedet", "checked");
console.log('----------hiding everything');
GM_addStyle ( "div.dashboard.dashboard-left, div.content-main.top-timeline-tweetbox, div.dashboard.dashboard-right{ display:none; }" );
} else {
console.log('----------remembering checked status');
GM_setValue("checkedet", "notchecked");
console.log('----------showing clickbait');
GM_addStyle ( "div.dashboard.dashboard-left, div.content-main.top-timeline-tweetbox, div.dashboard.dashboard-right{ display:initial; }" );
}
});
$('input.hideclickbaityn').change(function(){
if($('input.hideclickbaityn').is(':checked'))
{
console.log('----------remembering checked status');
GM_setValue("checkedcb", "checked");
console.log('----------hiding clickbait');
GM_addStyle ( "div.js-nav.trend-item-stats {display:none;}" );
} else {
console.log('----------remembering checked status');
GM_setValue("checkedcb", "notchecked");
console.log('----------showing clickbait');
GM_addStyle ( "div.js-nav.trend-item-stats {display:initial;}" );}
});
//on pageload check if it is checked and run the deleter
if($('input.hideeverythingyn').is(':checked'))
{
console.log('----------hiding everything');
GM_addStyle ( "div.dashboard.dashboard-left, div.content-main.top-timeline-tweetbox, div.dashboard.dashboard-right{ display:none; }" );
}
if($('input.hideclickbaityn').is(':checked'))
{
console.log('----------hiding clickbait');
GM_addStyle ( "div.js-nav.trend-item-stats {display:none;}" );
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment