Fixed Playground issue and updated copy

This commit is contained in:
ポール ウェッブ 2019-02-20 13:50:12 -06:00
parent a7a54704d1
commit 1fccef0820
2 changed files with 28 additions and 15 deletions

View file

@ -125,19 +125,13 @@ function debounce(func, wait, immediate) {
}; };
} }
function initializePlayground() { function escapeHTML(content) {
document.querySelector(".playground").classList.add("waiting"); return content.replace(/&/g, "&")
document.querySelector("#fetch-claim-uri").value = ""; .replace(/</g, "&lt;")
document.querySelector("#fetch-claim-uri").focus(); .replace(/>/g, "&gt;")
document.querySelector(".playground-navigation__example:nth-child(1)").classList.add("active"); .replace(/"/g, "&quot;")
.replace(/'/g, "&#39;")
send({ .replace(/\//g, "&#x2F;");
message: "landed on playground"
});
setTimeout(() => {
document.querySelector(".playground-navigation__example:nth-child(1)").click();
}, 300);
} }
function fetchMetadata(exampleNumber, data) { function fetchMetadata(exampleNumber, data) {
@ -153,6 +147,8 @@ function fetchMetadata(exampleNumber, data) {
example: exampleNumber example: exampleNumber
}); });
data = escapeHTML(data);
document.getElementById("fetch-claim-uri").value = data; document.getElementById("fetch-claim-uri").value = data;
document.getElementById("playground-results").innerHTML = playgroundResponseForExample1(data); document.getElementById("playground-results").innerHTML = playgroundResponseForExample1(data);
document.getElementById("playground-loader").style.display = "none"; document.getElementById("playground-loader").style.display = "none";
@ -178,6 +174,8 @@ function fetchMetadata(exampleNumber, data) {
example: exampleNumber example: exampleNumber
}); });
data = escapeHTML(data);
document.getElementById("fetch-claim-uri").value = data; document.getElementById("fetch-claim-uri").value = data;
document.getElementById("playground-results").innerHTML = playgroundResponseForExample3(data); document.getElementById("playground-results").innerHTML = playgroundResponseForExample3(data);
document.getElementById("playground-loader").style.display = "none"; document.getElementById("playground-loader").style.display = "none";
@ -200,6 +198,21 @@ function getMemeInfo() { // TODO: Error handling
}; };
} }
function initializePlayground() {
document.querySelector(".playground").classList.add("waiting");
document.querySelector("#fetch-claim-uri").value = "";
document.querySelector("#fetch-claim-uri").focus();
document.querySelector(".playground-navigation__example:nth-child(1)").classList.add("active");
send({
message: "landed on playground"
});
setTimeout(() => {
document.querySelector(".playground-navigation__example:nth-child(1)").click();
}, 300);
}
function playgroundResponseForExample1(source) { function playgroundResponseForExample1(source) {
return ` return `
<pre><code class="language-bash"><span class="token comment"># With the LBRY app/daemon running locally, you can use this in your Terminal</span> <pre><code class="language-bash"><span class="token comment"># With the LBRY app/daemon running locally, you can use this in your Terminal</span>

View file

@ -6,7 +6,7 @@ LBRY offers a complimentary 100 LBC to qualified engineers to facilitate explora
To qualify you must: To qualify you must:
- Have a GitHub account prior to January 1st, 2018. - have a GitHub account that is at least 90 days old and
- Have made a public pull request within the past year. - have an active commit history
This program will be active on 2019.02.21. Stay tuned! This program will be active on 2019.02.21. Stay tuned!