1 (edited by 2010-10-27 18:08:49)

Topic: [BUG] IE8 and javascript

Name: IE8 and Javascript problem
Author: Damoor
CuteNews Compatibility: ALL CuteNews versions
Description: Well, many will have noticed that in Internet Explorer 8 a whole new set of Javascript rules apply. We don't feel this is a bug on behalf of CuteNews but a fault in the IE8 browser.
Meaning, many Javascript functions don't work anymore. For CN this has also it's consequences.
The only "fix" at the moment is telling IE8 to use the IE7 Javascript rules.
Even when you don't use CuteNews but do use Javascript on your site, it doesn't hurt to add this line of html code.
Instructions:
START EDIT:
Seems the original images.mdu still won't work after that. It does work for the advanced image module made by FI-DD.
END EDIT:
So open images.mdu (even if you're using a hack), compact.skin.php, default.skin.php and simple.skin.php
find all

<head>


add below or after, and not just between the head tags if you think you're smarter.

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

(even facebook uses this so it's bound to be good https://cutephp.com/forum/style_emoticons/default/wink.gif )

EDIT 2: It seems that inserting smilies doesn't work either in IE8 despite the above solution. A solution to this will be posted shortly.
At this point the latest CN version is 1.4.6. As long as this is true, I suggest using UTF-8 CuteNews. It's a spin-off that is more secure and it contains a fix for these Javascript problems.

in images.mdu (not hack) find

echo"
                      MYRTE=window.opener.document.getElementById(area).contentWindow;
                      window.opener.currentRTE=area; MYRTE.document.execCommand('InsertImage', false, '-my-temp-img-url-');
                      replacement = \"$config_http_script_dir/data/upimages/\" + selectedImage + \"\\\" alt=\\\"\" + alternativeText + \"\\\" border=\\\"\" + imageBorder + \"\\\" align=\\\"\" + imageAlign;
                      MYRTE.document.body.innerHTML = MYRTE.document.body.innerHTML.replace(/-my-temp-img-url-/gi,replacement);

                      ";

and replace with

MYRTE=window.opener.document.getElementById(area).contentWindow;
                                    window.opener.currentRTE=area; 
                      MYRTE.document.body.innerHTML += finalImage;

in addnews and editnews.mdu find

function preview(){

add above

function insert_smilie( ttarget, url, name )
    {    
        url = \"[img]\[/img]\";
        insert_HTML( ttarget, url );
        
    }
    function insert_HTML( ttarget, html )
    {
        MYRTE=document.getElementById(ttarget).contentWindow;
    currentRTE=ttarget; 
      MYRTE.document.body.innerHTML += html;
}


in functions.inc.php find

function insertSmilies($insert_location, $break_location = FALSE, $admincp = FALSE, $wysiwyg = FALSE)
{
    global $config_http_script_dir, $config_smilies;

    $smilies = explode(",", $config_smilies);
        foreach($smilies as $smile)
        {
        $i++; $smile = trim($smile);
              if($admincp){
                    if($wysiwyg){
//                       $advanced_smile = "<img alt=\':$smile:\' src=\'data/emoticons/$smile.gif\' />";
  //                     $output .= "[url= onclick=\]<img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" />[/url]";
                       $output .= "[url= onclick=\]<img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" />[/url]";

                    }
                    else{ $output .= "[url= onclick=\]<img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" />[/url]"; }
              }else{
                    $output .= "[url=]<img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" />[/url]";
              }
                if($i%$break_location == 0 and $break_location)
                {
                        $output .= "
";
                }else{ $output .= " "; }
    }
        return $output;
}

replace with

function insertSmilies($insert_location, $break_location = FALSE, $admincp = FALSE, $wysiwyg = FALSE)
{
    global $config_http_script_dir, $config_smilies;

    $smilies = explode(",", $config_smilies);
        foreach($smilies as $smile)
        {
        $i++; $smile = trim($smile);
              if($admincp){
                    if($wysiwyg){
//                       $advanced_smile = "<img alt=\':$smile:\' src=\'data/emoticons/$smile.gif\' />";
  //                     $output .= "[url= onclick=\]<img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" />[/url]";
                       $output .= "[url= onclick=\]<img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" />[/url]";

                    }
                    else{ $output .= "[url= onclick=\]<img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" />[/url]"; }
              }else{
                    $output .= "[url=]<img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" />[/url]";
              };
                if( isset($break_location) && (int)$break_location > 0 && $i%$break_location == 0 )
                {
                        $output .= "
";
                }else{ $output .= " "; }
    }
        return $output;
}

and make sure that in the above code the word javascript isn't split into 'java script'.