Deviantart Emoticons for KAT V3

Deviantart Emoticons for KAT Version 3

// ==UserScript==
// @name         Deviantart Emoticons for KAT V3
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Deviantart Emoticons for KAT Version 3
// @include *kat.cr/*
// @author       TheDels
// @grant        none
// ==/UserScript==

$(window).load(function(){
    $('.bbedit-smileybar').append('<img title="Sneeze" class="cusSmile" alt="sneeze" href src="http://st.deviantart.net/emoticons/s/sneeze2.gif" />');
    $('.bbedit-smileybar').append('<img title="Innocent" class="cusSmile" alt="innocent" src="http://st.deviantart.net/emoticons/i/innocent.gif" />');
    $('.bbedit-smileybar').append('<img title="Psychotic" class="cusSmile" alt="psychotic" src="http://st.deviantart.net/emoticons/p/psychotic.gif" />');
    $('.bbedit-smileybar').append('<img title="Woo Hoo!" class="cusSmile" alt="woohoo" src="http://st.deviantart.net/emoticons/w/woohoo.gif" />');
    $('.bbedit-smileybar').append('<img title="Head Bang" class="cusSmile" alt="headbang" src="http://st.deviantart.net/emoticons/h/headbang.gif" />');
    $('.bbedit-smileybar').append('<img title="Wave" class="cusSmile" alt="wave" src="http://st.deviantart.net/emoticons/w/wave1.gif" />');
    $('.bbedit-smileybar').append('<img title="Boing" class="cusSmile" alt="boing" src="http://st.deviantart.net/emoticons/b/boing.gif" />');
    $('.bbedit-smileybar').append('<img title="Airborne" class="cusSmile" alt="airborne" src="http://st.deviantart.net/emoticons/a/airborne.gif" />');
    $('.bbedit-smileybar').append('<img title="Evil Laughter" class="cusSmile" alt="evillaugh" src="http://st.deviantart.net/emoticons/m/mwahaha.gif" />');
    $('.bbedit-smileybar').append('<img title="Plotting" class="cusSmile" alt="plotting" src="http://st.deviantart.net/emoticons/p/plotting.gif" />');
    $('.bbedit-smileybar').append('<img title="The Devil" class="cusSmile" alt="devilish" src="http://st.deviantart.net/emoticons/d/devilish.gif" />');
    $('.bbedit-smileybar').append('<img title="Blush" class="cusSmile" alt="blush" src="http://st.deviantart.net/emoticons/b/blushes.gif" />');
    $('.bbedit-smileybar').append('<img title="Ashamed" class="cusSmile" alt="ashamed" src="http://st.deviantart.net/emoticons/a/ashamed2.gif"  />');
    $('.bbedit-smileybar').append('<img title="Facepalm" class="cusSmile" alt="facepalm" src="http://st.deviantart.net/emoticons/o/ohmygod.gif" />');
    $('.bbedit-smileybar').append('<img title="Oh?" class="cusSmile" alt="oh" src="http://st.deviantart.net/emoticons/w/weirdface2.gif" />');
    $('.bbedit-smileybar').append('<img title="Confused" class="cusSmile" alt="confused" src="http://st.deviantart.net/emoticons/c/confuse.gif" />');
    $('.bbedit-smileybar').append('<img title="What?" class="cusSmile" alt="what" src="http://st.deviantart.net/emoticons/c/confused.gif" />');
    $('.bbedit-smileybar').append('<img title="Sherlock" class="cusSmile" alt="sherlock" src="http://st.deviantart.net/emoticons/s/sherlock.gif" />');
    $('.bbedit-smileybar').append('<img title="Hmm" class="cusSmile" alt="hmm" src="http://st.deviantart.net/emoticons/h/hmm2.gif" />');
    $('.bbedit-smileybar').append('<img title="Buck-Teeth" class="cusSmile" alt="buckteeth" src="http://st.deviantart.net/emoticons/b/bucktooth.gif" />');
    $('.bbedit-smileybar').append('<img title="Tamper Tantrum" class="cusSmile" alt="tampertantrum" src="http://st.deviantart.net/emoticons/t/tantrum.gif" />');
    $('.bbedit-smileybar').append('<img title="Bleh" class="cusSmile" alt="bleh" src="http://st.deviantart.net/emoticons/b/bleh.gif" />');
    $('.bbedit-smileybar').append('<img title="Unimpressed" class="cusSmile" alt="unimpressed" src="http://st.deviantart.net/emoticons/u/unimpressed.gif" />');
    $('.bbedit-smileybar').append('<img title="Woot! Woot!" class="cusSmile" alt="wootwoot" src="http://st.deviantart.net/emoticons/w/w00t.gif" />');
    $('.bbedit-smileybar').append('<img title="Excited" class="cusSmile" alt="excited" src="http://st.deviantart.net/emoticons/e/excited.gif" />');
    $('.bbedit-smileybar').append('<img title="#1" class="cusSmile" alt="#1" src="http://st.deviantart.net/emoticons/n/number1.gif" />');
    $('.bbedit-smileybar').append('<img title="Salute" class="cusSmile" alt="salute" src="http://st.deviantart.net/emoticons/s/salute.gif" />');
    $('.bbedit-smileybar').append('<img title="Worship" class="cusSmile" alt="worship" src="http://st.deviantart.net/emoticons/w/worships.gif" />');
    $('.bbedit-smileybar').append('<img title="Yummy!" class="cusSmile" alt="yummy" src="http://st.deviantart.net/emoticons/c/chewing.gif" />');
    $('.bbedit-smileybar').append('<img title="Popcorn" class="cusSmile" alt="popcorn" src="http://st.deviantart.net/emoticons/p/popcorn2.gif" />');
    $('.bbedit-smileybar').append('<img title="Hungry" class="cusSmile" alt="hungry" src="http://st.deviantart.net/emoticons/h/hungry2.gif" />');
    $('.bbedit-smileybar').append('<img title="BRUSH YOUR TEETH!" class="cusSmile" alt="brushteeth" src="http://st.deviantart.net/emoticons/b/brushteeth.gif" />');
    $('.bbedit-smileybar').append('<img title="Meditate" class="cusSmile" alt="meditate" src="http://st.deviantart.net/emoticons/m/meditate.gif" />');
    $('.bbedit-smileybar').append('<img title="Fear" class="cusSmile" alt="fear" src="http://st.deviantart.net/emoticons/f/fear.gif" />');
    $('.bbedit-smileybar').append('<img title="OMG" class="cusSmile" alt="omg" src="http://st.deviantart.net/emoticons/o/omg.gif" />');
    $('.bbedit-smileybar').append('<img title="Shocked2" class="cusSmile" alt="shocked2" src="http://st.deviantart.net/emoticons/s/shocked.gif" />');
    $('.bbedit-smileybar').append('<img title="OMFG" class="cusSmile" alt="omfg" src="http://st.deviantart.net/emoticons/o/omfg.gif" />');
    $('.bbedit-smileybar').append('<img title="Blush2" class="cusSmile" alt="blush2" src="http://st.deviantart.net/emoticons/b/blush2.gif" />');
    $('.bbedit-smileybar').append('<img title="Petting" class="cusSmile" alt="petting" src="http://st.deviantart.net/emoticons/p/petting.gif" />');
    $('.bbedit-smileybar').append('<img title="Handshake" class="cusSmile" alt="handshake" src="http://st.deviantart.net/emoticons/h/handshake.gif" />');
    $('.bbedit-smileybar').append('<img title="Happy Tears" class="cusSmile" alt="happycry" src="http://st.deviantart.net/emoticons/h/happycry2.gif" />');
    $('.bbedit-smileybar').append('<img title="Flirty" class="cusSmile" alt="flirty" src="http://st.deviantart.net/emoticons/f/flirty.gif" />');
    $('.bbedit-smileybar').append('<img title="Drooling" class="cusSmile" alt="drooling" src="http://st.deviantart.net/emoticons/d/drool.gif" />');
    $('.bbedit-smileybar').append('<img title="Smoking" class="cusSmile" alt="smoking" src="http://st.deviantart.net/emoticons/s/smoking.gif" />');
    $('.bbedit-smileybar').append('<img title="Sad Rain" class="cusSmile" alt="sadrain" src="http://st.deviantart.net/emoticons/r/raincloud.gif" />');
    $('.bbedit-smileybar').append('<img title="Sarcasm" class="cusSmile" alt="sarcasm" src="http://st.deviantart.net/emoticons/s/sarcasm.gif" />');
    $('.bbedit-smileybar').append('<img title="Sarcastic Clap" class="cusSmile" alt="sarcasticclap" src="http://st.deviantart.net/emoticons/s/sarcasticclap.gif" />');
    $('.bbedit-smileybar').append('<img title="Slapping" class="cusSmile" alt="slap" src="http://st.deviantart.net/emoticons/s/slap.gif" />');
    $('.bbedit-smileybar').append('<img title="Happy Typer" class="cusSmile" alt="happytyper" src="http://st.deviantart.net/emoticons/t/typerhappy.gif" />');
    $('.bbedit-smileybar').append('<img title="Dance" class="cusSmile" alt="dance" src="http://st.deviantart.net/emoticons/d/dance.gif" />');
    jQuery.fn.extend({
        insertAtCaret: function(myValue){
            return this.each(function(i) {
                if (document.selection) {
                    //For browsers like Internet Explorer
                    this.focus();
                    var sel = document.selection.createRange();
                    sel.text = myValue;
                    this.focus();
                }
                else if (this.selectionStart || this.selectionStart == '0') {
                    //For browsers like Firefox and Webkit based
                    var startPos = this.selectionStart;
                    var endPos = this.selectionEnd;
                    var scrollTop = this.scrollTop;
                    this.value = this.value.substring(0, startPos)+myValue+this.value.substring(endPos,this.value.length);
                    this.focus();
                    this.selectionStart = startPos + myValue.length;
                    this.selectionEnd = startPos + myValue.length;
                    this.scrollTop = scrollTop;
                } else {
                    this.value += myValue;
                    this.focus();
                }
            });
        }
    });

    $('.cusSmile').click(function(){ $('textarea',$(this).closest('form')).insertAtCaret( '[img width="20px" height="20px"]'+ $(this).attr('src') +'[/img]' );});
});