Post Reply 
filter to strip presentation tags
Apr. 01, 2004, 06:30 PM
Post: #1
 
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
Add Thank You Quote this message in a reply
Apr. 01, 2004, 07:43 PM
Post: #2
 
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...
Add Thank You Quote this message in a reply
Apr. 01, 2004, 07:51 PM
Post: #3
 
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?
Add Thank You Quote this message in a reply
Apr. 01, 2004, 08:47 PM
Post: #4
 
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;"...
Add Thank You Quote this message in a reply
Apr. 01, 2004, 09:08 PM
Post: #5
 
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
Add Thank You Quote this message in a reply
Apr. 01, 2004, 10:28 PM
Post: #6
 
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.
Add Thank You Quote this message in a reply
Apr. 01, 2004, 10:37 PM
Post: #7
 
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...
Add Thank You Quote this message in a reply
Apr. 01, 2004, 11:06 PM
Post: #8
 
thing is, i want the changes to affect only the sites listed in restyle.txt - not _every_ page.
Add Thank You Quote this message in a reply
Apr. 01, 2004, 11:19 PM
Post: #9
 
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

In Proxomitron we trust.
Add Thank You Quote this message in a reply
Apr. 01, 2004, 11:23 PM
Post: #10
 
JD5000, what filter exactly are you referring to? the stylesheets must also go to some folder. which one?

thanks.
Add Thank You Quote this message in a reply
Apr. 01, 2004, 11:30 PM
Post: #11
 
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

In Proxomitron we trust.
Add Thank You Quote this message in a reply
Apr. 01, 2004, 11:35 PM
Post: #12
 
Sidki, just reminded me. If they have more then one CSS file (Alternate displays), yours will be injected more then once.

In Proxomitron we trust.
Add Thank You Quote this message in a reply
Apr. 01, 2004, 11:35 PM
Post: #13
 
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.
Add Thank You Quote this message in a reply
Apr. 01, 2004, 11:37 PM
Post: #14
 
Can't be done right now. In the new set, should be able to do it the same way. Smile!

In Proxomitron we trust.
Add Thank You Quote this message in a reply
Apr. 02, 2004, 12:10 AM
Post: #15
 
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.
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: