Greasy Fork

Extra Smileys

Adds more smileys to KAT

目前为 2015-05-12 提交的版本。查看 最新版本

// ==UserScript==
// @name        Extra Smileys
// @namespace   SexyWolfie
// @description Adds more smileys to KAT
// @include     *localhost:999/kat/testpage
// @include     *kickass.to/*
// @version     1.5
// @grant       none
// ==/UserScript==


$(window).load(function(){
  
	$('.bbedit-smileybar').append('<img title="Smoking" class="bbedit-smoker" alt="smoke" src="http://www.skype-emoticons.com/images/emoticon-00176-smoke.gif" />');
	$('.bbedit-smileybar').append('<img title="Headbanger" class="bbedit-headbang" alt="headbang" src="http://www.skype-emoticons.com/images/emoticon-00179-headbang.gif" />');
	$('.bbedit-smileybar').append('<img title="Mooning" class="bbedit-mooning" alt="mooning" src="http://www.skype-emoticons.com/images/emoticon-00172-mooning.gif" />');
	$('.bbedit-smileybar').append('<img title="Squirrel" class="bbedit-squirrel" alt="squirrel" src="http://www.skype-emoticons.com/images/emoticon-00185-heidy.gif" />');
	$('.bbedit-smileybar').append('<img title="Ninja" class="bbedit-ninja" alt="ninja" src="http://www.skype-emoticons.com/images/emoticon-00170-ninja.gif" />');
	$('.bbedit-smileybar').append('<img title="Beer" class="bbedit-beer" alt="beer" src="http://www.skype-emoticons.com/images/emoticon-00167-beer.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();
    }
  });
}
});

	$('.bbedit-smoker').click(function(){ $('#replytext').insertAtCaret( '[:Qsmoker]' );})
	$('.bbedit-headbang').click(function(){ $('#replytext').insertAtCaret( '[:Qheadbang]' );})
	$('.bbedit-mooning').click(function(){ $('#replytext').insertAtCaret( '[:Qmooning]' );})
	$('.bbedit-squirrel').click(function(){ $('#replytext').insertAtCaret( '[:Qsquirrel]' );})
	$('.bbedit-ninja').click(function(){ $('#replytext').insertAtCaret( '[:Qninja]' );})
	$('.bbedit-beer').click(function(){ $('#replytext').insertAtCaret( '[:Qbeer]' );})
  
});