add usage examples

This commit is contained in:
zxawry 2019-06-23 21:39:09 +01:00
parent 896b3bae3c
commit c361c77115
No known key found for this signature in database
GPG key ID: 70F5D1B4F51F051A
7 changed files with 15 additions and 2 deletions

6
examples/simple-pack.js Normal file
View file

@ -0,0 +1,6 @@
const lbryFormat = require('../index');
// should be run from package root directory
lbryFormat.packDirectory('./examples/src', {
fileName: './examples/simple-pack.lbry',
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View file

@ -0,0 +1,7 @@
const lbryFormat = require('../index');
// should be run from package root directory
lbryFormat.packDirectory('./examples/src', {
fileName: './examples/template-pack.lbry',
useTemplate: true,
});

View file

@ -5,7 +5,7 @@ module.exports = {
type: "static", type: "static",
name: "index.html", name: "index.html",
contents: contents:
'<!doctype html><title>Gallary Slideshow</title><meta name=viewport content="width=device-width,initial-scale=1" charset=utf-8><link rel=stylesheet href=index.css><script src=files.js charset=utf-8></script><div id=container class=slideshow-container><a class=prev onclick=plusSlides(-1)>&#10094;</a> <a class=next onclick=plusSlides(1)>&#10095;</a></div><script src=index.js charset=utf-8></script>' '<!doctype html><title>Gallery Slideshow</title><meta name=viewport content="width=device-width,initial-scale=1" charset=utf-8><link rel=stylesheet href=index.css><script src=files.js charset=utf-8></script><div id=container class=slideshow-container><a class=prev onclick=plusSlides(-1)>&#10094;</a> <a class=next onclick=plusSlides(1)>&#10095;</a></div><script src=index.js charset=utf-8></script>'
}, },
{ {
type: "static", type: "static",
@ -20,6 +20,6 @@ module.exports = {
'const container=document.getElementById("container");for(let e=0;e<images.length;e++){const n=document.createElement("img");n.className="mySlides fade",n.src=images[e],container.appendChild(n)}let slideIndex=1;function plusSlides(e){showSlides(slideIndex+=e)}function showSlides(e){const n=document.getElementsByClassName("mySlides");e>n.length&&(slideIndex=1),e<1&&(slideIndex=n.length);for(let e=0;e<n.length;e++)n[e].style.display="none";n[slideIndex-1].style.display="block"}showSlides(slideIndex);' 'const container=document.getElementById("container");for(let e=0;e<images.length;e++){const n=document.createElement("img");n.className="mySlides fade",n.src=images[e],container.appendChild(n)}let slideIndex=1;function plusSlides(e){showSlides(slideIndex+=e)}function showSlides(e){const n=document.getElementsByClassName("mySlides");e>n.length&&(slideIndex=1),e<1&&(slideIndex=n.length);for(let e=0;e<n.length;e++)n[e].style.display="none";n[slideIndex-1].style.display="block"}showSlides(slideIndex);'
} }
], ],
title: "Gallary Slideshow" title: "Gallery Slideshow"
} }
}; };