Home Events! Entrance Everyone Wiki Search Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
November 22, 2024 - @164.71 (what is this?)
Forum activity rating: Three Stars Posts: 33/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts    Start New Topic
News: :4u: ~~~~~~~~~~~  :4u:

+  MelonLand Forum
|-+  World Wild Web
| |-+  ♺ ∙ Web Crafting Materials
| | |-+  randomized fortune cookie generator element!


« previous next »
Pages: [1] Print
Author Topic: randomized fortune cookie generator element!  (Read 188 times)
candycanearter07
Sr. Member ⚓︎
****


i like slimes

⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: candycanearter
Itch.io: My Games

View Profile WWW

Suck At Something September - Did It!uh oh! a pigeon got in!Artsy Candy CaneJoined 2024!
« on: August 17, 2024 @164.13 »

hiya!

so, i finally implemented my own fortune cookie thing and made it compatible with unix fortune!
for those who dont know, unix fortune database files are just plaintext seperated by newlines and a percent sign
theres a ton out there and i wanted to make them compatible with this so i implemented it to be supported!

a fortune file looks like this:
Code
quote 1
%
quote 2

if you make your own quote file make sure to add a newline between them because its hardcoded to remove the last character to cope with the newline

its super easy to implement too! just add this to your html:
Code
<script src="https://abslimeware.neocities.org/assets/js/unixfortune.js"></script>
<marquee onstart="updateFortune(this, 'path/to/fortunefile')"></marquee>

you can also replace the marquee with any element and replace onstart with onload, since it uses the first argument of the function to target which element to edit

edit: for clarification, updateFortune is just a wrapper to update the element pointed to by the first argument, if you want to immplement your own you can use fetchFortune('path/to/fortunefile') to just get the string
« Last Edit: August 17, 2024 @166.38 by candycanearter07 » Logged

new to oldnet be nice




Zunne
Casual Poster ⚓︎
*


Mmm... Ice Cream...

⛺︎ My Room
XMPP: Chat!

View Profile WWW

Joined 2024!
« Reply #1 on: November 21, 2024 @681.28 »

what does it look like?
Logged

I wonder why i like ice cream so much?
candycanearter07
Sr. Member ⚓︎
****


i like slimes

⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: candycanearter
Itch.io: My Games

View Profile WWW

Suck At Something September - Did It!uh oh! a pigeon got in!Artsy Candy CaneJoined 2024!
« Reply #2 on: November 21, 2024 @938.16 »

Well, currently its broken, but it should just display a random quote, and reload every time the marquee resets. Maybe they changed how the onload() attr worked on firefox? idk
Logged

new to oldnet be nice




Pages: [1] Print 
« previous next »
 

Vaguely similar topics! (3)

Earthbound Text Generator

Started by ObspogonBoard ♖ ∙ Video Games

Replies: 7
Views: 4800
Last post March 04, 2023 @848.91
by sig
Random Art Generator ! ! !

Started by ellievoyydBoard ☆ ∙ Showcase & Links

Replies: 9
Views: 2840
Last post August 13, 2024 @642.43
by TheFrugalGamer
A cool dummy image generator

Started by PepyogurtBoard ☆ ∙ Showcase & Links

Replies: 0
Views: 1303
Last post July 03, 2022 @168.19
by Pepyogurt

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021, Simple Machines | Terms and Policies Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi