Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons

Reply
 
Thread Tools
Add Google Chrome to the is_browser() function Details »»
Add Google Chrome to the is_browser() function
Version: 1.00, by Lea Verou Lea Verou is offline
Developer Last Online: Jul 2012 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 3.7.2 Rating:
Released: 09-03-2008 Last Update: Never Installs: 24
Re-useable Code Code Changes Translations  
No support by the author.

About the is_browser() function

This modification will allow you to insert into templates code specific for Google Chrome (useful for correcting CSS issues that it has with box-shadow and opacity).

It obviously needs file edits, as there is no hook in there.

Should work for vB versions from 3.7.3 and below, although in very old versions, the code to find might slightly be different.

File: includes/functions.php

1. Find:
PHP Code:
'safari'    => 0
add above:
PHP Code:
'chrome'    => 0//added for chrome detection 
2. Find:
PHP Code:
        // detect safari
            # Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/74 (KHTML, like Gecko) Safari/74
            # Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/51 (like Gecko) Safari/51
            # Mozilla/5.0 (Windows; U; Windows NT 6.0; en) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3
            # Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3
            # Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3
        
if (strpos($useragent'applewebkit') !== false)
        {
            
preg_match('#applewebkit/(\d+)#'$useragent$regs);
            
$is['webkit'] = $regs[1];

            if (
strpos($useragent'safari') !== false)
            {
                
preg_match('#safari/([0-9\.]+)#'$useragent$regs);
                
$is['safari'] = $regs[1];
            }
        } 
Add below:
PHP Code:
        // detect Google Chrome
            # Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.14
        
if($is['webkit'] AND strpos($useragent'chrome') !== false)
        {
            
preg_match('#chrome/([0-9\.]+)#'$useragent$regs);
            
$is['chrome'] = $regs[1];
        } 
3. Find:
PHP Code:
if (strpos($useragent'gecko') !== false AND !$is['safari'] AND !$is['konqueror']) 
Change to:
PHP Code:
if (strpos($useragent'gecko') !== false AND !$is['safari'] AND !$is['konqueror'] AND !$is['chrome']) 

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 09-09-2008, 07:53 PM
S@NL - BlackBik's Avatar
S@NL - BlackBik S@NL - BlackBik is offline
 
Join Date: Jul 2004
Location: Netherlands
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks!
Was allready searching for this
Reply With Quote
  #13  
Old 09-09-2008, 10:32 PM
VeeDubZ VeeDubZ is offline
 
Join Date: Nov 2007
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

top mod
Reply With Quote
  #14  
Old 09-11-2008, 05:59 AM
TimberFloorAu's Avatar
TimberFloorAu TimberFloorAu is offline
 
Join Date: May 2008
Location: Brisbane
Posts: 2,264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed: But have not noticed any difference with Opacity ( perhaps Chrome just doesnt linke Reflections )
Reply With Quote
  #15  
Old 09-11-2008, 06:22 AM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TimberFloorAu View Post
Installed: But have not noticed any difference with Opacity ( perhaps Chrome just doesnt linke Reflections )
What do you mean?
This mod just lets you detect Chrome, its not a fix for any particular issue with it, but rather something you'll definately need when making such a fix.
Reply With Quote
  #16  
Old 09-11-2008, 07:33 PM
TimberFloorAu's Avatar
TimberFloorAu TimberFloorAu is offline
 
Join Date: May 2008
Location: Brisbane
Posts: 2,264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Michelle View Post
What do you mean?
This mod just lets you detect Chrome, its not a fix for any particular issue with it, but rather something you'll definately need when making such a fix.
Your Initial Post:

Quote:
This modification will allow you to insert into templates code specific for Google Chrome (useful for correcting CSS issues that it has with box-shadow and opacity).
Reply With Quote
  #17  
Old 09-11-2008, 07:43 PM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Exactly. It doesn't provide the exact code to insert, just the ability to do so.
Reply With Quote
  #18  
Old 09-11-2008, 10:44 PM
TimberFloorAu's Avatar
TimberFloorAu TimberFloorAu is offline
 
Join Date: May 2008
Location: Brisbane
Posts: 2,264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Michelle View Post
Exactly. It doesn't provide the exact code to insert, just the ability to do so.
You have lost me.

We use opacity on various mods within our sites, with the google chrome fix, you have created, it doesnt in any way make any difference to image opacity.
All image reflections, have opacity set as reflective properties.

Or perhaps I have missed the ghist of your initial statement...
Reply With Quote
  #19  
Old 09-11-2008, 11:19 PM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you actually read the is_browser() documentation that I provided a link to at the first post? Perhaps that will help you understand what this mod does.
Reply With Quote
Reply

Thread Tools

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 08:14 PM.


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.04348 seconds
  • Memory Usage 2,305KB
  • Queries Executed 25 (?)
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
  • (6)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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