Flags for KAT

Adds Flags

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        Flags for KAT
// @namespace   PXgamer
// @description Adds Flags
// @include     *kat.cr/*
// @include     *kickass.to/*
// @include     *localhost:999/kat/testpage
// @version     1.4
// @grant       none
// ==/UserScript==

$(window).load(function(){
  $('.bbedit-spoiler').after('<span id="flagTog" style="width:auto; padding:1px; margin-right:2px;">Show/Hide Flags</span>');
  $('.bbedit-smileybar').after('<div id="flags" class="bbedit-smileybar" style="display:none;"></div>');

//Add countries under here
var j = [
"gb",
"us",
"zw"
];

  for (var i = 0; i < j.length; i++) {
   $('#flags').append('<img title="'+j[i].toUpperCase()+'" class="cusFlag" alt="flag" src="http://www.skype-emoticons.com/images/'+j[i]+'.png" />');
  }
});

$(document).delegate('#flagTog', 'click', function() {
  $('#flags').toggle();
});

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();
    }
  });
}
});

$(document).delegate('.cusFlag', 'click', function() { $('textarea',$(this).closest('form')).insertAtCaret( '[img]'+ $(this).attr('src') +'[/img]' );});