Tabun IMG'er

I Want my <img> back!

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        Tabun IMG'er
// @author   Йетанозер
// @namespace   localhaust
// @description I Want my <img> back!

// @include  http://tabun.everypony.ru/*
// @include  http://tabun.everypony.info/*
// @include  http://табун.всепони.рф/*

// @include  https://tabun.everypony.ru/*
// @include  https://tabun.everypony.info/*
// @include  https://табун.всепони.рф/*

// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js

// @grant none

// @version     0.1
// ==/UserScript==

$(window).load(function(){ //Да, это всё за чем нуже жикваери. Нет, я не смог заставить это работать иначе.
    function insertOverCaret(areaId, text, aftertext) {
        var txtarea = document.getElementById(areaId);
        var scrollPos = txtarea.scrollTop;
        var caretPos = txtarea.selectionStart;

        var front = (txtarea.value).substring(0, caretPos);
        var mid = (txtarea.value).substring(txtarea.selectionStart, txtarea.selectionEnd);
        var back = (txtarea.value).substring(txtarea.selectionEnd, txtarea.value.length);
        txtarea.value = front + text + mid + aftertext + back;
        caretPos = caretPos + text.length;
        txtarea.selectionStart = caretPos;
        txtarea.selectionEnd = caretPos;
        txtarea.focus();
        txtarea.scrollTop = scrollPos;
    }
    

        var newButt = document.createElement("li");
       newButt.classList.add('markItUpButton');
       newButt.classList.add('markItUpButton15');
       newButt.classList.add('edit-image');
    
       var newLink = document.createElement("a");
       newLink.href = '#';
       newLink.title = 'Добавить <img>';
       newLink.innerHTML = 'Добавить <img>';
    
       newLink.onclick = function(event){
           event.preventDefault();
           insertOverCaret('form_comment_text', '<img src = "', '"></img>');
       };
    
       newButt.appendChild(newLink);
       var header = document.getElementsByClassName("markItUpHeader");
        //alert(header.length);
        header.item(0).firstChild.appendChild(newButt);
});