Hide links based on content date
|
|
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...
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? |
|
|
Nothing hard there, if you gave the link. |
|
|
|
|
|
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. |
|
|
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';
|
|
|
ya... good thinking... I never thought of that... thanks a lot Mikado... that was a far simpler script than I imagined it would be. |
