I recently written some code on Leetcode, it’s a really fantastic website. But it has no feature to let us hidden accepted problem.
So I write my own bookmarklet to do it. The repository is here: https://github.com/xcv58/toggle-leetcode-ac
The main part is:
(
function()
{
var filter = new RegExp("=\"ac");
var list=document.getElementById("problemList").childNodes[3].childNodes;
for (var i=1;i<list.length;i+=2){
if (filter.test(list[i].children[0].innerHTML)) {
if (list[i].style.display == "none") {
list[i].style.display="";
} else {
list[i].style.display="none";
}
}
}
return;
}
)();
Update by 20140927, I use jQuery to reimplement this and add toggle notac’s color feature:
(
function()
{
var color = $( ".notac" ).css("background-color");
if (color == "rgb(255, 255, 0)") {
$( ".notac" ).css("background-color", "");
} else {
$( ".notac" ).css("background-color", "yellow");
}
var current = $( ".ac" ).parent().parent().css("display");
if (current == "none") {
$( ".ac" ).parent().parent().css("display", "");
} else {
$( ".ac" ).parent().parent().css("display", "none");
}
return;
}
)();
I host this part on my Dropbox Public folder.
So you just need add this line of code as a bookmark:
javascript:(function(){document.body.appendChild(document.createElement('script')).src='https://dl.dropboxusercontent.com/u/4121165/js/toggle-display-leetcode.js';})();
or you can drag this to your bookmark bar.