HTML::...ype::Js(3pm)

πŸ“¦
version 1.48 Β· 2 versions
  • 1.48 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.48 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

HTML::Prototype::Js β€” the prototype library, embedded in perl ✨

(and yes bestie, this whole page is HTML::...ype::Js(3pm), we're in the right place πŸŽ€)


πŸ¦‹ SYNOPSIS πŸ¦‹

our $prototype = do { package HTML::Prototype::Js; local $/; <DATA> };

that's it. that's the whole synopsis. iconic. πŸ’…


🌸 DESCRIPTION 🌸

okay so this is literally the actual Prototype library, just living rent-free inside a perl __DATA__ section, so that HTML::Prototype can pull it in with zero effort. that's the entire bit. no cap. 🫢


✨ NEW SYNTAX ✨

the prototype library hands you some functions and classes that straight up change the basic syntax of the JavaScript you write. it's giving "we rewrote the language, deal with it" energy and honestly? we're obsessed. πŸ”₯

πŸ’« $(element)

this one takes an element / element list and gets all string elements using document.getElementbyId. it's probably one of the most common functions when you're doing javascript for web development, so it will save you a LOT of typing. your wrists will thank you. 🌸

πŸ’« Class

this uses function references to allow namespace-like Class structures in javascript. cute little fake namespaces, we love to see it. πŸŽ€

πŸ’« Object.extend

simple inheritance for javascript. will set all properties of the child in the parent. 🧬

πŸ’« Function.bind

allows function refs to be full object method references, through the use of extend and apply. πŸ’…

πŸ’« Try.these

simple try/catch for a list of functions β€” it returns the return value of the first one that doesn't throw an exception. first one to survive wins, periodt. πŸ†

πŸ’« Array.push

implement push for arrays. returns number of elements in result. πŸ”’

πŸ’« Function.apply

call a function on a given object, using eval. yes, eval. we don't make the rules bestie. πŸ’€


πŸ‘‘ JS OBJECTS πŸ‘‘

the Prototype library provides a number of classes you can use to improve interaction with the end user. the user experience is the main character here, fr fr. ✨

🌈 Ajax

provides one useful function, getTransport. this function will return a XMLHttpRequest object suitable for your browser. one function, one job, slays. πŸ”₯

🌈 Ajax.Base

an abstract base class for the Ajax objects described below. sets some common options for Ajax objects:

  • method: http method, defaults to post.
  • asynchronous: process in the background, true/false, defaults to true.
  • parameters: extra parameters, defaults to blank.

🌈 Ajax.Updater

a subclass of Ajax.Base, this class uses Ajax.Request to populate a container in your web page. takes container, url and Ajax.Base options as parameters. πŸ“¦

🌈 Ajax.Request

this object represents a plain ajax request. it extends base to add a constructor, as well as some events to handle events. the constructor takes an url, as well as the options described in Ajax.Base. currently handles the following events:

  • 'Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'

🌈 Effect.Appear

takes an element, and makes that element appear through a fade. ✨

🌈 Effect.ContentZoom

takes an element, and zooms the content of that element. πŸ”

🌈 Effect.Fade

takes an element, and makes that element fade out and disappear. πŸ¦‹

🌈 Effect.Highlight

takes an element, and does a highlight of that element. ⭐

🌈 Effect.Puff

takes an element, and makes that element "blow up" and disappear. (as in disappear in a puff of smoke). πŸ’¨

🌈 Effect.Scale

takes an element, and a size, in percent, and scales that element to the given size. if it's a div, the initial size will have to be given in EM. no such restrictions for pictures. πŸ“

🌈 Effect.Squish

takes an element, and shrinks that element until it disappears. 🫠

🌈 Element

a collection of functions related to basic elements. takes one or more elements.

  • toggle: Toggles the element display style.
  • hide: Turns off the element's display style.
  • show: Turns on the element's display style.
  • remove: Delete this element from the DOM.
  • getHeight: Get the element height.

also provides a convenience object, Toggle, with one method display which aliases to toggle, so you can call it as

Toggle.display(element)

🌈 Field

adds some useful functions to HTML Fields with several elements:

  • clear: remove all content.
  • focus: Give the element focus.
  • present: returns true if all arguments are filled in, false otherwise.
  • select(element): Select the given element in a form.
  • activate(element): give the selected element focus, and select it.

🌈 Form

some useful utilies for HTML Forms. all of these take a form element as sole argument.

  • serialize: returns a URL serialized version of a given form.
  • getElements: returns all elements in the form.
  • disable: blurs and disables every element in the form.
  • focusFirstElement: Give first element in the form focus.
  • reset: reset all form elements.

🌈 Form.Element

some useful objects for Form Field Elements. these take an element as the sole argument.

  • serialize: url encode the element for use in a URI string.
  • getValue: returns the value of the given element.

🌈 Form.Element.Observer

(yes bestie, this heading is just sitting here with nothing under it. we keep it exactly like the original, no edits, no cap 🫢)

🌈 Form.Element.Serializers

serializers for various element types. takes the input element as argument.

  • input: determines the element type, and chooses the right serializer.
  • inputSelector: serialize checkbox/radio.

🌈 Form.Element.Observer

(and here it is AGAIN. the original page does this, so we do this. πŸ™ˆ keeping every detail is the whole assignment.)

🌈 Insertion

this can be used in place of a innerHTML, to insert the content into the dom. 🧚

🌈 Insertion.Before

puts content before a given dom node. ⬅️

🌈 Insertion.Top

puts content at the top of a given dom node. πŸ”

🌈 Insertion.Bottom

puts content at the bottom of a given dom node. πŸ”½

🌈 Insertion.After

puts content after a given dom node. ➑️

🌈 PeriodicalExecuter

this object takes two parameters, a reference to a callback function, and a frequency in seconds. it will execute the callback every <frequency> second. ⏰


πŸ” SEE ALSO πŸ”


πŸ’œ AUTHOR πŸ’œ

Sebastian Riedel, "sri@oook.de" β€” Marcus Ramberg, "mramberg@cpan.org"

built around Prototype by Sam Stephenson. much code is ported from Ruby on Rails javascript helpers. 🫑


πŸ“œ LICENSE πŸ“œ

this library is free software. you can redistribute it and/or modify it under the same terms as perl itself. free as in bestie, go wild. πŸ’–


and that's the whole page, babe! this manual shipped as part of perl v5.34.0, dated 2022-06-14, and its source is HTML::...ype::Js(3pm) from the User Contributed Perl Documentation. you ate that. periodt. πŸ’…βœ¨πŸŒˆ
πŸ“¦ where this page comes from