Created
July 9, 2013 21:20
-
-
Save WillSullivan/5961396 to your computer and use it in GitHub Desktop.
Userscript that adds a checkbox to the questions page that removes ignored questions from your list.
This file contains 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
// ==UserScript== | |
// @name Remove ignored | |
// @namespace http://statestreetgang.net/ | |
// @version 0.1 | |
// @description enter something useful | |
// @match http://stackoverflow.com/questions | |
// @copyright 2012+, You | |
// ==/UserScript== | |
function exec(fn) { | |
var script = document.createElement('script'); | |
script.setAttribute("type", "application/javascript"); | |
script.textContent = '(' + fn + ')();'; | |
document.body.appendChild(script); | |
document.body.removeChild(script); | |
} | |
window.addEventListener("load", function () { | |
exec(function () { | |
if (typeof(localStorage) === 'undefined' ){ return; } | |
var name = 'removeIgnoredCheckbox', ignoredName = '.tagged-ignored', isChecked = (localStorage.getItem(name) || 'false') === 'true'; // fucking javascript bullshit fuck you | |
var butt = $('<input id="' + name + '" type="checkbox" title="clear ignored questions when checked" style="margin-top:2px;" />'); | |
$('#tabs').append(butt); | |
butt.prop('checked', isChecked) | |
butt.change(function () | |
{ | |
var newValue = $(this).is(':checked'); | |
$(ignoredName).slideToggle(300) | |
localStorage.setItem(name, newValue); | |
}); | |
if(isChecked) | |
{ | |
setTimeout(function(){ | |
$(ignoredName).slideToggle(300)//.detach().prependTo('#questions'); | |
}, 300); // shit happens too late. | |
} | |
}); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment