Thursday, January 31, 2013

emoticon otomatis with jquery

·
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' type='text/javascript'/>
letakkan code diatas sebelum code </head>
kalo di template anda sudah ada jangan di dipasang lagi...

lalu masukkan code yang dibawah ini sebelum code </body>
 

<script type='text/javascript'>

    window.setTimeout(function() {

        document.body.className = document.body.className.replace('loading', '');

      }, 10);

  </script>

  <b:include data='blog' name='google-analytics'/>

<script type='text/javascript'>

//<![CDATA[

var emoRange = "#comments p, div.emoWrap",

    putEmoAbove = "iframe#comment-editor",

    emoMessage = "To insert emoticon you must added at least one space before the code.";



// Emoticon bar before comment-form

$(function() {

    $(putEmoAbove)

        .before('<div style="text-align:center" class="emoWrap">
:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :&gt;) (o) [-( :-? (p)
:-s (m) 8-) :-t :-b  b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
<br/><b>Click to see the code!</b><br/>To insert
emoticon you must added at least one space before the
code.</div>');

    var emo = function(emo, imgRep, emoKey) {

        $(emoRange)

            .each(function() {

            $(this)

                .html($(this)

                .html()

                .replace(/<br>:/g, "<br> :")

                .replace(/<br>;/g, "<br> ;")

                .replace(/<br>=/g, "<br> =")

                .replace(/<br>\^/g, "<br> ^")

                .replace(emo, " <img style='max-height:24px' src='" +
imgRep + "' class='emo delayLoad' alt='" + emoKey + "' />"));

        });

    };

    emo(/\s:\)\)+/g, "http://devilzc0de.org/forum/images/smilies/wawa.gif", ":))");

    emo(/\s;\(\(+/g, "http://devilzc0de.org/forum/images/smilies/ngambek.gif", ";((");

emo(/\s:\)+/g, "http://devilzc0de.org/forum/images/smilies/top.gif", ":)");

emo(/\s:-\)+/g, "http://devilzc0de.org/forum/images/smilies/ngakak.gif", ":-)");

    emo(/\s=\)\)+/g, "http://devilzc0de.org/forum/images/smilies/muntah.gif", "=))");

    emo(/\s;\(+/g, "http://devilzc0de.org/forum/images/smilies/mewek.gif", ";(");

    emo(/\s;-\(+/g, "http://devilzc0de.org/forum/images/smilies/nangis.gif", ";-(");

    emo(/\s:d/ig, "http://devilzc0de.org/forum/images/smilies/curiga.gif", ":d");

    emo(/\s:-d/ig, "http://devilzc0de.org/forum/images/smilies/cuteboy.gif", ":-d");

    emo(/\s@-\)+/g, "http://devilzc0de.org/forum/images/smilies/pusing.gif", "@-)");

    emo(/\s:p/ig, "http://devilzc0de.org/forum/images/smilies/camb.gif", ":p");

    emo(/\s:o/ig, "http://devilzc0de.org/forum/images/smilies/hah.gif", ":o");

    emo(/\s:&gt;\)+/g, "http://devilzc0de.org/forum/images/smilies/bodo.gif", ":&gt;)");

    emo(/\s\(o\)+/ig, "http://devilzc0de.org/forum/images/smilies/angel1.gif", "(o)");

    emo(/\s\[-\(+/g, "http://devilzc0de.org/forum/images/smilies/siapinpisau.gif", "[-(");

    emo(/\s:-\?/g, "http://devilzc0de.org/forum/images/smilies/bingung.gif", ":-?");

    emo(/\s\(p\)+/ig, "http://devilzc0de.org/forum/images/smilies/mohon.gif", "(p)");

    emo(/\s:-s/ig, "http://devilzc0de.org/forum/images/smilies/bangga.gif", ":-s");

    emo(/\s\(m\)+/ig, "http://devilzc0de.org/forum/images/smilies/capedeh.gif", "(m)");

    emo(/\s8-\)+/ig, "http://devilzc0de.org/forum/images/smilies/ngasep.gif", "8-)");

    emo(/\s:-t/ig, "http://devilzc0de.org/forum/images/smilies/siul.gif", ":-t");

    emo(/\s:-b/ig, "http://devilzc0de.org/forum/images/smilies/gengster.gif", ":-b");

    emo(/\sb-\(+/ig, "http://devilzc0de.org/forum/images/smilies/cium.gif", "b-(");

    emo(/\s:-#/ig, "http://devilzc0de.org/forum/images/smilies/dingin.gif", ":-#");

    emo(/\s=p~/ig, "http://devilzc0de.org/forum/images/smilies/cheer.gif", "=p~");

    emo(/\s\$-\)+/ig, "http://devilzc0de.org/forum/images/smilies/relax.gif", "$-)");

    emo(/\s\(b\)+/ig, "http://devilzc0de.org/forum/images/smilies/bacit.gif", "(b)");

    emo(/\s\(f\)+/ig, "http://devilzc0de.org/forum/images/smilies/rocker.gif'", "(f)");

    emo(/\sx-\)+/ig, "http://devilzc0de.org/forum/images/smilies/wow.gif", "x-)");

    emo(/\s\(k\)+/ig, "http://devilzc0de.org/forum/images/smilies/tolong.gif", "(k)");

    emo(/\s\(h\)+/ig, "http://devilzc0de.org/forum/images/smilies/tagih.gif", "(h)");

    emo(/\s\(c\)+/ig, "http://devilzc0de.org/forum/images/smilies/batuk.gif", "(c)");

    emo(/\scheer/ig, "http://devilzc0de.org/forum/images/smilies/chaer.gif", "cheer");

   

// Show alert one times!

    $('div.emoWrap')

        .one("click", function() {

        if (emoMessage) {

            alert(emoMessage);

        }

    });

    // Click to show the code!

    $('.emo')

        .css('cursor', 'pointer')

        .live("click", function(e) {

        $('.emoKey')

            .remove();

        $(this)

            .after('<input class="emoKey" type="text" size="' + this.alt.length + '" value=" ' + this.alt + '" />');

$('.emoKey')

            .trigger("select");

e.stopPropagation();

    });

    $('.emoKey')

        .live("click", function() {

        $(this)

            .focus()

            .select();

    });



});

//]]>

</script>

pesan emoticon nya tidak tampil diatas kotak komentar..
masukkan code di bawah ini di:
setting -->>post and comment -->>Comment Form Message -->taruh kode nya di kotak yg tersedia....
:)   :))  ;((  :-)  =))   ;(   ;-(  :d   :-d   
@-)  :p  :o  :&gt;)  (o)  [-(  :-?  (p)  :-s  (m)  8-)  :-t  :-b  b-(  :-#  =p~  $-)  (b)  (f)  x-)  (k)  (h)  (c)  cheer.....

Click to see the code!

To insert emoticon you must added at least one space before the code.

demo nya seperti punya saya.....

1 comments:

Unknown said...
This comment has been removed by the author.

Post a Comment