﻿if (typeof Poly9 == "undefined") { var Poly9 = {} } Poly9.URLParser = function (a) { this._fields = { Username: 4, Password: 5, Port: 7, Protocol: 2, Host: 6, Pathname: 8, URL: 0, Querystring: 9, Fragment: 10 }; this._values = {}; this._regex = null; this.version = 0.1; this._regex = /^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/; for (var b in this._fields) { this["get" + b] = this._makeGetter(b) } if (typeof a != "undefined") { this._parse(a) } }; Poly9.URLParser.prototype.setURL = function (a) { this._parse(a) }; Poly9.URLParser.prototype._initValues = function () { for (var a in this._fields) { this._values[a] = "" } }; Poly9.URLParser.prototype._parse = function (a) { this._initValues(); var b = this._regex.exec(a); if (!b) { throw "DPURLParser::_parse -> Invalid URL" } for (var c in this._fields) { if (typeof b[this._fields[c]] != "undefined") { this._values[c] = b[this._fields[c]] } } }; Poly9.URLParser.prototype._makeGetter = function (a) { return function () { return this._values[a] } }; function iFrameCorrectSize(b) { var a = getBodyHeight(b.contentWindow.document); if (a) { b.style.height = a + "px" } } function iFrameOpenLinksOnTop(d) { var g = new Poly9.URLParser(d.src); var f = g.getPathname(); var a; if (d.contentWindow.location) { a = d.contentWindow.location.pathname } if (a && a != "/blank" && a != f) { d.contentWindow.document.body.style.display = "none"; top.location.href = d.contentWindow.location.href } else { var b = d.contentWindow.document.getElementsByTagName("a"); for (var c = 0; c < b.length; c++) { var e = b[c]; if (e.href.indexOf("javascript:") == -1) { if (!e.onclick) { e.onclick = function () { top.location.href = this.href } } } } } } function getBodyHeight(d) { var a; var c; var b; if (d.height) { a = d.height } else { if (d.body) { if (d.body.scrollHeight) { a = c = d.body.scrollHeight } if (d.body.offsetHeight) { a = b = d.body.offsetHeight } if (c && b) { a = Math.max(c, b) } } } return a };
