different comments order in opera/chrmoe browser fix

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    different comments order in opera/chrmoe browser fix

    the problem is in the core_min.js, but im not very good in javascript so i made my life easier doing it in php.

    here is a fix:

    open include/functions_general.php

    add this code to it:

    PHP Code:
    function browser_detection$which_test ) {

        
    // initialize the variables
        
    $browser '';
        
    $dom_browser '';

        
    // set to lower case to avoid errors, check to see if http_user_agent is set
        
    $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower$_SERVER['HTTP_USER_AGENT'] ) : '';

        
    // run through the main browser possibilities, assign them to the main $browser variable
        
    if (stristr($navigator_user_agent"opera")) 
        {
            
    $browser 'opera';
            
    $dom_browser true;
        }

        elseif (
    stristr($navigator_user_agent"msie 4")) 
        {
            
    $browser 'msie4'
            
    $dom_browser false;
        }
        
        elseif (
    stristr($navigator_user_agent"chrome")) 
        {
            
    $browser 'chrome'
            
    $dom_browser true;
        }
        
        elseif (
    stristr($navigator_user_agent"msie")) 
        {
            
    $browser 'msie'
            
    $dom_browser true;
        }

        elseif ((
    stristr($navigator_user_agent"konqueror")) || (stristr($navigator_user_agent"safari"))) 
        {
            
    $browser 'safari'
            
    $dom_browser true;
        }

        elseif (
    stristr($navigator_user_agent"gecko")) 
        {
            
    $browser 'mozilla';
            
    $dom_browser true;
        }
        
        elseif (
    stristr($navigator_user_agent"mozilla/4")) 
        {
            
    $browser 'ns4';
            
    $dom_browser false;
        }
        
        else 
        {
            
    $dom_browser false;
            
    $browser false;
        }

        
    // return the test result you want
        
    if ( $which_test == 'browser' )
        {
            return 
    $browser;
        }
        elseif ( 
    $which_test == 'dom' )
        {
            return 
    $dom_browser;
            
    //  note: $dom_browser is a boolean value, true/false, so you can just test if
            // it's true or not.
        
    }

    now open misc_js.php
    find elseif($task == "comment_get")

    and inside this find and replace:
    PHP Code:
      $response_array = array(
        
    'total_comments'  => (int) $total_comments,
        
    'maxpage'         => (int) $page_vars[2],
        
    'p_start'         => (int) ($page_vars[0]+1),
        
    'p_end'           => (int) ($page_vars[0]+count($comments)),
        
    'p'               => (int) $page_vars[1],
        
    'comments'        => array()
      ); 
    with

    PHP Code:
    $browser browser_detection('browser');
    $response_array = array(
        
    'total_comments'  => (int) $total_comments,
        
    'maxpage'         => (int) $page_vars[2],
        
    'p_start'         => (int) ($page_vars[0]+1),
        
    'p_end'           => (int) ($page_vars[0]+count($comments)),
        
    'p'               => (int) $page_vars[1],
        
    'comments'        => array(),
        
    'browser'         => $browser
      
    ); 
    now open include/js/core_min.js

    find
    PHP Code:
    r.inject(g); 
    and replace with

    PHP Code:
                if(b.browser=='opera'||b.browser=='chrome')
                {
                    
    r.inject(g'top');
                }else
                {
                    
    r.inject(g'bottom');
                } 
    DONE!!!
    Advertise your mobile site for FREE with AdTwirl

Working...
X