Skip to content

Instantly share code, notes, and snippets.

@kawaz
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kawaz/ab11092a1609ab074f69 to your computer and use it in GitHub Desktop.
Save kawaz/ab11092a1609ab074f69 to your computer and use it in GitHub Desktop.
楽天ブックスの「一括配送でポイント10倍キャンペーン」とか用に在庫あり商品以外のチェックボックスを外すブックマークレット。ついでに注文数が複数になってしまってるのを1にする。
javascript:(function(){Array.prototype.slice.apply(document.querySelectorAll("input[type=checkbox][name^=check_item]")).forEach(function(input){var tr=input.parentNode.parentNode;if("tr"==tr.tagName.toLowerCase()){var priceText=tr.querySelector("td:nth-child(3)").textContent;var zaikoText=tr.querySelector("td:nth-child(5)").textContent;var countSelect=tr.querySelector("td:nth-child(4) select");if(1<parseInt(countSelect.value)){countSelect.value=1}if(!/在庫あり\(/.test(zaikoText)){input.checked=false}}})})()
(function(){
Array.prototype.slice.apply(
document.querySelectorAll("input[type=checkbox][name^=check_item]")
)
.forEach(function(input){
var tr = input.parentNode.parentNode;
if("tr" == tr.tagName.toLowerCase()) {
var priceText = tr.querySelector("td:nth-child(3)").textContent;
var zaikoText = tr.querySelector("td:nth-child(5)").textContent;
var countSelect = tr.querySelector("td:nth-child(4) select");
//注文数を1にする
if(1 < parseInt(countSelect.value)) {
countSelect.value = 1;
}
//在庫あり以外のチェックを外す
if(!/在庫あり\(/.test(zaikoText)){
input.checked=false;
}
}
})
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment