Entrance Events! Chat Gallery Search Everyone Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
February 05, 2025 - @896.39 (what is this?)
Activity rating: Five Stars Posts & Arts: 101/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts Start New Topic  Submit Art
News: :skull: Websites are like whispers in the night  :skull: Super News: E-Zine #3 Accepting Entries!

+  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 291 times)
candycanearter07
Sr. Member ⚓︎
****


i like slimes

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

View Profile WWWArt

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
RSS: RSS

View Profile WWWArt

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: 5143
Last post March 04, 2023 @848.91
by sig
Random Art Generator ! ! !

Started by ellievoyydBoard ☆ ∙ Community Projects

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

Started by PepyogurtBoard ♺ ∙ Web Crafting Materials

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

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | ~ Send Feedback ~ 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