Post Reply 
Correct link targets (site-specific, list-based)
Nov. 03, 2012, 04:35 PM (This post was last modified: Nov. 03, 2012 06:31 PM by duebel13.)
Post: #1
Correct link targets (site-specific, list-based)
Hello,

for some hours I've been fighting with this new thingy:

Code:
Name = "Links: Correct Target (Site-specifc, HTML) [dbl]"
Active = TRUE
Multi = TRUE
URL = "$TYPE(htm)$LST(CorrectLinkTargets-S)"
Bounds = "$NEST(<a\s,>)"
Limit = 512
Match = "\2( target=$AV(\4)|)(\3)>"
        "&"
        "*href=$AV(($TST(href)*)\5)"
        "&"
        "((^$TST(target=*))($TST(\5=*.(7z|zip|rar|exe|msi|pdf|tgz|gz|rpm|iso)(\?*|))"
        "$SET(1=_self)|$SET(1=_blank))|$SET(1=$GET(target)))"
Replace = "\2\3 target="\1">"

Given initial list:
Code:
www.ebay.(de|com|co.uk)/[^\?]++/i.html         $SET(href=/itm/)
*/forumdisplay.php                             $SET(href=showthread.php)

This will open the matched links in new tabs in eBay item lists and in this forums. I could also add $SET(target=_self) to any line to force page opening in same page. The filter also contains some code to force download links to not open in a new page.

Questions that puzzle me / things I couldn't get to work:

1.) The initial idea was to use positional variables instead of global variables but I've actually given up on this. Basically, what I originally intended was using $SET(0= instead of $SET(href=, and $SET(1= instead of $SET(target= in the list. But positional variables always expanded to nothing, wether I was using \0 or $TST(\0). Any idea what I might be missing?

2.) I'd like to use matching in the href part of the lists. For example:
Code:
*/forumdisplay.php                             $SET(href=*/(show|view)thread.php)

But as soon as I do this, the filter will no longer match.

I' really stuck and would appreciate any help. Thanks.
Add Thank You Quote this message in a reply
Post Reply 


Messages In This Thread
Correct link targets (site-specific, list-based) - duebel13 - Nov. 03, 2012 04:35 PM

Forum Jump: