0

Is it possible to load this script without jQuery?

function script(url) {
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.setAttribute("crossorigin", "anonymous");
    s.async = true;
    s.src = url;
    var x = document.getElementsByTagName('head')[0];
    x.appendChild(s)
}(function() {
    script('https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min.js');
    script('https://cdn.firebase.com/v0/firebase.js')
})();
window.onload = function() {
    jQuery.each(jQuery("span[id]"), function(a, e) {
        var n = jQuery(e).parent().find(".postviews"),
            t = new Firebase("https://aazs-17bc0.firebaseio.com/pages/id/" + jQuery(e).attr("id"));
        t.once("value", function(a) {
            var i = a.val(),
                o = !1;
            null == i && ((i = {}).value = 0, i.url = window.location.href, i.id = jQuery(e).attr("id"), o = !0), n.text(i.value), i.value++, "/" != window.location.pathname && (o ? t.set(i) : t.child("value").set(i.value))
        })
    })
};
1

Browse other questions tagged or ask your own question.