Solved

Adding code to css file to block add(s)

Posted on 2010-11-12
18
705 Views
Last Modified: 2013-12-07
Hello

I am looking to add a string to my css sheet to block the newiest add that has appeared on my MFL, NEWS, page. I have attached the strings I added to my css to block adds up to this point, however MFL just released some new adds, and I havent had luck blocking them via css yet.

I do not want to use FireFox and add blocker to block the adds, rather have css block them for all browsers.

Please review the current code that removes adds, and then the new page link I want removed.

Here is the area (NEWS) then players name, that has the NEW adds at the bottom of the page, they are BING adds.

http://football10.myfantasyleague.com/2010/view_news_article?L=39492&ID=680928KFFL

 adremoval-1-.css Newiest-MFL-add-source-code..txt
0
Comment
Question by:sticks2u
  • 10
  • 6
  • 2
18 Comments
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 34129558
Strangest use of CSS I have ever seen.  Perhaps the new code is not working because you are using javascript rather than CSS -- at least that looks like what the second file does.  Why not stick to CSS?

BTW, I think you mean ADS  in your description.  ADD is a verb, not a noun.  AD = advertisement

You are aware that the AdBlock data file can be imported and exported to other browsers, which is what I do between Mozilla and Firefox.  That doesn't help IE, but then nothing much can, it is too quirky.
0
 

Author Comment

by:sticks2u
ID: 34129619
That CSS snippet is part of a larger CSS file.

Not looking for add blockers via add-INS, per my post.

The second file is the source code I want to block by CSS, it might be a java add I don't know, but my code is CSS..I can assure that.

If you don't know CSS, thanks I will keep post alive.
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 34129636
From your second file, THIS is javascript --

<script> document.write('<scr' + 'ipt src=http://ad.doubleclick.net/adj/myfantasyleague.fsv;kw=bing;sz=1x1;ord=' + Math.floor(Math.random()*9999999999+1) + '?></scr' + 'ipt>'); </SCRIPT>

0
 

Author Comment

by:sticks2u
ID: 34129644
Ok all I know that it's a bing add, it might be java, like I said I don't know.

I want to block the add, via CSS, attached is my CSS string that I am using to block most adds already, but this new BING add I just can't get it blocked.
0
 

Author Comment

by:sticks2u
ID: 34132768
bump
0
 
LVL 22

Expert Comment

by:remorina
ID: 34133322
Hi sticks2u,
I can't seem to find any adds on the link you have posted, I presume you have already worked it out ?

Let me know if you still need any help

Cheers!
0
 

Author Comment

by:sticks2u
ID: 34133345
No sir the new ADD is still present, if you click on the top URL link, player news, you will see the BING ADD at the bottom page, it is that ADD I want CSS to block ..any help appreciate
0
 
LVL 22

Expert Comment

by:remorina
ID: 34133541
sticks2u:
Pardon my ignorance, I've revisited the link and I still can't seem to find a BING link, I'm sure I'm missing something so bear with me.

I've attached the screen capture for the the result I'm getting below.


capture.gif
0
 

Author Comment

by:sticks2u
ID: 34133586
Hey Remorina:

I dont know if your using ADD BLOCK add on for FF, but my IE 8 and FF (without addblock) shows the add.

See my attachment.

Add block FF plug in will kill the add...however I am trying the css kill route and it has been great for all the adds so far, up till this new one. FireFox Capture
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 22

Expert Comment

by:remorina
ID: 34133812
@ sticks2u:
I am not using any Ad blocker and this was driving me crazy since I've tried it on all borwsers (IE6,7,8,FF, Safari, Chrome and Even Opera) till I figured out that it doesn't show except for United States and since I'm in Australia it simply didn't come up until I used a US proxy, very interesting.

Now to achieve what you need, it won't be easy and I'm still not sure if it would be possible for you or not, but the Ad seems to render without any IDs or Class names, so in order to disable it we will try the following

The row in which has the AD is rendered inside a table that has a class report, that table seems to have only 2 other rows, one which has the class "oddtablerow" and the 1st one which has no class, I presume this is done for the Alternate row styling.

If you are able to assign a class name for the 1st row which has the date as I've done in the attached image below, I gave it the classname "newstitle" it can be "newsdate" or anything else you like, this would leave us with only 1 table row which doesn't have a classname and that is the one we want to get rid of.

