// ==UserScript==
// @name XioScript
// @namespace Virtonomics
// @description XioScript including building and top manager only
// @version 6.0
// @include http://*virtonomic*.*/*/*
// ==/UserScript==
function addJQuery(callback){
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "(" + callback.toString() + ")();";
document.getElementsByTagName("head")[0].appendChild(script);
}, false);
document.getElementsByTagName("head")[0].appendChild(script);
};
var virtoscript = function(){
if(window.top !== window.self){
return false;
}
console.log("Xio's superScript is running!");
/*
* more suggestions to the Xio script:
- add the CTI function to the "production" screen, and make it executable by group operation!
- in warehouses: "set selling price to prime cost"
- in warehouses: change for all items (on stock) from not for sale" to "to my company" ; selling price: prime cost of stocked goods
- for any purchase window: set purchase quantity to 0
- stock removal assistant (for producing subdivisions) : at the production screen ofclick the red truck symbol to send products away to a warehouse. My suggestion is that when clicking this button, the script will take the stocked quantity, deduct the required quantity and set the entry box in the popup window to the remaining quantity; this would serve especially well in restaurants and medical centres!). But better to take take this to the next level directly by requesting a code added to the end of the warehouse name, for example RGW (returned goods warehouse) so all different excess goods would be sent automatically into their respective warehouses trough one simple button click. This will be a bigger timesaver than your amazing building-funcion.
- add the required worker qualification for top-maxing onto the employee management page
- make the list sortable by the green "percentage of city salary"
- restaurant and hospital cleanup
*/
//Usefull stuff
function giveInfo(){
var $container = $('#topblock');
var loadview = '<p id="loading">Starting Up</p>';
$container.append(loadview);
$("#loading").css("color","#AAFFAA")
.css("font-size",16);
var tempPlace = "<p id='tempPlace'></table>";
$container.append(tempPlace);
$("#tempPlace").hide();
}
function numberfy(variable){
return parseFloat(String(variable).replace(/[\s\$\%]/g, "")) || 0;
}
function spaces(value){
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
//Top1 and Top3
function subdType(){
var link = $("#unitImage").find($("img")).attr('src');
var n = link.indexOf('animalfarm');
if (n > 0) return "farm";
n = link.indexOf('orchard');
if (n > 0) return "plantation";
n = link.indexOf('restaurant');
if (n > 0) return "restaurant";
n = link.indexOf('service_light');
if (n > 0) return "service";
n = link.indexOf('medicine');
if (n > 0) return "medical";
n = link.indexOf('fishingbase');
if (n > 0) return "fishing";
n = link.indexOf('lab');
if (n > 0) return "laboratory";
n = link.indexOf('workshop');
if (n > 0) return "factory";
n = link.indexOf('shop');
if (n > 0) return "shop";
n = link.indexOf('office');
if (n > 0) return "office";
n = link.indexOf('mill');
if (n > 0) return "mill";
n = link.indexOf('mine');
if (n > 0) return "mine";
n = link.indexOf('farm');
if (n > 0) return "agriculture";
n = link.indexOf('power');
if (n > 0) return "power";
return "unknow";
}
function subdFactor(){
var factor = 0;
switch(subdType()){
case "mine":
factor = 8;
break;
case "power":
factor = 6;
break;
case "factory":
factor = 4;
break;
case "agriculture": //fall-trough
factor = 1.6;
break;
case "plantation":
factor = 1.2;
break;
case "medical": //fall-trough
case "fishing":
factor = 1;
break;
case "farm":
factor = 0.6;
break;
case "restaurant": //fall-trough
case "shop":
case "laboratory":
case "mill":
factor = 0.4;
break;
case "service":
factor = 0.12;
break;
case "office":
factor = 0.08;
break;
}
return factor;
}
function calcTop1(empl, qual, factor){
return Math.pow(5, 1/2*(-1-qual)) * Math.pow(7, 1/2*(-1+qual)) * Math.sqrt(empl / factor);
}
function calcQualification(empl, manager, factor){
var value = -Math.log(empl/(35*factor*manager*manager))/Math.log(7/5);
return Math.floor(value*100)/100;
}
function calcEmployees(qual, manager, factor){
var value = Math.pow(5,1+qual) * Math.pow(7, 1-qual) * factor * manager * manager;
return Math.floor(value);
}
function calcTop3(manager){
var f = subdFactor() * 25;
return f * manager * (manager + 3);
}
function calcMaxTech(manager){
return Math.floor(Math.sqrt(29)*Math.pow(manager, 1/3));
}
function calcManagerTech(techLevel){
return Math.pow(techLevel/Math.sqrt(29), 3);
}
function calcEquipment(qualification){
return Math.floor(Math.pow(qualification, 1.5)*100)/100;
}
function calcEfficiency(employees, allEmployees, manager, factor, qualification, techLevel){
var effi = [];
effi[0] = 100;
effi[1] = manager * calcTop3(manager) / allEmployees / calcTop1(employees, qualification, factor) * 100;
effi[2] = manager / calcTop1(employees, qualification, factor) * 6/5 * 100;
effi[3] = calcTop3(manager) / allEmployees * 6/5 * 100;
effi[4] = manager / calcManagerTech(techLevel) * calcTop3(manager) / allEmployees * 100;
effi[5] = manager / calcManagerTech(techLevel) * 6/5 * 100;
console.log(effi);
return (Math.round(Math.min.apply(null, effi)*10)/10).toFixed(2) + "%";
}
function placeText($place, text, value){
$place.html($place.html()+"<br><span style='color:purple'><b>"+value+"</b>"+text+"</span>");
}
function makeRed($place, value, maxValue){
if(value > maxValue){
$place.css("color", "red");
}
}
function seeTops(){
var $qualRow = $("tr:contains('Qualification of employees'), tr:contains('Qualification of scientists'), \n\
tr:contains('Workers qualification')");
var $levelRow = $("tr:contains('Qualification of player')");
var $empRow = $("tr:contains('Number of employees'), tr:contains('Number of scientists'),\n\
tr:contains('Number of workers')");
var $totalEmpRow = $("tr:contains('profile qualification')");
var $techRow = $("tr:contains('Technology level')");
var $equipRow = $("tr:contains('Equipment quality'), tr:contains('Computers quality'),\n\
tr:contains('Livestock quality'), tr:contains('Quality of agricultural machines')");
var $effiRow = $("tr:contains('Top manager efficiency')");
var amount = numberfy($empRow.find("td:eq(1)").text());
var qual = numberfy($qualRow.find("td:eq(1)").text());
var level = numberfy($levelRow.find("td:eq(1)").text());
var factor = subdFactor();
var totalEmp = numberfy($totalEmpRow.find("td:eq(1)").text());
var tech = numberfy($techRow.find("td:eq(1)").text());
var eqQual = numberfy($equipRow.find("td:eq(1)").text());
var topQual = calcQualification(amount, level, factor);
var topEmp = spaces(calcEmployees(qual, level, factor));
var top3 = spaces(calcTop3(level));
var topTech = calcMaxTech(level);
var topEqQual = calcEquipment(qual);
var effi = calcEfficiency(amount, totalEmp, level, factor, qual, tech);
placeText($empRow.find("td:eq(1)")," (Maximum amount of employees with this employee qualification)", topEmp);
placeText($qualRow.find("td:eq(1)")," (Maximum employee qualification with this amount of employees)", topQual);
placeText($totalEmpRow.find("td:eq(1)")," (Maximum amount of employees in all subdivisions)", top3);
placeText($techRow.find("td:eq(1)")," (Maximum technology level with this top manager qualification)", topTech);
placeText($equipRow.find("td:eq(1)")," (Maximum equipment quality with this employee qualification)", topEqQual);
placeText($effiRow.find("td:eq(1)")," (Expected top manager efficiency with these settings)", effi);
makeRed($empRow.find("td:eq(0)"), amount, topEmp);
makeRed($qualRow.find("td:eq(0)"), qual, topQual);
makeRed($totalEmpRow.find("td:eq(0)"), totalEmp, top3);
makeRed($techRow.find("td:eq(0)"), tech, topTech);
makeRed($equipRow.find("td:eq(0)"), eqQual, topEqQual);
}
//Small overview settings
function industryQuality(){
$("a div .c_qlt:nth-of-type(5)").each(function(){
if(numberfy($(this).text()) > numberfy($(this).next().text()))
$(this).css("background-color", "#E1F5E2");
else
$(this).css("background-color", "#F5E1F4");
});
}
//Ajax
function ajaxGet(count, prior, arr, url, varNames, multiple, selectors, editor, callback, before){
if(typeof counts[count] === "undefined")
counts[count] = 0;
counts[count]++;
ajaxList(prior, function(){
$.ajax({
url: url,
dataType: "html"
})
.done(function(data){
var $data = $(data);
ajaxList(prior);
counts[count]--;
console.log(count+" left: "+counts[count]);
for(var i = 0; i < varNames.length; i++){
var temp = $data.find(selectors[i]);
if(multiple[i]){
arr[varNames[i]] = [];
for(var j = 0; j < $(temp).length; j++){
arr[varNames[i]][j] = editor[i]($(temp).eq(j));
}
}
else{
arr[varNames[i]] = editor[i](temp);
}
}
if(callback){
callback(data);
}
if(counts[count] === 0){
console.log("Done! ("+count+")");
countList();
}
})
.fail(function(){
counts[count]--;
ajaxGet(count, prior, arr, url, varNames, multiple, selectors, editor, callback, before);
setTimeout(function(){ajaxList(prior);}, 10000);
});
}, before);
}
function ajaxPost(count, prior, url, form, condition, callback, type, before){
function done(data, text){
counts[count]--;
if(text === "console.log"){
console.log(count+" left: "+counts[count]);
}
if(callback){
callback(data);
}
if(counts[count] === 0){
console.log("Done! ("+count+")");
countList();
}
}
if(typeof counts[count] === "undefined")
counts[count] = 0;
counts[count]++;
if(condition)
setTimeout(function(){done();}, 1000);
else
ajaxList(prior, function(){
$.post(url, form, function(){}, type)
.done(function(data){
ajaxList(prior);
done(data, "console.log");
})
.fail(function(){
counts[count]--;
ajaxPost(count, prior, url, form, condition, callback, type, before);
setTimeout(function(){ajaxList(prior);}, 10000);
});
}, before);
}
function ajaxList(prio, func, before){
if(typeof func === "function" && !before){
ajaxData[prio].push(func);
}
else if(typeof func === "function" && before){
ajaxData[prio].unshift(func);
}
else if(prio !== "STOP"){
if(prio === 0){
if(ajaxData[prio][0]){
ajaxData[prio].shift()();
return false;
}
}
else{
for(var i = 1; i < ajaxData.length; i++){
if(ajaxData[i][0]){
ajaxData[i].shift()();
return false;
}
}
}
setTimeout(function(){ajaxList(prio);}, 1000);
}
}
function countList(count, toCall){
var num = countData.length;
if(count){
countData[num] = {"counts":count, "function":toCall};
}
else{
for(var i = 0; i < num; i++){
if(countData[i]["counts"].every(function(element){ return counts[element] === "done";})){
countData[i]["function"]();
countData[i]["function"] = function(){return false;};
}
}
}
}
function edit(type){
var func;
switch(type){
case "":
func = function(obj){return obj;};
break;
case "text":
func = function(obj){return obj.text().trim();};
break;
case "val":
func = function(obj){return obj.val();};
break;
case "alt":
func = function(obj){return obj.attr("alt");};
break;
case "href":
func = function(obj){return obj.attr("href");};
break;
case "src":
func = function(obj){return obj.attr("src");};
break;
case "num":
func = function(obj){return numberfy(obj);};
break;
case "textnum":
func = function(obj){return numberfy(obj.text());};
break;
case "valnum":
func = function(obj){return numberfy(obj.val());};
break;
case "textdigit":
func = function(obj){return parseFloat(obj.text().replace(/[^\d+|\.]/g, ""));};
break;
}
return func;
}
function addHidden(form, button){
return form.append(form.find(button).clone().wrap("<p></p>").parent().html().replace("submit","hidden"));
}
//Building
function newLink(type, link){
var linkData = {
"Store" : ["/step2", "/step3" ,"/step4", "/step4-shop-district", "/step6", "/step8"],
"Service sector" : ["/step1-type-select", "/step2", "/step3" ,"/step4", "/step4-shop-district", "/step5", "/step6", "/step8"],
"Restaurant" : ["/step2", "/step3" ,"/step4", "/step4-shop-district", "/step5", "/step6", "/step8"],
"Factory" : ["/step1-type-select", "/step2", "/step3" ,"/step4", "/step5", "/step6", "/step7", "/step8"],
"Mill" : ["/step2", "/step3" ,"/step4", "/step6", "/step7", "/step8"],
"Animal farm" : ["/step1-type-select", "/step2", "/step3", "/step4", "/step5", "/step6", "/step7", "/step8"],
"Warehouse" : ["/step2", "/step3" ,"/step4", "/step4-warehouse", "/step6", "/step8"],
"Laboratory" : ["/step2", "/step3" ,"/step4", "/step6", "/step8"],
"Medical Center" : ["/step2", "/step3" ,"/step4", "/step5", "/step6", "/step8"],
"Power Plant" : ["/step2", "/step3" ,"/step4", "/step6", "/step7", "/step8"]
};
var linkArray = linkData[type];
var nLink = "";
for(var i = 0; i < linkArray.length; i++){
if(link.indexOf(linkArray[i]) >= 0){
nLink = link.replace(linkArray[i], linkArray[i+1]);
}
}
if(nLink === ""){
nLink = link + linkArray[0];
}
return nLink;
}
function getBuild(){
ajaxGet("buildingInfo", 0, build, build["link"], ["form"], [false], ["form:has('.list')"], [edit("")], function(data){
var $data = $(data);
var choices = $data.find("td:has('input:radio'):not(:has(td))").length;
build["choice"] = [];
build["name"] = [];
build["link"] = build["form"].attr("action");
var options = "";
var $parts = $data.find("td:has('input:radio'):not(:has(td))");
for(var i = 0; i < choices; i++){
build["choice"][i] = $parts.eq(i).nextUntil("td:has('input:radio')").andSelf();
build["name"][i] = build["choice"][i].filter(function(){return $(this).text().trim() !== "";}).eq(0).text().trim();
options += "<option>"+build["name"][i]+"</option>";
}
if(!build["type"]){
//First page
options = "";
var supportedBuildings = ["Store", "Service sector", "Restaurant", "Factory", "Mill", "Animal farm", "Warehouse", "Laboratory", "Medical Center", "Power Plant"];
for(var i = 0; i < supportedBuildings.length; i++){
options += "<option>"+supportedBuildings[i]+"</option>";
}
}
$("#buildTable").append("<tr><td><select id=buildSelect style='width:100%'>"+options+"</select></td><td><input type=submit id=buildGo value=Go!></td></tr>");
if(autoBuild){
$("#buildGo").trigger("click");
}
});
}
function getBuildLastPage(){
ajaxGet("buildingInfo", 0, build, build["link"], ["form", "input"], [false, false], ["form:has('.list')", "input:text"], [edit(""), edit("val")], function(){
console.log(build);
$("#buildTable").append("<tr><td><input type=text id=buildSelect style='width:100%' value="+build["input"]+" ></td><td><input type=submit id=buildGo value=Go!></td></tr>");
if(autoBuild){
$("#buildGo").trigger("click");
}
});
}
function postBuild(){
var index = build["name"].indexOf(build["value"]);
console.log(index);
build["form"].find("td:has('input:radio'):not(:has(td))").eq(index).find("input:radio")[0].checked = true;
build["form"] = addHidden(build["form"], "[name=next]");
build["form"] = build["form"].serialize();
ajaxPost("buildingInfo", 0, build["link"], build["form"], false, function(){
build["link"] = newLink(build["type"], build["link"]);
if(build["link"].slice(-1) === "8"){
getBuildLastPage();
}
else{
getBuild();
}
});
}
function postBuildLastPage(){
build["form"].find("input:text").val(build["value"]);
build["form"] = addHidden(build["form"], "[name=next]");
build["form"] = build["form"].serialize();
ajaxPost("buildingInfo", 0, build["link"], build["form"], false, function(){
console.log("ALL DONE!!!");
localStorage.XioBuilding = build["recipe"];
$("#buildTable").append("<tr><td>All Built!</td><td><input type=submit id=buildRestart value='Build another!'></td></tr>");
});
}
function mainBuild(){
console.log("start building");
countData = [];
counts = {};
ajaxData = [[]];
build = [];
build["link"] = $("a:contains('New subdivision')").attr("href");
var table = $("<table id=buildTable style='color:gold'></table>");
$("#topblock").append(table);
build["recipe"] = "";
getBuild();
ajaxList(0);
}
//Price
//Supply
//Salary
//Training
//Group
function setMainScheme(){
var base = $("<table id=groupBase>"
+"<tr id=buildButtons style='color:gold'>"
+"<td>Building</td>"
+"<td><input type=submit id=buildStart value=Start! title='Start building here!'></td>"
+"<td><input type=submit id=buildRestart value=Restart title='If you mess up, you can start with building from the beginning again'></td>"
+"<td><input type=submit id=buildLast value=Repeat title='Auto-build the last built subdivision. If you don't remove cookies, it will even remember the last thing you've built yesterday!'></td>"
+"</tr>"
+"<tr id=priceButtons style='color:gold'>"
+"<td>Pricing</td>"
+"<td><input type=submit id=pricePrime value='Prime Cost'></td>"
+"<td><input type=submit id=priceCTIE value='CTIE Price'></td>"
+"<td><input type=submit id=priceIP value='IP Price'></td>"
+"<td><input type=submit id=priceTaxes value='Save Taxes'></td>"
+"<td>"
+"Formula: Price = Prime Cost x "
+"<input type=text id=priceInputPrime value=1.1>"
+"</td>"
+"<td><input type=submit id=priceFormula value='Use Formula'></td>"
+"</tr>"
+"<tr id=supplyButtons style='color:gold'>"
+"<td>Supply</td>"
+"<td><input type=submit id=supplyRequired value='Required'></td>"
+"<td><input type=submit id=supplyXio value='Xio's'></td>"
+"<td></td>"
+"<td></td>"
+"<td>"
+"Formula: Supply = Required x "
+"<input type=text id=supplyInputRequired value=4>"
+" - Stock x "
+"<input type=text id=supplyInputStock value=1>"
+"</td>"
+"<td><input type=submit id=supplyFormula value='Use Formula'></td>"
+"</tr>"
+"<tr id=policyButtons style='color:gold'>"
+"<td>Policy</td>"
+"<td><input type=submit id=policyNo value='No Sale'></td>"
+"<td><input type=submit id=policyAll value='All'></td>"
+"<td><input type=submit id=policyCompany value='Company'></td>"
+"<td><input type=submit id=policyCorporation value='Corporation'></td>"
+"</tr>"
+"<tr id=adsButtons style='color:gold'>"
+"<td>Adverts</td>"
+"<td><input type=submit id=adsTV value=TV Minimum></td>"
+"<td><input type=submit id=adsManager value=Manager></td>"
+"<td></td>"
+"<td></td>"
+"<td>"
+"Formula: Advertisement budget = "
+"<input type=text id=adsInputBudget value='1 000 000' style='width: 100px'>"
+"</td>"
+"</tr>"
+"<tr id=salaryButtons style='color:gold'>"
+"<td>Salary</td>"
+"<td><input type=submit id=salaryRequired value='Required'></td>"
+"<td><input type=submit id=salaryManager value='Manager'></td>"
+"<td><input type=submit id=salaryBonus value='Bonus'></td>"
+"<td></td>"
+"<td>"
+"Formula: Salary = City Average x "
+"<input type=text id=salaryInputPerc value=0.8>"
+"</td>"
+"<td><input type=submit id=salaryFormula value='Use Formula'></td>"
+"</tr>"
+"<tr id=trainingButtons style='color:gold'>"
+"<td>Training</td>"
+"<td><input type=submit id=trainingMax value='Maximum'></td>"
+"<td></td>"
+"<td></td>"
+"<td></td>"
+"<td>"
+"Formula: Train "
+"<input type=text id=trainingInputDays value=4>"
+" days if salary is higher than "
+"<input type=text id=trainingInputPerc value=125>"
+"% of City Average"
+"</td>"
+"<td><input type=submit id=trainingFormula value='Use Formula'></td>"
+"</tr>"
+"</table>").tooltip();
$("#topblock").append(base);
$("body").delegate("#buildStart", "click", function(){
$(this).attr("disabled", true);
mainBuild();
});
$("body").delegate("#buildGo", "click", function(){
$(this).removeAttr("id").attr("class", "buildGoUSED").attr("disabled", true);
build["value"] = $("#buildSelect").val();
if(autoBuild){
build["value"] = localStorage.XioBuilding.split(";")[$(".buildSelectUSED").length];
$("#buildSelect").val(build["value"]);
}
if(!build["type"]){
build["type"] = build["value"];
build["recipe"] = build["value"];
}
else{
build["recipe"] += ";"+build["value"];
}
$("#buildSelect").removeAttr("id").attr("class", "buildSelectUSED").attr("disabled", true);
if(build["link"].slice(-1) === "8"){
postBuildLastPage();
}
else{
postBuild();
}
});
$("body").delegate("#buildRestart", "click", function(){
autoBuild = false;
$("#buildTable").remove();
mainBuild();
});
$("body").delegate("#buildLast", "click", function(){
if(localStorage.XioBuilding){
autoBuild = true;
}
else{
alert("Build something first!");
}
$("#buildTable").remove();
mainBuild();
});
var first = true;
var type = null;
var selector = 'tbody:first > tr[class!=u-th][class!=u-z][class!=u-z ozz]';
function disButton(img){
function enable(selector){
$(selector).css("font-style", "normal").css("color", "gold").find("input").attr("disabled", false).css("background-color", "");
}
function disable(selector){
$(selector).css("font-style", "italic").css("color", "grey").find("input").attr("disabled", true).css("background-color", "#777777");
}
switch(img){
case false: disable("#priceButtons, #supplyButtons, #policyButtons, #adsButtons, #salaryButtons, #trainingButtons"); break;/*
case "u-c i-workshop": enable("#priceButtons, #supplyButtons, #policyButtons, #salaryButtons, #trainingButtons"); break;
case "u-c i-animalfarm": enable("#priceButtons, #supplyButtons, #policyButtons, #salaryButtons, #trainingButtons"); break;
case "u-c i-fishingbase": enable("#priceButtons, #policyButtons, #salaryButtons, #trainingButtons"); break;
case "u-c i-lab": enable("#salaryButtons, #trainingButtons"); break;
case "u-c i-medicine": enable("#supplyButtons, #adsButtons, #salaryButtons, #trainingButtons"); break;
case "u-c i-mine": enable("#priceButtons, #policyButtons, #salaryButtons, #trainingButtons"); break;
case "u-c i-office": enable("#salaryButtons, #trainingButtons"); break;
case "u-c i-orchard": enable("#priceButtons, #policyButtons, #salaryButtons, #trainingButtons"); break;
case "u-c i-coal_power": enable("#supplyButtons, #salaryButtons, #trainingButtons"); break;
case "u-c i-restaurant": enable("#supplyButtons, #adsButtons, #salaryButtons, #trainingButtons"); break;
case "u-c i-shop": enable("#supplyButtons, #adsButtons, #salaryButtons, #trainingButtons"); break;
case "u-c i-warehouse": enable("#priceButtons, #policyButtons"); break;*/
}
}
disButton(false);
$('table.unit-list').selectable({
filter: selector,
tolerance: 'touch',
cancel: ':input,option,a',
selecting: function(event, ui) {
},
selected: function(event, ui) {
var img = $('td:eq(2)', ui.selected).attr('class');
if (first) {
first = false;
type = img;
disButton(img);
return false;
} else {
if (type !== img) {
$(ui.selected).removeClass('ui-selected');
}
}
},
unselected: function(event, ui) {
if ($('.ui-selected').length === 0){
first = true;
type = null;
$(this).selectable('option', 'filter', selector);
disButton(false);
}
}
});
}
var countData = [];
var counts = {};
var ajaxData = [[]];
var building = [];
var build = [];
var autoBuild = false;
var urlRegEx = {
main : "virtonomic*.*\/(.*)\/main\/.*",
unitList : "virtonomic*.*\/.*\/main\/company\/view\/.*\/unit_list$",
companyView : "virtonomic*.*\/(.*)\/main\/company\/view\/([0-9]+/.*)",
unitViewMain: "virtonomic*.*\/(.*)\/main\/unit\/view\/([0-9]+#?$)",
unitViewSubPage : "virtonomic*.*\/(.*)\/main\/unit\/view\/([0-9]{1,})/(.*)",
globalReport : "virtonomic*.*\/(.*)\/window\/globalreport\/marketing\/by_products\/([0-9]+)",
unitSupplyCreate : "virtonomic*.*\/(.*)\/window\/unit\/supply\/create\/([0-9]+)\/step2",
unitSupply : "virtonomic*.*\/.*\/main\/unit\/view\/[0-9]+\/supply",
equipment : "virtonomic*.*\/.*/window/unit/equipment/[0-9]+",
companyEmployeeMgmnt : "virtonomic*.*\/.*\/main\/company\/view\/[0-9]+\/unit_list/employee",
qualification : "virtonomic*.*\/.*\/main\/user\/privat\/persondata\/knowledge",
unitMarket : "virtonomic*.*\/.*\/main\/unit_market\/list",
MgmntEquipmentRepair : "virtonomic*.*\/.*\/window\/management_units\/equipment\/repair",
reportsIndustry : "virtonomic*.*\/.*\/main/company\/.*/.*\/sales_report/by_produce",
warehouseSaleScreen: "virtonomic*.*\/.*\/window\/unit\/supply\/multiple\/vendor:([0-9]+)\/product:([0-9]+)/brandname:([0-9]*)",
};
var url = location.href;
if(new RegExp(urlRegEx["unitList"]).test(url)){
var style = document.createElement("style");
style.type = 'text/css';
style.textContent = ".ui-selected td { background-color: #FEE068 !important;}"
+".ui-selecting td { background-color: #FEE88F !important;} "
+"input[type=submit] {width: 100%}"
+"input[type=text] {width: 25px}";
document.getElementsByTagName("head")[0].appendChild(style);
var link = document.createElement("link");
link.rel = "stylesheet";
link.href = "//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css";
document.getElementsByTagName("head")[0].appendChild(link);
var script = document.createElement("script");
script.src = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js';
script.onload = setMainScheme;
document.getElementsByTagName("head")[0].appendChild(script);
pageShow([1000, 2000, 4000]);
}
if(new RegExp(urlRegEx["reportsIndustry"]).test(url)){
industryQuality();
}
if(new RegExp(urlRegEx["unitViewMain"]).test(url)){
seeTops();
}
//Page Subdivision
function pageShow(array) {
var html = "";
for(var i = 0; i < array.length; i++){
html += '<a href="http://virtonomics.com/mary/main/common/util/setpaging/dbunit/unitListWithProduction/'+array[i]+'">'
+'<span class="">'+array[i]+'</span></a>';
}
$(".paging a[href$=400]").after(html);
}
};
addJQuery(virtoscript);