DCFever+

Verze ze dne 26. 10. 2014. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        DCFever+
// @description:zh-tw	  在二手買賣加入快速檢舉錯區按鈕
// @namespace         http://greasyfork.org/
// @include     http://www.dcfever.com/trading/listing.php*
// @version     1
// @grant       none
// ==/UserScript==
(function ($) {
  var queryString = function (url) {
    var qs = url.substring(url.indexOf('?') + 1).split('&');
    var result = {};
    for (var i = 0; i < qs.length; i++) {
      qs[i] = qs[i].split('=');
      result[qs[i][0]] = decodeURIComponent(qs[i][1]);
    }
    return result;
  };
  $('.trade_listing tr').each(function (index, tr) {
    var $tr = $(tr);
    var $link = $tr.find('td:nth-child(3) > a.tlist_title');
    if (!$link.length) {
      return;
    }
    var $wrong = $('<a href="#">錯</a>');
    $wrong.click(function (e) {
      e.preventDefault();
      $.get($link.attr('href')).done(function (data) {
        var html = $.parseHTML(data);
        var $reportLink = $(html).filter('#main_wrapper').find('.trade_function > a:last');
        if (!$reportLink.length) {
          return;
        }
        var partial = $reportLink.attr('href');
        var params = queryString(partial);
        params['form_action'] = 'prosecuteaction';
        params['submit'] = '確定檢舉';
        params['reason'] = 'miscategorized';
        params['content'] = 'wrong+type';
        $.post('prosecute.php', params).done(function() {
          $wrong.remove();
        });
      });
    })
    $(tr).find('td:nth-child(2)').append($wrong);
  });
}) (unsafeWindow.jQuery);