Skip to content
This repository was archived by the owner on Aug 6, 2022. It is now read-only.

V.4. Classes

Andrey Bogdanov edited this page Mar 1, 2016 · 6 revisions

Contents

Note: Classes, that are used internally, are not described here.

lord.PopupMessage

Represents a popup message.

Popup message

  • lord.PopupMessage(text[, options]) Constructor. text is either some text, raw HTML, or a DOM node, depending on the options.type value (by default it is treated as text). Possible options:
  • timeout Timeout (in milliseconds) after which the popup will be hidden. Default: 5000 (5 seconds).
  • type Type of the text parameter. Possible values: html, node, critical, warning, or any other string. If the type is critical or warning, the text parameter is treated as text, but additional CSS class names are added to the popup.
  • classNames A string containing additional CSS class names to be set for the popup. Does not override the default class names.
  • show() Shows the popup in the top right corner (CSS position is static). The hide timer is started.
  • hide() Hides the popup even if the hide timer has not fired yet.
  • resetTimeout(timeout) Resets the timeout (the hide timer is restarted).
  • resetText(text[, options]) Resets the popup content. The hide timer is not affected.

It is recommended to use the lord.showPopup(text[, options]) function to show popups. This method creates the popup, calls it's show() method and returns the object.

Example:

var popup = lord.showPopup("<font color='red'>ALARMA!!!</font>", { type: "html", timeout: 10 * lord.Second });
setTimeout(function() {
    popup.resetText("<font color='green'>False alert.</font>", { type: "html" });
}, 5 * lord.Second);

lord.OverlayProgressBar

Warning: The API of this class has to be changed, because it is very "dirty". Planned for ololord.js v1.1.0.

lord.MovablePlayer

Represents a movable overlay player. The player may show both static images (.jpg, .png, etc.) and audio/video content (using HTML audio and video elements).

Movable player: image Movable player: audio

  • lord.MovablePlayer(fileInfo[, options]) Constructor. fileInfo must be an object, containing the following fields:

    • href The URL of the content to be shown.
    • mimeTpe MIME-type of the content (image/*, audio/* and video/* are supported).
    • width Width of the content. A number.
    • height Height of the content. A number.

    Possible options:

    • imageZoomSensitivity Zoom sensitivity (in percents). The value must be between 1 and 100. The default is 25.
    • minimumContentWidth Minimum allowed content width (to prevent downscaling too much).
    • minimumContentHeight Minimum allowed content height (to prevent downscaling too much).
    • loop If casts to boolean true, and the content is either audio or video, it will be played in a loop.
    • play If casts to a number greater than 0, and the content is either audio or video, it will be played immediately after the play milliseconds have passed.
  • on(eventType, handler) Installs an event handler handler for vents of type eventType. A handler is passed an object containing the following fields:

    • type The event type. Matches the eventType the handler was installed for.
    • action The function that will be called if the event is not cancelled.
    • cancel The function that may be used inside the handler to cancel the event.

    The available event types are:

    • requestClose The event that is triggered if a user clicks on the player content (not on it's controls). The event's action is this.hide().
  • show Appends the player to the page's DOM, making it visbile.

  • hide Removes the player from the page's DOM. If the content is either an audio or a video, it is paused.

  • reset Resets the size of the player and, if the content is either an audio or a video, it's currentTime. Implicitly called once the object is constructed.

  • showScalePopup Shows the popup, containing the player's size and scale (in percents) in the top right corner of the page for 1 second.

Clone this wiki locally