The Un-Official Proxomitron Forum
DOM container killer - Printable Version

+- The Un-Official Proxomitron Forum (https://www.prxbx.com/forums)
+-- Forum: Forum Related (/forumdisplay.php?fid=37)
+--- Forum: Proxomitron Program (/forumdisplay.php?fid=4)
+--- Thread: DOM container killer (/showthread.php?tid=177)



- z12 - Jul. 26, 2004 12:49 PM

Hi all,

After finding out about the issues with the $NEST command, I decided to review all my filters. The filters that I relied upon the most for $NEST, were for killing Table, TD, & Div elements. After trying several variations of the filters, and not being satisfied with the results, I decided that the best way to remove nested elements would be by using the DOM.

Thats when I remembered seeing the "DOM Banner Blaster" filter back when I upgraded to v4.5. Since I run my own config, I never got around to checking this filter out till now. So I extracted the filter & associated txt & js files and gave it a whirl.

I started by disabling my web filters that removed HTML tags. Things looked promising but it wasn't matching the way I wanted it to. After thinking about it for a while, I realized I didn't need the dom banner blaster web filter at all.

All I needed to do was use the replacement text from the banner blaster in my existing tag killers. So I modifed my tag killer filters, disabled the dom banner blaster filter but left the dom container filter enabled.

Since the DOM conatiner killer filter is still enabled, it silently removes left over junk that my web filters didn't get. However, it still wasn't doing as good a job as I thought it could, so I decided to take a look at the javascript.

I found a site to test, turned debug on in the container killer javascript and started testing. Some of the nodes that I thought should have been deleted were not since the score was too high. So I compared the calculated score to my manually calculated score. A child node array that should have been scoring about 13, was scoring 22. Upon investigation, it turned out that the total value was being (apparently) incorrectly initialised. I fixed this (tot=0Wink and looked at it some more.

By default, anchor tags get a score of 5. Since an anchor tag is being used in the replacement text when a web filter matches, this can have the undesired side effect of raising the score. Say you matched 2 anchors inside a TD. Both those anchors are replaced with new anchors that are both PDomTarget's. When the js examines the first anchor tag, it sees that the 2nd anchor tag is a sibling and adds 5 points to the score. This is not what we want since the 2nd anchor is only a dummy replacement. The solution is to modify the replacement text of the web filters, yet again.

Instead of using an anchor tag in the replacement text, I used this:
Code:
<proxo name="PDomTarget" title="\0:\9" />

Since the browser (firefox) doesn't know what a proxo tag is, it ignores it. The \0 & \9 in the title attribute are so I can see what tag was deleted & what matched my (custom) block list when I view the page source, They are not needed.

I also added a new case to the switch statement that gives the proxo tag a score of -10. This allows unmodified anchor tags to retain the +5 score but makes the proxo tag act like a text node that has one of the ad kewords in it. The best of both worlds.

The final tweak I made to the scoring routine was to exit the loop once the score got above the killscore. Since the node won't be deleted anyway, theres no sense in wasting time calculating an even higher score.

As a final note, I load the DOM container javascript before my end javascript. This way, my end js doesn't have to waste time dealing with nodes that aren't going to be there. To make things work right, I found I had to rem out the function call to PDomHide at the end of the container killer js and put it as the first call in my end javascript.

In Summary, if you want to revisit the dom container killer, do this:

-Fix the DOM container killer javascript
-Modify the replacement for web filters that delete html tags (or DOM Blaster if you use it)
-Enable the DOM container killer web filter

I will try to attach a annotated copy of the modified javascript. If you use it you need to rename it from .txt to .js
Also I changed the name of it to DomConKiller2. so adjust the name of the script in the DOM container killer web filter.

Comments welcome
Mike


- JakBeNymble - Jul. 27, 2004 01:15 AM

Hi "z12",
This little "proggie" can take care of the "DOM" feature. It's an exe.file, You don't have to install it, it doesn't create any dll.files, or make any registry changes. And You only use it to access the "services" that You want to "disable" and that's it. It doesn't run in the background. Smile!

Click Here for info. & d/l

Best Wishes,
"JaK" [smoke]


- Jaded_Goth - Jul. 27, 2004 02:42 AM

JaK,

I d/l the safeXP,and it flagged services which I know to be disabled.

How have you found it,so far?

I tried to remove my user name from the start panel,also-to no effect.Would you recommend it purely as a method of disabling the DOM feature,nothing else?


- Bold_Fortune - Jul. 27, 2004 02:45 AM

Aha, you'd like to remove your name from the Start Panel. Got it. Try This...


- Jaded_Goth - Jul. 27, 2004 02:53 AM

I just *knew* you'd know how to do that!

Actually,it's not my name perse-it's Cyril's.Think laterally,and you'll get what I mean.

Thanks,mate!


- z12 - Jul. 27, 2004 03:01 AM

Hi JakBeNymble,

Thanks for the reply & link, but I think I gave you the wrong impression when I said this:

"Since the DOM conatiner killer filter is still enabled, it silently removes left over junk that my web filters didn't get."

What I meant by "silently" was it doesn't fill proxo's log window with matches & "left over junk" is just the annoying text you sometimes see when a web filter does't quite get everything.

Sorry if I gave the wrong impression. The program you linked to looks interesting though Smile!

Thanks
Mike


- z12 - Jul. 27, 2004 03:11 AM

Hi all,

Maybe I gave the wrong impression. The DOM I'm refering to is the browsers Document Object Model. And no, I'm not trying to "Kill it", rather use it. With javascript, you can access the DOM and do some pretty cool stuff. In this case, using the dom to remove html element nodes like tables & divs & such.

Hope that clears things up.
Mike


- JakBeNymble - Jul. 28, 2004 06:17 AM

Hi "z12",
Yes, . . .I did mis-understand, . . .thankx for clearing it up for Me. Smile!
Best Wishes,
"JaK" Smile!