Created
January 23, 2011 07:30
-
-
Save koduki/791901 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
https://books.step.rakuten.co.jp/rms/mall/book/bs/Cart | |
https://books.step.rakuten.co.jp/rms/mall/book/bs/Cart?shop_bid=213310 | |
*/ | |
var trs = jQuery("html body div form table tbody tr td table tbody tr:has(img[alt='削除'])") | |
var items = trs.toArray().map(function(tr){ | |
var item = jQuery(tr) | |
var name = item.find("td a").eq(1) | |
var isbn = item.find("td b").eq(0).text() | |
var price = jQuery(item.find("td").get().reverse()[7]).text() | |
return { | |
title: name.text(), | |
link: name.attr("href"), | |
isbn: isbn.replace(/.*ISBN:(.*?)\)/g, function(){return RegExp.$1}).trim(), | |
price:parseInt(price.replace(/\D/g, "")) | |
}}) | |
window.localStorage.setItem('order_items', JSON.stringify(items)); | |
JSON.parse(window.localStorage.getItem('order_items')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment