KG - upload: add [img] tags

adds link to auto tag image URLs

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        KG - upload: add [img] tags
// @description adds link to auto tag image URLs
// @namespace   KG
// @include     http*://*karagarga.in/upload.php*
// @grant	none
// @version     0.4
// ==/UserScript==

var d = document.getElementsByName("descr")[0];

if (d && d.type != 'hidden') {  // only run on second step of upload.php

	 var code = 'javascript: '
		 + 'var d = document.getElementsByName("descr")[0];'
		 + 'd.value = d.value.replace(/^\\s+(?=http)/gim, "");'		 
		 + 'd.value = d.value.replace(/(https?:\\S*?\\S\\.(png|jpg|jpeg|gif))/gi, "[img]$1[/img]\\n");'
		 + 'return false;'
		 ;
	 
	 var tagImg = document.createElement("a");
	 tagImg.setAttribute("onclick", code);
	 tagImg.textContent = "Add [IMG][/IMG] tags";
	 tagImg.href = "#";
	 
	 d.parentNode.insertBefore(tagImg, d.nextSibling);
}