Virtonomica: выделить все позиции товара в снабжении

Добавляет чекбокс "выделить все" для каждого товара в снабжении

  1. // ==UserScript==
  2. // @name Virtonomica: выделить все позиции товара в снабжении
  3. // @version 1.6
  4. // @include http*://*virtonomic*.*/*/main/unit/view/*/supply
  5. // @description Добавляет чекбокс "выделить все" для каждого товара в снабжении
  6. // @author cobra3125
  7. // @namespace virtonomica
  8. // ==/UserScript==
  9.  
  10. var run = function() {
  11.  
  12. var win = (typeof(unsafeWindow) != 'undefined' ? unsafeWindow : top.window);
  13. $ = win.$;
  14. var cbs = $('table.list > tbody > tr > td:nth-child(1) > input[type="checkbox"]');
  15. if(cbs.length > 0){
  16. var box = $('<input type="checkbox" style="float:left;">').click(function(){
  17. var row = $(this).closest('tr');
  18. var checked = $(this).is(':checked');
  19. var next = row.next();
  20. while (next.length > 0 && !next.hasClass('p_title')) {
  21. $('> td:nth-child(1) > input[type="checkbox"]', next).attr('checked', checked);
  22. next = next.next();
  23. }
  24. });
  25. $('a:has(img[src="/img/supplier_add.gif"])').after(box);
  26. }
  27. }
  28.  
  29. if(window.top == window) {
  30. var script = document.createElement("script");
  31. script.textContent = '(' + run.toString() + ')();';
  32. document.documentElement.appendChild(script);
  33. }