主题: 如何自定义插入层和特殊符号?网站须用到
作者: aaron, 发布日期: 2011-08-19 17:09:26, 浏览数: 3127

 

 

从最早的3.2到3.5.5一用使用这两个插件,现在升级4.0了,也想增加这两个插件,因为网站部分功能实现要用到他们,请指教!!

作者: aaron, 发布日期: 2011-08-19 17:10:10

现在都修改好了,如果搞定这两个插件就非常完美了。

回复
作者: aaron, 发布日期: 2011-08-19 17:14:48

贴上原来的层插件:

KE.plugin['layer'] = {
    click : function(id) {
        var cmd = 'layer';
        var styles = [
            'margin:5px;border:1px solid #FF9900;',
            'margin:5px;border:2px solid #FF9900;',
            'margin:5px;border:1px dashed #FF9900;',
            'margin:5px;border:2px dashed #FF9900;',
            'margin:5px;border:1px dotted #FF9900;',
            'margin:5px;border:2px dotted #FF9900;'
        ];
  KE.util.selection(id);
  var table = KE.$$('table');
  table.width = 150;
  table.cellPadding = 0;
  table.cellSpacing = 2;
  table.border = 0;
  table.style.margin = 0;
  table.style.padding = 0;
  table.style.borderCollapse = 'separate';
  table.style.borderSpacing = '2px';
  for (var i = 0; i < styles.length; i++) {
  var row = table.insertRow(i);
  for (var j = 0; j < 1; j++) {
  var cell = row.insertCell(j);
  cell.style.padding = '1px';
  cell.style.margin = 0;
  cell.style.border = '1px solid #F9FCEF';
  cell.style.fontSize = '12px';
  cell.style.cursor = 'pointer';
  cell.onmouseover = function() {this.style.borderColor = '#FF9900'; }
  cell.onmouseout = function() {this.style.borderColor = '#F9FCEF'; }
  cell.onclick = new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "padding:5px;' + styles[i] + '")');
  cell.innerHTML = '<div class="ke-reset" style="height:15px;' + styles[i] + '"></div>';
   }
  }
  var menu = new KE.menu({
   id : id,
   cmd : cmd
  });
  menu.append(table);
  menu.show();
    },
    exec : function(id, value) {
        KE.util.select(id);
        var html = '<div style="' + value + 'width:90%;background-color:#FFFBE8;">' + KE.lang['pleaseInput'] + '</div>';
        KE.util.insertHtml(id, html);
        KE.layout.hide(id);
        KE.util.focus(id);
    }
};

 

特殊符号插件:

 

KE.plugin.specialchar = {
 click : function(id) {
  var charTable = [
   ['§','№','☆','★','○','●','◎','◇','◆','□'],
   ['℃','‰','■','△','▲','※','→','←','↑','↓'],
   ['〓','¤','°','#','&','@','\','︿','_',' ̄'],
   ['―','α','β','γ','δ','ε','ζ','η','θ','ι'],
   ['κ','λ','μ','ν','ξ','ο','π','ρ','σ','τ'],
   ['υ','φ','χ','ψ','ω','≈','≡','≠','=','≤'],
   ['≥','<','>','≮','≯','∷','±','+','-','×'],
   ['÷','/','∫','∮','∝','∞','∧','∨','∑','∏'],
   ['∪','∩','∈','∵','∴','⊥','∥','∠','⌒','⊙'],
   ['≌','∽','〖','〗','【','】','(',')','[',']']
  ];
  var cmd = 'specialchar';
  KE.util.selection(id);
  var table = KE.$$('table');
  table.cellPadding = 0;
  table.cellSpacing = 2;
  table.border = 0;
  table.style.margin = 0;
  table.style.padding = 0;
  table.style.borderCollapse = 'separate';
  table.style.borderSpacing = '2px';
  for (var i = 0; i < charTable.length; i++) {
   var row = table.insertRow(i);
   for (var j = 0; j < charTable[i].length; j++) {
    var cell = row.insertCell(j);
    cell.style.padding = '1px';
    cell.style.margin = 0;
    cell.style.border = '1px solid #FFFFFF';
    cell.style.fontSize = '12px';
    cell.style.cursor = 'pointer';
    cell.onmouseover = function() {this.style.borderColor = '#FF6600'; }
    cell.onmouseout = function() {this.style.borderColor = '#FFFFFF'; }
    cell.onclick = new Function('KE.plugin["' + cmd + '"].exec("' + id + '", "' + charTable[i][j] + '")');
    cell.innerHTML = charTable[i][j];
   }
  }
  var menu = new KE.menu({
   id : id,
   cmd : cmd
  });
  menu.append(table);
  menu.show();
 },
 exec : function(id, value) {
  KE.util.select(id);
  KE.util.insertHtml(id, value);
  KE.layout.hide(id);
  KE.util.focus(id);
 }
};

 

现在4.0要如何修改这两部分代码?

 

回复
作者: aaron, 发布日期: 2011-08-19 17:15:23
在线等!!!~~~~~
回复
作者: Roddy, 发布日期: 2011-08-19 18:27:08
呵呵,先修改好bug后会加这些功能的,我先记录一下。
回复
发表新帖 发表回复