Skip to content

Instantly share code, notes, and snippets.

@flyfy1
Last active August 9, 2020 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flyfy1/43d96d53d2434e3287cf4476138969a4 to your computer and use it in GitHub Desktop.
Save flyfy1/43d96d53d2434e3287cf4476138969a4 to your computer and use it in GitHub Desktop.
// in item order page
deliveryInfo = document.querySelector("#appOrders > div > table > tbody > tr > td > ul > li > div")
deliveryCompany = deliveryInfo.querySelector("span:nth-child(2)").innerText
deliveryID = deliveryInfo.querySelector("span:nth-child(4)").innerText
itemName = document.querySelector("#appOrders > div > table > tbody > tr > td > ul > li > table > tbody > tr > td.header-item.order-item-info > div > div.item-meta > a").innerText
totalPrice = document.querySelector("#appAmount > div > table > tbody > tr > td.total-count > div:nth-child(1) > div:nth-child(4) > table > tbody > tr > td > span > div").innerText.split('¥')[1]
console.log(`${itemName}\t${deliveryCompany}\t${deliveryID}\t\t\t\t${totalPrice}`)
// in order to set the value into clipboard
function handlePermission() {
navigator.permissions.query({name:'clipboard-write'}).then(function(result) {
console.log("result state: ", result.state);
if (result.state == 'granted') {
console.log("would proceed with normal biz logic here");
} else if (result.state == 'prompt') {
} else if (result.state == 'denied') {
console.log("would proceed with error handling biz logic here");
}
result.onchange = function() {
console.log("permission changed, args: ", arguments)
}
})
}
// here saves my other drafts
// totalPrice = document.querySelector("#appAmount > div > table > tbody > tr > td.total-count > div:nth-child(1) > div:nth-child(5) > table > tbody > tr > td > span > div > div > span:nth-child(3)").innerText.replace('¥','')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment