dever 6 anos atrás
pai
commit
ca3bab640d
1 arquivos alterados com 44 adições e 0 exclusões
  1. 44 0
      assets/dever/core.js

+ 44 - 0
assets/dever/core.js

@@ -43,6 +43,7 @@ var Dever =
         //this.Target();
         //this.Pjax();
         this.AutoComplete();
+        this.Emoji().Init();
     }
 
     ,AutoComplete : function()
@@ -68,6 +69,11 @@ var Dever =
 		//$.pjax.reload('.container');
 	}
 
+    ,Emoji : function()
+    {
+        return _Dever_Emoji;
+    }
+
     ,Page : function()
     {
         return _Dever_Page;
@@ -1118,6 +1124,44 @@ var _Dever_Upload =
     }
 }
 
+var _Dever_Emoji = 
+{
+    Init : function()
+    {
+        var self = this;
+        if ($('.dever-emoji').length) {
+            $('.dever-emoji').each(function()
+            {
+                self.Get($(this), $(this).html());
+            })
+        }
+    }
+
+    ,Get : function(e, content)
+    {
+        var handle = function()
+        {
+            e.html(twemoji.parse(content)).show(200);
+        };
+        if (typeof jEmoji != 'object') {
+            $.getScript('//twemoji.maxcdn.com/2/twemoji.min.js?11.4', function() {
+                /*
+                $("head").append("<link>");
+                var css = $("head").children(":last");
+                css.attr({
+                    rel:  "stylesheet",
+                    type: "text/css",
+                    href: config.script + '/lib/emoji/emoji.css'
+                });
+                */
+                return handle();
+            });
+        } else {
+            return handle();
+        }
+    }
+}
+
 //创建监听函数
 var xhrOnProgress=function(fun) {
     xhrOnProgress.onprogress = fun; //绑定监听