Ignore:
Timestamp:
01/29/07 13:53:12 (13 years ago)
Author:
ray
Message:

changed name of of colorPicker() to Xinha.colorPicker() see #923

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/ColorPicker/ColorPicker.js

    r700 r704  
    9393  } 
    9494  //the actual function is below 
    95   function colorPicker(params) 
     95  Xinha.colorPicker = function (params) 
    9696  { 
    9797    // if the savedColors is empty, try to read the savedColors from cookie 
    98     if ( colorPicker.savedColors.length === 0 ) 
    99     { 
    100       colorPicker.loadColors(); 
     98    if ( Xinha.colorPicker.savedColors.length === 0 ) 
     99    { 
     100      Xinha.colorPicker.loadColors(); 
    101101    } 
    102102    var picker = this; 
     
    501501                 } 
    502502            }; 
    503             td.ondblclick = function() { colorPicker.remember(this.colorCode, picker.savecolors); picker.callback(this.colorCode); picker.close(); }; 
     503            td.ondblclick = function() { Xinha.colorPicker.remember(this.colorCode, picker.savecolors); picker.callback(this.colorCode); picker.close(); }; 
    504504            td.appendChild(document.createTextNode(' ')); 
    505505            td.style.cursor = 'pointer'; 
     
    617617                   } 
    618618          }; 
    619           td.ondblclick = function() { colorPicker.remember(this.colorCode, picker.savecolors); picker.callback(this.colorCode); picker.close(); }; 
     619          td.ondblclick = function() { Xinha.colorPicker.remember(this.colorCode, picker.savecolors); picker.callback(this.colorCode); picker.close(); }; 
    620620          td.appendChild(document.createTextNode(' ')); 
    621621          td.style.cursor = 'pointer'; 
     
    661661        but.style.padding = '0px 4px'; 
    662662        but.style.cursor = 'pointer'; 
    663         but.onclick = function() { colorPicker.remember(picker.chosenColor.value, picker.savecolors); picker.callback(picker.chosenColor.value); picker.close(); }; 
     663        but.onclick = function() { Xinha.colorPicker.remember(picker.chosenColor.value, picker.savecolors); picker.callback(picker.chosenColor.value); picker.close(); }; 
    664664        but.appendChild(document.createTextNode('OK')); 
    665665        but.align = 'center'; 
     
    709709          savedColors.appendChild(div); 
    710710        } 
    711         for ( var savedCols = 0; savedCols < colorPicker.savedColors.length; savedCols++ ) 
    712         { 
    713           createSavedColors(colorPicker.savedColors[savedCols]); 
     711        for ( var savedCols = 0; savedCols < Xinha.colorPicker.savedColors.length; savedCols++ ) 
     712        { 
     713          createSavedColors(Xinha.colorPicker.savedColors[savedCols]); 
    714714        } 
    715715        td.appendChild(savedColors); 
     
    781781 
    782782// array of the saved colors 
    783 colorPicker.savedColors = []; 
     783Xinha.colorPicker.savedColors = []; 
    784784 
    785785// add the color to the savedColors 
    786 colorPicker.remember = function(color, savecolors) 
     786Xinha.colorPicker.remember = function(color, savecolors) 
    787787{ 
    788788  // check if this color is known 
    789   for ( var i = colorPicker.savedColors.length; i--; ) 
     789  for ( var i = Xinha.colorPicker.savedColors.length; i--; ) 
    790790  { 
    791     if ( colorPicker.savedColors[i] == color ) 
     791    if ( Xinha.colorPicker.savedColors[i] == color ) 
    792792    { 
    793793      return false; 
     
    795795  } 
    796796  // insert the new color 
    797   colorPicker.savedColors.splice(0, 0, color); 
     797  Xinha.colorPicker.savedColors.splice(0, 0, color); 
    798798  // limit elements 
    799   colorPicker.savedColors = colorPicker.savedColors.slice(0, savecolors); 
     799  Xinha.colorPicker.savedColors = Xinha.colorPicker.savedColors.slice(0, savecolors); 
    800800  //[mokhet] probably some more parameters to send to the cookie definition 
    801801  // like domain, secure and such, especially with https connection i presume 
     
    804804  expdate.setMonth(expdate.getMonth() + 1); 
    805805 
    806   document.cookie = 'XinhaColorPicker=' + escape (colorPicker.savedColors.join('-')) + ';expires=' + expdate.toGMTString(); 
     806  document.cookie = 'XinhaColorPicker=' + escape (Xinha.colorPicker.savedColors.join('-')) + ';expires=' + expdate.toGMTString(); 
    807807  return true; 
    808808}; 
    809809 
    810810// try to read the colors from the cookie 
    811 colorPicker.loadColors = function() 
     811Xinha.colorPicker.loadColors = function() 
    812812{ 
    813813  var index = document.cookie.indexOf('XinhaColorPicker'); 
     
    817817    var end = document.cookie.indexOf(';', index); 
    818818    if ( end == -1 ) { end = document.cookie.length; } 
    819     colorPicker.savedColors = unescape(document.cookie.substring(begin, end)).split('-'); 
     819    Xinha.colorPicker.savedColors = unescape(document.cookie.substring(begin, end)).split('-'); 
    820820  } 
    821821}; 
    822822 
    823 colorPicker._lc = function(string) { 
     823Xinha.colorPicker._lc = function(string) { 
    824824  return Xinha._lc(string); 
    825825} 
Note: See TracChangeset for help on using the changeset viewer.