您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
выделяет технологии изученные вами, а так же добавляет кнопку продажи лицензий в итоги торгов лицензиями
当前为
// ==UserScript== // @name Virtonomica: "Обзор рынка лицензий: Спрос" и "Итоги торгов лицензиями" // @namespace virtonomica // @version 2.4 // @description выделяет технологии изученные вами, а так же добавляет кнопку продажи лицензий в итоги торгов лицензиями // @include http://*virtonomic*.*/*/main/globalreport/technology/*/*/target_market_summary // @include http://*virtonomic*.*/*/main/globalreport/technology/*/*/target_market_summary/* // @include http://*virtonomic*.*/*/main/management_action/*/investigations/technologies // @include http://*virtonomic*.*/*/main/globalreport/technology_target_market/total // @include http://*virtonomic*.*/*/main/globalreport/technology_market/total // @include http://*virtonomic*.*/*/window/technology_market/ask/by_unit/*/offer/set // @include http://*virtonomic*.*/*/main/management_action/*/technology_target_market/technologies // @include http://*virtonomic*.*/*/window/technology_market/bid/*/*/*/set // ==/UserScript== var run = function() { var win = (typeof(unsafeWindow) != 'undefined' ? unsafeWindow : top.window); $ = win.$; //резделитель разрядов function commaSeparateNumber(val, sep){ var separator = sep || ','; while (/(\d+)(\d{3})/.test(val.toString())){ val = val.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1"+separator); } return val; } function getLast(str){ var matches = str.match(/\/(\d+)$/); return matches[1]; } function getRealm(){ var svHref = window.location.href; var matches = svHref.match(/\/(\w+)\/main\/globalreport\/technology_target_market\//); return matches[1]; } function getVal(spName){ return JSON.parse(window.localStorage.getItem(spName)); } function setVal(spName, pValue){ window.localStorage.setItem(spName, JSON.stringify(pValue)); } function trim(str) { return str.replace(/^\s+|\s+$/g,""); } function getLvl(str) { var first = str.indexOf('</') + 4; var perc = trim(str.substr(0, first)); var second = str.substr(first+1).indexOf('</') + 4; //var lvl = parseFloat(trim(str.substr(first+1, second)).replace("<b>","").replace("</b>",""), 10); var matches = str.substr(first+1, second).match(/([0-9]+\.[0-9]+)/); var lvl; if(matches == null || matches.length == 0){ lvl = 0; }else{ lvl = parseFloat(matches[1], 10); } // console.log("'"+ lvl+"'" ); return lvl; } function sort_table(tbody, col, asc){ var rows = tbody.rows; var rlen = rows.length; var arr = []; var i, j, cells; // fill the array with values from the table for(i = 0; i < rlen; i++){ cells = rows[i].cells; arr.push([rows[i], cells[col].innerHTML]); } // sort the array by the specified column number (col) and order (asc) arr.sort(function(a, b){ return asc*compareSpec(a[1], b[1]); }); for(i = 0; i < rlen; i++){ tbody.appendChild(arr[i][0]); } } function getCurrDate(){ return new Date().getDate(); } function setTechList(callback) { var stab = getVal('techList'); //console.log(Object.keys(stab).length); if (stab == null || stab['update_date'] != getCurrDate() || Object.keys(stab).length == 1) { stab = {}; // получение информации о своих изученных технах var tmurl=$( 'ul.#menutop a:contains("Предприятия")').attr('href').slice(0,-10); var numpos=tmurl.indexOf("company"); var tmurl0=tmurl.substring(numpos+12); // tmurl=tmurl.substring(0,numpos); // tmurl=tmurl+"management_action"+tmurl0+"/investigations/technologies"; $.get(tmurl,function(data){ $('div[class="tech_row"] > div > div > a', data).each(function(){ var link = $(this); //http://virtonomica.ru/olga/window/management_action/4207337/investigations/technology_offer_create/5/370088 var matches = link.attr('href').match(/technology_offer_create\/(\d+)\/(\d+)/); var nteh = matches[1]; var techId = matches[2]; //console.log(link.attr('href')); stab[techId + '|' + nteh] = 1; }); stab['update_date'] = getCurrDate(); setVal('techList', stab); //alert(stab); if(callback != null) { callback(); } }); } else { if(callback != null) { callback(); } } } function sortTable(){ var rows = $('table[class="list"] > tbody > tr:has(td):has(a)'); //console.log(rows.length); var path = '> td[style="background: rgb(154, 255, 154);"]'; rows.sort(function(a, b) { //console.log($(path, a).length +' > '+ $(path, b).length); return $(path, b).length - $(path, a).length; }); rows.each(function() { var row = $(this); $('table[class="list"] > tbody:last-child').append(row); }); } function getSum(obj) { var sum = 0; for(var i=0, n=obj.length; i < n; i++) { sum += obj[i].p * obj[i].q; } return sum; } function getRowSum(cells) { var sum = 0; cells.each( function() { var cell = $(this); //console.log('sum = ' + sum); sum += parseFloat(cell.attr('asksum')); }); return sum; } function set_color_teh() { var stab = getVal('techList'); $('table[class="list"] > tbody > tr > td > a').each( function() { var link = $(this); var href = link.attr('href'); var matches = href.match(/technology\/(\d+)\/(\d+)\//); var techId = matches[1]; var nteh = matches[2]; //console.log(techId+'|'+nteh); // названия техн совпали var exist = stab[techId+'|'+nteh]; if (exist != null && exist == 1) { link.parent().css('background','#9AFF9A'); } link.parent().attr('title','lvl: '+nteh); }); //sortTable(); $.getJSON('http://cobr123.github.io/tech/'+getRealm()+'/license_ask_wo_bid.json', function (data) { var found = false; $.each(data, function (key, val) { //console.log(val.i+'/'+val.l); //console.log(JSON.stringify(val)); $('table[class="list"] > tbody > tr > td[style="background: rgb(154, 255, 154);"] > a[href*="/globalreport/technology/'+val.i+'/'+val.l+'/target_market_summary/"]').each( function() { var link = $(this); link.parent().css('background','#ffff6b'); var sum = getSum(val.awb); //console.log('sum = ' + sum); link.parent().attr('asksum', sum); link.parent().attr('title', commaSeparateNumber(sum, ' ')); found = true; }); }); if (found) { var rows = $('table[class="list"] > tbody > tr:has(td):has(a)'); //console.log(rows.length); var pathSum = '> td[asksum]'; var pathSelf = '> td[style="background: rgb(154, 255, 154);"]'; rows.sort(function(a, b) { var sumA = getRowSum($(pathSum, a)); var sumB = getRowSum($(pathSum, b)); if (sumB === sumA){ return $(pathSelf, b).length - $(pathSelf, a).length; } else { return sumB - sumA; } }); rows.each(function() { var row = $(this); $('table[class="list"] > tbody:last-child').append(row); }); } }); } function addSellLicenseLink() { var stab = getVal('techList'); //http://virtonomica.ru/olga/main/globalreport/technology/380082/2/target_market_summary var svHref = window.location.href; var matches = svHref.match(/technology\/(\d+)\/(\d+)\//); var techId = matches[1]; var nteh = matches[2]; var exist = stab[techId+'|'+nteh]; if (exist != null && exist == 1) { //http://virtonomica.ru/olga/main/globalreport/technology/422577/2/target_market_summary/2015-05-01/bid //http://virtonomica.ru/olga/window/technology_market/bid/4207337/422577/5/set //http://virtonomica.ru/olga/main/company/view/4207337/dashboard matches = $('a[class="dashboard"]').attr('href').match(/([0-9]+)/); var companyId = matches[1]; var svSellHref = svHref.replace('main/globalreport/technology/','window/technology_market/bid/'+companyId+'/').replace(/\/target_market_summary(\/\d+-\d+-\d+\/\w+)?/,'/set'); var svSellLink = '<b><a href="'+svSellHref+'" onclick="return doWindow(this, 1000, 800);">Продать лицензии</a></b>'; //http://virtonomica.ru/olga/main/management_action/4207337/technology_target_market/technologies var svOpenListHref = svHref.replace(/\/globalreport\/technology\/\w+\/\w+\/target_market_summary(\/\d+-\d+-\d+\/\w+)?/,'/management_action/'+companyId+'/technology_target_market/technologies'); var svOpenListLink = '<b><a href="'+svOpenListHref+'" target="_blank">Список лицензий</a></b>'; $('table[class="list"] > tbody > tr:last').after('<tr><td colspan="2">'+svSellLink+'</td><td colspan="3">'+svOpenListLink+'</td></tr>'); } } function addTargetMarketSummaryLink(){ //http://virtonomica.ru/olga/main/globalreport/technology/380082/2/target_market_summary //http://virtonomica.ru/olga/graph/globalreport/technology_market/summary/423170/4 var svDate = new Date().toISOString().slice(0, 10); var svUrl = $('img#graphreport').attr('src').replace('/graph/globalreport/technology_market/summary/','/main/globalreport/technology/') + '/target_market_summary/'+svDate+'/bid'; var svTargetMarketSummaryLink = '<b><a href="'+svUrl+'" target="_blank">Итоги торгов лицензиями</a></b>'; $('table[class="list"] > tbody > tr:last').after('<tr><td colspan="5">'+svTargetMarketSummaryLink+'</td></tr>'); } var postCount = 0; var postDoneCount = 0; var total = 0; function cancelBid(delAllBidsBtn, svUrl){ postCount += 1; delAllBidsBtn.val('Отправляю запросы: ' + postCount + ' / ' + total); //console.log("svUrl = " + svUrl); $.get( svUrl ) .done(function() { console.log( "success" ); }) .fail(function() { console.log( "error" ); }) .always(function() { console.log( "always" ); postDoneCount += 1; delAllBidsBtn.val('Ожидаю ответы: ' + postDoneCount + ' / ' + total); if(postCount === postDoneCount){ window.location = window.location.href; } }); } function addDelAllBidsBtn(){ var links = $('table.grid > tbody > tr > td > a:has(img[src="/img/icon/cancel.gif"])'); if(links.length === 0) return; var confirmMsg = 'Удалить все предложения отображаемые на странице'; var delAllBidsBtn = $('<input type="button" value="Удалить все предложения отображаемые на странице"/>').click(function() { if(confirm(confirmMsg + '?')) { delAllBidsBtn.attr('disabled', true); postCount = 0; postDoneCount = 0; var checkedCnt = $('input[name="cancel_bid"]:checked').length; if(checkedCnt === 0) { total = links.length; links.each(function() { var svUrl = $(this).attr('href'); cancelBid(delAllBidsBtn, svUrl); }); } else { total = checkedCnt; $('input[name="cancel_bid"]:checked').each(function() { var svUrl = $(this).prev().attr('href'); cancelBid(delAllBidsBtn, svUrl); }); } delAllBidsBtn.val('Ожидаю ответы: ' + postDoneCount + ' / ' + total); } }); var linkImgs = $('img[src="/img/icon/cancel.gif"]'); linkImgs.each(function() { var img = $(this); var checkbox = $('<input type="checkbox" name="cancel_bid">').click(function() { var checkedCnt = $('input[name="cancel_bid"]:checked').length; if(checkedCnt === 0) { confirmMsg = 'Удалить все предложения отображаемые на странице'; } else { confirmMsg = 'Удалить ' + checkedCnt + ' предложения(й) отображаемые на странице'; } delAllBidsBtn.val(confirmMsg); }); img.parent().after(checkbox); }); $('label[for="groupByUnitType"]').after(delAllBidsBtn).after(' '); } function formatMoney(spSum) { var rounded = Math.abs(parseFloat(spSum,10)); var idx = 0; while (rounded > 1000) { rounded = rounded / 1000; idx += 1; } if (idx === 1) { return rounded.toFixed(0) + 'Th'; } else if (idx === 2) { return rounded.toFixed(0) + 'M'; } else if (idx === 3) { return rounded.toFixed(0) + 'B'; } else if (idx === 4) { return rounded.toFixed(0) + 'Tr'; } else if (idx === 5) { return rounded.toFixed(0) + 'Qua'; } else if (idx === 6) { return rounded.toFixed(0) + 'Qui'; } else if (idx === 7) { return rounded.toFixed(0) + 'Sex'; } else if (idx === 8) { return rounded.toFixed(0) + 'Sep'; } else { return rounded; } } function sumMoneyToNumber(spSum){ return parseFloat(spSum.replace('$','').replace(/\s+/g,''),10); } function getShortSum(spSum) { return formatMoney(sumMoneyToNumber(spSum)); } function sortTechTable(){ var rows = $('table[class="list"] > tbody > tr:has(td[title^="$"]):has(td[style=""])'); //console.log(rows.length); var path = '>td[title^="$"]'; rows.sort(function(a, b) { //console.log($(path, a).length +' > '+ $(path, b).length); return sumMoneyToNumber($(path, b).attr('title')) - sumMoneyToNumber($(path, a).attr('title')); }); rows.each(function() { var row = $(this); $('table[class="list"] > tbody:last-child').append(row); }); } function sortAndColorTechTable(){ var stab = getVal('techList'); var techLvls = $('table[class="list"] > tbody > tr:nth-child(2) > th'); $('table[class="list"] > tbody > tr > td[title^="$"]').each( function() { var cell = $(this); //console.log('techIdlink = ' + $('> th > a:has(img)', cell.parent()).attr('href')); var techId = getLast($('> th > a:has(img)', cell.parent()).attr('href')); var nteh = techLvls.eq(cell.index()).text(); //console.log(techId+'|'+nteh); // названия техн совпали var exist = stab[techId+'|'+nteh]; if (exist != null && exist == 1) { cell.css('background','#9AFF9A'); } else if (sumMoneyToNumber(cell.attr('title')) <= 500000000) { cell.css('background','#ffff6b'); } }); //sortTechTable(); } function addQuickPriceBtns(){ var ovBtn1k = $('<button>1k</button>').click(function() { $('input#min_price').val(1000); return false; }); var ovBtn10k = $('<button>10k</button>').click(function() { $('input#min_price').val(10000); return false; }); var ovBtn100k = $('<button>100k</button>').click(function() { $('input#min_price').val(100000); return false; }); var ovBtn1m = $('<button>1m</button>').click(function() { $('input#min_price').val(1000000); return false; }); var ovBtn10m = $('<button>10m</button>').click(function() { $('input#min_price').val(10000000); return false; }); var ovBtn100m = $('<button>100m</button>').click(function() { $('input#min_price').val(100000000); return false; }); $('input#min_price').after(ovBtn100m).after(ovBtn10m).after(ovBtn1m).after(ovBtn100k).after(ovBtn10k).after(ovBtn1k); } // if (/http:\/\/\w*virtonomic\w+.\w+\/\w+\/main\/globalreport\/technology_target_market\/total/.test(window.location)) { setTechList(set_color_teh); var link = null; $('table[class="list"] > tbody > tr > td > a').each(function(){ link = $(this); link.attr('href', link.attr('href')+'/ask'); link.attr('onclick', 'return doWindow(this, 1000, 600);'); //console.log(link.attr('href')); }); } if (/http:\/\/\w*virtonomic\w+.\w+\/\w+\/main\/globalreport\/technology_market\/total/.test(window.location)) { var cell = null; var svNewVal = ''; $('table[class="list"] > tbody > tr > td[title^="$"]').each(function(){ cell = $(this); svNewVal = getShortSum(cell.attr('title')); cell.html(svNewVal); cell.attr('style',''); }); setTechList(sortAndColorTechTable); } if (/http:\/\/\w*virtonomic\w+.\w+\/\w+\/main\/globalreport\/technology\/\w+\/\w+\/target_market_summary/.test(window.location) ||/http:\/\/\w*virtonomic\w+.\w+\/\w+\/main\/globalreport\/technology\/\w+\/\w+\/target_market_summary\/\w+\/\w+/.test(window.location) ) { setTechList(addSellLicenseLink); } if (/http:\/\/\w*virtonomic\w+.\w+\/\w+\/window\/technology_market\/ask\/by_unit\/\w+\/offer\/set/.test(window.location) ) { addTargetMarketSummaryLink(); } if (/http:\/\/\w*virtonomic\w+.\w+\/\w+\/main\/management_action\/\w+\/technology_target_market\/technologies/.test(window.location) ) { addDelAllBidsBtn(); } if (/http:\/\/\w*virtonomic\w+.\w+\/\w+\/window\/technology_market\/bid\/\w+\/\w+\/\w+\/set/.test(window.location) ) { addQuickPriceBtns(); } } if(window.top == window) { var script = document.createElement("script"); script.textContent = '(' + run.toString() + ')();'; document.documentElement.appendChild(script); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址