We can then hide all the cells of the table class="report" then show back the ones with the classes we have assigned which are "newstitle" and "oddtablerow" using the below CSS
table.report tr.oddtablerow td, table.report tr.newstitle td {
display:table-cell;
}
table.report tr td {
display:none;
}

Open in new window


However, you might need to make sure this table class is not used elsewhere or this would affect all pages using the table with class="report", also if additional rows were to be present additional handling might be required.

I understand that in this particular situation it might not be possible to easily add classes or modify the structure, but unfortunately that will be the only way to handle it since there is no way we can specifically target the Ad row.

Alternatively you can sacrifice the news publishing date which is in the 1st row, and the above CSS will still hide the ad row along with the 1st row containing the Publishing date.

Hope this helps

Cheers!   code preview
0
 

Author Comment

by:sticks2u
ID: 34133913
Hey Remorina:

I dont know much css but I pasted your code above to my section of the css that I have labeled BLOCK ADDS, and when i uploaded it to my site, it basically shut my site down...it wouldnt display any content (blocked the whole site LOL)

had a heck of a time getting the old css back uploaded because it was blocking some text for me to see...

Here is what I pasted.

table.report tr.oddtablerow td, table.report tr.newstitle td {
display:table-cell;
}
table.report tr td {
display:none;
}


I do not understand your image code-capture or if I was to do anything with that or not. What you can do is go to myfantasyleague.com and make a league, they are free...upload my css section above (notepad) that blocks most the ADDS and try to add your new string of css to finalize this BING block if you have time to mess with it.

It is late here and I will be back at it tomorrow monday.

Thanks for your work so far, and using the proxy to see the ADD itself....

I think I am finding little support from all my friends by css because like you said it doesnt call out in CSS ID or class names.....

ok will talk later.
0
 
LVL 22

Expert Comment

by:remorina
ID: 34134001
Hi sticks2u:
Apologies about that, didn't realize most of the site would be using the same table class!

From your post above it would appear that you don't have any control over the code of the site since you just have an account on the portal, I have tried to quickly set up one, but it's seems it's a long process and it reequires a lot of info that I have no clue about.

However, taking another quick look, it seems that the site is basically built on table structure, and I haven't found any divs within the table report except those ones for the Ads.

I have tried the below CSS which seemed to work, but again you might need to double check if it affects any other section of the site, as what we're doing is hit and cross your fingers since there's still no way we can specifically target only the section of the Ad but this one might seem a bit more promising, hopefully  :-)

try adding the below and check it out.

table.report td > div {
display:none;
}

Open in new window


I'm also off duty now and probably won't be back before around 6pm your time

Cheers!
0
 

Author Comment

by:sticks2u
ID: 34136110
Remorina: Ok tried your latest code, and it did remove the ADDS.....I went to check out the rest of the site for other new erros....All looked ok....but now the front page scoreboard is NOT working.

I have included a shot of it, the code that goes in the home page module....and the handshake code for the CSS so you can see if your code is clashing with it.

Good work so far!!! scoreboard working css-scoreboard-code.txt scoreboard-script.txt
0
 
LVL 22

Accepted Solution

by:
remorina earned 500 total points
ID: 34137506
Hi sticks2u,
I've checked the page, seems it uses the class report and the scoreboard is contained in a div which would probably conflict.

Try adding the following class as well in addition to the one from my last post.
table.report td > div#ticker {
display:block;
}

Open in new window


So that you have both as below

table.report td > div {
display:none;
}
table.report td > div#ticker {
display:block;
}

Open in new window


And see if this fixes your homepage.

Cheers!
0
 

Author Comment

by:sticks2u
ID: 34138595
Remorina: Your efforts are relentless, your attention to detail is spot on!!!

YES IT WORKED  :) YEPPIE....and my scoreboard works also.

I would like to have you work on my css issue that pop up from time to time, your the best!

I will continue to watch the site for any clashes in code, but as far as I can tell we are golden.

Thank you
Sticks2u
0
 

Author Closing Comment

by:sticks2u
ID: 34138613
Remorina understands and listens, then he focuses on the main issue for a resolution.

What an asset to Expert Exchange!!!

Thank you again.
Sticks
0
 
LVL 22

Expert Comment

by:remorina
ID: 34141098
Awesome, and I'm glad it worked, I was in doubt at some stage :-)

Thank you very much Sticks for the encouraging words.

It's rewarding to see someone happy after giving a hand.

All the best,
Ray
0
 

Author Comment

by:sticks2u
ID: 34141333
No thank you!....u got mail also  :)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now