SupplyOnUnitList

shows direct link to supply from the unit list page

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey 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 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.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

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        SupplyOnUnitList
// @description shows direct link to supply from the unit list page
// @namespace   virtonomica
// @version     1.01
// @include     http*://*virtonomic*.*/*/main/company/view/*/unit_list
// @grant       none
// ==/UserScript==

var run = function() {

	var win = (typeof(unsafeWindow) != 'undefined' ? unsafeWindow : top.window);
	$ = win.$;
    var realm = readCookie('last_realm');

    $('.unit-list-2014>tbody td[class^=info]').each(function(){
        UnitType = $(this).prop('class');
        var showSupply = false;
        switch (UnitType){
			
            // рыболовная база
			case "info i-fishingbase":
			break;

			// лесопилка
			case "info i-sawmill":
			break;

			// шахта
			case "info i-mine":
			break;

			// Нефтевышка
			case "info i-oilpump":
			break;

			// магазин
			case "info i-shop":
			showSupply = true;
			break;

			// Медцентры
			case "info i-medicine":
			break;

			// мельницы
			case "info i-mill":
			showSupply = true;
			break;

			// Ресторан
			case "info i-restaurant":
			break;

			// Фитнес центр
			case "info i-fitness":
			break;

			// Парикмахерская
			case "info i-hairdressing":
			break;

			// Прачечная
			case "info i-laundry":
			break;
	
			// Фруктовая плантация
			case "info i-orchard":
			break;

			//Заводы
			case "info i-workshop":
			showSupply = true;
			break;

			//Склад
			case "info i-warehouse":
//			showSupply = true;
			break;

			// Животноводческая ферма
			case "info i-animalfarm":
			showSupply = true;
			break;

			// Офис
			case "info i-office":
			break;
        }
        
        if (showSupply == true) {
            var id = $(this).parent().find($('.unit_id')).text();
            if (id == "") return;
            var url = '/%realm%/main/unit/view/%id%/supply'.replace('%realm%', realm).replace('%id%',id);
            var b = $('<a href="'+url+'"><img width="16" height="16" title="Снабжение" src="/img/icon/buy.gif"></a>');
            $(this).next().append(b);
        }
    }) //each function
}

if(window.top == window) {
    var script = document.createElement("script");
    script.textContent = '(' + run.toString() + ')();';
    document.documentElement.appendChild(script);
}