The Un-Official Proxomitron Forum

Full Version: filter to strip presentation tags
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello:


could anyone please help me solve this task.

this is what is needed:

1) see if the URL matches a list of URLs in, say, restyle.txt;

2) if yes, strip all presentation markup;

3) display page according the stylesheet in, say, restyle.css


nothing fancy there. i'd just like to see certain pages in a better
format. something like verdana / tahoma, in black, against some
light-creme or gray background.

i'm sure some people have this covered in their setups.


thanks in advance.

marc
Not sure how 'effective' that would be...
For one, the "names" of the CSS-based line-items would need to be identical for every page in your .txt list of sites...

Below is a small portion of a .css style sheet open in another window at this very moment...

Code:
.fHL {font-size:12pt; font-family:Arial}
.fBT {font-size:12pt; font-family:Arial; font-weight:bold}
.fFP {font-size: 90%; font-family:ms sans serif,helvetica; font-weight:normal}
.fFL {font-size: 90%; color:#AAA5A3; font-family:ms sans serif,helvetica; font-weight:normal}
.fRC {color:#CC0000; font-size: 11px; font-family:verdana,helvetica; font-weight:bold}
.fCC {font-size: 11px; font-family:arial}
.fHT {font-size: 11px; font-family:arial; font-weight:bold}
.fOH {font-size: 11px; font-family:verdana,helvetica}
.fTT {font-weight:normal; font-size: 90%; font-family:ms sans serif,helvetica}.fSB {font-size:14px; font-family:verdana,helvetica,sans-serif; font-weight:bold; color:#000000}
.fST {font-size:14px; font-family:verdana,helvetica,sans-serif;}
.fLT {font-size: 11px; font-family:verdana,helvetica,sans-serif;}
.fLTW {font-size: 11px; font-family:verdana,helvetica,sans-serif; color: white; text-decoration:none; }
.fLB {font-size: 11px; font-family:verdana,helvetica,sans-serif; font-weight:bold;}
.fTH {font-size:11pt; font-family:verdana,helvetica,sans-serif; font-weight:bold;}
.fMH {font-size: 11px; font-family:verdana,helvetica,sans-serif; font-weight:bold;}

Sure, you can replace "their" style sheet with one of your own, but you need to keep all of the "names" the same for them to be 'applied' to the page...

I can insert that above .css into EVERY page that I visit, but if none of those pages "reference" fCC (number 6 in the above .css), then NOTHING will happen on the page that I inserted that .css into...

Sure, there are "fixes"...
I insert a .css into EVERY page that defines link formatting for visited links, .pdf links, .gif and .jpg links, javascript links, and mailto: links...

And then I disable all .css style sheets...

Or I use a "zap presentational html" bookmarklet that proves quite effective...
i understand. but there're simpler cases. like, say, a given page is formated with font tags. i presume some filter might strip this inline formatting, and then reapply a user-defined stylesheet to the background, p, h1-h6, and links.

am i wrong?
Sounds do-able, yes...

I guess I'd have to see the actual .css (and web page) to really know for sure...

Perhaps just insert your own .css into every page that defines links, p, h1-h6, and background as "!important;"...
What i'm doing is just blocking all original external stylesheets ...
Code:
[Patterns]
Name = "<link>: Cancel Styles on sel. Sites"
Active = TRUE
URL = "$TYPE(htm)$LST(foo)"
Bounds = "<link\s*>"
Limit = 256
Match = "(*rel=)\1$AV(stylesheet)\2"
Replace = "\1"alternate stylesheet"\2"
... and injecting my one.
I didn't need to remove the <style> blocks yet but that is probably easy: bounds=$NEST(<style,</style >) match=*.
I wouldn't bother about the other smallish style tags and attributes, unless they actually disturb the page layout *after* applying my user CSS.

sidki
sidki, i just checked out quickly your config, and well, yes, the stylesheet substitution feature is what i needed.

now Smile!, i have been using JD's advanced config for ages, and i'm not ready / willing (as of yet) to switch to a different config. if you could help incorporate the restyling feature into JD's advanced?

i can't figure out exactly what rule to copy from your config.

thanks so much in advance.
JD_Advanced already "inserts" a pre-defined .css script to every page...

Just edit JD's "prox-links.css" to incorporate the .css inclusions you are attempting to implement...
thing is, i want the changes to affect only the sites listed in restyle.txt - not _every_ page.
You can add that filter to my set, just add it and create the new list. Look in the Proxo helps files on how to create a list. Smile!

~JD
JD5000, what filter exactly are you referring to? the stylesheets must also go to some folder. which one?

thanks.
Based on sidki's, I would think...

Code:
[Patterns]
Name = "<link>: Cancel Styles on sel. Sites"
Active = TRUE
URL = "$LST(CustomCSS)$TYPE(htm)"
Bounds = "<link\s*>"
Limit = 256
Match = "*rel=$AV(stylesheet)*"
Replace = "<link type="text/css" rel="stylesheet" href="http://local.ptron/CustomCSS/Custom.css" />    "


Then the stylesheets would go in the html folder.

<prox dir>/html/CustomCSS/Custom.css

HTH

~JD
Sidki, just reminded me. If they have more then one CSS file (Alternate displays), yours will be injected more then once.
thanks, JD5000. in sidki's config it's handled in a rather cool way - i can assign a particular CSS to each given site:

Code:
# use a local stylesheet      $SET(usercss=CSS_NAME)
# CSS_NAME can be one of the 3 included W3C Core Styles:
# chocolate, oldstyle, or steely-mod
# -----------------------------------------------------------------------------
white.sakura.ne.jp/~piro/      $SET(usercss=chocolate)

how could i achive the same effect with your config?

thanks so much.
Can't be done right now. In the new set, should be able to do it the same way. Smile!
ok, let's see what i did and where it went wrong.

[ i am modifying JD_advanced config. ]

1) created a list named CustomCSS.txt, added this line there -

Code:
http://www.geocities.com/srl_list/

and put it into <prox dir>/Lists/JD_Lists/Misc Lists/

so the path to the newly created list is -

<prox dir>/Lists/JD_Lists/Misc Lists/CustomCSS.txt

great.

2) added the list to proxomitron's lists through configure > block lists > add. the list is called "CustomCSS".

3) inserted the code supploed by JD5000 earlier in this thread

Code:
[Patterns]
Name = "<link>: Cancel Styles on sel. Sites"
Active = TRUE
URL = "$LST(CustomCSS)$TYPE(htm)"
Bounds = "<link\s*>"
Limit = 256
Match = "*rel=$AV(stylesheet)*"
Replace = "<link type="text/css" rel="stylesheet" href="http://local.ptron/CustomCSS/Custom.css" /> "

saved default config. reloaded proxomitron. cleared cache.

went to http://www.geocities.com/srl_list/index.html - no changes.

where did i go wrong?

thanks so much.
Pages: 1 2
Reference URL's