[ Index ]
 

Code source de Seagull 0.6.1

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/tinyfck/themes/advanced/jscripts/ -> color_picker.js (source)

   1  function init() {
   2      if (tinyMCE.isMSIE)
   3          tinyMCEPopup.resizeToInnerSize();
   4  }
   5  
   6  function selectColor() {
   7      var color = document.getElementById("selectedColorBox").value;
   8  
   9      tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color);
  10      tinyMCEPopup.close();
  11  }
  12  
  13  function showColor(color) {
  14      document.getElementById("selectedColor").style.backgroundColor = color;
  15      document.getElementById("selectedColorBox").value = color;
  16  }
  17  
  18  var colors = new Array(
  19      "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
  20      "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
  21      "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
  22      "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
  23      "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
  24      "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
  25      "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
  26      "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
  27      "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
  28      "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
  29      "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
  30      "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
  31      "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
  32      "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
  33      "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
  34      "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
  35      "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
  36      "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
  37      "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
  38      "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
  39      "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
  40      "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
  41      "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
  42      "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
  43      "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
  44      "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
  45      "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
  46  );
  47  
  48  function convertRGBToHex(col) {
  49      var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
  50  
  51      var rgb = col.replace(re, "$1,$2,$3").split(',');
  52      if (rgb.length == 3) {
  53          r = parseInt(rgb[0]).toString(16);
  54          g = parseInt(rgb[1]).toString(16);
  55          b = parseInt(rgb[2]).toString(16);
  56  
  57          r = r.length == 1 ? '0' + r : r;
  58          g = g.length == 1 ? '0' + g : g;
  59          b = b.length == 1 ? '0' + b : b;
  60  
  61          return "#" + r + g + b;
  62      }
  63  
  64      return col;
  65  }
  66  
  67  function convertHexToRGB(col) {
  68      if (col.indexOf('#') != -1) {
  69          col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
  70  
  71          r = parseInt(col.substring(0, 2), 16);
  72          g = parseInt(col.substring(2, 4), 16);
  73          b = parseInt(col.substring(4, 6), 16);
  74  
  75          return "rgb(" + r + "," + g + "," + b + ")";
  76      }
  77  
  78      return col;
  79  }
  80  
  81  function renderColorMap() {
  82      var html = "";
  83      var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color'));
  84  
  85      html += '<table border="0" cellspacing="1" cellpadding="0">'
  86          + '<tr>';
  87      for (var i=0; i<colors.length; i++) {
  88          html += '<td bgcolor="' + colors[i] + '">'
  89              + '<a href="javascript:selectColor();" onfocus="showColor(\'' + colors[i] +  '\');" onmouseover="showColor(\'' + colors[i] +  '\');">'
  90              + '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] +  '" alt="' + colors[i] +  '" /></a></td>';
  91          if ((i+1) % 18 == 0)
  92              html += '</tr><tr>';
  93      }
  94      html += '<tr><td colspan="18">'
  95          + '<table width="100%" border="0" cellspacing="0" cellpadding="0">'
  96          + '<tr><td>'
  97          + '<img id="selectedColor" style="background-color:' + tinyMCE.getWindowArg('input_color') + '" border="0" src="images/spacer.gif" width="80" height="16" />'
  98          + '</td><td align="right">'
  99          + '<input id="selectedColorBox" name="selectedColorBox" type="text" size="7" maxlength="7" style="width:65px" value="' + inputColor + '" />'
 100          + '</td></tr>'
 101          + '</table>'
 102          + '<div style="float: left"><input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" style="margin-top:3px" onclick="selectColor();"></div>'
 103          + '<div style="float: right"><input type="button" name="cancel" value="{$lang_cancel}" style="margin-top:3px" onclick="tinyMCEPopup.close();" id="cancel" /></div>'
 104          + '</td></tr>'
 105          + '</table>';
 106  
 107      document.write(html);
 108  }


Généré le : Fri Mar 30 01:27:52 2007 par Balluche grâce à PHPXref 0.7