Skip to content
Snippets Groups Projects
Commit e5937a17 authored by inertia's avatar inertia
Browse files

#44 javascript live code examples

parent c82d96fc
No related branches found
No related tags found
1 merge request!114Restoring Master
Showing
with 109 additions and 5 deletions
......@@ -101,7 +101,13 @@ for (var i = 0; i < _accounts.length; i++) {
document.getElementById('accList').innerHTML = _accounts.join('<br/>');
```
That's it!
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js20accountreputation?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To run this tutorial
......
......@@ -162,7 +162,13 @@ The result returned form the service is a `JSON` object with the following prope
From this result we have access to everything associated to the post including additional metadata which is a `JSON` string that must be decoded to use. This `JSON` object has additional information and properties for the post including a reference to the image uploaded. And we are displaying this data in meaningful user interface. _Note: it is truncated to one element, but you would get five posts in array_
That's all there is to it.
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js01blogfeed?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To Run the tutorial
......
......@@ -157,6 +157,14 @@ We first check if `result` is not an empty object. We then iterate through each
We format `created` date and time, parse `body` markdown and get `totalVotes` on that comment.
Each line is then pushed and displayed separately.
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js09getaccountcomments?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To Run the tutorial
1. `git clone https://gitlab.syncad.com/hive/devportal.git`
......
......@@ -267,6 +267,14 @@ if (
We check if `content` is not an empty object and we iterate through each object via its key and extract, `author`, format `created` date and time, parse `body` markdown, get `net_votes` on that reply. Pushing each list item separately and displaying it. That's it!
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js08getaccountreplies?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To Run the tutorial
1. `git clone https://gitlab.syncad.com/hive/devportal.git`
......
......@@ -5,7 +5,7 @@ description: "_View the vesting delegations made by a user as well as the delega
layout: full
canonical_url: get_delegations_by_user.html
---
Full, runnable src of [Get Delegations By User](https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/python/29_get_delegations_by_user) can be downloaded as part of: [tutorials/python](https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/python) (or download just this tutorial: [devportal-master-tutorials-python-29_get_delegations_by_user.zip](https://gitlab.syncad.com/hive/devportal/-/archive/master/devportal-master.zip?path=tutorials/python/29_get_delegations_by_user)).
Full, runnable src of [Get Delegations By User](https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/javascript/29_get_delegations_by_user) can be downloaded as part of: [tutorials/javascript](https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/javascript) (or download just this tutorial: [devportal-master-tutorials-javascript-29_get_delegations_by_user.zip](https://gitlab.syncad.com/hive/devportal/-/archive/master/devportal-master.zip?path=tutorials/javascript/29_get_delegations_by_user)).
This tutorial will take you through the process of calling delegation information from the hive blockchain using the `database API`. The account information provided has been chosen by random and the process is applicable to any user account on both the `production server` and the `testnet`.
......@@ -155,6 +155,14 @@ delegationdata.forEach(newObj => {
});
```
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js29getdelegationsbyuser?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To run this tutorial
1. `git clone https://gitlab.syncad.com/hive/devportal.git`
......
......@@ -116,6 +116,14 @@ followlist.forEach(newObj => {
});
```
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js19getfollowerandfollowinglist?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To run this tutorial
1. `git clone https://gitlab.syncad.com/hive/devportal.git`
......
......@@ -158,6 +158,14 @@ The result is returned from the post content as a `JSON` object with the followi
From this result, you have access to comments made on selected post.
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js07getpostcomments?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To Run the tutorial
1. `git clone https://gitlab.syncad.com/hive/devportal.git`
......
......@@ -201,7 +201,13 @@ From this result, you have access to everything associated with the selected pos
* `body_length` - Total content length.
* `reblogged_by` - Unused.
That's it!
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js05getpostdetails?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To Run the tutorial
......
......@@ -207,6 +207,14 @@ The result returned from the service is a `JSON` list. This is an example list w
**And that's all there is to getting top-level posts.** _See [Get post comments](get_post_comments.html) for getting comments_
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js04getposts?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To Run the tutorial
1. `git clone https://gitlab.syncad.com/hive/devportal.git`
......
......@@ -521,6 +521,14 @@ This detailed information can be used to track the performance of a specific wit
}
```
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js34getstatereplacementapi?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To run this tutorial
1. `git clone https://gitlab.syncad.com/hive/devportal.git`
......
......@@ -103,6 +103,14 @@ From this result, you have access to everything associated with the selected pos
* `reputation` - The [reputation]({{ '/glossary/#reputation' | relative_url }}) of the account that voted.
* `time` - Time the vote was submitted.
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js06getvoterslistonpost?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To Run the tutorial
1. `git clone https://gitlab.syncad.com/hive/devportal.git`
......
......@@ -72,6 +72,14 @@ document.getElementById('accList').innerHTML = _accounts.join('<br>');
}
```
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js15searchaccounts?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
## To run this tutorial
1. `git clone https://gitlab.syncad.com/hive/devportal.git`
......
......@@ -76,6 +76,14 @@ _tags.forEach(post => {
document.getElementById('tagList').innerHTML = posts.join('<br>');
```
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js16searchtags?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To run this tutorial
1. `git clone https://gitlab.syncad.com/hive/devportal.git`
......
......@@ -124,7 +124,13 @@ Example of output:
}
```
That's it!
---
#### Try it
Click the play button below:
<iframe height="400px" width="100%" src="https://replit.com/@inertia186/js13streamblockchaintransactions?embed=1&output=1" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
### To Run the tutorial
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment