6

My Bookmarklets for Stack Exchange is a collection of 20+ simple bookmarklets for specific tasks that could be done through the interface, but would take longer. Some of them use API, others parse the HTML source of SE pages. Since the full list is long, I give three examples below, including the code. More readable code is at the bottom of the page linked above. Tested under Firefox and Chrome.

Examples

Votes cast today: Displays the number of votes cast by you today, for each vote type.

javascript:(function()%7Bs%3D%7B'upvote'%3A0%2C'downvote'%3A0%2C'deletion'%3A0%2C'undeletion'%3A0%2C'closure'%3A0%2C'reopen'%3A0%7D%3Bm%3Dtrue%3Bd%3Dnew%20Date().getUTCDate()%3Bp%3Dnew%20DOMParser()%3Bw%3Ddocument.querySelector('.profile-me').href%2B'%3Ftab%3Dvotes%26sort%3Dall%26page%3D'%3Bj%3D1%3Bwhile%20(m)%20%7Bu%3Dw%2Bj%2B%2B%3Br%3Dnew%20XMLHttpRequest()%3Br.onload%3Df%3Br.open('get'%2Cu%2Cfalse)%3Br.send()%3B%7Da%3D%5B'up%2Fdown%3A%20'%2Cs.upvote%2Bs.downvote%2C'%5Cr%5Cnup%3A%20'%2Cs.upvote%2C'%5Cr%5Cndown%3A%20'%2Cs.downvote%2C'%5Cr%5Cnclose%3A%20'%2Cs.closure%2C'%5Cr%5Cndelete%3A%20'%2Cs.deletion%2C'%5Cr%5Cnreopen%3A%20'%2Cs.reopen%2C'%5Cr%5Cnundelete%3A%20'%2Cs.undeletion%5D%3Bwindow.alert(a.join(''))%3Bfunction%20f(e)%20%7Bx%3Dp.parseFromString(e.currentTarget.responseText%2C'text%2Fhtml')%3Bv%3Dx.querySelector('.history-table').firstElementChild.children%3Bfor%20(i%3D0%3Bi%3Cv.length%3Bi%2B%2B)%20%7Bif%20(v%5Bi%5D.querySelector('.date').title.substring(8%2C10)%3D%3Dd)%20%7Bs%5Bv%5Bi%5D.children%5B1%5D.textContent.split('(')%5B0%5D.trim()%5D%2B%2B%3B%7Delse%20%7Bm%3Dfalse%3B%7D%7D%7D%7D)()

Interesting unanswered questions: On the sites other than SO, the "interesting" sorting algorithm is implemented but not present in the interface. This bookmarklet invokes it, and then filters the results further by keeping only unanswered questions.

javascript:(function()%7Bp%3Dnew%20DOMParser%3Br%3Dnew%20XMLHttpRequest()%3Br.onload%3Dfunction(e)%20%7Bx%3Dp.parseFromString(e.currentTarget.responseText%2C'text%2Fhtml')%3Bl%3Dx.getElementById('question-mini-list')%3Bq%3Dl.children%3Bfor%20(i%3D0%3Bi%3Cq.length%3Bi%2B%2B)%20%7Bs%3Dq%5Bi%5D.firstElementChild.children%5B1%5D%3Bd%3Dq%5Bi%5D.querySelector('.relativetime').textContent%3Bt%3Dq%5Bi%5D.querySelector('a').textContent%3Bif%20(s.className!%3D'status%20unanswered'%7C%7Cd.indexOf('m%20ago')!%3D-1%7C%7Cd.indexOf('s%20ago')!%3D-1%7C%7Ct.indexOf('%5Bon%20hold%5D')!%3D-1%7C%7Ct.indexOf('%5Bclosed%5D')!%3D-1%7C%7Ct.indexOf('%5Bmigrated%5D')!%3D-1%7C%7Ct.indexOf('%5Bduplicate%5D')!%3D-1)%20%7Bq%5Bi%5D.style.display%3D'none'%3B%7D%7Dm%3Ddocument.getElementById('content')%3Bm.innerHTML%3Dx.getElementById('content').innerHTML%3BMathJax.Hub.Typeset(m)%3B%7D%3Bu%3D'%2F%2F'%2Bwindow.location.hostname%2B'%2F%3Ftab%3Dinteresting'%3Br.open('get'%2Cu%2Ctrue)%3Br.send()%7D)()

New questions with a downvote or a closevote: Shows the list of new questions with at least one downvote or closevote. Data presented as upvotes : downvotes : closevotes : title

javascript:(function()%7Bh%3D''%3Bu%3D'%2F%2Fapi.stackexchange.com%2F2.2%2Fquestions%3Fpagesize%3D100%26order%3Ddesc%26sort%3Dcreation%26key%3DfetJx5PJVUspEFsbpN9n1A((%26site%3D'%2Bwindow.location.hostname%2B'%26filter%3D!5RCKNPabixdwaF2)tI5y0XSqb'%3B%24.getJSON(u%2C%20function(e)%20%7Bq%3De.items%3Bfor%20(i%3D0%3Bi%3Cq.length%3Bi%2B%2B)%20%7Bif%20((q%5Bi%5D.down_vote_count%3E0%20%7C%7C%20q%5Bi%5D.close_vote_count%3E0)%20%26%26%20!(q%5Bi%5D.closed_date))%20%7Bh%3Dh%2B'%3Cdiv%20style%3D%22font-size%3A18px%3Bmargin%3A9px%3B%22%3E'%2Bq%5Bi%5D.up_vote_count%2B'%20%3A%20'%2Bq%5Bi%5D.down_vote_count%2B'%20%3A%20'%2Bq%5Bi%5D.close_vote_count%2B'%20%3A%20%3Ca%20href%3D%22'%2Bq%5Bi%5D.share_link%2B'%22%3E'%2Bq%5Bi%5D.title%2B'%3C%2Fa%3E%3C%2Fdiv%3E'%3B%7D%7Dx%3Ddocument.getElementById('content')%3Bx.innerHTML%3Dh%3BMathJax.Hub.Typeset(x)%3B%7D)%7D)()

You must log in to answer this question.