Discuss Scratch

han614698
Scratcher
1000+ posts

More HTML Questions

I want my website to display the exact number of Forum Posts I have. How would I do this?

<Scratch Wikian | Forum Helper | Almost to 6000 Posts! | Please be aware I may mistype things, my wrist is fractured>

Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why




Vaibhs11
Scratcher
1000+ posts

More HTML Questions

You would need JS and the vast world API backend stuff which I don't understand
But you can use https://shefwerld.rirurin.com/post/user?user=han614698 if not for an actual wesite
han614698
Scratcher
1000+ posts

More HTML Questions

Vaibhs11 wrote:

You would need JS and the vast world API backend stuff which I don't understand
But you can use https://shefwerld.rirurin.com/post/user?user=han614698 if not for an actual wesite
Well, I understand the website, but I would like have it display on my website,
I'm assuming I need something like:
<p>I have
  <script>
    *script for getting post number*
  </script>
      forum posts.</p>
But I don't know the Javascript part.

<Scratch Wikian | Forum Helper | Almost to 6000 Posts! | Please be aware I may mistype things, my wrist is fractured>

Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why




kccuber
Scratcher
1000+ posts

More HTML Questions

han614698 wrote:

Vaibhs11 wrote:

You would need JS and the vast world API backend stuff which I don't understand
But you can use https://shefwerld.rirurin.com/post/user?user=han614698 if not for an actual wesite
Well, I understand the website, but I would like have it display on my website,
I'm assuming I need something like:
<p>I have
  <script>
    *script for getting post number*
  </script>
      forum posts.</p>
But I don't know the Javascript part.
Uhh, I believe you need ScratchDB and not Shefwerld.


Made using Nord Theme & Inkscape
Maximouse
Scratcher
1000+ posts

More HTML Questions

han614698 wrote:

Vaibhs11 wrote:

You would need JS and the vast world API backend stuff which I don't understand
But you can use https://shefwerld.rirurin.com/post/user?user=han614698 if not for an actual wesite
Well, I understand the website, but I would like have it display on my website,
I'm assuming I need something like:
<p>I have
  <script>
    *script for getting post number*
  </script>
      forum posts.</p>
But I don't know the Javascript part.
Something like this:
<p>I have <span id="count">(loading...)</span> forum posts.</p>
<script>
fetch("https://scratchdb.lefty.one/v3/forum/user/info/han614698")
  .then((res) => res.json())
  .then((data) => {
    document.getElementById("count").innerText = data.counts.total.count;
  });
</script>


This is Maximouse's signature. Learn more about signatures.
han614698
Scratcher
1000+ posts

More HTML Questions

kccuber wrote:

han614698 wrote:

Vaibhs11 wrote:

You would need JS and the vast world API backend stuff which I don't understand
But you can use https://shefwerld.rirurin.com/post/user?user=han614698 if not for an actual wesite
Well, I understand the website, but I would like have it display on my website,
I'm assuming I need something like:
<p>I have
  <script>
    *script for getting post number*
  </script>
      forum posts.</p>
But I don't know the Javascript part.
Uhh, I believe you need ScratchDB and not Shefwerld.
But still, how do i get that info?

<Scratch Wikian | Forum Helper | Almost to 6000 Posts! | Please be aware I may mistype things, my wrist is fractured>

Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why




han614698
Scratcher
1000+ posts

More HTML Questions

han614698 wrote:

kccuber wrote:

han614698 wrote:

Vaibhs11 wrote:

You would need JS and the vast world API backend stuff which I don't understand
But you can use https://shefwerld.rirurin.com/post/user?user=han614698 if not for an actual wesite
Well, I understand the website, but I would like have it display on my website,
I'm assuming I need something like:
<p>I have
  <script>
    *script for getting post number*
  </script>
      forum posts.</p>
But I don't know the Javascript part.
Uhh, I believe you need ScratchDB and not Shefwerld.
But still, how do i get that info?
I am posting this post as a test.

