AMZ - SKU Delete

10/10/2022, 10:19:36 AM

目前為 2024-05-27 提交的版本,檢視 最新版本

// ==UserScript==
// @name        AMZ - SKU Delete
// @namespace   Violentmonkey Scripts
// @match       https://sellercentral.amazon.*/inventory*
// @match       https://sellercentral-japan.amazon.com/inventory*
// @grant       none
// @version     1.3.5.2
// @author      -
// @license     Eveny One
// @description 10/10/2022, 10:19:36 AM
// ==/UserScript==

window.onload = function(){
  url = window.location.href
  if(/confirmAction/.test(url)){
    try{
      var hh = $("#interStitialPageMessage").html();
    }catch(err) {
      var hh = document.getElementById("interStitialPageMessage").textContent;
    }
    var Num = hh.match(/\d+/);
    var Num = 2;
    if(Number(Num) == 0){
      alert("当前产品数为0,停止操作")
    }else{
      setTimeout( function(){
        try{
          $("#interstitialPageContinue").click();
        }catch(err){
          document.getElementById("interstitialPageContinue").click();
        }
      }, 3 * 1000 )

      setTimeout( function(){
        try{
          $("#interstitialPageContinue").click();
        }catch(err){
          document.getElementById("interstitialPageContinue").click();
        }
      }, 6 * 1000 )

      setTimeout( function(){
        window.location.href = window.location.href.split('/').slice(0,3).join('/') + "/inventory"
      }, 8 * 1000 )
    }

  }else{
    // 替换弹窗 直接确定
    confirm = function(){return 1}
    // alert('nb')
    // 等待5秒后执行
    setTimeout( function(){
      try{
        $("#mt-select-all").click();
      }catch(err) {
        document.getElementById("mt-select-all").click();
      }
    }, 5 * 1000 )

    setTimeout(function(){
      try{
        $("#a-autoid-3-announce").click();
      }catch(err){
        document.getElementById("a-autoid-3-announce").click();
      }
      try{
        $("#a-autoid-2-announce").click();
      }catch(err){
        document.getElementById("a-autoid-2-announce").click();
      }
    }, 6 * 1000 )

    setTimeout( function(){
      try{
        for(var i=0;i < $('ul.a-nostyle.a-list-link li').length;i++){
          if($("#dropdown1_" + String(i)).text().indexOf('删除商品') != -1 | $("#dropdown1_" + String(i)).text().indexOf('Delete products') != -1){
            $("#dropdown1_" + String(i)).click()
          }
        }
      }catch(err){
        var ull = document.getElementsByClassName("a-nostyle a-list-link");
        var lil = ull[0].getElementsByTagName('li');
        for(var i=0;i < lil.length;i++){
          console.log(lil[i].textContent)
          if(lil[i].textContent.indexOf('删除商品') != -1 | lil[i].textContent.indexOf('Delete products') != -1){
            document.getElementById("dropdown1_" + String(i)).click()
          }
        }
      }
    }, 7 * 1000 )

    setTimeout( function(){
      window.location.href = window.location.href.split('/').slice(0,3).join('/') + "/inventory"
    }, 12 * 1000 )
  }
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址