Webigail
    Preparing search index...

    Represents an object that is helpful in building a url.

    Index

    Constructors

    • Initializes a new instance of this object.

      Parameters

      • protocol: string = "http"

        The protocol to use.

      • hostname: string = "localhost"

        The hostname to connect with.

      Returns ZUrlBuilder

    Properties

    ProtocolPorts: {
        ftp: number;
        http: number;
        https: number;
        sftp: number;
        smb: number;
        smtp: number;
        ssh: number;
    } = ...

    A mapping between protocol and default port.

    UrlGravatar: string = "https://s.gravatar.com/avatar"

    The url to the gravatar api.

    UrlYouTube: string = "https://www.youtube.com"

    The url to youtube.

    This is mostly used to embed videos.

    Methods

    • Fills the information for an api path call.

      This is a combination of location, hash with an empty string, and an append of the basePath.

      Parameters

      • loc: Location

        The optional location object to populate with.

      • basePath: string = "api"

        The basePath for the api. Generally, it's best to just keep this as api and have your server accept this path.

      Returns this

      This object.

    • Appends a path segment.

      Parameters

      • path: string

        The segment to append.

      Returns this

      This object.

    • Builds the url string and returns it.

      Returns string

      The url string.

    • Adds a filter param.

      Parameters

      • Optionalfilter: string | null

        The filter param to add. If this is null, undefined, or empty, then any filter param is deleted.

      Returns this

      This object.

    • Sets the url for a user gravatar.

      Parameters

      • Optionalhash: string

        The md5 email hash.

      • Optionalsize: number

        The dimensional size of the gravatar image.

      Returns this

      This object.

    • Sets the hash section.

      Parameters

      • hash: string | undefined

        The hash section.

      Returns this

      This object.

    • Sets the host name.

      This sets the entire hostname as the root domain. This will blow away any subdomains added, so it's best to call this method first.

      Parameters

      • host: string

        The hostname.

      Returns this

      This object.

    • Fills the information from the current location data.

      Parameters

      • loc: Location

        The optional location object to populate with.

      Returns this

      This object.

    • Removes all duplicate params and adds one with the key to the value.

      Parameters

      • key: string

        The parameter key that can have only one.

      • Optionalval: string

        The parameter value. If this is falsy, then the key is deleted.

      Returns this

    • Adds a page param.

      Parameters

      • Optionalpage: number | null

        The page param to add. If this null, undefined, or less than 1, then any page param is deleted.

      Returns this

      This object.

    • Adds a search parameter.

      This version assumes that value is not null.

      Parameters

      • key: string

        The parameter key.

      • val: string

        The parameter value.

      Returns this

      This object.

    • Parses an existing url and sets all properties.

      If you give this a path without the protocol and hostname, then it will automatically append the protocol and host of the browser window if it exists.

      This method sets all the properties so if you need to modify the url before parsing it, it is best to always call this method first.

      Parameters

      • url: string

        The url to parse.

      Returns ZUrlBuilder

      This object.

    • Sets the password.

      This is only valid if the username is set.

      Parameters

      • pwd: string | undefined

        The user password.

      Returns this

      This object.

    • Removes all existing path segments and restarts the path.

      Parameters

      • path: string

        The starting path.

      Returns this

      This object.

    • Removes a subdomain from the current domain.

      Returns this

      This object.

    • Sets the port.

      Parameters

      • port: number | undefined

        The port.

      Returns this

      This object.

    • Sets the protocol.

      Parameters

      • protocol: string

        The protocol.

      Returns this

      This object.

    • Adds a search param.

      Parameters

      • Optionalsearch: string | null

        The search param to add. If this is null, undefined, or empty, then any search param is deleted.

      Returns this

      This object.

    • Adds a size param.

      Parameters

      • Optionalsize: number | null

        The size param to add. If this is null, undefined, or less than 0, then any size param is deleted.

      Returns this

      This object.

    • Adds a sort param.

      Parameters

      • Optionalsort: string | null

        The sort param to add. If this is null, undefined, or empty, then any filter param is deleted.

      Returns this

      This object.

    • Adds a subdomain in front of the hostname.

      If a hostname was never set, then domain becomes the hostname.

      Parameters

      • domain: string

        The domain to append.

      Returns this

      This object.

    • Sets the user name.

      Used for things like ssh and ftp.

      Parameters

      • user: string | undefined

        The username

      Returns this

      This object.

    • Sets the url for a target video on YouTube.

      Parameters

      • api: ZYouTubeApi

        The target api. If this is watch, then it will be a target link to a youTube url. If this is embed, then it will be a target link that can be put into an iframe for embedded youtube videos.

      • id: string

        The id of the video to watch.

      Returns this

      This object.

    • Sets the url to the base YouTube domain.

      Returns this

      This object.

    • Gets whether the given protocols default port is port.

      The main purpose of this method is to determine if a url requires a port section. Therefore, there are some special behaviors which may not be obvious:

      1. If the port is falsy then this method returns true.
      2. If the port is NaN, then this method returns true.
      3. If the port is a string that evaluates to 0, then this method returns true.
      4. If port is less than 0, then this method returns true.

      Parameters

      • protocol: string

        The protocol to check.

      • port: string | number

        The port to compare.

      Returns boolean

      True if the default port for protocol is port.