indicator_zarplaty

Адаптация скрипта индикатора зарплат под наличие знака $

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name           indicator_zarplaty
// @version        0.2
// @description:ru Адаптация скрипта индикатора зарплат под наличие знака $
// @namespace      http://virtonomic*.*/*/main/unit/view/*
// @include        http://virtonomic*.*/*/main/unit/view/*
// @exclude        http://virtonomic*.*/*/main/unit/view/*/*
// @description Адаптация скрипта индикатора зарплат под наличие знака $
// ==/UserScript==
var win = (typeof(unsafeWindow) != 'undefined' ? unsafeWindow : top.window);
$=win.$;
if(!(/(?:Склад)/.test($('div.officePlace').prop('textContent')))) {
	aaa=$('tr:gt(0)>td.title:contains("Зарплата")').next();
	bbb=aaa.prop('textContent').replace("$", "").replace(" ", "").replace(" ", "").replace(" ", "").replace(" ", "").replace(" ", "").replace(" ", "").replace(" ", "").replace(" ", "");
	//console.log(bbb);
	zarp = parseFloat(bbb)
	//console.log(zarp);
	var n= bbb.indexOf("$");
	//console.log("n="+n);
	var str = bbb.substr(n+1);
	//console.log(str);
	zzz = Math.round( 100*zarp/parseFloat(str) );
	//console.log(zzz);
	//zarp=bbb.match(/\d[.\s\d]*(?=\$)/g);
	//console.log("zarp="+zarp[0]);
	color=zzz<80?'red':'green';
	color=zzz>80?'blue':color;
	aaa.prop('textContent',aaa.prop('textContent') +" ----> "+zzz+'%').css('color',color).css('fontWeight',(zzz==80?'':'bold'));
	//console.log("---------");

}