different comments order in opera/chrmoe browser fix

Started on the old forum in December 2010 · view the original in the archive · old links redirect here

No replies · 1,066 views · started 15 years ago · 2 min read

GumSlone Administrator Principal · 1,690 posts #1

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:

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:

  $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

$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

r.inject(g);

and replace with

            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

External image (may be gone)

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close