diff --git a/public/js/test.js b/public/js/test.js
index e69de29..a3bee2a 100644
--- a/public/js/test.js
+++ b/public/js/test.js
@@ -0,0 +1,3760 @@
+/*
+Wombat.js client-side rewriting engine for web archive replay
+Copyright (C) 2014-2020 Webrecorder Software, Rhizome, and Contributors. Released under the GNU Affero General Public License.
+
+This file is part of wombat.js, see https://github.com/webrecorder/wombat.js for the full source
+Wombat.js is part of the Webrecorder project (https://github.com/webrecorder)
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .
+ */
+(function () {
+ function FuncMap() {
+ this._map = []
+ }
+ function ensureNumber(maybeNumber) {
+ try {
+ switch (typeof maybeNumber) {
+ case "number":
+ case "bigint":
+ return maybeNumber;
+ }
+ var converted = Number(maybeNumber);
+ return isNaN(converted) ? null : converted
+ } catch (e) { }
+ return null
+ }
+ function addToStringTagToClass(clazz, tag) {
+ typeof self.Symbol !== "undefined" && typeof self.Symbol.toStringTag !== "undefined" && Object.defineProperty(clazz.prototype, self.Symbol.toStringTag, {
+ value: tag,
+ enumerable: false
+ })
+ }
+ function autobind(clazz) {
+ for (var prop, propValue, proto = clazz.__proto__ || clazz.constructor.prototype || clazz.prototype, clazzProps = Object.getOwnPropertyNames(proto), len = clazzProps.length, i = 0; i < len; i++)
+ prop = clazzProps[i],
+ propValue = clazz[prop],
+ prop !== "constructor" && typeof propValue === "function" && (clazz[prop] = propValue.bind(clazz))
+ }
+ function Storage(wombat, proxying) {
+ if (ThrowExceptions.yes)
+ throw new TypeError("Illegal constructor");
+ Object.defineProperties(this, {
+ data: {
+ enumerable: false,
+ value: {}
+ },
+ wombat: {
+ enumerable: false,
+ value: wombat
+ },
+ proxying: {
+ enumerable: false,
+ value: proxying
+ },
+ _deleteItem: {
+ enumerable: false,
+ value: function (item) {
+ delete this.data[item]
+ }
+ }
+ })
+ }
+ function WombatLocation(orig_loc, wombat) {
+ for (var prop in Object.defineProperties(this, {
+ _orig_loc: {
+ configurable: true,
+ enumerable: false,
+ value: orig_loc
+ },
+ wombat: {
+ configurable: true,
+ enumerable: false,
+ value: wombat
+ },
+ orig_getter: {
+ enumerable: false,
+ value: function (prop) {
+ return this._orig_loc[prop]
+ }
+ },
+ orig_setter: {
+ enumerable: false,
+ value: function (prop, value) {
+ this._orig_loc[prop] = value
+ }
+ }
+ }),
+ wombat.initLocOverride(this, this.orig_setter, this.orig_getter),
+ wombat.setLoc(this, orig_loc.href),
+ orig_loc)
+ this.hasOwnProperty(prop) || typeof orig_loc[prop] === "function" || (this[prop] = orig_loc[prop])
+ }
+ function AutoFetcher(wombat, config) {
+ return this instanceof AutoFetcher ? void (this.elemSelector = "img[srcset], img[data-srcset], img[data-src], video[srcset], video[data-srcset], video[data-src], audio[srcset], audio[data-srcset], audio[data-src], picture > source[srcset], picture > source[data-srcset], picture > source[data-src], video > source[srcset], video > source[data-srcset], video > source[data-src], audio > source[srcset], audio > source[data-srcset], audio > source[data-src]",
+ this.wombat = wombat,
+ this.$wbwindow = wombat.$wbwindow,
+ this.worker = null,
+ autobind(this),
+ this._initWorker(config)) : new AutoFetcher(wombat, config)
+ }
+ function wrapSameOriginEventListener(origListener, win) {
+ return function wrappedSameOriginEventListener(event) {
+ return window == win ? origListener(event) : void 0
+ }
+ }
+ function wrapEventListener(origListener, obj, wombat) {
+ var origListenerFunc;
+ return origListenerFunc = typeof origListener === "function" ? origListener : typeof origListener === "object" ? origListener.handleEvent.bind(origListener) : function () { }
+ ,
+ function wrappedEventListener(event) {
+ var ne;
+ if (event.data && event.data.from && event.data.message) {
+ if (event.data.to_origin !== "*" && obj.WB_wombat_location && !wombat.startsWith(event.data.to_origin, obj.WB_wombat_location.origin))
+ return void console.warn("Skipping message event to " + event.data.to_origin + " doesn't start with origin " + obj.WB_wombat_location.origin);
+ var source = event.source;
+ event.data.from_top ? source = obj.__WB_top_frame : event.data.src_id && obj.__WB_win_id && obj.__WB_win_id[event.data.src_id] && (source = obj.__WB_win_id[event.data.src_id]),
+ ne = new MessageEvent("message", {
+ bubbles: event.bubbles,
+ cancelable: event.cancelable,
+ data: event.data.message,
+ origin: event.data.from,
+ lastEventId: event.lastEventId,
+ source: wombat.proxyToObj(source),
+ ports: event.ports
+ }),
+ ne._target = event.target,
+ ne._srcElement = event.srcElement,
+ ne._currentTarget = event.currentTarget,
+ ne._eventPhase = event.eventPhase,
+ ne._path = event.path
+ } else
+ ne = event;
+ return origListenerFunc(ne)
+ }
+ }
+ function Wombat($wbwindow, wbinfo) {
+ if (!(this instanceof Wombat))
+ return new Wombat($wbwindow, wbinfo);
+ this.debug_rw = false,
+ this.$wbwindow = $wbwindow,
+ this.HTTP_PREFIX = "http://",
+ this.HTTPS_PREFIX = "https://",
+ this.REL_PREFIX = "//",
+ this.VALID_PREFIXES = [this.HTTP_PREFIX, this.HTTPS_PREFIX, this.REL_PREFIX],
+ this.IGNORE_PREFIXES = ["#", "about:", "data:", "blob:", "mailto:", "javascript:", "{", "*"],
+ "ignore_prefixes" in wbinfo && (this.IGNORE_PREFIXES = this.IGNORE_PREFIXES.concat(wbinfo.ignore_prefixes)),
+ this.WB_CHECK_THIS_FUNC = "_____WB$wombat$check$this$function_____",
+ this.WB_ASSIGN_FUNC = "_____WB$wombat$assign$function_____",
+ this.wb_setAttribute = $wbwindow.Element.prototype.setAttribute,
+ this.wb_getAttribute = $wbwindow.Element.prototype.getAttribute,
+ this.wb_funToString = Function.prototype.toString,
+ this.WBAutoFetchWorker = null,
+ this.wbUseAFWorker = wbinfo.enable_auto_fetch && $wbwindow.Worker != null && wbinfo.is_live,
+ this.wb_rel_prefix = "",
+ this.wb_wombat_updating = false,
+ this.message_listeners = new FuncMap,
+ this.storage_listeners = new FuncMap,
+ this.linkAsTypes = {
+ script: "js_",
+ worker: "js_",
+ style: "cs_",
+ image: "im_",
+ document: "if_",
+ fetch: "mp_",
+ font: "oe_",
+ audio: "oe_",
+ video: "oe_",
+ embed: "oe_",
+ object: "oe_",
+ track: "oe_",
+ "": "mp_",
+ null: "mp_",
+ undefined: "mp_"
+ },
+ this.linkTagMods = {
+ linkRelToAs: {
+ import: this.linkAsTypes,
+ preload: this.linkAsTypes
+ },
+ stylesheet: "cs_",
+ null: "mp_",
+ undefined: "mp_",
+ "": "mp_"
+ },
+ this.tagToMod = {
+ A: {
+ href: "mp_"
+ },
+ AREA: {
+ href: "mp_"
+ },
+ AUDIO: {
+ src: "oe_",
+ poster: "im_"
+ },
+ BASE: {
+ href: "mp_"
+ },
+ EMBED: {
+ src: "oe_"
+ },
+ FORM: {
+ action: "mp_"
+ },
+ FRAME: {
+ src: "fr_"
+ },
+ IFRAME: {
+ src: "if_"
+ },
+ IMAGE: {
+ href: "im_",
+ "xlink:href": "im_"
+ },
+ IMG: {
+ src: "im_",
+ srcset: "im_"
+ },
+ INPUT: {
+ src: "oe_"
+ },
+ INS: {
+ cite: "mp_"
+ },
+ META: {
+ content: "mp_"
+ },
+ OBJECT: {
+ data: "oe_",
+ codebase: "oe_"
+ },
+ Q: {
+ cite: "mp_"
+ },
+ SCRIPT: {
+ src: "js_",
+ "xlink:href": "js_"
+ },
+ SOURCE: {
+ src: "oe_",
+ srcset: "oe_"
+ },
+ TRACK: {
+ src: "oe_"
+ },
+ VIDEO: {
+ src: "oe_",
+ poster: "im_"
+ },
+ image: {
+ href: "im_",
+ "xlink:href": "im_"
+ }
+ },
+ this.URL_PROPS = ["href", "hash", "pathname", "host", "hostname", "protocol", "origin", "search", "port"],
+ this.wb_info = wbinfo,
+ this.wb_opts = wbinfo.wombat_opts,
+ this.wb_replay_prefix = wbinfo.prefix,
+ this.wb_is_proxy = this.wb_info.proxy_magic || !this.wb_replay_prefix,
+ this.wb_info.top_host = this.wb_info.top_host || "*",
+ this.wb_curr_host = $wbwindow.location.protocol + "//" + $wbwindow.location.host,
+ this.wb_info.wombat_opts = this.wb_info.wombat_opts || {},
+ this.wb_orig_scheme = this.wb_info.wombat_scheme + "://",
+ this.wb_orig_origin = this.wb_orig_scheme + this.wb_info.wombat_host,
+ this.wb_abs_prefix = this.wb_replay_prefix,
+ this.wb_capture_date_part = "",
+ !this.wb_info.is_live && this.wb_info.wombat_ts && (this.wb_capture_date_part = "/" + this.wb_info.wombat_ts + "/"),
+ this.BAD_PREFIXES = ["http:" + this.wb_replay_prefix, "https:" + this.wb_replay_prefix, "http:/" + this.wb_replay_prefix, "https:/" + this.wb_replay_prefix],
+ this.hostnamePortRe = /^[\w-]+(\.[\w-_]+)+(:\d+)(\/|$)/,
+ this.ipPortRe = /^\d+\.\d+\.\d+\.\d+(:\d+)?(\/|$)/,
+ this.workerBlobRe = /__WB_pmw\(.*?\)\.(?=postMessage\()/g,
+ this.rmCheckThisInjectRe = /_____WB\$wombat\$check\$this\$function_____\(.*?\)/g,
+ this.STYLE_REGEX = /(url\s*\(\s*[\\"']*)([^)'"]+)([\\"']*\s*\))/gi,
+ this.IMPORT_REGEX = /(@import\s*[\\"']*)([^)'";]+)([\\"']*\s*;?)/gi,
+ this.no_wombatRe = /WB_wombat_/g,
+ this.srcsetRe = /\s*(\S*\s+[\d.]+[wx]),|(?:\s*,(?:\s+|(?=https?:)))/,
+ this.cookie_path_regex = /\bPath='?"?([^;'"\s]+)/i,
+ this.cookie_domain_regex = /\bDomain=([^;'"\s]+)/i,
+ this.cookie_expires_regex = /\bExpires=([^;'"]+)/gi,
+ this.SetCookieRe = /,(?![|])/,
+ this.IP_RX = /^(\d)+\.(\d)+\.(\d)+\.(\d)+$/,
+ this.FullHTMLRegex = /^\s*<(?:html|head|body|!doctype html)/i,
+ this.IsTagRegex = /^\s*,
+ this.DotPostMessageRe = /(.postMessage\s*\()/,
+ this.extractPageUnderModiferRE = /\/(?:[0-9]{14})?([a-z]{2, 3}_)\//,
+ this.write_buff = "";
+ var eTargetProto = ($wbwindow.EventTarget || {}).prototype;
+ this.utilFns = {
+ cspViolationListener: function (e) {
+ if (console.group("CSP Violation"),
+ console.log("Replayed Page URL", window.WB_wombat_location.href),
+ console.log("The documentURI", e.documentURI),
+ console.log("The blocked URL", e.blockedURI),
+ console.log("The directive violated", e.violatedDirective),
+ console.log("Our policy", e.originalPolicy),
+ e.sourceFile) {
+ var fileInfo = "File: " + e.sourceFile;
+ e.lineNumber && e.columnNumber ? fileInfo += " @ " + e.lineNumber + ":" + e.columnNumber : e.lineNumber && (fileInfo += " @ " + e.lineNumber),
+ console.log(fileInfo)
+ }
+ console.groupEnd()
+ },
+ addEventListener: eTargetProto.addEventListener,
+ removeEventListener: eTargetProto.removeEventListener,
+ objToString: Object.prototype.toString,
+ wbSheetMediaQChecker: null,
+ XHRopen: null,
+ XHRsend: null
+ },
+ this.showCSPViolations = {
+ yesNo: false,
+ added: false
+ },
+ autobind(this)
+ }
+ FuncMap.prototype.set = function (fnKey, fnValue) {
+ this._map.push([fnKey, fnValue])
+ }
+ ,
+ FuncMap.prototype.get = function (fnKey) {
+ for (var i = 0; i < this._map.length; i++)
+ if (this._map[i][0] === fnKey)
+ return this._map[i][1];
+ return null
+ }
+ ,
+ FuncMap.prototype.find = function (fnKey) {
+ for (var i = 0; i < this._map.length; i++)
+ if (this._map[i][0] === fnKey)
+ return i;
+ return -1
+ }
+ ,
+ FuncMap.prototype.add_or_get = function (func, initter) {
+ var fnValue = this.get(func);
+ return fnValue || (fnValue = initter(),
+ this.set(func, fnValue)),
+ fnValue
+ }
+ ,
+ FuncMap.prototype.remove = function (func) {
+ var idx = this.find(func);
+ if (idx >= 0) {
+ var fnMapping = this._map.splice(idx, 1);
+ return fnMapping[0][1]
+ }
+ return null
+ }
+ ,
+ FuncMap.prototype.map = function (param) {
+ for (var i = 0; i < this._map.length; i++)
+ this._map[i][1](param)
+ }
+ ;
+ var ThrowExceptions = {
+ yes: false
+ };
+ Storage.prototype.getItem = function getItem(name) {
+ return this.data.hasOwnProperty(name) ? this.data[name] : null
+ }
+ ,
+ Storage.prototype.setItem = function setItem(name, value) {
+ var sname = String(name)
+ , svalue = String(value)
+ , old = this.getItem(sname);
+ return this.data[sname] = value,
+ this.fireEvent(sname, old, svalue),
+ undefined
+ }
+ ,
+ Storage.prototype.removeItem = function removeItem(name) {
+ var old = this.getItem(name);
+ return this._deleteItem(name),
+ this.fireEvent(name, old, null),
+ undefined
+ }
+ ,
+ Storage.prototype.clear = function clear() {
+ return this.data = {},
+ this.fireEvent(null, null, null),
+ undefined
+ }
+ ,
+ Storage.prototype.key = function key(index) {
+ var n = ensureNumber(index);
+ if (n == null || n < 0)
+ return null;
+ var keys = Object.keys(this.data);
+ return n < keys.length ? keys[n] : null
+ }
+ ,
+ Storage.prototype.fireEvent = function fireEvent(key, oldValue, newValue) {
+ var sevent = new StorageEvent("storage", {
+ key: key,
+ newValue: newValue,
+ oldValue: oldValue,
+ url: this.wombat.$wbwindow.WB_wombat_location.href
+ });
+ Object.defineProperty(sevent, "storageArea", {
+ value: this,
+ writable: false,
+ configurable: false
+ }),
+ sevent._storageArea = this,
+ this.wombat.storage_listeners.map(sevent)
+ }
+ ,
+ Storage.prototype.valueOf = function valueOf() {
+ return this.wombat.$wbwindow[this.proxying]
+ }
+ ,
+ Object.defineProperty(Storage.prototype, "length", {
+ enumerable: false,
+ get: function length() {
+ return Object.keys(this.data).length
+ }
+ }),
+ addToStringTagToClass(Storage, "Storage"),
+ WombatLocation.prototype.replace = function replace(url) {
+ var new_url = this.wombat.rewriteUrl(url)
+ , orig = this.wombat.extractOriginalURL(new_url);
+ return orig === this.href ? orig : this._orig_loc.replace(new_url)
+ }
+ ,
+ WombatLocation.prototype.assign = function assign(url) {
+ var new_url = this.wombat.rewriteUrl(url)
+ , orig = this.wombat.extractOriginalURL(new_url);
+ return orig === this.href ? orig : this._orig_loc.assign(new_url)
+ }
+ ,
+ WombatLocation.prototype.reload = function reload(forcedReload) {
+ return this._orig_loc.reload(forcedReload || false)
+ }
+ ,
+ WombatLocation.prototype.toString = function toString() {
+ return this.href
+ }
+ ,
+ WombatLocation.prototype.valueOf = function valueOf() {
+ return this
+ }
+ ,
+ addToStringTagToClass(WombatLocation, "Location"),
+ AutoFetcher.prototype._initWorker = function (config) {
+ var wombat = this.wombat;
+ if (config.isTop) {
+ try {
+ this.worker = new Worker(config.workerURL, {
+ type: "classic",
+ credentials: "include"
+ })
+ } catch (e) {
+ console.error("Failed to create auto fetch worker\n", e)
+ }
+ return
+ }
+ this.worker = {
+ postMessage: function (msg) {
+ msg.wb_type || (msg = {
+ wb_type: "aaworker",
+ msg: msg
+ }),
+ wombat.$wbwindow.__WB_replay_top.__orig_postMessage(msg, "*")
+ },
+ terminate: function () { }
+ }
+ }
+ ,
+ AutoFetcher.prototype.extractMediaRulesFromSheet = function (sheet) {
+ var rules, media = [];
+ try {
+ rules = sheet.cssRules || sheet.rules
+ } catch (e) {
+ return media
+ }
+ for (var rule, i = 0; i < rules.length; ++i)
+ rule = rules[i],
+ rule.type === CSSRule.MEDIA_RULE && media.push(rule.cssText);
+ return media
+ }
+ ,
+ AutoFetcher.prototype.deferredSheetExtraction = function (sheet) {
+ var afw = this;
+ Promise.resolve().then(function () {
+ var media = afw.extractMediaRulesFromSheet(sheet);
+ media.length > 0 && afw.preserveMedia(media)
+ })
+ }
+ ,
+ AutoFetcher.prototype.terminate = function () {
+ this.worker.terminate()
+ }
+ ,
+ AutoFetcher.prototype.justFetch = function (urls) {
+ this.worker.postMessage({
+ type: "fetch-all",
+ values: urls
+ })
+ }
+ ,
+ AutoFetcher.prototype.fetchAsPage = function (url, originalUrl, title) {
+ if (url) {
+ var headers = {
+ "X-Wombat-History-Page": originalUrl
+ };
+ if (title) {
+ var encodedTitle = encodeURIComponent(title.trim());
+ title && (headers["X-Wombat-History-Title"] = encodedTitle)
+ }
+ var fetchData = {
+ url: url,
+ options: {
+ headers: headers,
+ cache: "no-store"
+ }
+ };
+ this.justFetch([fetchData])
+ }
+ }
+ ,
+ AutoFetcher.prototype.postMessage = function (msg, deferred) {
+ if (deferred) {
+ var afWorker = this;
+ return void Promise.resolve().then(function () {
+ afWorker.worker.postMessage(msg)
+ })
+ }
+ this.worker.postMessage(msg)
+ }
+ ,
+ AutoFetcher.prototype.preserveSrcset = function (srcset, mod) {
+ this.postMessage({
+ type: "values",
+ srcset: {
+ value: srcset,
+ mod: mod,
+ presplit: true
+ }
+ }, true)
+ }
+ ,
+ AutoFetcher.prototype.preserveDataSrcset = function (elem) {
+ this.postMessage({
+ type: "values",
+ srcset: {
+ value: elem.dataset.srcset,
+ mod: this.rwMod(elem),
+ presplit: false
+ }
+ }, true)
+ }
+ ,
+ AutoFetcher.prototype.preserveMedia = function (media) {
+ this.postMessage({
+ type: "values",
+ media: media
+ }, true)
+ }
+ ,
+ AutoFetcher.prototype.getSrcset = function (elem) {
+ return this.wombat.wb_getAttribute ? this.wombat.wb_getAttribute.call(elem, "srcset") : elem.getAttribute("srcset")
+ }
+ ,
+ AutoFetcher.prototype.rwMod = function (elem) {
+ switch (elem.tagName) {
+ case "SOURCE":
+ return elem.parentElement && elem.parentElement.tagName === "PICTURE" ? "im_" : "oe_";
+ case "IMG":
+ return "im_";
+ }
+ return "oe_"
+ }
+ ,
+ AutoFetcher.prototype.extractFromLocalDoc = function () {
+ var afw = this;
+ Promise.resolve().then(function () {
+ for (var msg = {
+ type: "values",
+ context: {
+ docBaseURI: document.baseURI
+ }
+ }, media = [], i = 0, sheets = document.styleSheets; i < sheets.length; ++i)
+ media = media.concat(afw.extractMediaRulesFromSheet(sheets[i]));
+ var elem, srcv, mod, elems = document.querySelectorAll(afw.elemSelector), srcset = {
+ values: [],
+ presplit: false
+ }, src = {
+ values: []
+ };
+ for (i = 0; i < elems.length; ++i)
+ elem = elems[i],
+ srcv = elem.src ? elem.src : null,
+ mod = afw.rwMod(elem),
+ elem.srcset && srcset.values.push({
+ srcset: afw.getSrcset(elem),
+ mod: mod,
+ tagSrc: srcv
+ }),
+ elem.dataset.srcset && srcset.values.push({
+ srcset: elem.dataset.srcset,
+ mod: mod,
+ tagSrc: srcv
+ }),
+ elem.dataset.src && src.values.push({
+ src: elem.dataset.src,
+ mod: mod
+ }),
+ elem.tagName === "SOURCE" && srcv && src.values.push({
+ src: srcv,
+ mod: mod
+ });
+ media.length && (msg.media = media),
+ srcset.values.length && (msg.srcset = srcset),
+ src.values.length && (msg.src = src),
+ (msg.media || msg.srcset || msg.src) && afw.postMessage(msg)
+ })
+ }
+ ,
+ Wombat.prototype._internalInit = function () {
+ this.initTopFrame(this.$wbwindow),
+ this.initWombatLoc(this.$wbwindow),
+ this.initWombatTop(this.$wbwindow);
+ var wb_origin = this.$wbwindow.__WB_replay_top.location.origin
+ , wb_host = this.$wbwindow.__WB_replay_top.location.host
+ , wb_proto = this.$wbwindow.__WB_replay_top.location.protocol;
+ this.wb_rel_prefix = this.wb_replay_prefix && this.wb_replay_prefix.indexOf(wb_origin) === 0 ? this.wb_replay_prefix.substring(wb_origin.length) : this.wb_replay_prefix,
+ this.wb_prefixes = [this.wb_abs_prefix, this.wb_rel_prefix];
+ var rx = "((" + wb_proto + ")?//" + wb_host + ")?" + this.wb_rel_prefix + "[^/]+/";
+ this.wb_unrewrite_rx = new RegExp(rx, "g"),
+ this.wb_info.is_framed && this.wb_info.mod !== "bn_" && this.initTopFrameNotify(this.wb_info),
+ this.initAutoFetchWorker()
+ }
+ ,
+ Wombat.prototype._addRemoveCSPViolationListener = function (yesNo) {
+ this.showCSPViolations.yesNo = yesNo,
+ this.showCSPViolations.yesNo && !this.showCSPViolations.added ? (this.showCSPViolations.added = true,
+ this._addEventListener(document, "securitypolicyviolation", this.utilFns.cspViolationListener)) : (this.showCSPViolations.added = false,
+ this._removeEventListener(document, "securitypolicyviolation", this.utilFns.cspViolationListener))
+ }
+ ,
+ Wombat.prototype._addEventListener = function (obj, event, fun) {
+ return this.utilFns.addEventListener ? this.utilFns.addEventListener.call(obj, event, fun) : void obj.addEventListener(event, fun)
+ }
+ ,
+ Wombat.prototype._removeEventListener = function (obj, event, fun) {
+ return this.utilFns.removeEventListener ? this.utilFns.removeEventListener.call(obj, event, fun) : void obj.removeEventListener(event, fun)
+ }
+ ,
+ Wombat.prototype.getPageUnderModifier = function () {
+ try {
+ var pageUnderModifier = this.extractPageUnderModiferRE.exec(location.pathname);
+ if (pageUnderModifier && pageUnderModifier[1]) {
+ var mod = pageUnderModifier[1].trim();
+ return mod || "mp_"
+ }
+ } catch (e) { }
+ return "mp_"
+ }
+ ,
+ Wombat.prototype.isNativeFunction = function (funToTest) {
+ if (!funToTest || typeof funToTest !== "function")
+ return false;
+ var str = this.wb_funToString.call(funToTest);
+ return str.indexOf("[native code]") != -1 && (!(funToTest.__WB_is_native_func__ !== undefined) || !!funToTest.__WB_is_native_func__)
+ }
+ ,
+ Wombat.prototype.isString = function (arg) {
+ return arg != null && Object.getPrototypeOf(arg) === String.prototype
+ }
+ ,
+ Wombat.prototype.isSavedSrcSrcset = function (elem) {
+ switch (elem.tagName) {
+ case "IMG":
+ case "VIDEO":
+ case "AUDIO":
+ return true;
+ case "SOURCE":
+ if (!elem.parentElement)
+ return false;
+ switch (elem.parentElement.tagName) {
+ case "PICTURE":
+ case "VIDEO":
+ case "AUDIO":
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ }
+ ,
+ Wombat.prototype.isSavedDataSrcSrcset = function (elem) {
+ return !!(elem.dataset && elem.dataset.srcset != null) && this.isSavedSrcSrcset(elem)
+ }
+ ,
+ Wombat.prototype.isHostUrl = function (str) {
+ if (str.indexOf("www.") === 0)
+ return true;
+ var matches = str.match(this.hostnamePortRe);
+ return !!(matches && matches[0].length < 64) || (matches = str.match(this.ipPortRe),
+ !!matches && matches[0].length < 64)
+ }
+ ,
+ Wombat.prototype.isArgumentsObj = function (maybeArgumentsObj) {
+ if (!maybeArgumentsObj || typeof maybeArgumentsObj.toString !== "function")
+ return false;
+ try {
+ return this.utilFns.objToString.call(maybeArgumentsObj) === "[object Arguments]"
+ } catch (e) {
+ return false
+ }
+ }
+ ,
+ Wombat.prototype.deproxyArrayHandlingArgumentsObj = function (maybeArgumentsObj) {
+ if (!maybeArgumentsObj || maybeArgumentsObj instanceof NodeList || !maybeArgumentsObj.length)
+ return maybeArgumentsObj;
+ for (var args = this.isArgumentsObj(maybeArgumentsObj) ? new Array(maybeArgumentsObj.length) : maybeArgumentsObj, i = 0; i < maybeArgumentsObj.length; ++i) {
+ const res = this.proxyToObj(maybeArgumentsObj[i]);
+ res !== args[i] && (args[i] = res)
+ }
+ return args
+ }
+ ,
+ Wombat.prototype.startsWith = function (string, prefix) {
+ return string ? string.indexOf(prefix) === 0 ? prefix : undefined : undefined
+ }
+ ,
+ Wombat.prototype.startsWithOneOf = function (string, prefixes) {
+ if (!string)
+ return undefined;
+ for (var i = 0; i < prefixes.length; i++)
+ if (string.indexOf(prefixes[i]) === 0)
+ return prefixes[i];
+ return undefined
+ }
+ ,
+ Wombat.prototype.endsWith = function (str, suffix) {
+ return str ? str.indexOf(suffix, str.length - suffix.length) === -1 ? undefined : suffix : undefined
+ }
+ ,
+ Wombat.prototype.shouldRewriteAttr = function (tagName, attr) {
+ switch (attr) {
+ case "href":
+ case "src":
+ case "xlink:href":
+ return true;
+ }
+ return !!(tagName && this.tagToMod[tagName] && this.tagToMod[tagName][attr] !== undefined) || tagName === "VIDEO" && attr === "poster" || tagName === "META" && attr === "content"
+ }
+ ,
+ Wombat.prototype.skipWrapScriptBasedOnType = function (scriptType) {
+ return !!scriptType && (!!(scriptType.indexOf("json") >= 0) || scriptType.indexOf("text/template") >= 0)
+ }
+ ,
+ Wombat.prototype.skipWrapScriptTextBasedOnText = function (text) {
+ if (!text || text.indexOf(this.WB_ASSIGN_FUNC) >= 0 || text.indexOf("<") === 0)
+ return true;
+ for (var override_props = ["window", "self", "document", "location", "top", "parent", "frames", "opener"], i = 0; i < override_props.length; i++)
+ if (text.indexOf(override_props[i]) >= 0)
+ return false;
+ return true
+ }
+ ,
+ Wombat.prototype.nodeHasChildren = function (node) {
+ if (!node)
+ return false;
+ if (typeof node.hasChildNodes === "function")
+ return node.hasChildNodes();
+ var kids = node.children || node.childNodes;
+ return !!kids && kids.length > 0
+ }
+ ,
+ Wombat.prototype.rwModForElement = function (elem, attrName) {
+ if (!elem)
+ return undefined;
+ var mod = "mp_";
+ if (!(elem.tagName === "LINK" && attrName === "href")) {
+ var maybeMod = this.tagToMod[elem.tagName];
+ maybeMod != null && (mod = maybeMod[attrName])
+ } else if (elem.rel) {
+ var relV = elem.rel.trim().toLowerCase()
+ , asV = this.wb_getAttribute.call(elem, "as");
+ if (asV && this.linkTagMods.linkRelToAs[relV] != null) {
+ var asMods = this.linkTagMods.linkRelToAs[relV];
+ mod = asMods[asV.toLowerCase()]
+ } else
+ this.linkTagMods[relV] != null && (mod = this.linkTagMods[relV])
+ }
+ return mod
+ }
+ ,
+ Wombat.prototype.removeWBOSRC = function (elem) {
+ elem.tagName !== "SCRIPT" || elem.__$removedWBOSRC$__ || (elem.hasAttribute("__wb_orig_src") && elem.removeAttribute("__wb_orig_src"),
+ elem.__$removedWBOSRC$__ = true)
+ }
+ ,
+ Wombat.prototype.retrieveWBOSRC = function (elem) {
+ if (elem.tagName === "SCRIPT" && !elem.__$removedWBOSRC$__) {
+ var maybeWBOSRC;
+ return maybeWBOSRC = this.wb_getAttribute ? this.wb_getAttribute.call(elem, "__wb_orig_src") : elem.getAttribute("__wb_orig_src"),
+ maybeWBOSRC == null && (elem.__$removedWBOSRC$__ = true),
+ maybeWBOSRC
+ }
+ return undefined
+ }
+ ,
+ Wombat.prototype.wrapScriptTextJsProxy = function (scriptText) {
+ return "var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };\nif (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }\n{\nlet window = _____WB$wombat$assign$function_____(\"window\");\nlet self = _____WB$wombat$assign$function_____(\"self\");\nlet document = _____WB$wombat$assign$function_____(\"document\");\nlet location = _____WB$wombat$assign$function_____(\"location\");\nlet top = _____WB$wombat$assign$function_____(\"top\");\nlet parent = _____WB$wombat$assign$function_____(\"parent\");\nlet frames = _____WB$wombat$assign$function_____(\"frames\");\nlet opener = _____WB$wombat$assign$function_____(\"opener\");\n" + scriptText.replace(this.DotPostMessageRe, ".__WB_pmw(self.window)$1") + "\n\n}"
+ }
+ ,
+ Wombat.prototype.watchElem = function (elem, func) {
+ if (!this.$wbwindow.MutationObserver)
+ return false;
+ var m = new this.$wbwindow.MutationObserver(function (records, observer) {
+ for (var r, i = 0; i < records.length; i++)
+ if (r = records[i],
+ r.type === "childList")
+ for (var j = 0; j < r.addedNodes.length; j++)
+ func(r.addedNodes[j])
+ }
+ );
+ m.observe(elem, {
+ childList: true,
+ subtree: true
+ })
+ }
+ ,
+ Wombat.prototype.reconstructDocType = function (doctype) {
+ return doctype == null ? "" : ""
+ }
+ ,
+ Wombat.prototype.getFinalUrl = function (useRel, mod, url) {
+ var prefix = useRel ? this.wb_rel_prefix : this.wb_abs_prefix;
+ return mod == null && (mod = this.wb_info.mod),
+ this.wb_info.is_live || (prefix += this.wb_info.wombat_ts),
+ prefix += mod,
+ prefix[prefix.length - 1] !== "/" && (prefix += "/"),
+ prefix + url
+ }
+ ,
+ Wombat.prototype.resolveRelUrl = function (url, doc) {
+ var docObj = doc || this.$wbwindow.document
+ , parser = this.makeParser(docObj.baseURI, docObj)
+ , hash = parser.href.lastIndexOf("#")
+ , href = hash >= 0 ? parser.href.substring(0, hash) : parser.href
+ , lastslash = href.lastIndexOf("/");
+ return parser.href = lastslash >= 0 && lastslash !== href.length - 1 ? href.substring(0, lastslash + 1) + url : href + url,
+ parser.href
+ }
+ ,
+ Wombat.prototype.extractOriginalURL = function (rewrittenUrl) {
+ if (!rewrittenUrl)
+ return "";
+ if (this.wb_is_proxy)
+ return rewrittenUrl;
+ var rwURLString = rewrittenUrl.toString()
+ , url = rwURLString;
+ if (this.startsWithOneOf(url, this.IGNORE_PREFIXES))
+ return url;
+ var start;
+ start = this.startsWith(url, this.wb_abs_prefix) ? this.wb_abs_prefix.length : this.wb_rel_prefix && this.startsWith(url, this.wb_rel_prefix) ? this.wb_rel_prefix.length : this.wb_rel_prefix ? 1 : 0;
+ var index = url.indexOf("/http", start);
+ return index < 0 && (index = url.indexOf("///", start)),
+ index < 0 && (index = url.indexOf("/blob:", start)),
+ index < 0 && (index = url.indexOf("/about:blank", start)),
+ index >= 0 ? url = url.substr(index + 1) : (index = url.indexOf(this.wb_replay_prefix),
+ index >= 0 && (url = url.substr(index + this.wb_replay_prefix.length)),
+ url.length > 4 && url.charAt(2) === "_" && url.charAt(3) === "/" && (url = url.substr(4)),
+ url !== rwURLString && !this.startsWithOneOf(url, this.VALID_PREFIXES) && !this.startsWith(url, "blob:") && (url = this.wb_orig_scheme + url)),
+ rwURLString.charAt(0) === "/" && rwURLString.charAt(1) !== "/" && this.startsWith(url, this.wb_orig_origin) && (url = url.substr(this.wb_orig_origin.length)),
+ this.startsWith(url, this.REL_PREFIX) ? this.wb_info.wombat_scheme + ":" + url : url
+ }
+ ,
+ Wombat.prototype.makeParser = function (maybeRewrittenURL, doc) {
+ var originalURL = this.extractOriginalURL(maybeRewrittenURL)
+ , docElem = doc;
+ return doc || (this.$wbwindow.location.href === "about:blank" && this.$wbwindow.opener ? docElem = this.$wbwindow.opener.document : docElem = this.$wbwindow.document),
+ this._makeURLParser(originalURL, docElem)
+ }
+ ,
+ Wombat.prototype._makeURLParser = function (url, docElem) {
+ try {
+ return new this.$wbwindow.URL(url, docElem.baseURI)
+ } catch (e) { }
+ var p = docElem.createElement("a");
+ return p._no_rewrite = true,
+ p.href = url,
+ p
+ }
+ ,
+ Wombat.prototype.defProp = function (obj, prop, setFunc, getFunc, enumerable) {
+ var existingDescriptor = Object.getOwnPropertyDescriptor(obj, prop);
+ if (existingDescriptor && !existingDescriptor.configurable)
+ return false;
+ if (!getFunc)
+ return false;
+ var descriptor = {
+ configurable: true,
+ enumerable: enumerable || false,
+ get: getFunc
+ };
+ setFunc && (descriptor.set = setFunc);
+ try {
+ return Object.defineProperty(obj, prop, descriptor),
+ true
+ } catch (e) {
+ return console.warn("Failed to redefine property %s", prop, e.message),
+ false
+ }
+ }
+ ,
+ Wombat.prototype.defGetterProp = function (obj, prop, getFunc, enumerable) {
+ var existingDescriptor = Object.getOwnPropertyDescriptor(obj, prop);
+ if (existingDescriptor && !existingDescriptor.configurable)
+ return false;
+ if (!getFunc)
+ return false;
+ try {
+ return Object.defineProperty(obj, prop, {
+ configurable: true,
+ enumerable: enumerable || false,
+ get: getFunc
+ }),
+ true
+ } catch (e) {
+ return console.warn("Failed to redefine property %s", prop, e.message),
+ false
+ }
+ }
+ ,
+ Wombat.prototype.getOrigGetter = function (obj, prop) {
+ var orig_getter;
+ if (obj.__lookupGetter__ && (orig_getter = obj.__lookupGetter__(prop)),
+ !orig_getter && Object.getOwnPropertyDescriptor) {
+ var props = Object.getOwnPropertyDescriptor(obj, prop);
+ props && (orig_getter = props.get)
+ }
+ return orig_getter
+ }
+ ,
+ Wombat.prototype.getOrigSetter = function (obj, prop) {
+ var orig_setter;
+ if (obj.__lookupSetter__ && (orig_setter = obj.__lookupSetter__(prop)),
+ !orig_setter && Object.getOwnPropertyDescriptor) {
+ var props = Object.getOwnPropertyDescriptor(obj, prop);
+ props && (orig_setter = props.set)
+ }
+ return orig_setter
+ }
+ ,
+ Wombat.prototype.getAllOwnProps = function (obj) {
+ for (var ownProps = [], props = Object.getOwnPropertyNames(obj), i = 0; i < props.length; i++) {
+ var prop = props[i];
+ try {
+ obj[prop] && !obj[prop].prototype && ownProps.push(prop)
+ } catch (e) { }
+ }
+ for (var traverseObj = Object.getPrototypeOf(obj); traverseObj;) {
+ for (props = Object.getOwnPropertyNames(traverseObj),
+ i = 0; i < props.length; i++)
+ ownProps.push(props[i]);
+ traverseObj = Object.getPrototypeOf(traverseObj)
+ }
+ return ownProps
+ }
+ ,
+ Wombat.prototype.sendTopMessage = function (message, skipTopCheck, win) {
+ win = win || this.$wbwindow;
+ win.__WB_top_frame && (skipTopCheck || win == win.__WB_replay_top) && win.__WB_top_frame.postMessage(message, this.wb_info.top_host)
+ }
+ ,
+ Wombat.prototype.sendHistoryUpdate = function (url, title, win) {
+ this.sendTopMessage({
+ url: url,
+ ts: this.wb_info.timestamp,
+ request_ts: this.wb_info.request_ts,
+ is_live: this.wb_info.is_live,
+ title: title,
+ wb_type: "replace-url"
+ }, false, win)
+ }
+ ,
+ Wombat.prototype.updateLocation = function (reqHref, origHref, actualLocation) {
+ if (reqHref && reqHref !== origHref) {
+ var ext_orig = this.extractOriginalURL(origHref)
+ , ext_req = this.extractOriginalURL(reqHref);
+ if (ext_orig && ext_orig !== ext_req) {
+ var final_href = this.rewriteUrl(reqHref);
+ console.log(actualLocation.href + " -> " + final_href),
+ actualLocation.href = final_href
+ }
+ }
+ }
+ ,
+ Wombat.prototype.checkLocationChange = function (wombatLoc, isTop) {
+ var locType = typeof wombatLoc
+ , actual_location = isTop ? this.$wbwindow.__WB_replay_top.location : this.$wbwindow.location;
+ locType === "string" ? this.updateLocation(wombatLoc, actual_location.href, actual_location) : locType === "object" && this.updateLocation(wombatLoc.href, wombatLoc._orig_href, actual_location)
+ }
+ ,
+ Wombat.prototype.checkAllLocations = function () {
+ return !this.wb_wombat_updating && void (this.wb_wombat_updating = true,
+ this.checkLocationChange(this.$wbwindow.WB_wombat_location, false),
+ this.$wbwindow.WB_wombat_location != this.$wbwindow.__WB_replay_top.WB_wombat_location && this.checkLocationChange(this.$wbwindow.__WB_replay_top.WB_wombat_location, true),
+ this.wb_wombat_updating = false)
+ }
+ ,
+ Wombat.prototype.proxyToObj = function (source) {
+ if (source)
+ try {
+ var proxyRealObj = source.__WBProxyRealObj__;
+ if (proxyRealObj)
+ return proxyRealObj
+ } catch (e) { }
+ return source
+ }
+ ,
+ Wombat.prototype.objToProxy = function (obj) {
+ if (obj)
+ try {
+ var maybeWbProxy = obj._WB_wombat_obj_proxy;
+ if (maybeWbProxy)
+ return maybeWbProxy
+ } catch (e) { }
+ return obj
+ }
+ ,
+ Wombat.prototype.defaultProxyGet = function (obj, prop, ownProps, fnCache) {
+ switch (prop) {
+ case "__WBProxyRealObj__":
+ return obj;
+ case "location":
+ case "WB_wombat_location":
+ return obj.WB_wombat_location;
+ case "_WB_wombat_obj_proxy":
+ return obj._WB_wombat_obj_proxy;
+ case "__WB_pmw":
+ case "WB_wombat_eval":
+ case this.WB_ASSIGN_FUNC:
+ case this.WB_CHECK_THIS_FUNC:
+ return obj[prop];
+ case "origin":
+ return obj.WB_wombat_location.origin;
+ case "constructor":
+ if (obj.constructor === Window)
+ return obj.constructor;
+ }
+ var retVal = obj[prop]
+ , type = typeof retVal;
+ if (type === "function" && ownProps.indexOf(prop) !== -1) {
+ switch (prop) {
+ case "requestAnimationFrame":
+ case "cancelAnimationFrame":
+ {
+ if (!this.isNativeFunction(retVal))
+ return retVal;
+ break
+ }
+ }
+ var cachedFN = fnCache[prop];
+ return cachedFN && cachedFN.original === retVal || (cachedFN = {
+ original: retVal,
+ boundFn: retVal.bind(obj)
+ },
+ fnCache[prop] = cachedFN),
+ cachedFN.boundFn
+ }
+ return type === "object" && retVal && retVal._WB_wombat_obj_proxy ? (retVal instanceof Window && this.initNewWindowWombat(retVal),
+ retVal._WB_wombat_obj_proxy) : retVal
+ }
+ ,
+ Wombat.prototype.setLoc = function (loc, originalURL) {
+ var parser = this.makeParser(originalURL, loc.ownerDocument);
+ loc._orig_href = originalURL,
+ loc._parser = parser;
+ var href = parser.href;
+ loc._hash = parser.hash,
+ loc._href = href,
+ loc._host = parser.host,
+ loc._hostname = parser.hostname,
+ loc._origin = parser.origin ? parser.host ? parser.origin : "null" : parser.protocol + "//" + parser.hostname + (parser.port ? ":" + parser.port : ""),
+ loc._pathname = parser.pathname,
+ loc._port = parser.port,
+ loc._protocol = parser.protocol,
+ loc._search = parser.search,
+ Object.defineProperty || (loc.href = href,
+ loc.hash = parser.hash,
+ loc.host = loc._host,
+ loc.hostname = loc._hostname,
+ loc.origin = loc._origin,
+ loc.pathname = loc._pathname,
+ loc.port = loc._port,
+ loc.protocol = loc._protocol,
+ loc.search = loc._search)
+ }
+ ,
+ Wombat.prototype.makeGetLocProp = function (prop, origGetter) {
+ var wombat = this;
+ return function newGetLocProp() {
+ if (this._no_rewrite)
+ return origGetter.call(this, prop);
+ var curr_orig_href = origGetter.call(this, "href");
+ return prop === "href" ? wombat.extractOriginalURL(curr_orig_href) : prop === "ancestorOrigins" ? [] : (this._orig_href !== curr_orig_href && wombat.setLoc(this, curr_orig_href),
+ this["_" + prop])
+ }
+ }
+ ,
+ Wombat.prototype.makeSetLocProp = function (prop, origSetter, origGetter) {
+ var wombat = this;
+ return function newSetLocProp(value) {
+ if (this._no_rewrite)
+ return origSetter.call(this, prop, value);
+ if (this["_" + prop] !== value) {
+ if (this["_" + prop] = value,
+ !this._parser) {
+ var href = origGetter.call(this);
+ this._parser = wombat.makeParser(href, this.ownerDocument)
+ }
+ var rel = false;
+ prop === "href" && typeof value === "string" && value && (value[0] === "." ? value = wombat.resolveRelUrl(value, this.ownerDocument) : value[0] === "/" && (value.length <= 1 || value[1] !== "/") && (rel = true,
+ value = WB_wombat_location.origin + value));
+ try {
+ this._parser[prop] = value
+ } catch (e) {
+ console.log("Error setting " + prop + " = " + value)
+ }
+ prop === "hash" ? (value = this._parser[prop],
+ origSetter.call(this, "hash", value)) : (rel = rel || value === this._parser.pathname,
+ value = wombat.rewriteUrl(this._parser.href, rel),
+ origSetter.call(this, "href", value))
+ }
+ }
+ }
+ ,
+ Wombat.prototype.styleReplacer = function (match, n1, n2, n3, offset, string) {
+ return n1 + this.rewriteUrl(n2) + n3
+ }
+ ,
+ Wombat.prototype.domConstructorErrorChecker = function (thisObj, what, args, numRequiredArgs) {
+ var errorMsg, needArgs = typeof numRequiredArgs === "number" ? numRequiredArgs : 1;
+ if (thisObj instanceof Window ? errorMsg = "Failed to construct '" + what + "': Please use the 'new' operator, this DOM object constructor cannot be called as a function." : args && args.length < needArgs && (errorMsg = "Failed to construct '" + what + "': " + needArgs + " argument required, but only 0 present."),
+ errorMsg)
+ throw new TypeError(errorMsg)
+ }
+ ,
+ Wombat.prototype.rewriteNodeFuncArgs = function (fnThis, originalFn, newNode, oldNode) {
+ if (newNode)
+ switch (newNode.nodeType) {
+ case Node.ELEMENT_NODE:
+ this.rewriteElemComplete(newNode);
+ break;
+ case Node.TEXT_NODE:
+ (fnThis.tagName === "STYLE" || newNode.parentNode && newNode.parentNode.tagName === "STYLE") && (newNode.textContent = this.rewriteStyle(newNode.textContent));
+ break;
+ case Node.DOCUMENT_FRAGMENT_NODE:
+ this.recurseRewriteElem(newNode);
+ }
+ var created = originalFn.call(fnThis, newNode, oldNode);
+ return created && created.tagName === "IFRAME" && (created.allow = "autoplay 'self'; fullscreen 'self'",
+ this.initIframeWombat(created)),
+ created
+ }
+ ,
+ Wombat.prototype.rewriteWSURL = function (originalURL) {
+ if (!originalURL)
+ return originalURL;
+ var urltype_ = typeof originalURL
+ , url = originalURL;
+ if (urltype_ === "object")
+ url = originalURL.toString();
+ else if (urltype_ !== "string")
+ return originalURL;
+ if (!url)
+ return url;
+ var wsScheme = "ws://"
+ , wssScheme = "wss://";
+ if (this.wb_is_proxy)
+ return this.wb_orig_scheme === this.HTTP_PREFIX && this.startsWith(url, wssScheme) ? "ws://" + url.substr(wssScheme.length) : this.wb_orig_scheme === this.HTTPS_PREFIX && this.startsWith(url, "ws://") ? wssScheme + url.substr(5) : url;
+ var wbSecure = this.wb_abs_prefix.indexOf(this.HTTPS_PREFIX) === 0
+ , wbPrefix = this.wb_abs_prefix.replace(wbSecure ? this.HTTPS_PREFIX : this.HTTP_PREFIX, wbSecure ? wssScheme : "ws://");
+ return wbPrefix += this.wb_info.wombat_ts + "ws_",
+ url[url.length - 1] !== "/" && (wbPrefix += "/"),
+ wbPrefix + url.replace("WB_wombat_", "")
+ }
+ ,
+ Wombat.prototype.rewriteUrl_ = function (originalURL, useRel, mod, doc) {
+ if (!originalURL)
+ return originalURL;
+ var url, urltype_ = typeof originalURL;
+ if (urltype_ === "object")
+ url = originalURL.toString();
+ else {
+ if (urltype_ !== "string")
+ return originalURL;
+ url = originalURL
+ }
+ if (!url)
+ return url;
+ if (this.wb_is_proxy)
+ return this.wb_orig_scheme === this.HTTP_PREFIX && this.startsWith(url, this.HTTPS_PREFIX) ? this.HTTP_PREFIX + url.substr(this.HTTPS_PREFIX.length) : this.wb_orig_scheme === this.HTTPS_PREFIX && this.startsWith(url, this.HTTP_PREFIX) ? this.HTTPS_PREFIX + url.substr(this.HTTP_PREFIX.length) : url;
+ if (url = url.replace("WB_wombat_", ""),
+ mod === "if_" && this.wb_info.isSW && this.startsWith(url, "blob:"))
+ return this.wb_info.prefix + this.wb_info.timestamp + "if_/" + url;
+ if (this.startsWithOneOf(url.toLowerCase(), this.IGNORE_PREFIXES))
+ return url;
+ if (this.wb_opts.no_rewrite_prefixes && this.startsWithOneOf(url, this.wb_opts.no_rewrite_prefixes))
+ return url;
+ var check_url;
+ check_url = url.indexOf("//") === 0 ? window.location.protocol + url : url;
+ var originalLoc = this.$wbwindow.location;
+ if (this.startsWith(check_url, this.wb_replay_prefix) || this.startsWith(check_url, originalLoc.origin + this.wb_replay_prefix))
+ return url;
+ if (originalLoc.host !== originalLoc.hostname && this.startsWith(url, originalLoc.protocol + "//" + originalLoc.hostname + "/"))
+ return url.replace("/" + originalLoc.hostname + "/", "/" + originalLoc.host + "/");
+ if (url.charAt(0) === "/" && !this.startsWith(url, this.REL_PREFIX)) {
+ if (this.wb_capture_date_part && url.indexOf(this.wb_capture_date_part) >= 0)
+ return url;
+ if (url.indexOf(this.wb_rel_prefix) === 0 && url.indexOf("http") > 1) {
+ var scheme_sep = url.indexOf(":/");
+ return scheme_sep > 0 && url[scheme_sep + 2] !== "/" ? url.substring(0, scheme_sep + 2) + "/" + url.substring(scheme_sep + 2) : url
+ }
+ return this.getFinalUrl(true, mod, this.wb_orig_origin + url)
+ }
+ url.charAt(0) === "." && (url = this.resolveRelUrl(url, doc));
+ var prefix = this.startsWithOneOf(url.toLowerCase(), this.VALID_PREFIXES);
+ if (prefix) {
+ var orig_host = this.$wbwindow.__WB_replay_top.location.host
+ , orig_protocol = this.$wbwindow.__WB_replay_top.location.protocol
+ , prefix_host = prefix + orig_host + "/";
+ if (this.startsWith(url, prefix_host)) {
+ if (this.startsWith(url, this.wb_replay_prefix))
+ return url;
+ var curr_scheme = orig_protocol + "//"
+ , path = url.substring(prefix_host.length)
+ , rebuild = false;
+ return path.indexOf(this.wb_rel_prefix) < 0 && url.indexOf("/static/") < 0 && (path = this.getFinalUrl(true, mod, WB_wombat_location.origin + "/" + path),
+ rebuild = true),
+ prefix !== curr_scheme && prefix !== this.REL_PREFIX && (rebuild = true),
+ rebuild && (url = useRel ? "" : curr_scheme + orig_host,
+ path && path[0] !== "/" && (url += "/"),
+ url += path),
+ url
+ }
+ return this.getFinalUrl(useRel, mod, url)
+ }
+ return prefix = this.startsWithOneOf(url, this.BAD_PREFIXES),
+ prefix ? this.getFinalUrl(useRel, mod, this.extractOriginalURL(url)) : this.isHostUrl(url) && !this.startsWith(url, originalLoc.host + "/") ? this.getFinalUrl(useRel, mod, this.wb_orig_scheme + url) : url
+ }
+ ,
+ Wombat.prototype.rewriteUrl = function (url, useRel, mod, doc) {
+ var rewritten = this.rewriteUrl_(url, useRel, mod, doc);
+ return this.debug_rw && (url === rewritten ? console.log("NOT REWRITTEN " + url) : console.log("REWRITE: " + url + " -> " + rewritten)),
+ rewritten
+ }
+ ,
+ Wombat.prototype.performAttributeRewrite = function (elem, name, value, absUrlOnly) {
+ switch (name) {
+ case "innerHTML":
+ case "outerHTML":
+ return this.rewriteHtml(value);
+ case "filter":
+ return this.rewriteInlineStyle(value);
+ case "style":
+ return this.rewriteStyle(value);
+ case "srcset":
+ return this.rewriteSrcset(value, elem);
+ }
+ if (absUrlOnly && !this.startsWithOneOf(value, this.VALID_PREFIXES))
+ return value;
+ var mod = this.rwModForElement(elem, name);
+ return this.wbUseAFWorker && this.WBAutoFetchWorker && this.isSavedDataSrcSrcset(elem) && this.WBAutoFetchWorker.preserveDataSrcset(elem),
+ this.rewriteUrl(value, false, mod, elem.ownerDocument)
+ }
+ ,
+ Wombat.prototype.rewriteAttr = function (elem, name, absUrlOnly) {
+ var changed = false;
+ if (!elem || !elem.getAttribute || elem._no_rewrite || elem["_" + name])
+ return changed;
+ var value = this.wb_getAttribute.call(elem, name);
+ if (!value || this.startsWith(value, "javascript:"))
+ return changed;
+ var new_value = this.performAttributeRewrite(elem, name, value, absUrlOnly);
+ return new_value !== value && (this.removeWBOSRC(elem),
+ this.wb_setAttribute.call(elem, name, new_value),
+ changed = true),
+ changed
+ }
+ ,
+ Wombat.prototype.noExceptRewriteStyle = function (style) {
+ try {
+ return this.rewriteStyle(style)
+ } catch (e) {
+ return style
+ }
+ }
+ ,
+ Wombat.prototype.rewriteStyle = function (style) {
+ if (!style)
+ return style;
+ var value = style;
+ return typeof style === "object" && (value = style.toString()),
+ typeof value === "string" ? value.replace(this.STYLE_REGEX, this.styleReplacer).replace(this.IMPORT_REGEX, this.styleReplacer).replace(this.no_wombatRe, "") : value
+ }
+ ,
+ Wombat.prototype.rewriteSrcset = function (value, elem) {
+ if (!value)
+ return "";
+ for (var split = value.split(this.srcsetRe), values = [], mod = this.rwModForElement(elem, "srcset"), i = 0; i < split.length; i++)
+ if (split[i]) {
+ var trimmed = split[i].trim();
+ trimmed && values.push(this.rewriteUrl(trimmed, true, mod))
+ }
+ return this.wbUseAFWorker && this.WBAutoFetchWorker && this.isSavedSrcSrcset(elem) && this.WBAutoFetchWorker.preserveSrcset(values, this.WBAutoFetchWorker.rwMod(elem)),
+ values.join(", ")
+ }
+ ,
+ Wombat.prototype.rewriteFrameSrc = function (elem, attrName) {
+ var new_value, value = this.wb_getAttribute.call(elem, attrName);
+ if (this.startsWith(value, "javascript:") && value.indexOf("WB_wombat_") >= 0) {
+ var JS = "javascript:";
+ new_value = "javascript:window.parent._wb_wombat.initNewWindowWombat(window);" + value.substr(11)
+ }
+ return new_value || (new_value = this.rewriteUrl(value, false, this.rwModForElement(elem, attrName))),
+ new_value !== value && (this.wb_setAttribute.call(elem, attrName, new_value),
+ true)
+ }
+ ,
+ Wombat.prototype.rewriteScript = function (elem) {
+ if (elem.hasAttribute("src") || !elem.textContent || !this.$wbwindow.Proxy)
+ return this.rewriteAttr(elem, "src");
+ if (this.skipWrapScriptBasedOnType(elem.type))
+ return false;
+ var text = elem.textContent.trim();
+ return !this.skipWrapScriptTextBasedOnText(text) && (elem.textContent = this.wrapScriptTextJsProxy(text),
+ true)
+ }
+ ,
+ Wombat.prototype.rewriteSVGElem = function (elem) {
+ var changed = this.rewriteAttr(elem, "filter");
+ return changed = this.rewriteAttr(elem, "style") || changed,
+ changed = this.rewriteAttr(elem, "xlink:href") || changed,
+ changed = this.rewriteAttr(elem, "href") || changed,
+ changed = this.rewriteAttr(elem, "src") || changed,
+ changed
+ }
+ ,
+ Wombat.prototype.rewriteElem = function (elem) {
+ var changed = false;
+ if (!elem)
+ return changed;
+ if (elem instanceof SVGElement)
+ changed = this.rewriteSVGElem(elem);
+ else
+ switch (elem.tagName) {
+ case "META":
+ var maybeCSP = this.wb_getAttribute.call(elem, "http-equiv");
+ maybeCSP && maybeCSP.toLowerCase() === "content-security-policy" && (this.wb_setAttribute.call(elem, "http-equiv", "_" + maybeCSP),
+ changed = true);
+ break;
+ case "STYLE":
+ var new_content = this.rewriteStyle(elem.textContent);
+ elem.textContent !== new_content && (elem.textContent = new_content,
+ changed = true,
+ this.wbUseAFWorker && this.WBAutoFetchWorker && elem.sheet != null && this.WBAutoFetchWorker.deferredSheetExtraction(elem.sheet));
+ break;
+ case "LINK":
+ changed = this.rewriteAttr(elem, "href"),
+ this.wbUseAFWorker && elem.rel === "stylesheet" && this._addEventListener(elem, "load", this.utilFns.wbSheetMediaQChecker);
+ break;
+ case "IMG":
+ changed = this.rewriteAttr(elem, "src"),
+ changed = this.rewriteAttr(elem, "srcset") || changed,
+ changed = this.rewriteAttr(elem, "style") || changed,
+ this.wbUseAFWorker && this.WBAutoFetchWorker && elem.dataset.srcset && this.WBAutoFetchWorker.preserveDataSrcset(elem);
+ break;
+ case "OBJECT":
+ if (this.wb_info.isSW && elem.parentElement && elem.getAttribute("type") === "application/pdf") {
+ for (var iframe = this.$wbwindow.document.createElement("IFRAME"), i = 0; i < elem.attributes.length; i++) {
+ var attr = elem.attributes[i]
+ , name = attr.name;
+ name === "data" && (name = "src"),
+ this.wb_setAttribute.call(iframe, name, attr.value)
+ }
+ elem.parentElement.replaceChild(iframe, elem),
+ changed = true;
+ break
+ }
+ changed = this.rewriteAttr(elem, "data", true),
+ changed = this.rewriteAttr(elem, "style") || changed;
+ break;
+ case "FORM":
+ changed = this.rewriteAttr(elem, "poster"),
+ changed = this.rewriteAttr(elem, "action") || changed,
+ changed = this.rewriteAttr(elem, "style") || changed;
+ break;
+ case "IFRAME":
+ if (changed = this.rewriteFrameSrc(elem, "src"),
+ this.wb_info.isSW && !changed) {
+ var srcdoc = elem.getAttribute("srcdoc");
+ if (srcdoc)
+ elem.removeAttribute("srcdoc"),
+ elem.src = this.wb_info.prefix + this.wb_info.timestamp + "id_/srcdoc:" + btoa(encodeURIComponent(srcdoc));
+ else {
+ var src = elem.getAttribute("src");
+ src && src !== "about:blank" || (!src && (elem.__WB_blank = true),
+ elem.src = this.wb_info.prefix + this.wb_info.timestamp + "mp_/about:blank")
+ }
+ }
+ changed = this.rewriteAttr(elem, "style") || changed;
+ break;
+ case "FRAME":
+ changed = this.rewriteFrameSrc(elem, "src"),
+ changed = this.rewriteAttr(elem, "style") || changed;
+ break;
+ case "SCRIPT":
+ changed = this.rewriteScript(elem);
+ break;
+ default:
+ {
+ changed = this.rewriteAttr(elem, "src"),
+ changed = this.rewriteAttr(elem, "srcset") || changed,
+ changed = this.rewriteAttr(elem, "href") || changed,
+ changed = this.rewriteAttr(elem, "style") || changed,
+ changed = this.rewriteAttr(elem, "poster") || changed;
+ break
+ }
+ }
+ return elem.hasAttribute && elem.removeAttribute && (elem.hasAttribute("crossorigin") && (elem.removeAttribute("crossorigin"),
+ changed = true),
+ elem.hasAttribute("integrity") && (elem.removeAttribute("integrity"),
+ changed = true)),
+ changed
+ }
+ ,
+ Wombat.prototype.recurseRewriteElem = function (curr) {
+ if (!this.nodeHasChildren(curr))
+ return false;
+ for (var changed = false, rewriteQ = [curr.children || curr.childNodes]; rewriteQ.length > 0;)
+ for (var child, children = rewriteQ.shift(), i = 0; i < children.length; i++)
+ child = children[i],
+ child.nodeType === Node.ELEMENT_NODE && (changed = this.rewriteElem(child) || changed,
+ this.nodeHasChildren(child) && rewriteQ.push(child.children || child.childNodes));
+ return changed
+ }
+ ,
+ Wombat.prototype.rewriteElemComplete = function (elem) {
+ if (!elem)
+ return false;
+ var changed = this.rewriteElem(elem)
+ , changedRecursively = this.recurseRewriteElem(elem);
+ return changed || changedRecursively
+ }
+ ,
+ Wombat.prototype.rewriteElementsInArguments = function (originalArguments) {
+ for (var argElem, argArr = new Array(originalArguments.length), i = 0; i < originalArguments.length; i++)
+ argElem = originalArguments[i],
+ argElem instanceof Node ? (this.rewriteElemComplete(argElem),
+ argArr[i] = argElem) : typeof argElem === "string" ? argArr[i] = this.rewriteHtml(argElem) : argArr[i] = argElem;
+ return argArr
+ }
+ ,
+ Wombat.prototype.rewriteHtml = function (string, checkEndTag) {
+ if (!string)
+ return string;
+ var rwString = string;
+ if (typeof string !== "string" && (rwString = string.toString()),
+ this.write_buff && (rwString = this.write_buff + rwString,
+ this.write_buff = ""),
+ rwString.indexOf("
-
-
-
-
-
-
-
+
-
-
@endguest