Changeset 775


Ignore:
Timestamp:
03/13/07 12:47:30 (12 years ago)
Author:
ray
Message:

update branch with changes from trunk

Location:
branches/ray
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/ray/Xinha.css

    r762 r775  
    11.htmlarea { background: #fff; } 
     2.htmlarea td { margin:0;padding:0; } 
    23 
    34.htmlarea .toolbar { 
     
    5556.htmlarea .toolbar .separator { 
    5657  /*position: relative;*/ 
    57   margin: 3px; 
     58  margin:0 3px; 
    5859  border-left: 1px solid ButtonShadow; 
    5960  border-right: 1px solid ButtonHighlight; 
     
    184185} 
    185186 
     187.dialog .buttonColor .chooser, .dialog .buttonColor .nocolor { 
     188  height: 0.6em; 
     189  border: 1px solid; 
     190  padding: 0px 1em; 
     191  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; 
     192} 
     193 
    186194.dialog .buttonClick { 
    187195  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; 
    188196} 
    189197.dialog .buttonColor-hilite { 
    190   border-color: #000; 
    191 } 
    192  
    193 .dialog .buttonColor .chooser, .dialog .buttonColor .nocolor { 
    194   height: 0.6em; 
    195   border: 1px solid; 
    196   padding: 0px 1em; 
    197   border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; 
     198   border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; 
    198199} 
    199200 
  • branches/ray/XinhaCore.js

    r762 r775  
    111111Xinha.ie_version= parseFloat(Xinha.agt.substring(Xinha.agt.indexOf("msie")+5)); 
    112112Xinha.is_opera  = (Xinha.agt.indexOf("opera") != -1); 
     113Xinha.is_khtml  = (Xinha.agt.indexOf("khtml") != -1); 
     114Xinha.is_safari  = (Xinha.agt.indexOf("safari") != -1); 
     115Xinha.opera_version = navigator.appVersion.substring(0, navigator.appVersion.indexOf(" "))*1; 
    113116Xinha.is_mac       = (Xinha.agt.indexOf("mac") != -1); 
    114117Xinha.is_mac_ie = (Xinha.is_ie && Xinha.is_mac); 
    115118Xinha.is_win_ie = (Xinha.is_ie && !Xinha.is_mac); 
    116 Xinha.is_gecko  = (navigator.product == "Gecko"); 
     119Xinha.is_gecko  = (navigator.product == "Gecko" && !Xinha.is_safari); // Safari lies! 
    117120Xinha.isRunLocally = document.URL.toLowerCase().search(/^file:/) != -1; 
    118 if ( Xinha.isRunLocally ) 
     121Xinha.is_designMode = (typeof document.designMode != 'undefined' && !Xinha.is_ie); // IE has designMode, but we're not using it 
     122Xinha.checkSupportedBrowser = function() 
     123{ 
     124  if ( Xinha.is_gecko ) 
     125  { 
     126    if ( navigator.productSub < 20021201 ) 
     127    { 
     128      alert("You need at least Mozilla-1.3 Alpha.\nSorry, your Gecko is not supported."); 
     129      return false; 
     130    } 
     131    if ( navigator.productSub < 20030210 ) 
     132    { 
     133      alert("Mozilla < 1.3 Beta is not supported!\nI'll try, though, but it might not work."); 
     134    } 
     135  } 
     136  if ( Xinha.is_opera ) 
     137  { 
     138    alert("Sorry, Opera is not yet supported by Xinha."); 
     139  } 
     140  return Xinha.is_gecko || (Xinha.is_opera && Xinha.opera_version >= 9.1) || Xinha.ie_version >= 5.5; 
     141}; 
     142 
     143Xinha.isSupportedBrowser = Xinha.checkSupportedBrowser(); 
     144 
     145if ( Xinha.isRunLocally && Xinha.isSupportedBrowser) 
    119146{ 
    120147  alert('Xinha *must* be installed on a web server. Locally opened files (those that use the "file://" protocol) cannot properly function. Xinha will try to initialize but may not be correctly loaded.'); 
     
    125152function Xinha(textarea, config) 
    126153{ 
     154  if ( !Xinha.isSupportedBrowser ) return; 
     155   
    127156  if ( !textarea ) 
    128157  { 
     
    130159  } 
    131160 
    132   if ( Xinha.checkSupportedBrowser() ) 
    133   { 
    134     if ( typeof config == "undefined" ) 
    135     { 
    136       this.config = new Xinha.Config(); 
    137     } 
    138     else 
    139     { 
    140       this.config = config; 
    141     } 
    142     this._htmlArea = null; 
    143  
    144     if ( typeof textarea != 'object' ) 
    145     { 
    146       textarea = Xinha.getElementById('textarea', textarea); 
    147     } 
    148     this._textArea = textarea; 
    149     this._textArea.spellcheck = false; 
    150         
    151     // Before we modify anything, get the initial textarea size 
    152     this._initial_ta_size = 
    153     { 
    154       w: textarea.style.width  ? textarea.style.width  : ( textarea.offsetWidth  ? ( textarea.offsetWidth  + 'px' ) : ( textarea.cols + 'em') ), 
    155       h: textarea.style.height ? textarea.style.height : ( textarea.offsetHeight ? ( textarea.offsetHeight + 'px' ) : ( textarea.rows + 'em') ) 
    156     }; 
    157     // Create the loading message elements 
    158     if ( this.config.showLoading ) 
    159     { 
    160       // Create and show the main loading message and the sub loading message for details of loading actions 
    161       // global element 
    162       var loading_message = document.createElement("div"); 
    163       loading_message.id = "loading_" + textarea.name; 
    164       loading_message.className = "loading"; 
    165       try 
    166       { 
    167         // how can i find the real width in pixels without % or em *and* with no visual errors ? 
    168         // for instance, a textarea with a style="width:100%" and the body padding > 0 result in a horizontal scrollingbar while loading 
    169         // A few lines above seems to indicate offsetWidth is not always set 
    170         loading_message.style.width = textarea.offsetWidth + 'px'; 
    171       } 
    172       catch (ex) 
    173       { 
    174         // offsetWidth seems not set, so let's use this._initial_ta_size.w, but sometimes it may be too huge width 
    175         loading_message.style.width = this._initial_ta_size.w; 
    176       } 
    177       loading_message.style.left = Xinha.findPosX(textarea) +  'px'; 
    178       loading_message.style.top = (Xinha.findPosY(textarea) + parseInt(this._initial_ta_size.h, 10) / 2) +  'px'; 
    179       // main static message 
    180       var loading_main = document.createElement("div"); 
    181       loading_main.className = "loading_main"; 
    182       loading_main.id = "loading_main_" + textarea.name; 
    183       loading_main.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait !"))); 
    184       // sub dynamic message 
    185       var loading_sub = document.createElement("div"); 
    186       loading_sub.className = "loading_sub"; 
    187       loading_sub.id = "loading_sub_" + textarea.name; 
    188       loading_sub.appendChild(document.createTextNode(Xinha._lc("Constructing main object"))); 
    189       loading_message.appendChild(loading_main); 
    190       loading_message.appendChild(loading_sub); 
    191       document.body.appendChild(loading_message); 
    192       this.setLoadingMessage("Constructing object"); 
    193     } 
    194  
    195     this._editMode = "wysiwyg"; 
    196     this.plugins = {}; 
    197     this._timerToolbar = null; 
    198     this._timerUndo = null; 
    199     this._undoQueue = [this.config.undoSteps]; 
    200     this._undoPos = -1; 
    201     this._customUndo = true; 
    202     this._mdoc = document; // cache the document, we need it in plugins 
    203     this.doctype = ''; 
    204     this.__htmlarea_id_num = __xinhas.length; 
    205     __xinhas[this.__htmlarea_id_num] = this; 
    206  
    207     this._notifyListeners = {}; 
    208  
    209     // Panels 
    210     var panels =  
    211     { 
    212       right: 
    213       { 
    214         on: true, 
    215         container: document.createElement('td'), 
    216         panels: [] 
    217       }, 
    218       left: 
    219       { 
    220         on: true, 
    221         container: document.createElement('td'), 
    222         panels: [] 
    223       }, 
    224       top: 
    225       { 
    226         on: true, 
    227         container: document.createElement('td'), 
    228         panels: [] 
    229       }, 
    230       bottom: 
    231       { 
    232         on: true, 
    233         container: document.createElement('td'), 
    234         panels: [] 
    235       } 
    236     }; 
    237  
    238     for ( var i in panels ) 
    239     { 
    240       if(!panels[i].container) { continue; } // prevent iterating over wrong type 
    241       panels[i].div = panels[i].container; // legacy 
    242       panels[i].container.className = 'panels ' + i; 
    243       Xinha.freeLater(panels[i], 'container'); 
    244       Xinha.freeLater(panels[i], 'div'); 
    245     } 
    246     // finally store the variable 
    247     this._panels = panels; 
    248  
    249     Xinha.freeLater(this, '_textArea'); 
    250   } 
     161  if ( typeof config == "undefined" ) 
     162  { 
     163    this.config = new Xinha.Config(); 
     164  } 
     165  else 
     166  { 
     167    this.config = config; 
     168  } 
     169  this._htmlArea = null; 
     170 
     171  if ( typeof textarea != 'object' ) 
     172  { 
     173    textarea = Xinha.getElementById('textarea', textarea); 
     174  } 
     175  this._textArea = textarea; 
     176  this._textArea.spellcheck = false; 
     177      
     178  // Before we modify anything, get the initial textarea size 
     179  this._initial_ta_size = 
     180  { 
     181    w: textarea.style.width  ? textarea.style.width  : ( textarea.offsetWidth  ? ( textarea.offsetWidth  + 'px' ) : ( textarea.cols + 'em') ), 
     182    h: textarea.style.height ? textarea.style.height : ( textarea.offsetHeight ? ( textarea.offsetHeight + 'px' ) : ( textarea.rows + 'em') ) 
     183  }; 
     184  // Create the loading message elements 
     185  if ( this.config.showLoading ) 
     186  { 
     187    // Create and show the main loading message and the sub loading message for details of loading actions 
     188    // global element 
     189    var loading_message = document.createElement("div"); 
     190    loading_message.id = "loading_" + textarea.name; 
     191    loading_message.className = "loading"; 
     192    try 
     193    { 
     194      // how can i find the real width in pixels without % or em *and* with no visual errors ? 
     195      // for instance, a textarea with a style="width:100%" and the body padding > 0 result in a horizontal scrollingbar while loading 
     196      // A few lines above seems to indicate offsetWidth is not always set 
     197      loading_message.style.width = textarea.offsetWidth + 'px'; 
     198    } 
     199    catch (ex) 
     200    { 
     201      // offsetWidth seems not set, so let's use this._initial_ta_size.w, but sometimes it may be too huge width 
     202      loading_message.style.width = this._initial_ta_size.w; 
     203    } 
     204    loading_message.style.left = Xinha.findPosX(textarea) +  'px'; 
     205    loading_message.style.top = (Xinha.findPosY(textarea) + parseInt(this._initial_ta_size.h, 10) / 2) +  'px'; 
     206    // main static message 
     207    var loading_main = document.createElement("div"); 
     208    loading_main.className = "loading_main"; 
     209    loading_main.id = "loading_main_" + textarea.name; 
     210    loading_main.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait !"))); 
     211    // sub dynamic message 
     212    var loading_sub = document.createElement("div"); 
     213    loading_sub.className = "loading_sub"; 
     214    loading_sub.id = "loading_sub_" + textarea.name; 
     215    loading_sub.appendChild(document.createTextNode(Xinha._lc("Constructing main object"))); 
     216    loading_message.appendChild(loading_main); 
     217    loading_message.appendChild(loading_sub); 
     218    document.body.appendChild(loading_message); 
     219    this.setLoadingMessage("Constructing object"); 
     220  } 
     221 
     222  this._editMode = "wysiwyg"; 
     223  this.plugins = {}; 
     224  this._timerToolbar = null; 
     225  this._timerUndo = null; 
     226  this._undoQueue = [this.config.undoSteps]; 
     227  this._undoPos = -1; 
     228  this._customUndo = true; 
     229  this._mdoc = document; // cache the document, we need it in plugins 
     230  this.doctype = ''; 
     231  this.__htmlarea_id_num = __xinhas.length; 
     232  __xinhas[this.__htmlarea_id_num] = this; 
     233 
     234  this._notifyListeners = {}; 
     235 
     236  // Panels 
     237  var panels =  
     238  { 
     239    right: 
     240    { 
     241      on: true, 
     242      container: document.createElement('td'), 
     243      panels: [] 
     244    }, 
     245    left: 
     246    { 
     247      on: true, 
     248      container: document.createElement('td'), 
     249      panels: [] 
     250    }, 
     251    top: 
     252    { 
     253      on: true, 
     254      container: document.createElement('td'), 
     255      panels: [] 
     256    }, 
     257    bottom: 
     258    { 
     259      on: true, 
     260      container: document.createElement('td'), 
     261      panels: [] 
     262    } 
     263  }; 
     264 
     265  for ( var i in panels ) 
     266  { 
     267    if(!panels[i].container) { continue; } // prevent iterating over wrong type 
     268    panels[i].div = panels[i].container; // legacy 
     269    panels[i].container.className = 'panels ' + i; 
     270    Xinha.freeLater(panels[i], 'container'); 
     271    Xinha.freeLater(panels[i], 'div'); 
     272  } 
     273  // finally store the variable 
     274  this._panels = panels; 
     275 
     276  Xinha.freeLater(this, '_textArea'); 
    251277} 
    252278 
     
    260286Xinha.RE_body     = /<body[^>]*>((.|\n|\r|\t)*?)<\/body>/i; 
    261287Xinha.RE_Specials = /([\/\^$*+?.()|{}[\]])/g; 
    262 Xinha.RE_email    = /[_a-zA-Z\d\-\.]{3,}@[_a-zA-Z\d\-]{2,}(\.[_a-zA-Z\d\-]{2,})+/i; 
     288Xinha.RE_email    = /[_a-z\d\-\.]{3,}@[_a-z\d\-]{2,}(\.[_a-z\d\-]{2,})+/i; 
    263289Xinha.RE_url      = /(https?:\/\/)?(([a-z0-9_]+:[a-z0-9_]+@)?[a-z0-9_-]{2,}(\.[a-z0-9_-]{2,}){2,}(:[0-9]+)?(\/\S+)*)/i; 
    264290 
     
    385411 
    386412  // CharSet of the iframe, default is the charset of the document 
    387   this.charSet = Xinha.is_gecko ? document.characterSet : document.charset; 
     413  this.charSet = (typeof document.characterSet != 'undefined') ? document.characterSet : document.charset; 
     414 
     415  // Whether the edited document should be rendered in Quirksmode or Standard Compliant (Strict) Mode 
     416  // This is commonly known as the "doctype switch" 
     417  // for details read here http://www.quirksmode.org/css/quirksmode.html 
     418  // 
     419  // Possible values: 
     420  //    true     :  Quirksmode is used 
     421  //    false    :  Strict mode is used 
     422  // leave empty :  the mode of the document Xinha is in is used 
     423  this.browserQuirksMode = ''; 
    388424 
    389425  // URL-s 
     
    15001536Xinha.prototype.generate = function () 
    15011537{ 
     1538  if ( !Xinha.isSupportedBrowser ) return; 
     1539   
    15021540  var i; 
    15031541  var editor = this;  // we'll need "this" in some nested functions 
     
    18111849 
    18121850  // add a handler for the "back/forward" case -- on body.unload we save 
    1813   // the HTML content into the original textarea. 
     1851  // the HTML content into the original textarea and restore it in its place. 
     1852  // apparently this does not work in IE? 
    18141853  Xinha.prependDom0Event( 
    18151854    window, 
     
    18181857    { 
    18191858      textarea.value = editor.outwardHtml(editor.getHTML()); 
     1859      var x = xinha.parentNode.replaceChild(textarea,xinha); 
     1860      // put it back into the page to let Xinha.collectGarbageForIE() do its work afterwards 
     1861      textarea.style.display = ""; 
     1862      x.style.display = 'none'; 
     1863      document.body.appendChild(x); 
    18201864      return true; 
    18211865    } 
     
    18301874  // Add an event to initialize the iframe once loaded. 
    18311875  editor._iframeLoadDone = false; 
    1832   Xinha._addEvent( 
    1833     this._iframe, 
    1834     'load', 
    1835     function(e) 
    1836     { 
    1837       if ( !editor._iframeLoadDone ) 
    1838       { 
    1839         editor._iframeLoadDone = true; 
    1840         editor.initIframe(); 
    1841       } 
    1842       return true; 
    1843     } 
    1844   ); 
     1876  if (Xinha.is_opera) 
     1877    { 
     1878      Xinha._addEvent( 
     1879        this._iframe.contentWindow, 
     1880        'load', 
     1881        function(e) 
     1882        { 
     1883          if ( !editor._iframeLoadDone ) 
     1884          { 
     1885             editor._iframeLoadDone = true; 
     1886             editor.initIframe(); 
     1887          } 
     1888          return true; 
     1889        } 
     1890      ) 
     1891    } 
     1892  else 
     1893    Xinha._addEvent( 
     1894      this._iframe, 
     1895      'load', 
     1896      function(e) 
     1897      { 
     1898        if ( !editor._iframeLoadDone ) 
     1899        { 
     1900          editor._iframeLoadDone = true; 
     1901          editor.initIframe(); 
     1902        } 
     1903        return true; 
     1904      } 
     1905    ); 
    18451906 
    18461907}; 
     
    22342295  try 
    22352296  { 
    2236     return Xinha.is_gecko? this._doc.designMode == 'on' : this._doc.body.contentEditable; 
     2297    return Xinha.is_designMode ? this._doc.designMode == 'on' : this._doc.body.contentEditable; 
    22372298  } 
    22382299  catch (ex) 
     
    22562317  } 
    22572318 
    2258   if ( Xinha.is_gecko && this._doc.designMode != 'on' ) 
     2319  if ( Xinha.is_designMode && this._doc.designMode != 'on' ) 
    22592320  { 
    22602321    try 
     
    22922353  this.disableToolbar(); 
    22932354 
    2294   if ( Xinha.is_gecko && this._doc.designMode != 'off' ) 
     2355  if ( Xinha.is_designMode && this._doc.designMode != 'off' ) 
    22952356  { 
    22962357    try 
     
    23532414   
    23542415  Xinha.freeLater(this, '_doc'); 
    2355    
     2416 
    23562417  doc.open("text/html","replace"); 
    23572418  var html = ''; 
     2419  if ( editor.config.browserQuirksMode === false ) 
     2420  { 
     2421    var doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; 
     2422  } 
     2423  else if ( editor.config.browserQuirksMode === true ) 
     2424  { 
     2425     var doctype = ''; 
     2426  } 
     2427  else 
     2428  { 
     2429     var doctype = Xinha.getDoctype(document); 
     2430  } 
    23582431  if ( !editor.config.fullPage ) 
    23592432  { 
    2360     html = "<html>\n"; 
     2433    html += doctype + "\n"; 
     2434    html += "<html>\n"; 
    23612435    html += "<head>\n"; 
    23622436    html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + editor.config.charSet + "\">\n"; 
     
    23962470    { 
    23972471      editor.setDoctype(RegExp.$1); 
    2398       html = html.replace(Xinha.RE_doctype, ""); 
     2472      //html = html.replace(Xinha.RE_doctype, ""); 
    23992473    } 
    24002474     
     
    25022576  { 
    25032577    this.setDoctype(RegExp.$1); 
    2504     html = html.replace(Xinha.RE_doctype, ""); 
     2578   // html = html.replace(Xinha.RE_doctype, ""); 
    25052579  } 
    25062580  RegExp.multiline = save_multiline; 
     
    25992673Xinha.prototype.registerPlugin = function() 
    26002674{ 
     2675  if ( !Xinha.isSupportedBrowser ) return;  
     2676   
    26012677  var plugin = arguments[0]; 
    26022678 
     
    26622738Xinha.loadPlugin = function(pluginName, callback, plugin_file) 
    26632739{ 
     2740  if ( !Xinha.isSupportedBrowser ) return; 
     2741   
    26642742  // @todo : try to avoid the use of eval() 
    26652743  // Might already be loaded 
     
    26882766Xinha.loadPlugins = function(plugins, callbackIfNotReady) 
    26892767{ 
     2768  if ( !Xinha.isSupportedBrowser ) return; 
     2769   
    26902770  // Rip the ones that are loaded and look for ones that have failed 
    26912771  var retVal = true; 
     
    43634443}; 
    43644444 
    4365 Xinha.checkSupportedBrowser = function() 
    4366 { 
    4367   if ( Xinha.is_gecko ) 
    4368   { 
    4369     if ( navigator.productSub < 20021201 ) 
    4370     { 
    4371       alert("You need at least Mozilla-1.3 Alpha.\nSorry, your Gecko is not supported."); 
    4372       return false; 
    4373     } 
    4374     if ( navigator.productSub < 20030210 ) 
    4375     { 
    4376       alert("Mozilla < 1.3 Beta is not supported!\nI'll try, though, but it might not work."); 
    4377     } 
    4378   } 
    4379   return Xinha.is_gecko || Xinha.ie_version >= 5.5; 
    4380 }; 
    4381  
    43824445// selection & ranges 
    43834446 
     
    53705433Xinha.makeEditors = function(editor_names, default_config, plugin_names) 
    53715434{ 
     5435  if ( !Xinha.isSupportedBrowser ) return; 
     5436   
    53725437  if ( typeof default_config == 'function' ) 
    53735438  { 
     
    53925457Xinha.startEditors = function(editors) 
    53935458{ 
     5459  if ( !Xinha.isSupportedBrowser ) return; 
     5460   
    53945461  for ( var i in editors ) 
    53955462  { 
     
    54035470Xinha.prototype.registerPlugins = function(plugin_names) 
    54045471{ 
     5472  if ( !Xinha.isSupportedBrowser ) return; 
     5473   
    54055474  if ( plugin_names ) 
    54065475  { 
     
    55725641 */ 
    55735642  
    5574 Xinha.getElementTopLeft = function(element) 
    5575 { 
    5576   var position = { top:0, left:0 }; 
    5577   while ( element ) 
    5578   { 
    5579     position.top  += element.offsetTop; 
    5580     position.left += element.offsetLeft; 
    5581     if ( element.offsetParent && element.offsetParent.tagName.toLowerCase() != 'body' ) 
    5582     { 
    5583       element = element.offsetParent; 
    5584     } 
    5585     else 
    5586     { 
    5587       element = null; 
    5588     } 
    5589   } 
    5590    
    5591   return position; 
     5643Xinha.getElementTopLeft = function(element)  
     5644{ 
     5645  var curleft = curtop = 0; 
     5646  if (element.offsetParent)  
     5647  { 
     5648    curleft = element.offsetLeft 
     5649    curtop = element.offsetTop 
     5650    while (element = element.offsetParent)  
     5651    { 
     5652      curleft += element.offsetLeft 
     5653      curtop += element.offsetTop 
     5654    } 
     5655  } 
     5656  return { top:curtop, left:curleft }; 
    55925657} 
    55935658 
  • branches/ray/modules/ColorPicker/ColorPicker.js

    r762 r775  
    143143    td.unselectable = "on"; 
    144144    td.style.MozUserSelect = "none"; 
     145    td.style.cursor = "default"; 
    145146    td.appendChild(document.createTextNode(Xinha._lc('Click a color...'))); 
    146147    td.style.borderBottom = '1px solid WindowFrame'; 
     
    319320      return colors; 
    320321    } 
    321  
     322    var self = this; 
     323    function closeOnBodyClick (ev) 
     324    { 
     325      ev = ev ? ev : window.event; 
     326      el = ev.target ? ev.target : ev.srcElement; 
     327      do 
     328      { 
     329        if (el == self.table) return; 
     330      } 
     331      while (el = el.parentNode); 
     332      self.close(); 
     333    } 
    322334    /** Open the color picker 
    323335     * 
     
    343355      } 
    344356 
     357      Xinha._addEvent(document.body,'mousedown',closeOnBodyClick); 
     358       
    345359      // Find position of the element 
    346360      this.table.style.position = 'absolute'; 
     
    357371 
    358372      var x, y; 
    359       if(/top/.test(anchorage)) 
     373      if(/top/.test(anchorage) || (top + this.table.offsetHeight > document.body.offsetHeight)) 
    360374      { 
    361375        if(top - this.table.offsetHeight > 0) 
     
    373387      } 
    374388 
    375       if(/left/.test(anchorage)) 
     389      if(/left/.test(anchorage) || (left + this.table.offsetWidth > document.body.offsetWidth)) 
     390      { 
     391        if(left - (this.table.offsetWidth - element.offsetWidth) > 0 ) 
     392        { 
     393          this.table.style.left = (left - (this.table.offsetWidth - element.offsetWidth)) + 'px'; 
     394        } 
     395        else 
     396        { 
     397                  this.table.style.left = 0; 
     398        } 
     399      } 
     400      else 
    376401      { 
    377402        this.table.style.left = left + 'px'; 
    378       } 
    379       else 
    380       { 
    381         if(left - (this.table.offsetWidth - element.offsetWidth) > 0) 
    382         { 
    383           this.table.style.left = (left - (this.table.offsetWidth - element.offsetWidth)) + 'px'; 
    384         } 
    385         else 
    386         { 
    387                   this.table.style.left = 0; 
    388         } 
    389403      } 
    390404     // IE ONLY - prevent windowed elements (<SELECT>) to render above the colorpicker 
     
    779793    this.close = function() 
    780794    { 
     795      Xinha._removeEvent(document.body,'mousedown',closeOnBodyClick); 
    781796      this.table.style.display = 'none'; 
    782797      // IE ONLY - prevent windowed elements (<SELECT>) to render above the colorpicker 
     
    831846  return Xinha._lc(string); 
    832847} 
    833 Xinha.colorPicker.inputBinding = function(input) 
     848 
     849 
     850/** Create a neat little box next to an input field 
     851 *    * shows actual color 
     852 *    * opens colorPicker on click 
     853 *    * has a button to clear the color with a click 
     854 * 
     855 *  @param input (DOM element)  
     856 *  @param optional pickerConfig configuration object for Xinha.colorPicker() 
     857 */ 
     858Xinha.colorPicker.InputBinding = function(input,pickerConfig) 
    834859{ 
    835860  var main = document.createElement('span'); 
     
    838863  var chooser = this.chooser = document.createElement('span'); 
    839864  chooser.className = "chooser"; 
    840   chooser.onmouseover = function() {main.style.borderColor='black';chooser.style.borderColor='black'}; 
    841   chooser.onmouseout = function() {main.style.borderColor='ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight',chooser.style.borderColor='ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight'}; 
     865  if (input.value) chooser.style.backgroundColor = input.value; 
     866  chooser.onmouseover = function() {chooser.className = "chooser buttonColor-hilite";}; 
     867  chooser.onmouseout = function() {chooser.className = "chooser";}; 
    842868  chooser.appendChild(document.createTextNode('\u00a0')); 
    843869  main.appendChild(chooser); 
    844870  var clearColor = document.createElement('span'); 
    845871  clearColor.className = "nocolor"; 
    846   clearColor.onmouseover = function() {clearColor.style.color='#f00'}; 
    847   clearColor.onmouseout = function() {clearColor.style.color='#000'}; 
     872  clearColor.onmouseover = function() {clearColor.className = "nocolor buttonColor-hilite"; clearColor.style.color='#f00'}; 
     873  clearColor.onmouseout = function() {clearColor.className = "nocolor"; clearColor.style.color='#000'}; 
    848874  clearColor.onclick = function() {input.value ='';chooser.style.backgroundColor = ''}; 
    849875  clearColor.appendChild(document.createTextNode('\u00d7')); 
     
    853879   
    854880  Xinha._addEvent(input,'change',function() {chooser.style.backgroundColor = this.value;}) 
    855    
     881 
     882  pickerConfig = (pickerConfig) ? Xinha.cloneObject(pickerConfig) : { cellsize:'5px' }; 
     883  pickerConfig.callback = (pickerConfig.callback) ? pickerConfig.callback : function(color) {chooser.style.backgroundColor = color;input.value=color}; 
     884 
    856885  chooser.onclick = function()  
    857886  {  
    858           var colPicker = new Xinha.colorPicker({cellsize:'5px',callback:function(color) {chooser.style.backgroundColor = color;input.value=color}}); 
    859           colPicker.open('left',chooser, input.value );  
     887    var colPicker = new Xinha.colorPicker(pickerConfig); 
     888          colPicker.open("",chooser, input.value );  
    860889  } 
    861890} 
    862 Xinha.colorPicker.inputBinding.prototype.setColor = function(color) 
     891Xinha.colorPicker.InputBinding.prototype.setColor = function (color) 
    863892{ 
    864893  this.chooser.style.backgroundColor = color; 
  • branches/ray/modules/Gecko/Gecko.js

    r761 r775  
    739739   
    740740  return result; 
    741 } 
     741}; 
     742 
     743/** Return the doctype of a document, if set 
     744 *  
     745 * @param doc DOM element document 
     746 * @returns string the actual doctype 
     747 */ 
     748Xinha.getDoctype = function (doc) 
     749{ 
     750  var d = ''; 
     751  if (doc.doctype) 
     752  { 
     753    d += '<!DOCTYPE ' + doc.doctype.name + " PUBLIC "; 
     754    d +=  doc.doctype.publicId ? '"' + doc.doctype.publicId + '"' : '';   
     755    d +=  doc.doctype.systemId ? ' "'+ doc.doctype.systemId + '"' : '';  
     756    d += ">"; 
     757  } 
     758  return d; 
     759}; 
  • branches/ray/modules/InsertTable/InsertTable.js

    r762 r775  
    8787        dialog.getElementById('cancel').onclick = function() { self.dialog.hide()}; 
    8888   
    89         this.borderColorPicker = new Xinha.colorPicker.inputBinding(dialog.getElementById('border_color')); 
     89        this.borderColorPicker = new Xinha.colorPicker.InputBinding(dialog.getElementById('border_color')); 
    9090 
    9191        this.dialog.onresize = function () 
  • branches/ray/modules/InternetExplorer/InternetExplorer.js

    r761 r775  
    458458  if ( target == 'textarea' ) this._textArea.focus(); 
    459459}; 
     460 
     461/** Return a doctype or empty string depending on whether the document is in Qirksmode or Standards Compliant Mode 
     462 *  It's hardly possible to detect the actual doctype without unreasonable effort, so we set HTML 4.01 just to trigger the rendering mode 
     463 *  
     464 * @param doc DOM element document 
     465 * @returns string doctype || empty 
     466 */ 
     467Xinha.getDoctype = function (doc) 
     468{ 
     469  return (doc.compatMode == "CSS1Compat") ? '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">' : ''; 
     470}; 
  • branches/ray/plugins/CharacterMap/character-map.js

    r761 r775  
    121121  }; 
    122122  editor._CharacterMap.appendChild( a ); 
     123  a = null; 
    123124}; 
  • branches/ray/plugins/Equation/example.html

    r761 r775  
    2323<pre> 
    2424 
    25   &lt;!-- This block is optional configuration --&lt; 
     25  &lt;!-- This block is optional configuration --&gt; 
    2626  &lt;script type="text/javascript"&gt; 
    2727    var mathcolor = "black"; // You may change the color of the formulae (default: red) 
     
    2929    var mathfontfamily = "Arial"; //and the font (default: serif, which is good I think) 
    3030  &lt;/script&gt; 
    31   &lt;!-- THIS LOADS THE ACTUAL SCRIPT --&lt; 
    32   &lt;script type="text/javascript" src="ASCIIMathML.js"&gt;&lt;/script&gt; 
     31  &lt;!-- THIS LOADS THE ACTUAL SCRIPT, PLEASE ADJUST THE URL --&lt; 
     32  &lt;script type="text/javascript" src="/xinha/plugins/Equation/ASCIIMathML.js"&gt;&lt;/script&gt; 
    3333 
    3434 
  • branches/ray/plugins/ExtendedFileManager/assets/manager.css

    r761 r775  
    2727 
    2828.buttonColor { 
    29   padding: 1px; 
     29  width :1em; 
     30  margin-left: 2px; 
    3031  cursor: default; 
     32} 
     33 
     34.buttonColor .chooser, .buttonColor .nocolor { 
     35  height: 0.6em; 
    3136  border: 1px solid; 
     37  padding: 0px 1em; 
    3238  border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; 
    3339} 
     40 
     41.buttonColor .buttonClick { 
     42  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; 
     43} 
     44.buttonColor .buttonColor-hilite { 
     45  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; 
     46} 
     47 
     48.buttonColor .nocolor { padding: 0px; } 
     49.buttonColor .nocolor-hilite { background-color: #fff; color: #f00; } 
  • branches/ray/plugins/ExtendedFileManager/assets/manager.js

    r761 r775  
    7171     
    7272    var editor = window.dialogArguments.editor; 
    73     if (manager_mode == 'image' && typeof Xinha.colorPicker != "undefined" && document.getElementById('bgCol_pick')) { 
    74         // Hookup color pickers 
    75         var pickerConfig = { 
    76             cellsize:editor.config.colorPickerCellSize, 
    77             granularity:editor.config.colorPickerGranularity, 
    78             websafe:editor.config.colorPickerWebSafe, 
    79             savecolors:editor.config.colorPickerSaveColors 
    80         }; 
    81  
    82         var bgCol_pick = document.getElementById('bgCol_pick'); 
    83         var f_backgroundColor = document.getElementById('f_backgroundColor'); 
    84         pickerConfig.callback = function(color){f_backgroundColor.value=color;}; 
    85         var bgColPicker = new Xinha.colorPicker(pickerConfig); 
    86         bgCol_pick.onclick = function() { bgColPicker.open('top,right', f_backgroundColor ); } 
    87  
    88         var bdCol_pick = document.getElementById('bdCol_pick'); 
    89         var f_borderColor = document.getElementById('f_borderColor'); 
    90         pickerConfig.callback = function(color){f_borderColor.value=color;}; 
    91         var bdColPicker = new Xinha.colorPicker(pickerConfig); 
    92         bdCol_pick.onclick = function() { bdColPicker.open('top,right', f_borderColor ); } 
    93     } 
    9473 
    9574    var param = window.dialogArguments.param; 
     
    238217        target_select.appendChild(opt); 
    239218        target_select.onchange = onTargetChanged; 
     219         
    240220        document.getElementById("f_href").focus(); 
    241221    } 
     
    257237                } 
    258238        } 
     239    } 
     240    if (manager_mode == 'image' && typeof Xinha.colorPicker != "undefined" && document.getElementById('f_backgroundColor')) { 
     241      // Hookup color pickers 
     242 
     243      var pickerConfig = { 
     244        cellsize:editor.config.colorPickerCellSize, 
     245        granularity:editor.config.colorPickerGranularity, 
     246        websafe:editor.config.colorPickerWebSafe, 
     247        savecolors:editor.config.colorPickerSaveColors 
     248      }; 
     249 
     250      new Xinha.colorPicker.InputBinding(document.getElementById('f_backgroundColor'),pickerConfig); 
     251      new Xinha.colorPicker.InputBinding(document.getElementById('f_borderColor'),pickerConfig); 
    259252    } 
    260253} 
  • branches/ray/plugins/ExtendedFileManager/manager.php

    r761 r775  
    236236                    <td align="left">Color</td> 
    237237                    <td> 
    238                   <input name="f_backgroundColor" type="text" id="f_backgroundColor" size="7" /><input type="button" id="bgCol_pick" value="..." /> 
     238                  <input name="f_backgroundColor" type="text" id="f_backgroundColor" size="7" /> 
    239239                </td> 
    240240                <?php } ?> 
     
    262262                        <?php if($insertMode=='image' && !empty($IMConfig['use_color_pickers']) && $IMConfig['images_enable_styling'] !== false) { ?> 
    263263                <td align="left">Border Color</td> 
    264             <td><input name="f_borderColor" type="text" id="f_borderColor" size="7" /><input type="button" id="bdCol_pick" value="..." /></td> 
     264            <td><input name="f_borderColor" type="text" id="f_borderColor" size="7" /></td> 
    265265            <?php } ?> 
    266266</tr> 
  • branches/ray/plugins/ImageManager/assets/manager.css

    r761 r775  
    2222table { margin-top:10px; } 
    2323th, td { padding-right:3px; text-align:left; font-family:small-caption,helvetica,sans-serif; } 
     24 
    2425.buttonColor { 
    25   padding: 1px; 
     26  width :1em; 
     27  margin-left: 2px; 
    2628  cursor: default; 
     29} 
     30 
     31.buttonColor .chooser, .buttonColor .nocolor { 
     32  height: 0.6em; 
    2733  border: 1px solid; 
     34  padding: 0px 1em; 
    2835  border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; 
    2936} 
     37 
     38.buttonColor .buttonClick { 
     39  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; 
     40} 
     41.buttonColor .buttonColor-hilite { 
     42  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; 
     43} 
     44 
     45.buttonColor .nocolor { padding: 0px; } 
     46.buttonColor .nocolor-hilite { background-color: #fff; color: #f00; } 
  • branches/ray/plugins/ImageManager/assets/manager.js

    r761 r775  
    3737        document.getElementById("f_align").selectedIndex = 0; 
    3838         
    39     // Hookup color pickers 
    40     var bgCol_pick = document.getElementById('bgCol_pick'); 
    41     var f_backgroundColor = document.getElementById('f_backgroundColor'); 
    42     var bgColPicker = new Xinha.colorPicker({cellsize:'5px',callback:function(color){f_backgroundColor.value=color;}}); 
    43     bgCol_pick.onclick = function() { bgColPicker.open('top,right', f_backgroundColor ); } 
    44  
    45     var bdCol_pick = document.getElementById('bdCol_pick'); 
    46     var f_borderColor = document.getElementById('f_borderColor'); 
    47     var bdColPicker = new Xinha.colorPicker({cellsize:'5px',callback:function(color){f_borderColor.value=color;}}); 
    48     bdCol_pick.onclick = function() { bdColPicker.open('top,right', f_borderColor ); } 
    49  
    50  
    5139 
    5240                var uploadForm = document.getElementById('uploadForm'); 
     
    10593      document.getElementById('f_preview').src = _backend_url + '__function=thumbs&img=' + param.f_url;       
    10694                } 
     95                 
     96                 // Hookup color pickers 
     97    new Xinha.colorPicker.InputBinding(document.getElementById('f_backgroundColor')); 
     98    new Xinha.colorPicker.InputBinding(document.getElementById('f_borderColor')); 
    10799 
    108100                document.getElementById("f_alt").focus(); 
    109  
    110     // For some reason dialog is not shrinkwrapping correctly in IE so we have to explicitly size it for now. 
    111     // if(HTMLArea.is_ie) window.resizeTo(600, 460); 
    112101        }; 
    113102 
  • branches/ray/plugins/ImageManager/image-manager.js

    r761 r775  
    134134    outparam.f_padding = shortSize(outparam.f_padding); 
    135135    outparam.f_margin = shortSize(outparam.f_margin); 
     136     
     137    function convertToHex(color) { 
     138 
     139      if (typeof color == "string" && /, /.test.color) 
     140      color = color.replace(/, /, ','); // rgb(a, b) => rgb(a,b) 
     141 
     142      if (typeof color == "string" && / /.test.color) { // multiple values 
     143        var colors = color.split(' '); 
     144        var colorstring = ''; 
     145        for (var i = 0; i < colors.length; i++) { 
     146          colorstring += Xinha._colorToRgb(colors[i]); 
     147          if (i + 1 < colors.length) 
     148          colorstring += " "; 
     149        } 
     150        return colorstring; 
     151      } 
     152 
     153      return Xinha._colorToRgb(color); 
     154    } 
     155     
     156    outparam.f_backgroundColor = convertToHex(outparam.f_backgroundColor); 
     157    outparam.f_borderColor = convertToHex(outparam.f_borderColor); 
    136158 
    137159                } // end of if we selected an image before raising the dialog. 
  • branches/ray/plugins/ImageManager/manager.php

    r761 r775  
    145145    <td> 
    146146      <input name="f_backgroundColor" type="text" id="f_backgroundColor" size="7" /> 
    147       <input type="button" id="bgCol_pick" value="..." /> 
     147      
    148148    </td> 
    149149  </tr> 
     
    173173    <td> 
    174174      <input name="f_borderColor" type="text" id="f_borderColor" size="7" /> 
    175       <input type="button" id="bdCol_pick" value="..." /> 
     175       
    176176    </td> 
    177177  </tr> 
  • branches/ray/plugins/SuperClean/tidy.php

    r762 r775  
    116116    ob_end_clean(); 
    117117 
    118     if(strlen($content) < 5) 
     118    if(strlen($content) < 4) 
    119119    { 
    120120      // Tidy on the local machine failed, try a post 
Note: See TracChangeset for help on using the changeset viewer.