Changeset 904


Ignore:
Timestamp:
10/15/07 22:16:58 (9 years ago)
Author:
ray
Message:

#1093 [InsertSmiley] remove smiley gifs from trunk

Location:
trunk/plugins/InsertSmiley
Files:
2 added
580 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/InsertSmiley/insert-smiley.js

    r853 r904  
    3838  return Xinha._lc(string, 'InsertSmiley'); 
    3939}; 
     40Xinha.Config.prototype.InsertSmiley=  { 
     41  smileyURL : "http://www.x-webservice.net/storage/xinha/plugins/InsertSmiley/" 
     42}; 
    4043 
    4144InsertSmiley.prototype.buttonPress = function(editor) { 
    4245  var self = this; 
    4346  var sel = editor.getSelectedHTML().replace(/(<[^>]*>|&nbsp;|\n|\r)/g,""); 
    44   var param = new Object(); 
     47  var param = {}; 
    4548  param.editor = editor; 
    46   param.editor_url = _editor_url; 
    47   if(param.editor_url == "../") { 
    48     param.editor_url = document.URL; 
    49     param.editor_url = param.editor_url.replace(/^(.*\/).*\/.*$/g, "$1"); 
    50   } 
    5149  editor._popupDialog("plugin://InsertSmiley/insertsmiley", function(param) { 
    52     editor.insertHTML("<img src=\"" + param.imgURL + "\" alt=\"Smiley\" />"); 
     50    editor.insertHTML("<img src=\"" + editor.config.InsertSmiley.smileyURL + param.smileyfile + "\" alt=\"Smiley\" />"); 
    5351  }, param); 
    5452}; 
  • trunk/plugins/InsertSmiley/popups/insertsmiley.html

    r859 r904  
    88var InsertSmiley = window.opener.InsertSmiley; 
    99var editor = null; 
     10var _editor_url = opener._editor_url; 
    1011var param; 
    11  
     12var smileys = null; 
    1213function Init() { 
    13   var totalsmileys = 580; 
    1414  __dlg_translate("InsertSmiley"); 
    1515  __dlg_init(); 
    1616  param = window.dialogArguments; 
    1717  editor = param['editor']; 
    18  
     18  var smileyList = Xinha._geturlcontent(_editor_url + 'plugins/InsertSmiley/smileys.txt'); 
     19  smileyList = smileyList.match(/^.+$/mg); 
     20  var smileyURL = editor.config.InsertSmiley.smileyURL; 
    1921  var tbody = document.getElementById("smileytable"); 
    2022  var inum; 
    2123  var trow; 
    22   for(var i = 1; i <= totalsmileys; i++) { 
    23     if((i - 1) % 4 == 0) { 
    24     trow = tbody.insertRow((i - 1) / 4); 
     24  for(var i = 0; i < smileyList.length; i++) { 
     25    if((i) % 4 == 0) { 
     26      trow = tbody.insertRow((i ) / 4); 
     27    } 
     28   trow.insertCell((i) % 4).innerHTML = '<a onclick="onOK(\'' + encodeURIComponent( smileyList[i] ) + '\')" href="javascript:void(0);"><img style="border: 0px;" alt="Smiley ' + (i +1) + '" src="'+ smileyURL + encodeURIComponent(smileyList[i]) + '" />'; 
    2529  } 
    26   // find new number to be found in smileys folder 
    27   inum = ""; 
    28   if(i < 1000) { 
    29     if(i < 100) { 
    30     if(i < 10) { 
    31       inum = "000" + i; 
    32     } else { 
    33       inum = "00" + i; 
    34     } 
    35     } else { 
    36       inum = "0" + i; 
    37     } 
    38   } else { 
    39     inum = i; 
    40   } 
    41   trow.insertCell((i - 1) % 4).innerHTML = "<a href=\"javascript:onOK('" + inum + "')\"><img style=\"border: 0px;\" alt=\"Smiley " + + i + "\" src=\""+ param.editor_url +"plugins/InsertSmiley/smileys/" + inum + ".gif\" />"; 
    42   } 
    43   document.body.onkeypress = __dlg_key_press; 
    4430} 
    45  
    4631function onCancel() { 
    4732  __dlg_close(null); 
     
    4934} 
    5035 
    51 function onOK(smileynum) { 
     36function onOK(smileyfile) { 
    5237  var params = {}; 
    53   params.imgURL = param.editor_url +"plugins/InsertSmiley/smileys/" + smileynum + ".gif"; 
     38  params.smileyfile = smileyfile; 
    5439  __dlg_close(params); 
    5540  return false; 
    5641} 
    5742 
    58 function __dlg_key_press(ev) { 
    59   ev || (ev = window.event); 
    60   switch(ev.keyCode) { 
    61     case 13: 
    62     document.getElementById('bt_ok').click(); 
    63       break; 
    64     case 27: 
    65     __dlg_close(); 
    66     return false; 
    67   } 
    68 return true; 
    69 } 
    7043</script> 
    7144 
Note: See TracChangeset for help on using the changeset viewer.