HTML::...ype::Js(3pm)
π 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 π
HTML::Prototype,Catalyst::Plugin::Prototype- <http://prototype.conio.net/>
π 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
- debian bookworm: libhtml-prototype-perl 1.48-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhtml-prototype-perl 1.48-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-prototype-perl 1.48-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-prototype-perl 1.48-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-prototype-perl 1.48-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms