Closes #151 #162

Merged
NetOpWibby merged 5 commits from 151-missing-example into master 2018-09-28 21:14:13 +02:00
3 changed files with 47 additions and 40 deletions
Showing only changes of commit a7e6be4a50 - Show all commits

View file

@ -144,9 +144,9 @@ function fetchMetadata(exampleNumber, data) {
"example": exampleNumber "example": exampleNumber
})); }));
$("#fetch-claim-uri").val(data); document.getElementById("fetch-claim-uri").value = data;
$("#tour-results").html(` document.getElementById("tour-results").innerHTML = `
<pre><code class="language-bash"> <pre><code class="language-bash">
<span class="token comment"># With the LBRY app/daemon running locally, you can use this in your Terminal</span> <span class="token comment"># With the LBRY app/daemon running locally, you can use this in your Terminal</span>
curl --header <span class="token string">"Content-Type: application/json"</span> --data <span class="token string">'{ "method": "resolve", "params": { "uri": "${data}" }}'</span> <span class="token url">http://localhost:5279 </span> curl --header <span class="token string">"Content-Type: application/json"</span> --data <span class="token string">'{ "method": "resolve", "params": { "uri": "${data}" }}'</span> <span class="token url">http://localhost:5279 </span>
@ -154,9 +154,9 @@ curl --header <span class="token string">"Content-Type: application/json"</span>
<div class="loader" id="temp-loader"></div> <div class="loader" id="temp-loader"></div>
<div id="example1-result"></div> <div id="example1-result"></div>
`); `;
$("#tour-loader").hide(); document.getElementById("tour-loader").style.display = "none";
break; break;
case 2: case 2:
@ -167,16 +167,17 @@ curl --header <span class="token string">"Content-Type: application/json"</span>
"example": exampleNumber "example": exampleNumber
})); }));
$("#tour-results").html(` document.getElementById("tour-results").innerHTML = `
<pre><code class="language-bash"> <pre><code class="language-bash">
<span class="token comment"># This will be updated soon</span> <span class="token comment"># With the LBRY app/daemon running locally, you can use this in your Terminal</span>
curl --header <span class="token string">"Content-Type: application/json"</span> --data <span class="token string">'{ "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 }}}'</span> <span class="token url">http://localhost:5279 </span>
</code></pre> </code></pre>
<div class="loader" id="temp-loader"></div> <div class="loader" id="temp-loader"></div>
<div id="example2-result"></div> <div id="example2-result"></div>
`); `;
$("#tour-loader").hide(); document.getElementById("tour-loader").style.display = "none";
break; break;
case 3: case 3:
@ -187,19 +188,20 @@ curl --header <span class="token string">"Content-Type: application/json"</span>
"example": exampleNumber "example": exampleNumber
})); }));
$("#fetch-claim-uri").val(data); document.getElementById("fetch-claim-uri").value = data;
// $("#fetch-claim-uri").val(data);
$("#tour-results").html(` document.getElementById("tour-results").innerHTML = `
<pre><code class="language-bash"> <pre><code class="language-bash">
<span class="token comment"># With the LBRY app/daemon running locally, you can use this in your Terminal</span> <span class="token comment"># With the LBRY app/daemon running locally, you can use this in your Terminal</span>
curl --header <span class="token string">"Content-Type: application/json"</span> --data <span class="token string">'{ "method": "wallet_send", "params": { "amount": "0.01", "claim_id": "${data}" }}'</span> <span class="token url">http://localhost:5279 </span> curl --header <span class="token string">"Content-Type: application/json"</span> --data <span class="token string">'{ "method": "wallet_send", "params": { "amount": "0.01", "claim_id": "${data}" }}'</span> <span class="token url">http://localhost:5279 </span>
</code></pre> </code></pre>
<div class="loader" id="temp-loader"></div> <div class="loader" id="temp-loader"></div>
<div id="example3-result"></div> <div id="example3-result"></div>
`); `;
$("#tour-loader").hide(); document.getElementById("tour-loader").style.display = "none";
break; break;
default: default:
@ -209,13 +211,13 @@ curl --header <span class="token string">"Content-Type: application/json"</span>
function getMemeInfo() { // TODO: Error handling function getMemeInfo() { // TODO: Error handling
const info = { const info = {
description: $("#meme-description").val(), description: document.getElementById("meme-description").value,
file_path: $("#meme-canvas")[0].toDataURL("image/jpeg", 0.6), file_path: document.getElementById("meme-canvas").toDataURL("image/jpeg", 0.6),
language: $("#meme-language").val(), language: document.getElementById("meme-language").value,
license: $("#meme-license").val(), license: document.getElementById("meme-license").value,
name: $("#meme-title").val(), name: document.getElementById("meme-title").value,
nsfw: $("#meme-nsfw-flag")[0].checked, nsfw: document.getElementById("meme-nsfw-flag").checked,
title: $("#meme-title").val() title: document.getElementById("meme-title").value
}; };
return info; return info;
@ -225,8 +227,8 @@ const handleExamples = debounce(event => {
let exampleNumber; let exampleNumber;
const data = event.dataset; const data = event.dataset;
if (!parseInt($(".tour__navigation__example.active")[0].dataset.example)) return; if (!parseInt(document.querySelector(".tour__navigation__example.active").dataset.example)) return;
exampleNumber = parseInt($(".tour__navigation__example.active")[0].dataset.example); exampleNumber = parseInt(document.querySelector(".tour__navigation__example.active").dataset.example);
switch(data.action) { switch(data.action) {
case "choose claim": case "choose claim":
@ -234,24 +236,32 @@ const handleExamples = debounce(event => {
break; break;
case "execute claim": case "execute claim":
if (!$("#fetch-claim-uri").val()) return; if (!document.getElementById("fetch-claim-uri").value.length > 0) return;
fetchMetadata(exampleNumber, $("#fetch-claim-uri").val()); fetchMetadata(exampleNumber, document.getElementById("fetch-claim-uri").value);
break; break;
case "tour, example 1": case "tour, example 1":
if ($("#tour-loader").hasClass("tour__content__meme")) { if (document.getElementById("tour-loader").classList.contains("tour__content__meme")) {
$("#tour-loader").removeClass("tour__content__meme").addClass("tour__content__trends"); document.getElementById("tour-loader").classList.remove("tour__content__meme");
document.getElementById("tour-loader").classList.add("tour__content__trends");
} }
$("#fetch-claim-uri").val(""); // reset URL bar document.getElementById("fetch-claim-uri").value = ""; // reset URL bar
$("#tour-url button").text("Resolve"); document.querySelector("#tour-url button").textContent = "Resolve";
if ($("#tour-url")[0].style.display === "none") $("#tour-url").show();
$(".tour__navigation__example").removeClass("active"); if (document.getElementById("tour-url").style.display === "none")
$(".tour__navigation__example:nth-child(1)").addClass("active"); document.getElementById("tour-url").removeAttribute("style");
$("#tour-loader").empty().show(); for (const example of document.querySelectorAll(".tour__navigation__example"))
$("#tour-results").empty().show(); example.classList.remove("active");
document.querySelector(".tour__navigation__example:nth-child(1)").classList.add("active");
document.getElementById("tour-loader").innerHTML = "";
document.getElementById("tour-results").innerHTML = "";
document.getElementById("tour-loader").removeAttribute("style");
document.getElementById("tour-results").removeAttribute("style");
send(JSON.stringify({ send(JSON.stringify({
"message": `request for ${data.action}` "message": `request for ${data.action}`
@ -286,7 +296,6 @@ const handleExamples = debounce(event => {
$("#fetch-claim-uri").val(""); // reset URL bar $("#fetch-claim-uri").val(""); // reset URL bar
$("#tour-url button").text("Tip"); $("#tour-url button").text("Tip");
// $("#tour-url").after("<p>In the LBRY app, you can financially support your favorite creators by donating LBRY Coin (LBC). In this example, we are donating LBC in your stead.</p>");
if ($("#tour-url")[0].style.display === "none") $("#tour-url").show(); if ($("#tour-url")[0].style.display === "none") $("#tour-url").show();
$(".tour__navigation__example").removeClass("active"); $(".tour__navigation__example").removeClass("active");

View file

@ -195,6 +195,7 @@ module.exports = exports = (data, socket) => {
/* /*
if ( if (
data.example === 3 &&
body.result && body.result &&
body.result.txid body.result.txid
) explorerNotice = ` ) explorerNotice = `

View file

@ -39,7 +39,6 @@ module.exports = exports = (socket, action) => {
case (action.message === "landed on tour"): case (action.message === "landed on tour"):
generateContent(1, result => { generateContent(1, result => {
socket.send(JSON.stringify({ socket.send(JSON.stringify({
// "example": 1,
"html": result, "html": result,
"message": "updated html", "message": "updated html",
"selector": "#tour-loader" "selector": "#tour-loader"
@ -50,7 +49,6 @@ module.exports = exports = (socket, action) => {
case (action.message === "request for tour, example 1"): case (action.message === "request for tour, example 1"):
generateContent(1, result => { generateContent(1, result => {
socket.send(JSON.stringify({ socket.send(JSON.stringify({
// "example": 1,
"html": result, "html": result,
"message": "updated html", "message": "updated html",
"selector": "#tour-loader" "selector": "#tour-loader"
@ -65,7 +63,6 @@ module.exports = exports = (socket, action) => {
case (action.message === "request for tour, example 3"): case (action.message === "request for tour, example 3"):
generateContent(3, result => { generateContent(3, result => {
socket.send(JSON.stringify({ socket.send(JSON.stringify({
// "example": 3,
"html": result, "html": result,
"message": "updated html", "message": "updated html",
"selector": "#tour-loader" "selector": "#tour-loader"
@ -298,7 +295,8 @@ function generateMemeCreator(socket) {
detectLanguageAndUpdate(); detectLanguageAndUpdate();
initCanvas(); initCanvas();
document.getElementById("tour-example-description").innerHTML = document.querySelector("[data-action='tour, example 2']").dataset.description; document.getElementById("tour-example-description").innerHTML =
document.querySelector("[data-action='tour, example 2']").dataset.description;
setTimeout(() => { setTimeout(() => {
document.querySelector(".tour__content__meme__canvas__thumbnail").click(); document.querySelector(".tour__content__meme__canvas__thumbnail").click();
@ -307,7 +305,6 @@ function generateMemeCreator(socket) {
`; `;
return socket.send(JSON.stringify({ return socket.send(JSON.stringify({
// "example": 2,
"html": memeCreator, "html": memeCreator,
"message": "updated html", "message": "updated html",
"selector": "#tour-loader" "selector": "#tour-loader"