Changeset 7132
- Timestamp:
- May 11, 2008, 2:46:16 AM (14 years ago)
- Location:
- OpenPNE/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
OpenPNE/trunk/public_html/js/tiny_mce/plugins/openpne/editor_plugin.js
r7044 r7132 32 32 }); 33 33 34 tinymce.create('tinymce.ui.OpenPNEEmojiButton:tinymce.ui.ColorSplitButton', { 35 OpenPNEEmojiButton : function(id, s) { 36 var t = this; 37 38 t.parent(id, s); 39 40 t.settings = s; 41 }, 42 43 renderMenu : function() { 44 var t = this, m, i = 0, s = t.settings, n, tb, tr, w; 45 var DOM = tinymce.DOM, Event = tinymce.dom.Event, is = tinymce.is, each = tinymce.each; 46 w = DOM.add(s.menu_container, 'div', {id : t.id + '_menu', dir : 'ltr', 'class' : s['menu_class'] + ' ' + s['class'], 47 style : 'position:absolute;left:0;top:-1000px;'}); 48 m = DOM.add(w, 'div', {'class' : s['class'] + ' mceSplitButtonMenu'}); 49 DOM.add(m, 'span', {'class' : 'mceMenuLine'}); 50 51 n = DOM.add(m, 'table', {'class' : 'mceEmojiSplitMenu'}); 52 tb = DOM.add(n, 'tbody'); 53 54 for (var num in s.emoji) { 55 var emoji = s.emoji[num]; 56 for (var i = emoji.start; i <= emoji.end; i++) { 57 if (i == emoji.start || i % 25 == 0) { 58 tr = DOM.add(tb, 'tr'); 59 } 60 n = DOM.add(tr, 'td'); 61 62 n = DOM.add(n, 'img', { 63 src : "./skin/default/img/emoji/" + s.carrier +"/" + s.carrier + i + ".gif", 64 alt : "[" + s.carrier + ":" + i + "]", 65 }); 66 67 Event.add(n, 'mousedown', function(e) { 68 tinyMCE.execCommand("mceInsertContent", false, e.element().getAttribute("alt")); 69 }); 70 } 71 } 72 73 DOM.addClass(m, 'mceColorSplitMenu'); 74 75 return w; 76 }, 77 78 renderHTML : function() { 79 var s = this.settings, h = '<a id="' + this.id + '" href="javascript:;" class="mceButton mceButtonEnabled ' + s['class'] 80 + '" onmousedown="return false;" onclick="return false;" title="' + tinymce.DOM.encode(s.title) + '">'; 81 82 if (s.image) { 83 h += '<img class="mceIcon" src="' + s.image + '" /></a>'; 84 } else { 85 h += '<span class="mceIcon ' + s['class'] + '"></span></a>'; 86 } 87 88 return h; 89 }, 90 91 postRender : function() { 92 tinymce.dom.Event.add(this.id, 'click', this.showMenu, this); 93 } 94 }); 95 34 96 tinymce.PluginManager.requireLangPack('openpne'); 35 97 … … 100 162 c = this._createOpenPNEColorButton("op_color", { title : "{#openpne.op_color}", image: config["op_color"].imageURL, cmd : "ForeColor"}, cm); 101 163 } 164 165 if (n == "op_emoji_docomo" || n == "op_emoji_au" && config["op_emoji_au"].isEnabled || n == "op_emoji_softbank" && config["op_emoji_softbank"].isEnabled) { 166 var emoji_config = { 167 op_emoji_docomo : { 168 carrier : "i", 169 emoji : [ {start : 1, end : 252} ], 170 title : "{#openpne." + n + "}", 171 image: config[n].imageURL 172 }, 173 op_emoji_au : { 174 carrier : "e", 175 emoji : [ {start : 1, end : 518}, {start : 700, end : 822} ], 176 title : "{#openpne." + n + "}", 177 image: config[n].imageURL 178 }, 179 op_emoji_softbank : { 180 carrier : "s", 181 emoji : [ {start : 1, end : 485} ], 182 title : "{#openpne." + n + "}", 183 image: config[n].imageURL 184 } 185 } 186 c = this._createOpenPNEEmojiButton(n, emoji_config[n], cm); 187 } 188 102 189 return c; 103 190 }, … … 143 230 }, 144 231 232 _createOpenPNEEmojiButton : function(id, s, cm) { 233 var t = cm, ed = t.editor, cmd, c; 234 235 if (t.get(id)) { 236 return null; 237 } 238 239 s.title = ed.translate(s.title); 240 s.scope = s.scope || ed; 241 242 if (!s.onclick) { 243 s.onclick = function(v) { ed.execCommand(s.cmd, s.ui || false, v || s.value); }; 244 } 245 246 if (!s.onselect) { 247 s.onselect = function(v) { ed.execCommand(s.cmd, s.ui || false, v || s.value); }; 248 } 249 250 id = t.prefix + id; 251 252 s = tinymce.extend({ title : s.title, 'class' : 'mce_' + id, 'menu_class' : ed.getParam('skin') + 'Skin', scope : s.scope}, s); 253 254 c = new tinymce.ui.OpenPNEEmojiButton(id, s); 255 ed.onMouseDown.add(c.hideMenu, c); 256 257 ed.onRemove.add(function() { 258 c.destroy(); 259 }); 260 261 return t.add(c); 262 }, 145 263 _previewToText : function(s, editor) { 146 264 var editorDoc = editor.getBody(); -
OpenPNE/trunk/webapp/modules/pc/templates/inc_tinymce_textarea.tpl
r7128 r7132 39 39 imageURL : "({t_img_url_skin filename=deco_op_image})", 40 40 contentURL : "({t_url _html=0 m=pc a=page_h_album_insert_dialog})" 41 }, 42 op_emoji_docomo : { 43 isEnabled : 1, 44 imageURL : "({t_img_url_skin filename=deco_op_emoji_docomo})", 45 }, 46 op_emoji_au : { 47 isEnabled : ({if $smarty.const.OPENPNE_EMOJI_DOCOMO_FOR_PC})0,({else})1({/if}), 48 imageURL : "({t_img_url_skin filename=deco_op_emoji_au})", 49 }, 50 op_emoji_softbank : { 51 isEnabled : ({if $smarty.const.OPENPNE_EMOJI_DOCOMO_FOR_PC})0,({else})1({/if}), 52 imageURL : "({t_img_url_skin filename=deco_op_emoji_softbank})", 41 53 } 42 54 }
Note: See TracChangeset
for help on using the changeset viewer.