// ==UserScript== // @name Extra Smileys // @namespace SexyWolfie // @description Adds more smileys to KAT // @include *localhost:999/kat/testpage // @include *kickass.to/* // @include *kat.cr/* // @version 2.5 // @grant none // @downloadURL none // ==/UserScript== $(window).load(function(){ $('.bbedit-smileybar').append('smoke'); $('.bbedit-smileybar').append('headbang'); $('.bbedit-smileybar').append('mooning'); $('.bbedit-smileybar').append('squirrel'); $('.bbedit-smileybar').append('ninja'); $('.bbedit-smileybar').append('beer'); $('.bbedit-smileybar').append('drink'); $('.bbedit-smileybar').append('cake'); $('.bbedit-smileybar').append('pizza'); $('.bbedit-smileybar').append('rain'); $('.bbedit-smileybar').append('mail'); $('.bbedit-smileybar').append('music'); $('.bbedit-smileybar').append('phone'); $('.bbedit-smileybar').append('weed'); $('.bbedit-smileybar').append('mlph'); $('.bbedit-smileybar').append('coffee'); 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="19px" height="19px"]'+ $(this).attr('src') +'[/img]' );}) });