diff --git a/app/components/api/header-blockchain.js b/app/components/api/header-blockchain.js index 301b016..34a9a85 100644 --- a/app/components/api/header-blockchain.js +++ b/app/components/api/header-blockchain.js @@ -1,15 +1,18 @@ "use strict"; + + +// P A C K A G E + import html from "choo/html"; -export default () => { - return html` -
-

lbrycrd APIs

-

- Methods and signatures provided by the lbrycrd blockchain daemon are documented below. - To build, download, or run lbrycrd, see the project README. -

-
- `; -}; + + +// E X P O R T + +export default () => html` +
+

lbrycrd APIs

+

Methods and signatures provided by the lbrycrd blockchain daemon are documented below. To build, download, or run lbrycrd, see the project README.

+
+`; diff --git a/app/components/api/header-sdk.js b/app/components/api/header-sdk.js index 694a66e..4ac685c 100644 --- a/app/components/api/header-sdk.js +++ b/app/components/api/header-sdk.js @@ -1,15 +1,18 @@ "use strict"; + + +// P A C K A G E + import html from "choo/html"; -export default () => { - return html` -
-

lbry-sdk APIs

-

- Methods and signatures provided by the lbry-sdk daemon are documented below. - To build, download, or run the daemon, see the project README. -

-
- `; -}; + + +// E X P O R T + +export default () => html` +
+

lbry-sdk APIs

+

Methods and signatures provided by the lbry-sdk daemon are documented below. To build, download, or run the daemon, see the project README.

+
+`; diff --git a/app/components/client/tour-scripts.js b/app/components/client/playground-scripts.js similarity index 68% rename from app/components/client/tour-scripts.js rename to app/components/client/playground-scripts.js index fcea1e3..c5ffa9b 100644 --- a/app/components/client/tour-scripts.js +++ b/app/components/client/playground-scripts.js @@ -2,7 +2,7 @@ -initializeTour(); +initializePlayground(); @@ -16,15 +16,15 @@ if (window.location.href.search && window.location.href.split("?url=")[1]) { // document.querySelector("body").addEventListener("click", event => { if (event.target.dataset.action) { event.preventDefault(); - document.querySelector(".tour").classList.add("waiting"); + document.querySelector(".playground").classList.add("waiting"); handleExamples(event.target); } if ( event.explicitOriginalTarget.classList && - event.explicitOriginalTarget.classList[0] === "tour__content__meme__canvas__thumbnail" + event.explicitOriginalTarget.classList[0] === "playground__content__meme__canvas__thumbnail" ) { - for (const thumbnail of document.querySelectorAll(".tour__content__meme__canvas__thumbnail")) + for (const thumbnail of document.querySelectorAll(".playground__content__meme__canvas__thumbnail")) thumbnail.classList.remove("selected"); event.explicitOriginalTarget.classList.add("selected"); @@ -119,18 +119,18 @@ function debounce(func, wait, immediate) { }; } -function initializeTour() { - document.querySelector(".tour").classList.add("waiting"); +function initializePlayground() { + document.querySelector(".playground").classList.add("waiting"); document.querySelector("#fetch-claim-uri").value = ""; document.querySelector("#fetch-claim-uri").focus(); - document.querySelector(".tour__navigation__example:nth-child(1)").classList.add("active"); + document.querySelector(".playground__navigation__example:nth-child(1)").classList.add("active"); send(JSON.stringify({ - "message": "landed on tour" + "message": "landed on playground" })); setTimeout(() => { - document.querySelector(".tour__navigation__example:nth-child(1)").click(); + document.querySelector(".playground__navigation__example:nth-child(1)").click(); }, 300); } @@ -150,7 +150,7 @@ function fetchMetadata(exampleNumber, data) { document.getElementById("fetch-claim-uri").value = data; - document.getElementById("tour-results").innerHTML = ` + document.getElementById("playground-results").innerHTML = `

 # With the LBRY app/daemon running locally, you can use this in your Terminal
 curl --header "Content-Type: application/json" --data '{ "method": "resolve", "params": { "uri": "${data}" }}' http://localhost:5279    
@@ -160,7 +160,7 @@ curl --header "Content-Type: application/json"
         
`; - document.getElementById("tour-loader").style.display = "none"; + document.getElementById("playground-loader").style.display = "none"; break; case 2: @@ -171,7 +171,7 @@ curl --header "Content-Type: application/json" "example": exampleNumber })); - document.getElementById("tour-results").innerHTML = ` + document.getElementById("playground-results").innerHTML = `

 # With the LBRY app/daemon running locally, you can use this in your Terminal
 curl --header "Content-Type: application/json" --data '{ "method": "publish", "params": { "name": "TITLE_OF_YOUR_CONTENT", "file_path": "ABSOLUTE_PATH_TO_MEDIA_ON_YOUR_COMPUTER", "bid": "0.001", "metadata": { "description": "DESCRIPTION_OF_YOUR_CONTENT", "title": "TITLE_OF_YOUR_CONTENT", "language": "en", "license": "", "nsfw": false }}}' http://localhost:5279    
