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
did:3:kjzl6cwe1jw145djdfeu68eidwi1yb9ulrqh2h9ct13dgohhlz0fr3l28swfwrb |
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
const decoder = new Demorse({ | |
stream: stream, // <audio> Element | UserMedia stream | |
render: function, // a callable render function | |
fft: 32, // Fast Fourier Transform window size, | |
idle: 75 // Delay before closing the receiver (milliseconds) | |
}); |
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
const initDecoder = (stream) => { | |
const decoder = new Demorse({ | |
stream, | |
render: (str) => { | |
document.querySelector("#message").innerText = str; | |
}, | |
}); | |
}; | |
navigator.getUserMedia({ audio: true }, initDecoder, console.error); |
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
const audio = document.querySelector("audio"); | |
const initDecoder = (stream) => { | |
const decoder = new Demorse({ | |
stream, | |
render: (str) => { | |
// #message is a node that will be updated on decoding | |
document.querySelector("#message").innerText = str; | |
}, | |
}); |
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
function Form({ isLoading, isSent, hasError, handler }) { | |
return ( | |
<form onSubmit={handler}> | |
<div>isLoading: {isLoading ? "Loading" : "false"}</div> | |
<div>isSent: {isSent ? "Sent" : "false"}</div> | |
<div>Error: {hasError || "null"}</div> | |
</form> | |
) | |
} |
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.cpAdapter = { | |
getProductTitle: function () { | |
try { | |
const [pageData] = window.dataLayer | |
return pageData.goods.title | |
} catch (err) { | |
console.error(err) | |
return "" | |
} | |
}, |
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
{ | |
... | |
getProductImages: function () { | |
try { | |
const imageNodes = document.querySelectorAll( | |
"#js-goodsIntroThumbNail img" | |
) | |
const images = [] | |
imageNodes.forEach((img) => { |
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
... | |
parseSpecsTable: (specsTable) => { | |
let textTable = "" | |
specsTable.forEach((row) => { | |
const [keyNode, valueNode] = row.children | |
const key = keyNode.textContent.trim() | |
const value = valueNode.textContent.trim() | |
textTable += `<strong>${key}</strong>: <p>${value}</p>` | |
}) |
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
{ | |
getProductTitle: () => { | |
try { | |
const [pageData] = window.dataLayer | |
return pageData.goods.title | |
} catch (err) { | |
console.error(err) | |
return "" | |
} | |
}, |
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
{ | |
isProductPage: () => { | |
try { | |
const [pageData] = window.dataLayer | |
return pageData.PAGE === "goods" ? true : false | |
} catch (err) { | |
console.error(err) | |
return false | |
} | |
} |
NewerOlder