Greasy Fork

店小秘[速卖通]列表显示全部🛠

2024/8/14 16:59:49

目前为 2024-08-21 提交的版本。查看 最新版本

// ==UserScript==
// @name        店小秘[速卖通]列表显示全部🛠
// @namespace   Violentmonkey Scripts
// @license MIT
// @match       https://www.dianxiaomi.com/smtProduct/*
// @grant       GM_xmlhttpRequest
// @require https://update.greasyfork.org/scripts/499487/1427818/%E5%BA%97%E5%B0%8F%E7%A7%98%E9%80%9A%E7%94%A8%E5%87%BD%E6%95%B0.js
// @grant       none
// @version     0.1
// @author      -
// @description 2024/8/14 16:59:49
// ==/UserScript==
var bnt = $(`<li class='showall'><a href="javascript:;">All</a></li>`);
$("#loading").on("hidden.bs.modal",function(){
  var hasList = !!$("#pageList");
  bnt.on("click",async function(){
    $('#loading').modal('show');
    var url = 'https://www.dianxiaomi.com/smtProduct/pageList.htm'
    var data = smtPageListSearchData();
    data.pageSize = '300';
    let book = await tool.getTotalPage(url,data,op='POST');
    pages = book[0];
    for (var i = 1;i<book.length;i++){
      pages.find("#goodsContent tbody#smtSysMsg").append(book[i].find("#goodsContent tr.content"));
    }
    var html = pages.map(function(){return this.outerHTML}).toArray().join("");
    $('#pageList').html(html)
    $('#loading').modal('hide');
  });
  if(hasList && !$("li.showall").length){
    $("#upPage:has(*),#downPage:has(*)").append(bnt);
  }
})