<Scratch Wikian | Forum Helper | Almost to 6000 Posts! | Please be aware I may mistype things, my wrist is fractured>

Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why




han614698
Scratcher
1000+ posts

More HTML Questions

han614698 wrote:

han614698 wrote:

kccuber wrote:

han614698 wrote:

Vaibhs11 wrote:

You would need JS and the vast world API backend stuff which I don't understand
But you can use https://shefwerld.rirurin.com/post/user?user=han614698 if not for an actual wesite
Well, I understand the website, but I would like have it display on my website,
I'm assuming I need something like:
<p>I have
  <script>
    *script for getting post number*
  </script>
      forum posts.</p>
But I don't know the Javascript part.
Uhh, I believe you need ScratchDB and not Shefwerld.
But still, how do i get that info?
I am posting this post as a test.
Why isn't it updating instantly?
It works fine,

but how long does it take to update?

Last edited by han614698 (May 28, 2021 13:53:16)


<Scratch Wikian | Forum Helper | Almost to 6000 Posts! | Please be aware I may mistype things, my wrist is fractured>

Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why




Maximouse
Scratcher
1000+ posts

More HTML Questions

han614698 wrote:

Why isn't it updating instantly?
It works fine,

but how long does it take to update?
I think it updates twice a day.


This is Maximouse's signature. Learn more about signatures.
linearlemur
Scratcher
500+ posts

More HTML Questions

You could use Scratchdb:

fetch('https://scratchdb.lefty.one/v3/forum/user/info/linearlemur')
.then(response => response.json())
.then(data => console.log(data["counts"]["total"]["count"]));

Last edited by linearlemur (May 28, 2021 14:25:14)


I found out how to put letters in cloud variables! https://turbowarp.org/526557379 (I really didn't feel like sharing the project, lol)
han614698
Scratcher
1000+ posts

More HTML Questions

Maximouse wrote:

han614698 wrote:

Why isn't it updating instantly?
It works fine,

but how long does it take to update?
I think it updates twice a day.
Ok. Now how would I display follows?
https://scratchdb.lefty.one/v3/followers/user/info/han614698

doesn't work.

<Scratch Wikian | Forum Helper | Almost to 6000 Posts! | Please be aware I may mistype things, my wrist is fractured>

Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why




Maximouse
Scratcher
1000+ posts

More HTML Questions

han614698 wrote:

Maximouse wrote:

han614698 wrote:

Why isn't it updating instantly?
It works fine,

but how long does it take to update?
I think it updates twice a day.
Ok. Now how would I display follows?
https://scratchdb.lefty.one/v3/followers/user/info/han614698

doesn't work.
https://scratchdb.lefty.one/v3/user/info/han614698


This is Maximouse's signature. Learn more about signatures.
wvj
Scratcher
1000+ posts

More HTML Questions

#python
import requests
 
x = requests.get('https://scratchdb.lefty.one/v3/user/info/han614698')
x = x.json()
 
followers = x['statistics']['followers'] #this variable stores your followers
print(str(followers) + ' followers!')

Vaibhs11
Scratcher
1000+ posts

More HTML Questions

wvj wrote:

#python
import requests
 
x = requests.get('https://scratchdb.lefty.one/v3/user/info/han614698')
x = x.json()
 
followers = x['statistics']['followers'] #this variable stores your followers
print(str(followers) + ' followers!')
They n e e d J a v a S c r i p t
wvj
Scratcher
1000+ posts

More HTML Questions

Vaibhs11 wrote:

wvj wrote:

#python
import requests
 
x = requests.get('https://scratchdb.lefty.one/v3/user/info/han614698')
x = x.json()
 
followers = x['statistics']['followers'] #this variable stores your followers
print(str(followers) + ' followers!')
They n e e d J a v a S c r i p t
lol then idk

linearlemur
Scratcher
500+ posts

More HTML Questions

Use this code to display follower count:

