Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Good idea. This prints jobs sorted:

    function hideAllExcept(searchRegex) {
        var allComments = Array.from(document.querySelectorAll('.comment-tree .comtr'))
            .map(function(e){e.style.display='none';return e});
        var topLevelComments = allComments.filter(e=> e.querySelector('img[width="0"]'));
        var matchedComments = topLevelComments.filter(e=> 
            (e.style.display = searchRegex.test(e.querySelector('.comment').innerText) ? 'table-row' : 'none')=='table-row');
        return 'Showing '+(matchedComments.length+'').padStart(3, ' ')+' out of '+topLevelComments.length+' jobs for '+searchRegex;
    }

    [
    /\b(Rust)\b/i,
    /\b(Java)\b/i,
    /\b(Scala)\b/i,
    /\b(Kotlin)\b/i,
    /\b(Swift)\b/i,
    /\b(Ruby)\b/i,
    /\b(Python)\b/i,
    /\b(PHP|PHP5|PHP7)\b/i,
    /\b(JS|JavaScript)\b/i,
    /\b(React|ReactJS)\b/i,
    /\b(Angular|Angular5|Angular6)\b/i,
    /\b(Vue|VueJS)\b/i,
    /\b(Node|NodeJS)\b/i,
    /\b(Go|GO|Golang|golang|GOLANG)\b/,
    /C#/i,
    /\bC\b|C\+\+/i,
    /\bHaskell\b/i,
    /\bErlang\b/i,
    ].map(hideAllExcept).sort().join('\n');


Thanks that's great I just put .reverse() after sort() to have it in descending order probably didn't say that in my original comment. Also if you're interested though I don't know how you'd apply it in this case, there is a chrome extension(cjs) where you can run javascript per page. Not sure how you'd apply it here though, maybe make a popup dialogue but mostly the url matching part as the urls don't exactly make sense eg. just numbers.

Anyway thanks pretty useful function




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: