aklim007

2be && knine

Feb 13th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           name
  3. // @namespace      name@aklim007
  4. // @include        http://torrents.local/*
  5. // ==/UserScript==
  6.  
  7. (function(){
  8.    
  9.     var aWind = (typeof unsafeWindow != 'undefined')? unsafeWindow: window;
  10.     //проверка для хрома, чтоб скрипт не обрабатывался на сторонних страницах
  11.     String.prototype.bool = function() {
  12.          return (/^true$/i).test(this);
  13.     };
  14.    
  15.     if(aWind.console){
  16.         var Log = aWind.console.log;
  17.     }else var Log = alert;
  18.  
  19.     $ = unsafeWindow.jQuery;
  20.     //добавляем кнопки на страницу
  21.     $('img[src $="/post.gif"]').parent().parent().after('<td><input type="button" value="" class="bSellNoTorrent" >'
  22.                                     +'<input type="button" value="" class="bSellDelete" ></td>');
  23.  
  24.     //названия кнопок
  25.     var valNoT = "Sel. No T-file";
  26.     var valX = "Sel. X";
  27.     //кнопки
  28.     var bNoT = $('.bSellNoTorrent');
  29.     var bX = $('.bSellDelete');
  30.     //прописываем названия
  31.     bNoT.val( valNoT );
  32.     bX.val( valX );
  33.    
  34.     //навешиваем события на кнопки
  35.     bNoT.click(function (){
  36.         var row = $('#forum-table tr:has(".torTopic")');
  37.         var count = 0;
  38.         row.each(function(indx, elem){
  39.             if($(elem).find('.torTopic a b').length == 0 && $(elem).find('.torTopic').parent().next().children().length == 0) {
  40.                 $(elem).find('.topic-chbox').attr('checked','true');
  41.                 $(elem).addClass("hl-selected-topic");
  42.                 count++;
  43.             }
  44.         });
  45.         bNoT.val( valNoT + " (" + count + ")");
  46.     });
  47.     bX.click(function (){
  48.         var row = $('#forum-table tr:has(".torTopic")');
  49.         var count = 0;
  50.         row.each(function(indx, elem){
  51.             if($(elem).find('.torTopic b span').html() == "x" ) {
  52.                 $(elem).find('.topic-chbox').attr('checked','true');
  53.                 $(elem).addClass("hl-selected-topic");
  54.                 count++;
  55.             }
  56.         });
  57.         bX.val( valX + " (" + count + ")");
  58.     });
  59. })();
Advertisement
Add Comment
Please, Sign In to add comment