LoginSignup
0
1

More than 5 years have passed since last update.

Amazonの購入確認画面で最適なポイントを付与するスニペット

Last updated at Posted at 2017-04-05

超ニッチ。
Amazonゴールドカード会員用。
ただ単に合計額を20で割りきれるようにしているだけ(20 * 2.5% = 0.5で、切り上げで1ポイントになるから)。

ポイントに応じてmodの法の数値を変える。
ブックマークレットにするといいと思う。

javascript:(function() {
    let price = +$(".grand-total-price strong").text().replace("", "").replace(/\D/g, "");
    let point = price % 20;

    if(point) {
        $("#spc-loyalty-points-input").val(point);
        $(".changePoints").click();
    }
})()

minified version

javascript:(function(){let price=+$(".grand-total-price strong").text().replace("","").replace(/\D/g,"");let point=price %2520;if(point){$("#spc-loyalty-points-input").val(point);$(".changePoints").click();}})();
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1