您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Price/Quallity on supply page
当前为
// ==UserScript== // @name supply PQR // @namespace virtonomica // @include *virtonomic*.*/*/supply // @description Price/Quallity on supply page // @version 1.1 // @grant none // ==/UserScript== var run = function () { function getType() { var type = ''; $('script').each(function () { var cl = $(this).text().match(/\.addClass\(\'bg-page-unit-header-(.+)\'\);/); if (cl != null) type = (cl[1]); }); return type==''?'unknown':type; } //end getType() var type = getType(); switch (type){ case 'warehouse': //склад $('.list th:contains("Качество")').after('<th>P/Q ratio</th>'); $('.list>tbody>tr:gt(0)').each(function () { var price = parseFloat($('>td:eq(3)', this).text().trim().replace(/[^\d\.]/g,'')); var qual = parseFloat($('>td:eq(5)', this).text().trim().replace(/[^\d\.]/g,'')); var PQR = (qual==0)?0:(price / qual).toFixed(2); $('>td:eq(5)', this).after('<td class="num"><span style="color:red">' + PQR + '</span></td>'); }); break; default: //завод $('td[id^="totalPrice_"]').each(function () { var price = parseFloat($('td:contains("Цена")', this).parent().find('td:last').text().trim().replace(/[^\d\.]/g,'')); var qual = parseFloat($('td:contains("Качество")', this).parent().find('td:last').text().trim().replace(/[^\d\.]/g,'')); var PQR = (qual==0)?0:(price / qual).toFixed(2); $('tr:last', this).after('<tr><td nowrap="nowrap">PQR</td><td> </td><td nowrap="nowrap" align="right" style="color:red">' + PQR + '</td></tr>'); }); break; } }; var script = document.createElement('script'); script.textContent = '(' + run.toString() + ')();'; document.documentElement.appendChild(script);