// ==UserScript== // @name Extra Smileys // @namespace pxgamer // @description Adds more smileys to KAT // @include *kickass.to/* // @include *kat.cr/* // @author pxgamer // @version 2.11 // @grant none // @downloadURL https://update.greasyfork.icu/scripts/9821/Extra%20Smileys.user.js // @updateURL https://update.greasyfork.icu/scripts/9821/Extra%20Smileys.meta.js // ==/UserScript== $(window).load(function(){ // Settings var showFacebookReactions = true; // End Settings $('.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'); $('.bbedit-smileybar').append('puke'); if (showFacebookReactions) { $('.bbedit-smileybar').append('like'); $('.bbedit-smileybar').append('love'); $('.bbedit-smileybar').append('haha'); $('.bbedit-smileybar').append('yay'); $('.bbedit-smileybar').append('wow'); $('.bbedit-smileybar').append('sad'); $('.bbedit-smileybar').append('angry'); } 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]' );}); });