changeset 739:8802d6935b6f

use same browser compatibility detection as FCKeditor does internally
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 02 Jun 2006 21:48:03 +0200
parents 0631cda1fbf8
children 0ec051831d52 73850527064e
files docs/CHANGES wiki/htdocs/common/js/common.js
diffstat 2 files changed, 31 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/docs/CHANGES	Fri Jun 02 21:02:58 2006 +0200
+++ b/docs/CHANGES	Fri Jun 02 21:48:03 2006 +0200
@@ -89,6 +89,12 @@
     * fixed smiley caching bug (smileys didn't change theme)
     * fixed backtrace when user removed css_url entry from user_form_fields
 
+  Other changes:
+    * we use (again) the same browser compatibility check as FCKeditor uses
+      internally, too. So if GUI editor invocation is broken due to browser
+      compatibility issues or a wrong browser version check, please file a bug
+      at FCKeditor development or browser development.
+
 Version 1.5.current:
   Developer notes:
     * We switched to Mercurial SCM, see here for more infos:
--- a/wiki/htdocs/common/js/common.js	Fri Jun 02 21:02:58 2006 +0200
+++ b/wiki/htdocs/common/js/common.js	Fri Jun 02 21:48:03 2006 +0200
@@ -17,26 +17,33 @@
 }
 
 function can_use_gui_editor() {
-    var sAgent = navigator.userAgent.toLowerCase();
- 
-    if (sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 &&
-        sAgent.indexOf("opera") == -1 ) {
-        // Internet Explorer
-        var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1];
-        return ( sBrowserVersion >= 5.5 );
-    } else if (navigator.product == "Gecko" && 
-               navigator.productSub >= 20030210) {
-        // Gecko
-        return true;
+    var sAgent = navigator.userAgent.toLowerCase() ;
+
+    // Internet Explorer
+    if ( sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 && sAgent.indexOf("opera") == -1 )
+    {   
+        var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ;
+        return ( sBrowserVersion >= 5.5 ) ;
     }
-    // else if (sAgent.indexOf("safari") != -1 ) {
-    //    // Safari - build must be at least 312 (1.3)
-    //    return (sAgent.match( /safari\/(\d+)/ )[1] >= 312 );
-    // } 
-    else {
-        // Unknown browser, assume gui editor is not compatible
-        return false;
+    
+    // Gecko
+    if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 )
+        return true ;
+
+    // Opera
+    if ( this.EnableOpera )
+    {   
+        var aMatch = sAgent.match( /^opera\/(\d+\.\d+)/ ) ;
+        if ( aMatch && aMatch[1] >= 9.0 )
+            return true ;
     }
+    
+    // Safari
+    if ( this.EnableSafari && sAgent.indexOf( 'safari' ) != -1 )
+        return ( sAgent.match( /safari\/(\d+)/ )[1] >= 312 ) ;  // Build must be at least 312 (1.3)
+
+    return false ;
+
 }