root / trunk / web / dojo / dojox / editor / plugins / _SmileyPalette.js
History | View | Annotate | Download (2.47 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.editor.plugins._SmileyPalette"]){ |
||
9 | dojo._hasResource["dojox.editor.plugins._SmileyPalette"]=true; |
||
10 | dojo.provide("dojox.editor.plugins._SmileyPalette");
|
||
11 | dojo.require("dijit._Widget");
|
||
12 | dojo.require("dijit._Templated");
|
||
13 | dojo.require("dojo.i18n");
|
||
14 | dojo.require("dijit._PaletteMixin");
|
||
15 | dojo.requireLocalization("dojox.editor.plugins","Smiley",null,"ROOT,cs,de,es,fr,hu,it,ja,ko,pl,pt,ro,ru,zh,zh-tw"); |
||
16 | dojo.experimental("dojox.editor.plugins._SmileyPalette");
|
||
17 | dojo.declare("dojox.editor.plugins._SmileyPalette",[dijit._Widget,dijit._Templated,dijit._PaletteMixin],{templateString:"<table class=\"dijitInline dijitEditorSmileyPalette dijitPaletteTable\""+" cellSpacing=0 cellPadding=0><tbody dojoAttachPoint=\"gridNode\"></tbody></table>",baseClass:"dijitEditorSmileyPalette",_palette:[["smile","laughing","wink","grin"],["cool","angry","half","eyebrow"],["frown","shy","goofy","oops"],["tongue","idea","angel","happy"],["yes","no","crying",""]],dyeClass:"dojox.editor.plugins.Emoticon",buildRendering:function(){ |
||
18 | this.inherited(arguments); |
||
19 | var _1=dojo.i18n.getLocalization("dojox.editor.plugins","Smiley"); |
||
20 | var _2={};
|
||
21 | for(var _3 in _1){ |
||
22 | if(_3.substr(0,8)=="emoticon"){ |
||
23 | _2[_3.substr(8).toLowerCase()]=_1[_3];
|
||
24 | } |
||
25 | } |
||
26 | this._preparePalette(this._palette,_2); |
||
27 | }}); |
||
28 | dojo.declare("dojox.editor.plugins.Emoticon",null,{constructor:function(id){ |
||
29 | this.id=id;
|
||
30 | },getValue:function(){ |
||
31 | return dojox.editor.plugins.Emoticon.ascii[this.id]; |
||
32 | },imgHtml:function(_4){ |
||
33 | var _5="emoticon"+this.id.substr(0,1).toUpperCase()+this.id.substr(1),_6=dojo.moduleUrl("dojox.editor.plugins","resources/emoticons/"+_5+".gif"),_7=dojo.i18n.getLocalization("dojox.editor.plugins","Smiley")[_5],_8=["<img src=\"",_6,"\" class=\"",_4,"\" alt=\"",this.getValue(),"\" title=\"",_7,"\">"]; |
||
34 | return _8.join(""); |
||
35 | },fillCell:function(_9,_a){ |
||
36 | dojo.place(this.imgHtml("dijitPaletteImg"),_9); |
||
37 | }}); |
||
38 | dojox.editor.plugins.Emoticon.ascii={smile:":-)",laughing:"lol",wink:";-)",grin:":-D",cool:"8-)",angry:":-@",half:":-/",eyebrow:"/:)",frown:":-(",shy:":-$",goofy:":-S",oops:":-O",tongue:":-P",idea:"(i)",yes:"(y)",no:"(n)",angel:"0:-)",crying:":'(",happy:"=)"}; |
||
39 | dojox.editor.plugins.Emoticon.fromAscii=function(_b){ |
||
40 | var _c=dojox.editor.plugins.Emoticon.ascii;
|
||
41 | for(var i in _c){ |
||
42 | if(_b==_c[i]){
|
||
43 | return new dojox.editor.plugins.Emoticon(i); |
||
44 | } |
||
45 | } |
||
46 | return null; |
||
47 | }; |
||
48 | } |