%SMARTEDITFORCE% to force smartedit to try to run on any browser
authorColas Nahaboo <colas@nahaboo.net>
Wed, 15 Apr 2009 08:35:15 +0200
changeset 17834a42b5102c
parent 16 0f19fc9d63ae
child 18 2ef558cae438
%SMARTEDITFORCE% to force smartedit to try to run on any browser
README-SmartEditContrib.txt
pub/System/SmartEditContrib/wikismartEngine.js
templates/edit.smarteditor.tmpl
     1.1 --- a/README-SmartEditContrib.txt	Wed Apr 15 00:55:43 2009 +0200
     1.2 +++ b/README-SmartEditContrib.txt	Wed Apr 15 08:35:15 2009 +0200
     1.3 @@ -124,6 +124,7 @@
     1.4  wikismartFoswikiUserIcons = ""+'%SMARTEDITICONUSER%";
     1.5  // End of copy
     1.6  wikismartCurrentWeb = "%WEB%";
     1.7 +wikismartForce = '%SMARTEDITFORCE%';
     1.8  // To know the id of the textarea ... if it is not 'topic'
     1.9  wikismartEdit('topic');
    1.10  </script>
     2.1 --- a/pub/System/SmartEditContrib/wikismartEngine.js	Wed Apr 15 00:55:43 2009 +0200
     2.2 +++ b/pub/System/SmartEditContrib/wikismartEngine.js	Wed Apr 15 08:35:15 2009 +0200
     2.3 @@ -61,18 +61,26 @@
     2.4  
     2.5  var smartEditFirstExternalLink = true;
     2.6  
     2.7 -var clientPC = navigator.userAgent.toLowerCase(); // Get client info
     2.8 -var is_opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
     2.9 -var is_firefox = ((clientPC.indexOf('gecko')!=-1) && (clientPC.indexOf('spoofer')==-1)
    2.10 -                && (clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0')==-1));
    2.11 +var reVarUnset = /^($|off|0|%)/i;
    2.12 +var reIsIE = /MSIE/;
    2.13 +var reIsIE8 = /MSIE [123489][.]/;
    2.14 +var reFFinclude = /gecko/i;
    2.15 +var reFFexclude = /(spoofer|khtml|netscape\/7[.]0)/i;
    2.16 +var reOpera = /opera/i;
    2.17  
    2.18 +var is_opera = reOpera.exec(navigator.userAgent);
    2.19 +var is_firefox = reFFinclude(navigator.userAgent) && !reFFexclude(navigator.userAgent);
    2.20  
    2.21  function wikismartEdit(textareaid){
    2.22  	wikismartTextareaId = textareaid;
    2.23  	// Works only on If browser is Firefox or IE 8
    2.24 -	if (is_firefox || ((navigator.userAgent).indexOf("MSIE 8.") != -1)){
    2.25 +	if (!is_firefox 
    2.26 +	    && !reIsIE8.exec(navigator.userAgent)
    2.27 +	    && reVarUnset.exec(wikismartForce)) { 
    2.28 +	      return -1; 
    2.29 +	    }
    2.30  	// Special CSS style for Internet Explorer
    2.31 -	if(!is_firefox && ((navigator.userAgent.toLowerCase()).indexOf("opera") == -1)){
    2.32 +	if(reIsIE.exec(navigator.userAgent)) {
    2.33  		smartEditorIECssClass = "IE";
    2.34  	}
    2.35  
    2.36 @@ -113,7 +121,6 @@
    2.37  		var newToolBottom = smartEditCreateToolbar();
    2.38  		wikismartInsertAfter(wikismartTextarea.parentNode, newToolBottom, wikismartTextarea);
    2.39  	}
    2.40 -	}
    2.41  }
    2.42  
    2.43  /* For function search*/
     3.1 --- a/templates/edit.smarteditor.tmpl	Wed Apr 15 00:55:43 2009 +0200
     3.2 +++ b/templates/edit.smarteditor.tmpl	Wed Apr 15 08:35:15 2009 +0200
     3.3 @@ -33,7 +33,7 @@
     3.4  wikismartFoswikiUserIcons = ""+'%SMARTEDITICONUSER%';
     3.5  // End of copy
     3.6  wikismartCurrentWeb = "%WEB%";
     3.7 -wikismartFoswikiIcons = '%SMARTEDITICONS%';
     3.8 +wikismartForce = "%SMARTEDITFORCE%";
     3.9  // To know the id of the textarea ... if it is not 'topic'
    3.10  wikismartEdit('topic');
    3.11  </script>%TMPL:END%