Home Events! Entrance Everyone Wiki Search Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
October 18, 2024 - @410.12 (what is this?)
Forum activity rating: Three Stars Posts: 27/1k.beats Unread Topics | Unread Replies | Own Posts | Own Topics | Random Topic | Recent Posts
News: :4u: :transport: More is More :transport: :4u:
Halloween Topics! Gfx + Costumes, Decor + Crafts, Prep, Horror Movies, Spooky Songs! ~ E-Zine #2 is out now!

+  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 138 times)
candycanearter07
Full 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




Pages: [1] Print 
« previous next »
 

Vaguely similar topics! (3)

Earthbound Text Generator

Started by ObspogonBoard ♖ ∙ Video Games

Replies: 7
Views: 4690
Last post March 04, 2023 @848.91
by sig
Case Study - Design elements and hits, should we care?

Started by MelooonBoard ✁ ∙ Web Crafting

Replies: 3
Views: 1892
Last post April 22, 2022 @82.67
by Icey!
Random Art Generator ! ! !

Started by ellievoyydBoard ☆ ∙ Showcase & Links

Replies: 9
Views: 2761
Last post August 13, 2024 @642.43
by TheFrugalGamer

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


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