Hide links based on content date

Subscribe to Hide links based on content date 6 posts, 3 voices

 
wmblewett Scriptwright

I'd like to get a script that is WAY over my head...

here's what I'd like it to do

1. get todays date...
2. convert it to MM/DD/YYYY
3. analyze a page full of links, all of which contain a date, amongst other things
4. if the date contained in the link has passed, hide the link.

The links don't have names or id's... they're all on their own < p > ... they have other text in the < a > < /a > other than just the date. All of the dates are wrapped in parenthesis as either (expires MM/DD/YYYY) or (expired MM/DD/YYYY)

Is this something that can be done? And more importantly, is there a kind soul out there willing to put it together for me?

 
Mikado Scriptwright

Nothing hard there, if you gave the link.

 
wmblewett Scriptwright

http://www.classicheartland.com/sweepstakes/swe...

 
RunningBlind Scriptwright

Instead of getting today's date and converting it to that format, wouldn't it just be easier to look if the expiration date says "expired" instead of "expires"?

i.e. Hide all paragraphs that have "expired "in that little parenthetical expression.

 
Mikado Scriptwright

I see no need to check the date since all the links that contain date before today also contain "expired" word. So:

for (var xp = document.evaluate('//p[contains(font/a,"expired")] | //p[contains(a/font,"expired")]', document, null, 6, null), x, i = 0; x = xp.snapshotItem(i); i++)
x.style.display = 'none';

 
wmblewett Scriptwright

ya... good thinking... I never thought of that... thanks a lot Mikado... that was a far simpler script than I imagined it would be.