2017-05-11 19 views
-2

私は現在tampermonkeyにコードを書いていますが、Google Chromeのコンソールでこのエラーが発生する理由を理解できません "スクリプト 'PalaceBOT'の実行に失敗しました!同じプリンシパルを使用する別のスクリプトがあり、これらの問題は発生しません。

スクリプト:

// ==UserScript== 
// @name   SupremeBOT 
// @namespace 
// @version  0.1 
// @description 
// @author  @alfiefogg_ 
// @match  http://www.supremenewyork.com/shop/* 
// @exclude  http://wwww.supremenewyork.com/shop/cart 
// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js 
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js 
// @grant  none 
// ==/UserScript== 
var mySize = "large"; //Change to appropriate size 
var productSort = "accessories"; //Change to appropriate size 
(function() { 
    var articles = $(".product-grid-item clearfix"); 
    if(productSort != "all"){ 
     for(var i = 0; i < articles.length;i++) 
     { 
      var category = $(articles[i]).find("a").attr("href"); 
      if(category.indexOf(productSort) == -1){ 
       articles[i].remove(); 
       document.getElementsByClassName("product-grid-item clearfix")[4].click(); 
      } 
     } 
    } 
    waitForKeyElements("#img-main", exe); 
})(); 
function exe(){ 
    selectSize(); 
    goCheckout(); 
} 
function goCheckout(){ 
    var x = document.getElementById("add-remove-buttons"); 
    var z = x.getElementsByClassName("button")[0]; 

    if(z.className != "button remove"){ 
     z.click(); 
     setTimeout(goCheckout ,100); 
    }else{ 
     window.location = "https://www.supremenewyork.com/checkout"; 
    } 
} 
function selectSize(){ 
    var sizeObj = document.getElementById("size"); 
    for(var i=0,sL=sizeObj.length;i<sL;i++){ 
     if(sizeObj.options[i].text == mySize){ 
      sizeObj.selectedIndex = i; 
      break; 
     } 
    } 
} 

これは、完成したスクリプトではないことを念頭に置いてクマを行います。あなたはjQueryの $を含める必要が

+0

ではありませんまた、あなたのhtmlを追加してください – Dwhitz

答えて

0

は、通常のJavaScriptの一部

関連する問題