nowfound

Life & fun · December 7, 2010

TC

Top Comment Highlighter

I wrote a quick and dirty script that I wanted to share with HN. This bookmarklet will put a border around the top 10 comments on any comments page so you can quickly see what comments other readers find valueable. Just create a new bookmark and copy the text below into the URL field.…

What it does

In the maker’s words, at launch

I wrote a quick and dirty script that I wanted to share with HN. This bookmarklet will put a border around the top 10 comments on any comments page so you can quickly see what comments other readers find valueable. Just create a new bookmark and copy the text below into the URL field. javascript:(function(){var%20s=document.createElement('script'),el=document.createElement('div'),b=document.getElementsByTagName('body')[0];var%20otherlib=false,startCounter=tryCounter=10,delay=250,msg='';s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js');el.style.position='fixed';el.style.height='32px';el.style.width='220px';el.style.marginLeft='-110px';el.style.top='0';el.style.left='50%';el.style.padding='5px%2010px%205px%2010px';el.style.fontSize='12px';el.style.color='#222';el.style.backgroundColor='#f99';if(typeof%20jQuery!='undefined'){msg='This%20page%20already%20using%20jQuery%20v'+jQuery.fn.jquery;}else{if(typeof%20$=='function'){otherlib=true;}%20document.getElementsByTagName('head')[0].appendChild(s);}%20var%20tryjQuery=function(){setTimeout(function(){if(typeof%20jQuery=='undefined'){if(tryCounter){tryCounter--;tryjQuery();}else{msg='Sorry,%20but%20after%20'+startCounter+'%20attempts,%20jQuery%20hasn\'t%20loaded';}}else{msg='This%20page%20is%20now%20jQuerified%20with%20v'+jQuery.fn.jquery;if(otherlib){msg+='%20and%20noConflict().%20Use%20$jq(),%20not%20$().';}var%20top%20=%20[];function%20sorter(a,%20b){return%20a[0]%20-%20b[0];}function%20process(i,%20el){%20var%20rating%20=%20parseInt($(el).text().split("%20")[0]);if%20(top.length%20<%2010){top.push([rating,%20el]);top%20=%20top.sort(sorter);}else%20if%20(rating%20>%20top[0][0]){top[0]%20=%20[rating,%20el];top%20=%20top.sort(sorter);}}function%20highlight(i,%20el){$(el).parent().parent().parent().css('border',%20'1px%20solid%20#FF6600');}var%20comments%20=%20$(".comhead%20>%20span");comments.each(process);$(top).each(highlight);}},delay);};tryjQuery();})(); A lot of the script is pulled from the jQuerify bookmarklet from the Learning jQuery blog(http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet/), so thanks to them for that code. Here's a link to what I wrote: https://gist.github.com/732292

Does the same job

all alternatives →

More life & fun this month

the category →
  • TL

    Life & fun · 10d ago · louisabraham.github.io

  • Photosynthesis fires two of your iPhone

    Life & fun · 28d ago · photosynthesis.camera

  • SoloUno310

    Take control of hair pulling, nail biting & skin picking

    Life & fun · 28d ago · solouno.io

  • Scroll through all 43,252,003,274,489,856,000 reachable Rubik's Cube permutations.

    Life & fun · 26d ago · everycube.alen.is

  • The Interactive 3D Encyclopedia

    Life & fun · 21d ago · expeditione.fun

  • Hi HN, I built Eigendrum, a web tool that solves the 2D wave equation for arbitrary shapes so you can hear what they sound like as drums. How it works: * Solves -∇²u = λu using finite element analysis (Kφ = λMφ) on a triangle mesh. * Validated to <0.1% error against closed-form solutions for circles (Bessel zeros) and rectangles. * Sound model factors in strike location, Rayleigh damping, and mallet width. * Includes Kac drums I & II to demonstrate identical sound spectra from different geometries. * No frameworks, build steps, or dependencies. Repo and tests:…

    Life & fun · 26d ago · baselashraf81.github.io

Launched alongside, December 2010

the whole month →