@@ -181,7 +181,7 @@ curl --header "Content-Type: application/json"
         
`; - document.getElementById("tour-loader").style.display = "none"; + document.getElementById("playground-loader").style.display = "none"; break; case 3: @@ -194,7 +194,7 @@ curl --header "Content-Type: application/json" document.getElementById("fetch-claim-uri").value = data; - document.getElementById("tour-results").innerHTML = ` + document.getElementById("playground-results").innerHTML = `

 # With the LBRY app/daemon running locally, you can use this in your Terminal
 curl --header "Content-Type: application/json" --data '{ "method": "wallet_send", "params": { "amount": "0.01", "claim_id": "${data}" }}' http://localhost:5279    
@@ -204,7 +204,7 @@ curl --header "Content-Type: application/json"
         
`; - document.getElementById("tour-loader").style.display = "none"; + document.getElementById("playground-loader").style.display = "none"; break; default: @@ -228,14 +228,14 @@ const handleExamples = debounce(event => { let exampleNumber; const data = event.dataset; - if (!parseInt(document.querySelector(".tour__navigation__example.active").dataset.example)) return; - exampleNumber = parseInt(document.querySelector(".tour__navigation__example.active").dataset.example); + if (!parseInt(document.querySelector(".playground__navigation__example.active").dataset.example)) return; + exampleNumber = parseInt(document.querySelector(".playground__navigation__example.active").dataset.example); switch(data.action) { case "choose claim": fetchMetadata(exampleNumber, data.claimId); - if (document.querySelector(".tour__navigation__example:nth-child(3)").classList.contains("active")) + if (document.querySelector(".playground__navigation__example:nth-child(3)").classList.contains("active")) document.getElementById("fetch-claim-uri").value = event.alt + "#" + event.dataset.claimId; break; @@ -245,28 +245,28 @@ const handleExamples = debounce(event => { fetchMetadata(exampleNumber, document.getElementById("fetch-claim-uri").value); break; - case "tour, example 1": - if (document.getElementById("tour-loader").classList.contains("tour__content__meme")) { - document.getElementById("tour-loader").classList.remove("tour__content__meme"); - document.getElementById("tour-loader").classList.add("tour__content__trends"); + case "playground, example 1": + if (document.getElementById("playground-loader").classList.contains("playground__content__meme")) { + document.getElementById("playground-loader").classList.remove("playground__content__meme"); + document.getElementById("playground-loader").classList.add("playground__content__trends"); } document.getElementById("fetch-claim-uri").value = ""; // reset URL bar - document.querySelector("#tour-url button").textContent = "Resolve"; + document.querySelector("#playground-url button").textContent = "Resolve"; - if (document.getElementById("tour-url").style.display === "none") - document.getElementById("tour-url").removeAttribute("style"); + if (document.getElementById("playground-url").style.display === "none") + document.getElementById("playground-url").removeAttribute("style"); - for (const example of document.querySelectorAll(".tour__navigation__example")) + for (const example of document.querySelectorAll(".playground__navigation__example")) example.classList.remove("active"); - document.querySelector(".tour__navigation__example:nth-child(1)").classList.add("active"); + document.querySelector(".playground__navigation__example:nth-child(1)").classList.add("active"); - document.getElementById("tour-loader").innerHTML = ""; - document.getElementById("tour-results").innerHTML = ""; + document.getElementById("playground-loader").innerHTML = ""; + document.getElementById("playground-results").innerHTML = ""; - document.getElementById("tour-loader").removeAttribute("style"); - document.getElementById("tour-results").removeAttribute("style"); + document.getElementById("playground-loader").removeAttribute("style"); + document.getElementById("playground-results").removeAttribute("style"); send(JSON.stringify({ "message": `request for ${data.action}` @@ -274,25 +274,25 @@ const handleExamples = debounce(event => { break; - case "tour, example 2": - if (document.getElementById("tour-loader").classList.contains("tour__content__trends")) { - document.getElementById("tour-loader").classList.remove("tour__content__trends"); - document.getElementById("tour-loader").classList.add("tour__content__meme"); + case "playground, example 2": + if (document.getElementById("playground-loader").classList.contains("playground__content__trends")) { + document.getElementById("playground-loader").classList.remove("playground__content__trends"); + document.getElementById("playground-loader").classList.add("playground__content__meme"); } document.getElementById("fetch-claim-uri").value = ""; // reset URL bar - document.getElementById("tour-url").style.display = "none"; + document.getElementById("playground-url").style.display = "none"; - for (const example of document.querySelectorAll(".tour__navigation__example")) + for (const example of document.querySelectorAll(".playground__navigation__example")) example.classList.remove("active"); - document.querySelector(".tour__navigation__example:nth-child(2)").classList.add("active"); + document.querySelector(".playground__navigation__example:nth-child(2)").classList.add("active"); - document.getElementById("tour-loader").innerHTML = ""; - document.getElementById("tour-results").innerHTML = ""; + document.getElementById("playground-loader").innerHTML = ""; + document.getElementById("playground-results").innerHTML = ""; - document.getElementById("tour-loader").removeAttribute("style"); - document.getElementById("tour-results").removeAttribute("style"); + document.getElementById("playground-loader").removeAttribute("style"); + document.getElementById("playground-results").removeAttribute("style"); send(JSON.stringify({ "message": `request for ${data.action}` @@ -300,28 +300,28 @@ const handleExamples = debounce(event => { break; - case "tour, example 3": - if (document.getElementById("tour-loader").classList.contains("tour__content__meme")) { - document.getElementById("tour-loader").classList.remove("tour__content__meme"); - document.getElementById("tour-loader").classList.add("tour__content__trends"); + case "playground, example 3": + if (document.getElementById("playground-loader").classList.contains("playground__content__meme")) { + document.getElementById("playground-loader").classList.remove("playground__content__meme"); + document.getElementById("playground-loader").classList.add("playground__content__trends"); } document.getElementById("fetch-claim-uri").value = ""; // reset URL bar - document.querySelector("#tour-url button").textContent = "Tip"; + document.querySelector("#playground-url button").textContent = "Tip"; - if (document.getElementById("tour-url").style.display === "none") - document.getElementById("tour-url").removeAttribute("style"); + if (document.getElementById("playground-url").style.display === "none") + document.getElementById("playground-url").removeAttribute("style"); - for (const example of document.querySelectorAll(".tour__navigation__example")) + for (const example of document.querySelectorAll(".playground__navigation__example")) example.classList.remove("active"); - document.querySelector(".tour__navigation__example:nth-child(3)").classList.add("active"); + document.querySelector(".playground__navigation__example:nth-child(3)").classList.add("active"); - document.getElementById("tour-loader").innerHTML = ""; - document.getElementById("tour-results").innerHTML = ""; + document.getElementById("playground-loader").innerHTML = ""; + document.getElementById("playground-results").innerHTML = ""; - document.getElementById("tour-loader").removeAttribute("style"); - document.getElementById("tour-results").removeAttribute("style"); + document.getElementById("playground-loader").removeAttribute("style"); + document.getElementById("playground-results").removeAttribute("style"); send(JSON.stringify({ "message": `request for ${data.action}` diff --git a/app/components/ecosystem.js b/app/components/ecosystem.js index 0bc1399..9adf194 100644 --- a/app/components/ecosystem.js +++ b/app/components/ecosystem.js @@ -16,7 +16,7 @@ const WALLET = require("./ecosystem/submodule-wallet"); // E X P O R T -export default function () { +export default () => { return `
`; -} +}; diff --git a/app/components/ecosystem/module-lbrycrd.js b/app/components/ecosystem/module-lbrycrd.js index 8798179..331cf19 100644 --- a/app/components/ecosystem/module-lbrycrd.js +++ b/app/components/ecosystem/module-lbrycrd.js @@ -24,7 +24,7 @@ module.exports = exports = () => `

LBRY uses a public, proof-of-work blockchain that is very similar to Bitcoin. The blockchain is the foundation of the protocol stack.

-

The most salient feature of the LBRY blockchain is the association of a string of characters (a "name") with a structured set of metadata. This name can be accessed as a LBRY URL, e.g. lbry://hellolbry

+

The most salient feature of the LBRY blockchain is the association of a string of characters (a "name") with a structured set of metadata. This name can be accessed as a LBRY URL, e.g. lbry://hellolbry

The LBRY blockchain stores names and metadata in a Merkle tree. This allows LBRY URLs to be trustfully resolved even without a full copy of the blockchain.

diff --git a/app/components/edit-link.js b/app/components/edit-link.js index e594ba3..6b181c4 100644 --- a/app/components/edit-link.js +++ b/app/components/edit-link.js @@ -15,7 +15,7 @@ const config = local("/config"); // E X P O R T -export default function (pagePath) { +export default pagePath => { let githubUrl = `https://github.com/${config.github.repo}/edit/${config.github.branch}`; switch(pagePath) { @@ -23,12 +23,16 @@ export default function (pagePath) { githubUrl = `${githubUrl}/app/views/home.js`; break; - case "/resources": - githubUrl = `${githubUrl}/views/pages/resources.js`; + case "/api": + githubUrl = `${githubUrl}/app/views/api.js`; break; - case "/tour": - githubUrl = `${githubUrl}/app/components/tour.js`; + case "/api/blockchain": + githubUrl = "https://github.com/lbryio/lbrycrd/blob/add_api_docs_scripts/contrib/devtools/generated/api_v1.json"; + break; + + case "/api/sdk": + githubUrl = "https://github.com/lbryio/lbry/blob/master/docs/api.json"; break; default: @@ -39,9 +43,9 @@ export default function (pagePath) { return html` ${config.github.linkText} `; -} +}; diff --git a/app/components/email-subscribe.js b/app/components/email-subscribe.js index 8ea1d22..b205998 100644 --- a/app/components/email-subscribe.js +++ b/app/components/email-subscribe.js @@ -10,17 +10,15 @@ import html from "choo/html"; // E X P O R T -export default function () { - return html` -