Author Topic: Indicator for Targeted Links  (Read 2327 times)

Arne

  • Administrator
  • Hero Member
  • *****
  • Posts: 778
    • ICQ Messenger - 1448105
    • AOL Instant Messenger - aflaaten
    • Yahoo Instant Messenger - arneflaa
    • View Profile
    • http://
    • Email
Indicator for Targeted Links
« on: December 17, 2001, 10:06:58 AM »
Mona has made this great filter:

[Patterns]

Name = "Add
  • or [T] to Targeted Links"

Active = FALSE
Multi = TRUE
Bounds = "<as(^*target=$AV(_(top|self)))*</a>"
Limit = 512
Match = "1(target=$AV((_|)(blank|new)$SET(0=[T])|*$SET(0=
  • )))23>4</a>"

        "&(^*(<im(g|age)|<font size=-2><sup>[(T|+)]</sup></font>))"
Replace = "123>4<font size=-2><sup></sup></font></a>"

------------------8<-----------------------

Summary of How It Works:

First, the Bounds limits the match to <a></a> tags, and
cancels the filter if there's a target of _top or _self.

The Match captures everything up to a required "target=" in
variable 1.  It then checks the target's value for either
_blank (a definate new window), blank, _new, or new (common
names for new windows) and assigns variable 0 to "[T]" for a
confirmed new window target.  If the target attribute is
something else, then variable 0 is set to "
  • " -- which

*would* always be a new window at a non-framed site, but an
unconfirmed new window at a framed site as the target
could simply be another frame.

It then captures the entire target= attribute in variable 2,
the remainder of the <a*> tag in variable 3, the description
of the link (up to the end tag) in variable 4.

The next line in the Match cancels the filter if it's an
image link and also keeps the filter from recursing by
checking against either of the new indicators.

The Replace simply reconstructs the entire link with
the 1-4 variables and an end tag.  The rest of the Replace
is new material -- the indicator surrounded by its font
and superscript tags.



Best wishes
Arne
Imici username: Arne
Best wishes
Arne
Imici username= Arne