Skip to content

Instantly share code, notes, and snippets.

@shao1555
Created October 14, 2019 08:28
Show Gist options
  • Save shao1555/1e2b827dbeae280717fa390c9e4d1bee to your computer and use it in GitHub Desktop.
Save shao1555/1e2b827dbeae280717fa390c9e4d1bee to your computer and use it in GitHub Desktop.
京东の注文明細印刷画面から抜き取った情報でファイル名をつくる
let tradeDate = document.querySelector(".t2").firstChild.nodeValue.match(/\d{4}-\d{2}-\d{2}/)[0];
let amount = document.querySelector(".ftx-01 .count").firstChild.nodeValue.match(/\d+\.\d{2}/)[0];
let productName = document.querySelector(".p-name").firstChild.nodeValue;
console.log(`${tradeDate} [JD.com] ${productName} CNY${amount}.pdf`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment