Reading Deleted Posts February 7, 2007 12:29 PM   Subscribe

My old method of reading deleted posts (so sue me... it's entertaining) doesn't seem to work. I used to use the following javascript I picked up somewhere (inside):

Is there a new way to do this?
posted by jpburns to Bugs at 12:29 PM (22 comments total) 1 user marked this as a favorite


javascript:void(A=document.getElementsByTagName('a'),N=[],M=[],f=');for(i=0;i%3CA.length;i++){%20void(h=A[i].href,p=h.indexOf('/mefi/'));%20if(p!=-1%20&&%20h.indexOf('%23')==-1%20&&%20A[i].parentNode.tagName.toLowerCase()=='span'){%20void(k=h.substring(p+6,h.length),N[N.length]=k,M[k]=1)}}%20for%20(i=N[0];%20i%3EN[N.length-1];%20i--)%20{%20if%20(!M[i])%20f%20+=%20'%3Ca%20target=_blank%20href=http://www.metafilter.com/mefi/'+i+'%3E'+i+'%3C/a%3E\n';%20}%20void((W=window.open()).document.write('Deleted%20threads:%20'%20+%20f));%20void(W.document.close());


posted by jpburns at 12:30 PM on February 7, 2007


What's really entertaining is breaking the front page of MetaTalk.
posted by carsonb at 12:31 PM on February 7, 2007


Haha, that is quite entertaining.
posted by Mister_A at 12:32 PM on February 7, 2007


jpburns: it probably has something to do with this.
posted by carsonb at 12:33 PM on February 7, 2007


STOP BREAKING THINGS :(
posted by boo_radley at 12:36 PM on February 7, 2007


try this. or you could just check out my last post. silly goose!
posted by Mach5 at 12:38 PM on February 7, 2007


Is there any reason this script couldn't be modified to work with the new scheme? I use the same bookmarklet, and I miss it.
posted by cortex at 12:45 PM on February 7, 2007


MORE COWBELL WHITE SPACE!
posted by Kirth Gerson at 12:47 PM on February 7, 2007


I have no idea what javascript even is, but scanning that line of code I see what looks like it might be an extra /meta tucked in there near the end.

javascript:void(A=document.getElementsByTagName('a'),N=[],M=[],f=');for(i=0;i%3CA.length;i++){%20void(h=A[i].href,p=h.indexOf('/mefi/'));%20if(p!=-1%20&&%20h.indexOf('%23')==-1%20&&%20A[i].parentNode.tagName.toLowerCase()=='span'){%20void(k=h.substring(p+6,h.length),N[N.length]=k,M[k]=1)}}%20for%20(i=N[0];%20i%3EN[N.length-1];%20i--)%20{%20if%20(!M[i])%20f%20+=%20'%3Ca%20target=_blank%20href=http://www.metafilter.com/'+i+'%3E'+i+'%3C/a%3E\n';%20}%20void((W=window.open()).document.write('Deleted%20threads:%20'%20+%20f));%20void(W.document.close());

Would that work?
posted by carsonb at 12:58 PM on February 7, 2007


I broke it on the inside instead of the outside.
posted by jessamyn (staff) at 1:02 PM on February 7, 2007


The URL went from:

http://www.metafilter.com/mefi/12345

to

http://www.metafilter.com/12345/foo

you just need to tweak the js to check the ID one / ahead. I can't read the js, but in CF, I split URLs into arrays, and I used to grab the ID from the 2nd position, now I just do it from the 1st (if you imagine them as http://mefi.com/first/second/third/etc)
posted by mathowie (staff) at 1:13 PM on February 7, 2007


Metatalk: we break it on the inside instead of the outside.
posted by rossination at 3:05 PM on February 7, 2007


*cough*
posted by Rhomboid at 3:49 PM on February 7, 2007


Yeah, Rhomboid's Greasemonkey works a treat for seeing deleted threads. A++, would use to gawk at deleted threads again.
posted by rossination at 4:37 PM on February 7, 2007


SCREWWHITESPACEandtheshiftkey
posted by YoBananaBoy at 9:30 PM on February 7, 2007


you broke MetaTalk's innards
posted by matteo at 1:09 AM on February 8, 2007


What about us poor Safari folks?

I was just hoping that someone had already solved this problem ... maybe... the person who originally wrote that block of JavaScript...??

I guess I can try to fix the JS, but I didn't write it, and find it tough to parse.
posted by jpburns at 4:05 AM on February 8, 2007


Mach5: "try this. or you could just check out my last post. silly goose!"

Userscripts.org is totally busted. It won't let me upload a fixed version, or even link to one off-site. Boo on that. Here's the fixed version I made, hosted, and then failed to publicize in any way whatsoever before seeing Rhomboid's fix. Looks like both fixes are roughly equivalent, but mine's less RegExpy.

*Cuts a corner off my Nerd 'N' Chip card*

Related, here's a fixed version of Mefi contact contributions that indicates nearby Mefites (the little house icons) again.
posted by Plutor at 5:03 AM on February 8, 2007


I second the request for a shorter, boomarklet-type piece of code to do this. The old bookmarklet worked a treat. Nerds, please hope us!
posted by bcwinters at 8:52 AM on February 9, 2007


thirded.
posted by quonsar at 2:03 PM on February 9, 2007


Okay then, try this one, which is just the greasemonkey script in bookmarklet form:

javascript:(function(){var%20xpath=%22%2F%2Fdiv[@class=%27copy%27]%2Fspan[@class=%27smallcopy%27][a[contains(@href,%27%2Fuser%2F%27)%20and%20not(contains(@href,%27%2Fuser%2F17564%27))]]%2Fa[(contains(text(),%27%20comment%27)%20or%20contains(text(),%27%20answer%27))]%22;var%20candidates%20=%20document.evaluate(xpath,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var%20last=0;for%20(var%20cand=null,i=0;(cand=candidates.snapshotItem(i));i++)%20{var%20h=cand.href;var%20p=h.match(%2Fmetafilter\.com\%2F([0-9]+)\%2F%2F);if(p%21=null){var%20k=Number(p[1]);if((last%3E0)&&(k%3Clast-1)){var%20gp=cand.parentNode.parentNode;for(var%20j=last-1;j%3Ek;--j){var%20nt=document.createElement(%27div%27);nt.className=%22copy%22;var%20ntd=document.createElement(%27span%27);ntd.className=%22smallcopy%22;ntd.style.color=%22%23f99%22;ntd.style.marginLeft=%221em%22;var%20nta=document.createElement(%27a%27);nta.href=%27%2Fmefi%2F%27+j;nta.appendChild(document.createTextNode(j));ntd.appendChild(document.createTextNode(%22Deleted%20thread:%20%22));ntd.appendChild(nta);nt.appendChild(ntd);gp.parentNode.insertBefore(nt,%20gp);gp.parentNode.insertBefore(document.createElement(%27br%27),gp);}}last=k;}}})();


Note: I tested this with Firefox. I have no idea if it works on IE.
posted by Rhomboid at 6:50 PM on February 9, 2007


Thanks! It's clever, but doesn't seem to work in Safari.

Wah!

Thanks anyway...
posted by jpburns at 5:50 AM on February 10, 2007


« Older mattamyn gets it   |   What are the most favorited commetns? Newer »

You are not logged in, either login or create an account to post comments