<script>
fetch('https://scratchdb.lefty.one/v3/user/info/han614698')
  .then(response => response.json())
  .then(data => followerCount = data["statistics"]["followers"]));
</script>

This sets the “followerCount” variable to the number of followers you have.

Last edited by linearlemur (May 28, 2021 15:00:11)


I found out how to put letters in cloud variables! https://turbowarp.org/526557379 (I really didn't feel like sharing the project, lol)
han614698
Scratcher
1000+ posts

More HTML Questions

linearlemur wrote:

Use this code to display follower count:

<script>
fetch('https://scratchdb.lefty.one/v3/user/info/han614698')
  .then(response => response.json())
  .then(data => followerCount = data["statistics"]["followers"]));
</script>

This sets the “followerCount” variable to the number of followers you have.
That works, but
<p>I have <span id="followerCount">(followerCount)</span> followers</p>
<script>
fetch('https://scratchdb.lefty.one/v3/user/info/han614698')
  .then(response => response.json())
  .then(data => followerCount = data["statistics"]["followers"]));
</script>
just displays
“I have (followerCount) followers”
not
“I have 226 followers”

<Scratch Wikian | Forum Helper | Almost to 6000 Posts! | Please be aware I may mistype things, my wrist is fractured>

Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why




linearlemur
Scratcher
500+ posts

More HTML Questions

han614698 wrote:

linearlemur wrote:

Use this code to display follower count:

<script>
fetch('https://scratchdb.lefty.one/v3/user/info/han614698')
  .then(response => response.json())
  .then(data => followerCount = data["statistics"]["followers"]));
</script>

This sets the “followerCount” variable to the number of followers you have.
That works, but
<p>I have <span id="followerCount">(followerCount)</span> followers</p>
<script>
fetch('https://scratchdb.lefty.one/v3/user/info/han614698')
  .then(response => response.json())
  .then(data => followerCount = data["statistics"]["followers"]));
</script>
just displays
“I have (followerCount) followers”
not
“I have 226 followers”

You'll have to programmatically change an empty element:

<p id=followerCount></p>
<script>
fetch('https://scratchdb.lefty.one/v3/user/info/han614698')
  .then(response => response.json())
  .then(data => followerCount = data["statistics"]["followers"]));
document.getElementById("followerCount").innerHTML = followerCount;
</script>

Last edited by linearlemur (May 28, 2021 15:11:27)


I found out how to put letters in cloud variables! https://turbowarp.org/526557379 (I really didn't feel like sharing the project, lol)
Maximouse
Scratcher
1000+ posts

More HTML Questions

han614698 wrote:

That works, but
<p>I have <span id="followerCount">(followerCount)</span> followers</p>
<script>
fetch('https://scratchdb.lefty.one/v3/user/info/han614698')
  .then(response => response.json())
  .then(data => followerCount = data["statistics"]["followers"]));
</script>
just displays
“I have (followerCount) followers”
not
“I have 226 followers”
This should work:
<p>I have <span id="followerCount">(followerCount)</span> followers</p>
<script>
fetch('https://scratchdb.lefty.one/v3/user/info/han614698')
  .then(response => response.json())
  .then(data => document.getElementById("followerCount").innerText = data.statistics.followers));
</script>


This is Maximouse's signature. Learn more about signatures.
Sheep_maker
Scratcher
1000+ posts

More HTML Questions

then do followerCount.textContent to set your <span>'s text content:
<p>I have <span id="followerCount">(followerCount)</span> followers</p>
<script>
fetch('https://scratchdb.lefty.one/v3/user/info/han614698')
  .then(response => response.json())
  .then(data => followerCount.textContent = data["statistics"]["followers"]);
</script>
There was also a syntax error (extra parenthesis on the last line of JS); don't forget to check the console for errors!

Edit: Ninja'd twice o_O

Last edited by Sheep_maker (May 28, 2021 15:16:07)


- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }

Powered by DjangoBB