Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-23-2013, 10:06 PM
RedTurtle's Avatar
RedTurtle RedTurtle is offline
 
Join Date: May 2006
Location: California
Posts: 205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Change ad_thread_first_post_content CSS?

I am trying to get some code to show up when a user is using adblocker on my site.

The problem is that the vBulletin CSS for the template ad_thread_first_post_content keeps getting blocked by the adblock extension itself.

I am trying to rename the <div id="ad_thread_first_post_content"> to remove the word 'ad' (so that it does not get blocked by adblock) but when I rename that div ID and then make the changes to the css in vbulletin-chrome.css and in showthread.css (renaming all instances of #ad_thread_first_post_content in both files) and what ends up happening is that the entire template no longer loads on the showthread page.

Is there any correct way to rename this div and all the css references to it?

Thank you!
Reply With Quote
  #2  
Old 10-23-2013, 10:22 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1. The ad blocking software manipulates the DOM via java script. It looks for key identifiers in your page and manipulates the code accordingly.

2. Since that is an #ID you are dealing with, vbulletin might also be doing something dynamically with it.

Just hoping to give you something to look at. Unfortunately, I have never messed with the 'Ad' code in vbulletin. I would have to see exactly what you are trying to do, to be of any more assistance.
Reply With Quote
  #3  
Old 10-23-2013, 10:42 PM
RedTurtle's Avatar
RedTurtle RedTurtle is offline
 
Join Date: May 2006
Location: California
Posts: 205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks tbworld.

So you're right, adblock does find the div ID ad_thread_first_post_content and hides it dynamically.

However, if I was able to rename that ID to another one that did not include the word "ad" in it, then this would not be blocked (I have tested this theory with changing the ID in firebug).

So what I am trying to do now is make it so that I can change that ID permanently (versus just temporarily editing it with firebug). I am not sure what I need to do to make this happen.

Once I have the div renamed, I will then be able to have an alternate image show up in place of the ad that adblocker blocks.

Hope that makes sense...

Thank you.
Reply With Quote
  #4  
Old 10-23-2013, 11:05 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I will take a look at the ad-block code when I have a chance. Although they might target the word 'Ad' the determination to hide the block would not just rest on that trigger and would primarily be triggered by the 'content': the code would then manipulate the DOM by either finding a block element to hide or adding a block element as needed. Your test in firebug might not be accurate as the page has already been rendered via the browser.

I would be creating my own test page, place an ad on it and step through the 'ad-block' JavaScript.

I am pretty busy right now, but if you run into trouble let me know and I will try to make some time to get you back on track.
Reply With Quote
  #5  
Old 10-23-2013, 11:19 PM
RedTurtle's Avatar
RedTurtle RedTurtle is offline
 
Join Date: May 2006
Location: California
Posts: 205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tbworld View Post
Although they might target the word 'Ad' the determination to hide the block would not just rest on that trigger and would primarily be triggered by the 'content: then manipulate the DOM by either finding a block element to hide or adding a block element as needed.
Thanks for the response again. I'm sorry but I don't know what this means.

To show you what I am trying to do though here is my ad code that goes in the Manage Ads section of vB and is showing in the first post of a thread:

Code:
<div id="wrap">
<div class="ad">
<!--- GOOGLE AD CODE GOES HERE -->
</div>

<div id="test"></div>
</div>
What I am doing is that when the adblocker blocks the google ad, I then have some jQuery check to see if the ad class is visible or not. If the ad class is not visible (meaning adblocker has blocked the ad), I then append a css class to the div id "test". Making "test" into #test .adblocked instead.

The CSS class for .adblocked is set to display an alternate image asking the user to help support the site and disable adblock.

So <div id="test"></div> becomes <div id="test" class="adblocked"></div> when an adblocker is running.

Now this part works great, except for the fact that all this is happening inside the div id ad_thread_first_post_content. Because of the name of that div, everything inside it is being hidden by the adblocker and therefore my test div does not show up properly when an adblocker is being detected.

If I can change the name of <div id="ad_thread_first_post_content"> somehow, then I would be able to have my code work.

Thanks for your time.
Reply With Quote
  #6  
Old 10-24-2013, 01:29 AM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PM me your jquery code or if you have a link to your site with the code already on a page, that will do to. I will take a look at it later this evening.
Reply With Quote
  #7  
Old 10-24-2013, 01:58 AM
RedTurtle's Avatar
RedTurtle RedTurtle is offline
 
Join Date: May 2006
Location: California
Posts: 205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks tbworld. I will PM it to you. Really appreciate the help.
Reply With Quote
  #8  
Old 07-13-2017, 03:27 PM
Guest200915
Guest
 
Posts: n/a
Default

Have you got solution of this problem?
Reply With Quote
  #9  
Old 08-01-2017, 10:52 PM
webmastersun's Avatar
webmastersun webmastersun is offline
 
Join Date: Oct 2013
Location: www.webmastersun.com
Posts: 433
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RedTurtle View Post
Is there any correct way to rename this div and all the css references to it?
There are 2 ways:
- Search and replace.
- create a new div and copying styles from ad_thread_first_post_content to paste into another css file that you can control.
Reply With Quote
  #10  
Old 08-04-2017, 05:45 PM
noypiscripter's Avatar
noypiscripter noypiscripter is offline
 
Join Date: Jul 2013
Posts: 468
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why not just dynamically create the test div outside the ad_thread_first_post_content div using Javascript/jQuery? Since it is outside the ad div, then it will not be hidden. No need to rename the id.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:11 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08941 seconds
  • Memory Usage 2,251KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (9)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete