# taboola/2.2.2/js/js_inject.min.js

Taboola, version 2.2.2. 64 lines.

- Page: https://pluginprobe.com/plugins/taboola/2.2.2/code/js/js_inject.min.js
- Raw: https://pluginprobe.com/plugins/taboola/2.2.2/raw/js/js_inject.min.js
- Modified: 2024-07-31T11:51:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/taboola/2.2.2/code/js/js_inject.min.js#L10-L20`.

```javascript

function insertAfter(e, t) {
    t.parentNode.insertBefore(e, t.nextSibling)
}

function getElementByXPath(e, t) {
    if (!t) t = document;
    if (t.evaluate) return t.evaluate(e, document, null, 9, null).singleNodeValue;
    while (e.charAt(0) == "/") e = e.substr(1);
    var n = t;
    var r = e.split("/");
    for (var i = 0; i < r.length; i++) {
        var a = r[i].split(/(\w*)\[(\d*)\]/gi).filter(function(e) {
            return !(e == "" || e.match(/\s/gi))
        }, this);
        var l = a[0];
        var o = a[1] ? a[1] - 1 : 0;
        if (i < r.length - 1) n = n.getElementsByTagName(l)[o];
        else return n.getElementsByTagName(l)[o]
    }
}
if (!Array.prototype.filter) {
    Array.prototype.filter = function(e) {
        var t = this.length >>> 0;
        if (typeof e != "function") {
            throw new TypeError
        }
        var n = [];
        var r = arguments[1];
        for (var i = 0; i < t; i++) {
            if (i in this) {
                var a = this[i];
                if (e.call(r, a, i, this)) {
                    n.push(a)
                }
            }
        }
        return n
    }
}

function injectWidgetByXpath(e) {
    var t = getElementByXPath(e);
    if (t == null) {
        t = document.getElementById("tbdefault")
    }
    innerInject(t)
}

function injectWidgetByMarker(e) {
    var t = document.getElementById(e);
    innerInject(t.parentNode)
}

function innerInject(e) {
    var t = document.createElement("span");
    var n = document.createElement("script");
    var r = "if JS crashes here, the first innerHTML value should be enclosed with single quotes instead of double, go to the minified version and change it";
    t.innerHTML = "{{HTML}}";
    n.innerHTML = "{{SCRIPT}}";
    insertAfter(t, e);
    insertAfter(n, t)
}

```
