JSFiddle - React, Tailwind, and code Playground
by dafin defandaky
HTML
<div id="panel-emo">
<div class='title'>PENTING UNTUK DIPERHATIKAN</div>
<div class="message"></div>
<a href='#' class="close">OK</a>
</div>
<div class="wrap-emo" id="emo-bar"><strong>kode klik emo</strong> :) :( ^_^ :D ;) :-bd :yaya: :'( :\ :p B) :Q :Ozz 7:( \o/ **p <3 0:) :-a 7:O *fck* x@ X@ ~x( =p* </div>
CSS
#panel-emo {
position:fixed !important;
position:absolute;
top:50px;
right:0;
left:0;
z-index:9999;
text-align:center;
width:370px;
margin:0 auto;
padding-bottom:10px;
height:auto;
background-color:#333;
-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.4);
-moz-box-shadow:0 1px 2px rgba(0,0,0,0.4);
box-shadow:0 1px 2px rgba(0,0,0,0.4);
z-index:1000;
opacity:0;
}
#panel-emo .title {
background-color:#3B5998;
padding:10px;
color:#fff;
font:normal 14px;
margin:0;
position:relative;
}
#panel-emo .message {
padding:5px 10px;
text-align:left;
display:block;
font-size:12px;
color:#fff;
}
.wrap-emo {padding:10px;background-color:#555;border:1px solid #369;}
#panel-emo a{color:#fff;}
#panel-emo .close-wrapper .close a{
position:relative;
font:bold 10px Arial,Sans-Serif;
cursor:pointer;
}
#panel-emo .close-wrapper .close:hover {
color:#aaa;
}
#emo-bar {
padding:10px 14px;
color:black;
font:bold 12px Tahoma,Arial,Sans-Serif;
text-align:center;
}
img.emo, input.emo-Key {
display:inline-block; /* Penting! */
*display:inline;
vertical-align:middle;
}
input.emo-Key {
border:1px solid #ccc;
background-color:white;
font:bold 11px Arial,Sans-Serif;
padding:1px 2px;
margin:0px 0px 0px 2px;
color:black;
width:20px;
}
JavaScript
$(function () {
if (putEmoAbove) {
$(putEmoAbove).before('<div class="wrap-emo" id="emo-bar"> :) :( ^_^ :D ;) :-bd :yaya: :'( :\ :p B) :Q :Ozz 7:( \o/ **p <3 0:) :-a 7:O *fck* x@ X@ ~x( =p* </div>');
}
function emo(emo, imgRep, emoKey) {
$(emoRange).each(function () {
$(this).html($(this).html().replace(/<br ?\/?>(:|;|=|\^)/ig, "<br> $1").replace(emo, " <img src='" + imgRep + "' class='emo delayLoad' alt='" + emoKey + "' />"));
});
}
emo(/\s:\)+/g, "http://reader-hosting.googlecode.com/svn/branches/emotion/smile.gif", ":)");
emo(/\s;\)+/g, "http://reader-hosting.googlecode.com/svn/branches/emotion/wink.gif", ";)");
emo(/\s:\(/g, "http://reader-hosting.googlecode.com/svn/branches/emotion/sad.gif", ":(");
emo(/\s:yaya:/ig, "http://reader-hosting.googlecode.com/svn/branches/emotion/yaya.gif", ":yaya:");
emo(/\s:\\/g, "http://reader-hosting.googlecode.com/svn/branches/emotion/memble.gif", ":\");
emo(/\s:D/g, "http://reader-hosting.googlecode.com/svn/branches/emotion/haha.gif", ":D");
emo(/\s\^(\_|)\^/g, "http://reader-hosting.googlecode.com/svn/branches/emotion/senyum-tulus.gif", "^_^");
emo(/\s:'\(/g, "http://reader-hosting.googlecode.com/svn/branches/emotion/cry.gif", ":'(");
emo(/\sB\)/g, "http://reader-hosting.googlecode.com/svn/branches/emotion/cool.gif", "B)");
emo(/\s:Q/ig, "http://reader-hosting.googlecode.com/svn/branches/emotion/smoking.gif", ":Q");
emo(/\s\*\*p/ig, "http://reader-hosting.googlecode.com/svn/branches/emotion/crazy.gif", "**p");
emo(/\s7:\(/g, "http://reader-hosting.googlecode.com/svn/branches/emotion/conf.gif", "7:(");
emo(/\s:p/ig, "http://reader-hosting.googlecode.com/svn/branches/emotion/wee.gif", ":p");
emo(/\s:Oz+/ig, "http://reader-hosting.googlecode.com/svn/branches/emotion/sleep.gif", ":Ozz");
emo(/\s7:O/ig, "http://reader-hosting.googlecode.com/svn/branches/emotion/angry.gif", "7:O");
...