Fark Anal Reverteresque ReDux

By Smiths Last update 10 hours ago — Installed 4,299 times.

Hey Smiths

in
Subscribe to Hey Smiths 3 posts, 2 voices



serial_crusher Scriptwright

Went and deleted my "remove t-shirt links" script since it was a hog and you were doing it anyhow. Noticed you had a post there saying you'd had to fix something in the "New stories" link? Go ahead and post the fix and I'll put it in.

Only bug I notice is that greasemonkey tries to run my new stories script twice; the first time fails, but then it runs fine. I guess the first one fails because the page hasn't finished fetching. No idea why GM is even running it then though.

 
Smiths Script's Author

Just noticed this comment.
Here's what I got:


// ==UserScript==
// @name Fark New Stories
// @namespace http://www.fark.com
// @description Marks new stories since the last time you looked at the fark main page.
// @include http://www.fark.com/
// @include http://www.fark.com/geek/
// @include http://www.fark.com/business/
// @include http://www.fark.com/sports/
// @include http://www.fark.com/showbiz/
// @include http://www.fark.com/politics/
// @include http://www.fark.com/video/
// @include http://www.fark.com/music/blender.html
// ==/UserScript==

// Get the last viewed headline
var lastHeadline = GM_getValue("lastHeadline" + location.href, "It's not news, it's fark.com!");

// Get all stories currently on the main page....
var allHeadlines = document.evaluate('//span[@class="headline"]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);;
// Loop through all headlines, embolden the new ones.
for(i=0; (i < allHeadlines.snapshotLength) && (allHeadlines.snapshotItem(i).innerHTML != lastHeadline); i++){
if (allHeadlines.snapshotItem(i).parentNode.parentNode.getElementsByTagName("a").item(1) != null)
{
j=1;
if (allHeadlines.snapshotItem(i).parentNode.parentNode.getElementsByTagName("a").item(1).href.indexOf('ordershirt.pl') > -1) j = 2;
comments = allHeadlines.snapshotItem(i).parentNode.parentNode.getElementsByTagName("a").item(j);
comments.innerHTML += " <b><font color=\"red\">*</font></b>";
}
}

// Set lastHeadline for next time
GM_setValue("lastHeadline" + location.href, allHeadlines.snapshotItem(0).innerHTML);

I add a red asterisk to the end of the comments. I have this new comment script ordered after the Anal Reverter script, so I guess it loads afterwards.

 
serial_crusher Scriptwright

Ah, so bug was in the changes you had previously made to put a red star after the link instead of making headlines green/bold.
I still prefer the green headline myself, so still leaving your changes out of the "official" version :)

I think fark took out the t-shirt links anyhow after enough people whined. Did a fresh install of windows recently and don't remember seeing it there before I got all my extensions setup.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel