Last active
August 29, 2015 14:00
-
-
Save kawaz/ab11092a1609ab074f69 to your computer and use it in GitHub Desktop.
楽天ブックスの「一括配送でポイント10倍キャンペーン」とか用に在庫あり商品以外のチェックボックスを外すブックマークレット。ついでに注文数が複数になってしまってるのを1にする。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}}})})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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