changeset 3959:8c04b4e35da3

browser compatibility check routine change with recent fckeditor's
author Byeongweon [tasyblue@gmail.com]
date Wed, 25 Jun 2008 19:18:40 +0900
parents 55444eae3fe5
children 4fb99140c7c6
files wiki/htdocs/common/js/common.js
diffstat 1 files changed, 27 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/wiki/htdocs/common/js/common.js	Wed Jun 25 18:33:07 2008 +0900
+++ b/wiki/htdocs/common/js/common.js	Wed Jun 25 19:18:40 2008 +0900
@@ -79,35 +79,36 @@
   }
 }
 
+// copy from fckeditor browser check code (fckeditor.js:298, function : FCKeditor_IsCompatibleBrowser)
 function can_use_gui_editor() {
-    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 ) ;
-    }
-    
-    // Gecko
-    if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 )
-        return true ;
+	var sAgent = navigator.userAgent.toLowerCase() ;
 
-    // Opera
-	// remove this.EnableOpera code to enable opera
-    if ( sAgent.indexOf("opera") != -1 )
-    {   
-        var aMatch = sAgent.match( /^opera\/(\d+\.\d+)/ ) ;
-        if ( aMatch && aMatch[1] >= 9.0 )
-            return true ;
-    }
-    
-    // Safari
-	// remove this.EnableSafari code to enable safari
-    if ( sAgent.indexOf( 'safari' ) != -1 )
-        return ( sAgent.match( /safari\/(\d+)/ )[1] >= 312 ) ;  // Build must be at least 312 (1.3)
+	// Internet Explorer 5.5+
+	if ( /*@cc_on!@*/false && sAgent.indexOf("mac") == -1 )
+	{
+		var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ;
+		return ( sBrowserVersion >= 5.5 ) ;
+	}
 
-    return false ;
+	// Gecko (Opera 9 tries to behave like Gecko at this point).
+	if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 && !( typeof(opera) == 'object' && opera.postError ) )
+		return true ;
+
+	// Opera 9.50+
+	if ( window.opera && window.opera.version && parseFloat( window.opera.version() ) >= 9.5 )
+		return true ;
+
+	// Adobe AIR
+	// Checked before Safari because AIR have the WebKit rich text editor
+	// features from Safari 3.0.4, but the version reported is 420.
+	if ( sAgent.indexOf( ' adobeair/' ) != -1 )
+		return ( sAgent.match( / adobeair\/(\d+)/ )[1] >= 1 ) ;	// Build must be at least v1
+
+	// Safari 3+
+	if ( sAgent.indexOf( ' applewebkit/' ) != -1 )
+		return ( sAgent.match( / applewebkit\/(\d+)/ )[1] >= 522 ) ;	// Build must be at least 522 (v3)
+
+	return false ;
 
 }