ZBLOG订单搜索

供开发者搜索订单,附带隐藏未付订单;

目前為 2017-05-17 提交的版本,檢視 最新版本

// ==UserScript==
// @name        ZBLOG订单搜索
// @description 供开发者搜索订单,附带隐藏未付订单;
// @link        https://greasyfork.org/zh-CN/scripts/25662
// @namespace   wdssmq.com
// @include     https://app.zblogcn.com/zb_users/plugin/AppBuy/main.php*
// @include     https://app.zblogcn.com/?id=*
// @version     1.5
// @grant       none
// ==/UserScript==
var TheHtml,
intVdg = 0,
rmbFgu = 0;
$(function () {
  $('.SubMenu').append('<input id="search" style="float:left;margin-right: 2px;margin-top: 2px" type="text" value=""><a href="javascript:;" id="js-search"><span class="m-left">搜索</span></a>');
  $('#js-search').click(function () {
    // alert($("#search").val());
    fnRun($('#search').val());
  });
  fnHide('');
});
function fnHide(t) {
  $('tr').each(function () {
    TheHtml = $(this).html();
    /待付款/.test(TheHtml) && $(this).remove();
    t == 'all' && $(this).remove();
  });
};
function fnRun(q) {
  intVdg = 0;
  rmbFgu = 0;
  var RegPat = new RegExp(q + '.+已付款', '');
  // var RegPat = new RegExp(q, "");
  fnHide('all');
  fnAjax(1, RegPat);
}
function fnAjax(page, pat) {
  $.ajax({
    url: 'https://app.zblogcn.com/zb_users/plugin/AppBuy/main.php?page=' + page,
    type: 'get',
    success: function (data) {
      // if (/已付款/.test(data) && page < 3) {
      if (/已付款/.test(data)) {
        $(data).find('#divMain2 table tr').each(function () {
          TheHtml = $(this).html().replace(/[\n\s]+/g, ' ');
          if (pat.test(TheHtml) === true) {
            intVdg++;
            var Match = TheHtml.match(/\(([\d\.]+)\)/);
            rmbFgu += parseFloat(Match[1]) * 100;
            $('table:not(#tbStatistic) tbody').append('<tr>' + TheHtml + '</tr>\n');
          }
        });
        page++;
        fnAjax(page, pat);
      } else {
        $('table:not(#tbStatistic) tbody').prepend('<tr><td>1</td><td>2</td><td>3</td><td>' + intVdg + '</td><td>' + rmbFgu / 100 + '</td><td></td><td></td><td></td><td></td></tr>');
      }      // fnHide("");

    }
  });
}
//前台编辑链接
$(function () {
  if ($(".appinfo_table").text() === "")
    return false;
  if ($(".appinfo_table").text().indexOf($("#logincp p:nth-child(2)").text()) == -1)
    return false;
  var edtLink = "https://app.zblogcn.com/zb_system/admin/edit.php" + location.search + "&act=ArticleEdt";
  var domLink = $('<a title="编辑" target="_blank" href="' + edtLink + '">编辑</a>');
  domLink.css({
    color: "darkgray",
    "font-size": "14px",
    "padding-left": "0.5em"
  }).hover(function () {
    $(this).css({
      color: "#d60000"
    });
  }, function () {
    $(this).css({
      color: "darkgray"
    });
  });
  if ($(".appinfo_table h2 b").text().indexOf("(免费)")>-1)
    $(".appinfo_table h2 b").hide();
  $(".appinfo_table h2 b").before(domLink);
});