Last active
December 10, 2015 16:48
-
-
Save kanreisa/4463433 to your computer and use it in GitHub Desktop.
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
// 一番最初に実行する | |
window.sessionStorage.setItem('total', 0); | |
// ♪ここから | |
// load | |
var total = parseInt(window.sessionStorage.getItem('total'), 10); | |
// totaling | |
total += (function () { | |
var total = 0; | |
var prices = document.getElementsByClassName('price'); | |
for (var i = 0; prices.length > i; i++) { | |
total += parseInt(prices[i].innerText.replace('¥ ', '').replace(',', '')); | |
} | |
return total; | |
})(); | |
// save | |
window.sessionStorage.setItem('total', total); | |
// 合計の表示 | |
total; | |
// 次のページへ(あれば)飛ぶ | |
var navs = document.getElementsByClassName('num-pages'); | |
for (var i = 0; navs.length > i; i++) { | |
var links = navs[i].getElementsByTagName('a'); | |
for (var j = 0; links.length > j; j++) { | |
if (links[j].innerText == '次へ »') { | |
window.location.href = links[j].href; | |
} | |
} | |
} | |
// ♪繰り返し |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment