Source: helper/prototype.string.js

/**
 * @namespace String
 */

/**
 * Parsing functions for URLs //parseUri 1.2.2 //(c) Steven Levithan
 * <stevenlevithan.com> //MIT License
 * {@link http://blog.stevenlevithan.com/archives/parseuri}
 *
 * @return {array} Array of the parsed URI components
 */
String.prototype.parseUri = function () {
    var o = String.prototype.parseUri.options;
    var m = o.parser.ipv6.exec(this);
    var uri = {};
    var i = 18;
    while (i--) {
        uri[o.key[i]] = m[i] || "";
    }

    uri[o.q.name] = {};
    uri[o.key[16]].replace(o.q.parser, function ($0, $1, $2) {
        if ($1) {
            // uri[o.q.name][$1] = decodeURIComponent($2); // this will be a trouble maker for subsequent request. It slipped in with the zoom settings. 
            uri[o.q.name][$1] = $2;
        }
    });

    if (uri.ipv4 !== "") {
        uri.ip = uri.ipv4;
    } else if (uri.ipv6 !== "") {
        uri.ip = uri.ipv6;
    }

    return uri;
};

String.prototype.parseUri.options = {
    // strictMode : false,
    key: ["source", "protocol", "authority", "userInfo", "user", "password",
            "host", "ipv4", "ipv6", "basename", "domain", "port", "relative",
            "path", "directory", "file", "query", "anchor"],
    q: {
        name: "queryKey",
        parser: /(?:^|&)([^&=]*)=?([^&]*)/g
    },
    parser: {
        ipv6: /^(?:(?![^:@]+:[^:@\/]*@)([^[:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:(\d+\.\d+\.\d+\.\d+)|\[([a-fA-F0-9:]+)\]|([^.:\/?#]*))(?:\.([^:\/?#]*))?)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
    }
};

if (typeof String.prototype.trim === "undefined") {

    /**
     * Trimming function. Returns the String without leading and trailing whitespaces.
     * 
     * @returns {String} String without leading and trailing whitespaces
     */
    String.prototype.trim = function () {
        var str = this.replace(/^\s\s*/, ''),
            ws = /\s/,
            i = str.length;
        while (ws.test(str.charAt(--i))) {}
        return str.slice(0, i + 1);
    };
}