Error in Javascript: Unexpected token ( - javascript

My page is throwing a javascript error, but I can't figure out why. I'm trying to debug a script that was imported to my client's site. It's throwing the error here:
function(t){
e._trigger("receive",t,this._uiHash(this))
}
The error is "Uncaught SyntaxError: Unexpected token ("
For context, here is the chunk of code it is located in. Unfortunately I don't really know what purpose these functions serve, but the error is preventing the page from loading correctly. Hopefully this Javascript is enough to give the context, the full script is very long.
_clear: function(e, t) {
this.reverting = !1;
var i, n = [];
if (!this._noFinalSort && this.currentItem.parent().length && this.placeholder
.before(this.currentItem), this._noFinalSort = null, this.helper[0] ===
this.currentItem[0]) {
for (i in this._storedCSS)
("auto" === this._storedCSS[i] || "static" === this._storedCSS[
i]) && (this._storedCSS[i] = "");
this.currentItem.css(this._storedCSS).removeClass(
"ui-sortable-helper")
} else this.currentItem.show();
for (this.fromOutside && !t && n.push(function(e) {
this._trigger("receive", e, this._uiHash(this.fromOutside))
}), !this.fromOutside && this.domPosition.prev === this.currentItem
.prev().not(".ui-sortable-helper")[0] && this.domPosition.parent ===
this.currentItem.parent()[0] || t || n.push(function(e) {
this._trigger("update", e, this._uiHash())
}), this !== this.currentContainer && (t || (n.push(function(e) {
this._trigger("remove", e, this._uiHash())
}), n.push(function(e) {
return
function(t) {
e._trigger("receive", t, this._uiHash(this))
}
}.call(this, this.currentContainer)), n.push(function(e) {
return
function(t) {
e._trigger("update", t, this._uiHash(this))
}
}.call(this, this.currentContainer)))), i = this.containers.length -
1; i >= 0; i--) t || n.push(function(e) {
return function(t) {
e._trigger("deactivate", t, this._uiHash(this))
}
}.call(this, this.containers[i])), this.containers[i].containerCache
.over && (n.push(function(e) {
return
function(t) {
e._trigger("out", t, this._uiHash(this))
}
}.call(this, this.containers[i])), this.containers[i].containerCache
.over = 0);
if (this.storedCursor && (this.document.find("body").css("cursor", this
.storedCursor), this.storedStylesheet.remove()), this._storedOpacity &&
this.helper.css("opacity", this._storedOpacity), this._storedZIndex &&
this.helper.css("zIndex", "auto" === this._storedZIndex ? "" : this
._storedZIndex), this.dragging = !1, this.cancelHelperRemoval) {
if (!t) {
for (this._trigger("beforeStop", e, this._uiHash()), i = 0; n.length >
i; i++) n[i].call(this, e);
this._trigger("stop", e, this._uiHash())
}
return this.fromOutside = !1, !1
}
if (t || this._trigger("beforeStop", e, this._uiHash()), this.placeholder[
0].parentNode.removeChild(this.placeholder[0]), this.helper[0] !==
this.currentItem[0] && this.helper.remove(), this.helper = null, !t
) {
for (i = 0; n.length > i; i++) n[i].call(this, e);
this._trigger("stop", e, this._uiHash())
}
return this.fromOutside = !1, !0
}
If you want to look at the page, it's located here

Every section of your code that looks like:
return
function(t) {
e._trigger("out", t, this._uiHash(this))
}
is broken. The rules of JavaScript automatic semicolon insertion are such that those return statements are treated as complete when the parser hits the newline. It has to look like:
return function(t) {
e._trigger("out", t, this._uiHash(this))
}
That may seem astonishing, but it's true. The error you're getting happens because the parser thinks that that function keyword is opening a new function declaration statement, and in such a statement the function name is not optional.

Related

wkhtmltopdf jQuery.Deferred exception: 'null' is not an object

I used Doxygen to create documentation in HTML and now I am trying to convert the HTML files to PDF using wkhtmltopdf but encountered the below error.
The PDF is generated but content is all blank.
I am using wkhtmltopdf 0.12.6 (with patched qt), Doxygen 1.9.4
The jQuery file should be the standard javascript that is generated from Doxygen step.
wkhtmltopdf --debug-javascript --enable-local-file-access *.html output.pdf
Loading pages (1/6)
Warning: file:///C:/Users/Downloads/Mik/html/jquery.js:2 jQuery.Deferred exception: 'null' is not an object
Warning: undefined:0 TypeError: 'null' is not an object
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done
S.extend({
Deferred: function(e) {
var o = [
["notify", "progress", S.Callbacks("memory"), S.Callbacks("memory"), 2],
["resolve", "done", S.Callbacks("once memory"), S.Callbacks("once memory"), 0, "resolved"],
["reject", "fail", S.Callbacks("once memory"), S.Callbacks("once memory"), 1, "rejected"]
],
i = "pending",
a = {
state: function() {
return i
},
always: function() {
return s.done(arguments).fail(arguments), this
},
"catch": function(e) {
return a.then(null, e)
},
pipe: function() {
var i = arguments;
return S.Deferred(function(r) {
S.each(o, function(e, t) {
var n = m(i[t[4]]) && i[t[4]];
s[t[1]](function() {
var e = n && n.apply(this, arguments);
e && m(e.promise) ? e.promise().progress(r.notify).done(r.resolve).fail(r.reject) : r[t[0] + "With"](this, n ? [e] : arguments)
})
}), i = null
}).promise()
},
then: function(t, n, r) {
var u = 0;
function l(i, o, a, s) {
return function() {
var n = this,
r = arguments,
e = function() {
var e, t;
if (!(i < u)) {
if ((e = a.apply(n, r)) === o.promise()) throw new TypeError("Thenable self-resolution");
t = e && ("object" == typeof e || "function" == typeof e) && e.then, m(t) ? s ? t.call(e, l(u, o, R, s), l(u, o, M, s)) : (u++, t.call(e, l(u, o, R, s), l(u, o, M, s), l(u, o, R, o.notifyWith))) : (a !== R && (n = void 0, r = [e]), (s || o.resolveWith)(n, r))
}
},
t = s ? e : function() {
try {
e()
} catch (e) {
S.Deferred.exceptionHook && S.Deferred.exceptionHook(e, t.stackTrace), u <= i + 1 && (a !== M && (n = void 0, r = [e]), o.rejectWith(n, r))
}
};
i ? t() : (S.Deferred.getStackHook && (t.stackTrace = S.Deferred.getStackHook()), C.setTimeout(t))
}
}
return S.Deferred(function(e) {
o[0][3].add(l(0, e, m(r) ? r : R, e.notifyWith)), o[1][3].add(l(0, e, m(t) ? t : R)), o[2][3].add(l(0, e, m(n) ? n : M))
}).promise()
},
promise: function(e) {
return null != e ? S.extend(e, a) : a
}
},
s = {};
return S.each(o, function(e, t) {
var n = t[2],
r = t[5];
a[t[1]] = n.add, r && n.add(function() {
i = r
}, o[3 - e][2].disable, o[3 - e][3].disable, o[0][2].lock, o[0][3].lock), n.add(t[3].fire), s[t[0]] = function() {
return s[t[0] + "With"](this === s ? void 0 : this, arguments), this
}, s[t[0] + "With"] = n.fireWith
}), a.promise(s), e && e.call(s, s), s
},
when: function(e) {
var n = arguments.length,
t = n,
r = Array(t),
i = s.call(arguments),
o = S.Deferred(),
a = function(t) {
return function(e) {
r[t] = this, i[t] = 1 < arguments.length ? s.call(arguments) : e, --n || o.resolveWith(r, i)
}
};
if (n <= 1 && (I(e, o.done(a(t)).resolve, o.reject, !n), "pending" === o.state() || m(i[t] && i[t].then))) return o.then();
while (t--) I(i[t], a(t), o.reject);
return o.promise()
}
});
var W = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
S.Deferred.exceptionHook = function(e, t) {
C.console && C.console.warn && e && W.test(e.name) && C.console.warn("jQuery.Deferred exception: " + e.message, e.stack, t)
}, S.readyException = function(e) {
C.setTimeout(function() {
throw e
})
};
var F = S.Deferred();

Import javascript Module in Angular 13

I need to implement a Map API in an Angular 13 project but I have just a Javascript file. Apparently it's based on TypeScript then easily importable but I don't know how...
The file starts by this code :
!function() {
function e(t, n, i) {
function r(a, s) {
if (!n[a]) {
if (!t[a]) {
var l = "function" == typeof require && require;
if (!s && l)
return l(a, !0);
if (o)
return o(a, !0);
var u = new Error("Cannot find module '" + a + "'");
throw u.code = "MODULE_NOT_FOUND",
u
}
var h = n[a] = {
exports: {}
};
t[a][0].call(h.exports, function(e) {
var n = t[a][1][e];
return r(n || e)
}, h, h.exports, e, t, n, i)
}
return n[a].exports
}
for (var o = "function" == typeof require && require, a = 0; a < i.length; a++)
r(i[a]);
return r
}
return e
}()({
In the documentation, I need just do this :
var map = new f4.map.Map('#map');
But f4 is undefined...
How i can do this ?
Thanks

jQuery Console Error: It's grabbing images that don't exist?

Thanks for any help or guidance first of all.
We run a Shopify store and we're getting console errors. They all say:
Failed to load resource: the server responded with a status of 404 () ... blue.png
Failed to load resource: the server responded with a status of 404 () ... red.png
Failed to load resource: the server responded with a status of 404 () ... green.png
Nothing seems to be showing up incorrectly on the site, and it seems to be happening only on pages that have products. I expect it be caused by code in the background that's cycling through and grabbing product info including images. But because everything is showing up fine, I don't know why/where it's trying to GET the images.
I read some 'how to fix console error articles' online that (I think) helped me determine the line of code that's causing the issue. I could be wrong. I activated "pause on caught exceptions" and it stopped on this:
It's a jQuery v1.11.2 file.
Everything below was marked with the squiggly red line, with a tooltip indicating it was the source of the error.
This code appears at the very end of the file.
Is it actually being caused by the jQuery file itself, or something that's calling the jQuery script to run a function?
If it's the latter, how to I find out what's calling the jQuery file?
How do I go about fixing the issue?
Thanks for any help or guidance in helping me figure this out.
{return a.offsetWidth <= 0 && a.offsetHeight <= 0 || !k.reliableHiddenOffsets() && "none" === (a.style && a.style.display || m.css(a, "display"))
}, m.expr.filters.visible = function(a) {
return !m.expr.filters.hidden(a)
};
var Qc = /%20/g,
Rc = /\[\]$/,
Sc = /\r?\n/g,
Tc = /^(?:submit|button|image|reset|file)$/i,
Uc = /^(?:input|select|textarea|keygen)/i;
function Vc(a, b, c, d) {
var e;
if (m.isArray(b)) m.each(b, function(b, e) {
c || Rc.test(a) ? d(a, e) : Vc(a + "[" + ("object" == typeof e ? b : "") + "]", e, c, d)
});
else if (c || "object" !== m.type(b)) d(a, b);
else
for (e in b) Vc(a + "[" + e + "]", b[e], c, d)
}
m.param = function(a, b) {
var c, d = [],
e = function(a, b) {
b = m.isFunction(b) ? b() : null == b ? "" : b, d[d.length] = encodeURIComponent(a) + "=" + encodeURIComponent(b)
};
if (void 0 === b && (b = m.ajaxSettings && m.ajaxSettings.traditional), m.isArray(a) || a.jquery && !m.isPlainObject(a)) m.each(a, function() {
e(this.name, this.value)
});
else
for (c in a) Vc(c, a[c], b, e);
return d.join("&").replace(Qc, "+")
}, m.fn.extend({
serialize: function() {
return m.param(this.serializeArray())
},
serializeArray: function() {
return this.map(function() {
var a = m.prop(this, "elements");
return a ? m.makeArray(a) : this
}).filter(function() {
var a = this.type;
return this.name && !m(this).is(":disabled") && Uc.test(this.nodeName) && !Tc.test(a) && (this.checked || !W.test(a))
}).map(function(a, b) {
var c = m(this).val();
return null == c ? null : m.isArray(c) ? m.map(c, function(a) {
return {
name: b.name,
value: a.replace(Sc, "\r\n")
}
}) : {
name: b.name,
value: c.replace(Sc, "\r\n")
}
}).get()
}
}), m.ajaxSettings.xhr = void 0 !== a.ActiveXObject ? function() {
return !this.isLocal && /^(get|post|head|put|delete|options)$/i.test(this.type) && Zc() || $c()
} : Zc;
var Wc = 0,
Xc = {},
Yc = m.ajaxSettings.xhr();
a.attachEvent && a.attachEvent("onunload", function() {
for (var a in Xc) Xc[a](void 0, !0)
}), k.cors = !!Yc && "withCredentials" in Yc, Yc = k.ajax = !!Yc, Yc && m.ajaxTransport(function(a) {
if (!a.crossDomain || k.cors) {
var b;
return {
send: function(c, d) {
var e, f = a.xhr(),
g = ++Wc;
if (f.open(a.type, a.url, a.async, a.username, a.password), a.xhrFields)
for (e in a.xhrFields) f[e] = a.xhrFields[e];
a.mimeType && f.overrideMimeType && f.overrideMimeType(a.mimeType), a.crossDomain || c["X-Requested-With"] || (c["X-Requested-With"] = "XMLHttpRequest");
for (e in c) void 0 !== c[e] && f.setRequestHeader(e, c[e] + "");
f.send(a.hasContent && a.data || null), b = function(c, e) {
var h, i, j;
if (b && (e || 4 === f.readyState))
if (delete Xc[g], b = void 0, f.onreadystatechange = m.noop, e) 4 !== f.readyState && f.abort();
else {
j = {}, h = f.status, "string" == typeof f.responseText && (j.text = f.responseText);
try {
i = f.statusText
} catch (k) {
i = ""
}
h || !a.isLocal || a.crossDomain ? 1223 === h && (h = 204) : h = j.text ? 200 : 404
}
j && d(h, i, j, f.getAllResponseHeaders())
}, a.async ? 4 === f.readyState ? setTimeout(b) : f.onreadystatechange = Xc[g] = b : b()
},
abort: function() {
b && b(void 0, !0)
}
}
}
});
function Zc() {
try {
return new a.XMLHttpRequest
} catch (b) {}
}
function $c() {
try {
return new a.ActiveXObject("Microsoft.XMLHTTP")
} catch (b) {}
}
m.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /(?:java|ecma)script/
},
converters: {
"text script": function(a) {
return m.globalEval(a), a
}
}
}), m.ajaxPrefilter("script", function(a) {
void 0 === a.cache && (a.cache = !1), a.crossDomain && (a.type = "GET", a.global = !1)
}), m.ajaxTransport("script", function(a) {
if (a.crossDomain) {
var b, c = y.head || m("head")[0] || y.documentElement;
return {
send: function(d, e) {
b = y.createElement("script"), b.async = !0, a.scriptCharset && (b.charset = a.scriptCharset), b.src = a.url, b.onload = b.onreadystatechange = function(a, c) {
(c || !b.readyState || /loaded|complete/.test(b.readyState)) && (b.onload = b.onreadystatechange = null, b.parentNode && b.parentNode.removeChild(b), b = null, c || e(200, "success"))
}, c.insertBefore(b, c.firstChild)
},
abort: function() {
b && b.onload(void 0, !0)
}
}
}
});
var _c = [],
ad = /(=)\?(?=&|$)|\?\?/;
m.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var a = _c.pop() || m.expando + "_" + vc++;
return this[a] = !0, a
}
}), m.ajaxPrefilter("json jsonp", function(b, c, d) {
var e, f, g, h = b.jsonp !== !1 && (ad.test(b.url) ? "url" : "string" == typeof b.data && !(b.contentType || "").indexOf("application/x-www-form-urlencoded") && ad.test(b.data) && "data");
return h || "jsonp" === b.dataTypes[0] ? (e = b.jsonpCallback = m.isFunction(b.jsonpCallback) ? b.jsonpCallback() : b.jsonpCallback, h ? b[h] = b[h].replace(ad, "$1" + e) : b.jsonp !== !1 && (b.url += (wc.test(b.url) ? "&" : "?") + b.jsonp + "=" + e), b.converters["script json"] = function() {
return g || m.error(e + " was not called"), g[0]
}, b.dataTypes[0] = "json", f = a[e], a[e] = function() {
g = arguments
}, d.always(function() {
a[e] = f, b[e] && (b.jsonpCallback = c.jsonpCallback, _c.push(e)), g && m.isFunction(f) && f(g[0]), g = f = void 0
}), "script") : void 0
}), m.parseHTML = function(a, b, c) {
if (!a || "string" != typeof a) return null;
"boolean" == typeof b && (c = b, b = !1), b = b || y;
var d = u.exec(a),
e = !c && [];
return d ? [b.createElement(d[1])] : (d = m.buildFragment([a], b, e), e && e.length && m(e).remove(), m.merge([], d.childNodes))
};
var bd = m.fn.load;
m.fn.load = function(a, b, c) {
if ("string" != typeof a && bd) return bd.apply(this, arguments);
var d, e, f, g = this,
h = a.indexOf(" ");
return h >= 0 && (d = m.trim(a.slice(h, a.length)), a = a.slice(0, h)), m.isFunction(b) ? (c = b, b = void 0) : b && "object" == typeof b && (f = "POST"), g.length > 0 && m.ajax({
url: a,
type: f,
dataType: "html",
data: b
}).done(function(a) {
e = arguments, g.html(d ? m("<div>").append(m.parseHTML(a)).find(d) : a)
}).complete(c && function(a, b) {
g.each(c, e || [a.responseText, b, a])
}), this
}, m.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(a, b) {
m.fn[b] = function(a) {
return this.on(b, a)
}
}), m.expr.filters.animated = function(a) {
return m.grep(m.timers, function(b) {
return a === b.elem
}).length
};
var cd = a.document.documentElement;
function dd(a) {
return m.isWindow(a) ? a : 9 === a.nodeType ? a.defaultView || a.parentWindow : !1
}
m.offset = {
setOffset: function(a, b, c) {
var d, e, f, g, h, i, j, k = m.css(a, "position"),
l = m(a),
n = {};
"static" === k && (a.style.position = "relative"), h = l.offset(), f = m.css(a, "top"), i = m.css(a, "left"), j = ("absolute" === k || "fixed" === k) && m.inArray("auto", [f, i]) > -1, j ? (d = l.position(), g = d.top, e = d.left) : (g = parseFloat(f) || 0, e = parseFloat(i) || 0), m.isFunction(b) && (b = b.call(a, c, h)), null != b.top && (n.top = b.top - h.top + g), null != b.left && (n.left = b.left - h.left + e), "using" in b ? b.using.call(a, n) : l.css(n)
}
}, m.fn.extend({
offset: function(a) {
if (arguments.length) return void 0 === a ? this : this.each(function(b) {
m.offset.setOffset(this, a, b)
});
var b, c, d = {
top: 0,
left: 0
},
e = this[0],
f = e && e.ownerDocument;
if (f) return b = f.documentElement, m.contains(b, e) ? (typeof e.getBoundingClientRect !== K && (d = e.getBoundingClientRect()), c = dd(f), {
top: d.top + (c.pageYOffset || b.scrollTop) - (b.clientTop || 0),
left: d.left + (c.pageXOffset || b.scrollLeft) - (b.clientLeft || 0)
}) : d
},
position: function() {
if (this[0]) {
var a, b, c = {
top: 0,
left: 0
},
d = this[0];
return "fixed" === m.css(d, "position") ? b = d.getBoundingClientRect() : (a = this.offsetParent(), b = this.offset(), m.nodeName(a[0], "html") || (c = a.offset()), c.top += m.css(a[0], "borderTopWidth", !0), c.left += m.css(a[0], "borderLeftWidth", !0)), {
top: b.top - c.top - m.css(d, "marginTop", !0),
left: b.left - c.left - m.css(d, "marginLeft", !0)
}
}
},
offsetParent: function() {
return this.map(function() {
var a = this.offsetParent || cd;
while (a && !m.nodeName(a, "html") && "static" === m.css(a, "position")) a = a.offsetParent;
return a || cd
})
}
}), m.each({
scrollLeft: "pageXOffset",
scrollTop: "pageYOffset"
}, function(a, b) {
var c = /Y/.test(b);
m.fn[a] = function(d) {
return V(this, function(a, d, e) {
var f = dd(a);
return void 0 === e ? f ? b in f ? f[b] : f.document.documentElement[d] : a[d] : void(f ? f.scrollTo(c ? m(f).scrollLeft() : e, c ? e : m(f).scrollTop()) : a[d] = e)
}, a, d, arguments.length, null)
}
}), m.each(["top", "left"], function(a, b) {
m.cssHooks[b] = Lb(k.pixelPosition, function(a, c) {
return c ? (c = Jb(a, b), Hb.test(c) ? m(a).position()[b] + "px" : c) : void 0
})
}), m.each({
Height: "height",
Width: "width"
}, function(a, b) {
m.each({
padding: "inner" + a,
content: b,
"": "outer" + a
}, function(c, d) {
m.fn[d] = function(d, e) {
var f = arguments.length && (c || "boolean" != typeof d),
g = c || (d === !0 || e === !0 ? "margin" : "border");
return V(this, function(b, c, d) {
var e;
return m.isWindow(b) ? b.document.documentElement["client" + a] : 9 === b.nodeType ? (e = b.documentElement, Math.max(b.body["scroll" + a], e["scroll" + a], b.body["offset" + a], e["offset" + a], e["client" + a])) : void 0 === d ? m.css(b, c, g) : m.style(b, c, d, g)
}, b, f ? d : void 0, f, null)
}
})
}), m.fn.size = function() {
return this.length
}, m.fn.andSelf = m.fn.addBack, "function" == typeof define && define.amd && define("jquery", [], function() {
return m
});
var ed = a.jQuery,
fd = a.$;
return m.noConflict = function(b) {
return a.$ === m && (a.$ = fd), b && a.jQuery === m && (a.jQuery = ed), m
}, typeof b === K && (a.jQuery = a.$ = m), m
});
jQuery shouldn't be grabbing any files all by itself.
Following are the things that you can try.
You can click on the error in chrome console, that will take you to the error location in the scripts. Sometimes it will take you to the function which handles the error and not the one which causes it. In this case follow second.
You can expand the Stacktrace in the console to see the call stack and verify if there are functions in the call stack which are loading these images.
You can check under the Network tab to check the call to the images. In Chrome Network console you would see the a column named Initiator (After Name,Status,Type). If you click on the link in this column against the image call, you chrome will open then script and move cursor to the line which initiated the call to image. If source code there is minified you can click on the {} (Pretty Print) icon at the bottom of source code editor. That will format the code, then you will be able to pin point the source code line that's causing the issue.
Finally brute force, check for the references to the blue.png or any other files in your source code.

DreamWeavers sees lots of errors, while script does work with jQuery3

Dreamweaver colors many lines red with warning. The script works perfectly with jQuery 3! So are these DreamWeaver warnings to be neglected or should (some of these) be changed, and if so how? I have manually written them down since the can only be seen when hovering the mouse over the line numbers.
Missing semicolon (line 2)
Use strict statement (line 4)
Expected === but saw == (line 10)
Expected !==but saw != (line 23)
Expected and assignment or call but saw expression (line 33)
Missing semicolon (41)
Expected === but saw == (43)
Missing use strict statement (45)
the body of a for in statement should be wrapped in an if statement to filter unwanted properties from the prototype (46)
Expected { but saw e (52)
Expected === but saw == (53)
Expecte { but saw for (54)
Expected { but saw e (55)
Expected === but saw == (60)
Expected and assignment or call but saw expression (70)
Expected and assignment or call but saw expression (75)
Missing semicolon (77)
Expected === but saw == (84)
Expected and assignment or call but saw expression (92)
Expected { but saw for (101)
Expected and assignment or call but saw expression (103)
! function(t, e) {
"function" == typeof define && define.amd ? define("ev-emitter/ev-emitter", e) : "object" == typeof module && module.exports ? module.exports = e() : t.EvEmitter = e()
}(this, function() {
function t() {}
var e = t.prototype;
return e.on = function(t, e) {
if (t && e) {
var i = this._events = this._events || {},
n = i[t] = i[t] || [];
return -1 == n.indexOf(e) && n.push(e), this
}
}, e.once = function(t, e) {
if (t && e) {
this.on(t, e);
var i = this._onceEvents = this._onceEvents || {},
n = i[t] = i[t] || [];
return n[e] = !0, this;
}
}, e.off = function(t, e) {
var i = this._events && this._events[t];
if (i && i.length) {
var n = i.indexOf(e);
return -1 != n && i.splice(n, 1), this
}
}, e.emitEvent = function(t, e) {
var i = this._events && this._events[t];
if (i && i.length) {
var n = 0,
o = i[n];
e = e || [];
for (var r = this._onceEvents && this._onceEvents[t]; o;) {
var s = r && r[o];
s && (this.off(t, o), delete r[o]), o.apply(this, e), n += s ? 0 : 1, o = i[n]
}
return this;
}
}, t;
}),
function(t, e) {
"use strict";
"function" == typeof define && define.amd ? define(["ev-emitter/ev-emitter"], function(i) {
return e(t, i);
}) : "object" == typeof module && module.exports ? module.exports = e(t, require("ev-emitter")) : t.imagesLoaded = e(t, t.EvEmitter)
}(window, function(t, e) {
function i(t, e) {
for (var i in e) t[i] = e[i];
return t;
}
function n(t) {
var e = [];
if (Array.isArray(t)) e = t;
else if ("number" == typeof t.length)
for (var i = 0; i < t.length; i++) e.push(t[i]);
else e.push(t);
return e;
}
function o(t, e, r) {
return this instanceof o ? ("string" == typeof t && (t = document.querySelectorAll(t)), this.elements = n(t), this.options = i({}, this.options), "function" == typeof e ? r = e : i(this.options, e), r && this.on("always", r), this.getImages(), h && (this.jqDeferred = new h.Deferred), void setTimeout(function() {
this.check();
}.bind(this))) : new o(t, e, r);
}
function r(t) {
this.img = t;
}
function s(t, e) {
this.url = t, this.element = e, this.img = new Image();
}
var h = t.jQuery,
a = t.console;
o.prototype = Object.create(e.prototype), o.prototype.options = {}, o.prototype.getImages = function() {
this.images = [], this.elements.forEach(this.addElementImages, this)
}, o.prototype.addElementImages = function(t) {
"IMG" == t.nodeName && this.addImage(t); this.options.background === !0 && this.addElementBackgroundImages(t);
var e = t.nodeType;
if (e && d[e]) {
for (var i = t.querySelectorAll("img"), n = 0; n < i.length; n++) {
var o = i[n];
this.addImage(o);
}
if ("string" == typeof this.options.background) {
var r = t.querySelectorAll(this.options.background);
for (n = 0; n < r.length; n++) {
var s = r[n];
this.addElementBackgroundImages(s);
}
}
}
};
var d = {
1: !0,
9: !0,
11: !0
};
return o.prototype.addElementBackgroundImages = function(t) {
var e = getComputedStyle(t);
if (e)
for (var i = /url\((['"])?(.*?)\1\)/gi, n = i.exec(e.backgroundImage); null !== n;) {
var o = n && n[2];
o && this.addBackground(o, t), n = i.exec(e.backgroundImage)
}
}, o.prototype.addImage = function(t) {
var e = new r(t);
this.images.push(e)
}, o.prototype.addBackground = function(t, e) {
var i = new s(t, e);
this.images.push(i)
}, o.prototype.check = function() {
function t(t, i, n) {
setTimeout(function() {
e.progress(t, i, n)
})
}
var e = this;
return this.progressedCount = 0, this.hasAnyBroken = !1, this.images.length ? void this.images.forEach(function(e) {
e.once("progress", t), e.check()
}) : void this.complete()
}, o.prototype.progress = function(t, e, i) {
this.progressedCount++, this.hasAnyBroken = this.hasAnyBroken || !t.isLoaded, this.emitEvent("progress", [this, t, e]), this.jqDeferred && this.jqDeferred.notify && this.jqDeferred.notify(this, t), this.progressedCount == this.images.length && this.complete(), this.options.debug && a && a.log("progress: " + i, t, e)
}, o.prototype.complete = function() {
var t = this.hasAnyBroken ? "fail" : "done";
if (this.isComplete = !0, this.emitEvent(t, [this]), this.emitEvent("always", [this]), this.jqDeferred) {
var e = this.hasAnyBroken ? "reject" : "resolve";
this.jqDeferred[e](this)
}
}, r.prototype = Object.create(e.prototype), r.prototype.check = function() {
var t = this.getIsImageComplete();
return t ? void this.confirm(0 !== this.img.naturalWidth, "naturalWidth") : (this.proxyImage = new Image, this.proxyImage.addEventListener("load", this), this.proxyImage.addEventListener("error", this), this.img.addEventListener("load", this), this.img.addEventListener("error", this), void(this.proxyImage.src = this.img.src))
}, r.prototype.getIsImageComplete = function() {
return this.img.complete && void 0 !== this.img.naturalWidth
}, r.prototype.confirm = function(t, e) {
this.isLoaded = t, this.emitEvent("progress", [this, this.img, e])
}, r.prototype.handleEvent = function(t) {
var e = "on" + t.type;
this[e] && this[e](t)
}, r.prototype.onload = function() {
this.confirm(!0, "onload"), this.unbindEvents()
}, r.prototype.onerror = function() {
this.confirm(!1, "onerror"), this.unbindEvents()
}, r.prototype.unbindEvents = function() {
this.proxyImage.removeEventListener("load", this), this.proxyImage.removeEventListener("error", this), this.img.removeEventListener("load", this), this.img.removeEventListener("error", this)
}, s.prototype = Object.create(r.prototype), s.prototype.check = function() {
this.img.addEventListener("load", this), this.img.addEventListener("error", this), this.img.src = this.url;
var t = this.getIsImageComplete();
t && (this.confirm(0 !== this.img.naturalWidth, "naturalWidth"), this.unbindEvents())
}, s.prototype.unbindEvents = function() {
this.img.removeEventListener("load", this), this.img.removeEventListener("error", this)
}, s.prototype.confirm = function(t, e) {
this.isLoaded = t, this.emitEvent("progress", [this, this.element, e])
}, o.makeJQueryPlugin = function(e) {
e = e || t.jQuery, e && (h = e, h.fn.imagesLoaded = function(t, e) {
var i = new o(this, t, e);
return i.jqDeferred.promise(h(this))
})
}, o.makeJQueryPlugin(), o
});
Stylistic warnings in minified third party libraries can safely be ignored.
Minifiers will almost always trim semicolons when they can, while linters will always warn about semicolons missing.

Angular2 rc1, where is shims_for_IE

There used to be shims_for_IE in Angular2 package, but since rc1 it's removed. So what's the workaround to support IE9+ ?
Error in IE 11 with rendering mode set to Edge:
Error: SyntaxError: Syntax error
at ZoneDelegate.prototype.invoke (http://localhost:11111/node_modules/zone.js/dist/zone.js:321:14)
at Zone.prototype.run (http://localhost:11111/node_modules/zone.js/dist/zone.js:216:18)
at Anonymous function (http://localhost:11111/node_modules/zone.js/dist/zone.js:571:18)
Evaluating http://localhost:11111/Scripts/script.js
Error loading http://localhost:11111/Scripts/script.js
Error in IE 11 with rendering mode set to IE 9:
File: script
Error: Expected ';'
Evaluating http://localhost:11111/Scripts/script.js
Error loading http://localhost:51592/Scripts/script.js
{
[functions]: ,
description: "Expected ';'
Evaluating http://localhost:11111/Scripts/script.js
Error loading http://localhost:11111/Scripts/script.js",
message: "Expected ';'
Evaluating http://localhost:11111/Scripts/script.js
Error loading http://localhost:11111/Scripts/script.js",
name: "Error",
originalErr: { },
stack: null
}
The script.js generated from script.ts as es6:
/// <amd-module name="script" />
System.register("script", ['#angular/core', '#angular/platform-browser-dynamic'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1, platform_browser_dynamic_1;
var script;
return {
setters:[
function (core_1_1) {
core_1 = core_1_1;
},
function (platform_browser_dynamic_1_1) {
platform_browser_dynamic_1 = platform_browser_dynamic_1_1;
}],
execute: function() {
let script = class script {
constructor(element) {
this.loginUrl = '';
this.antiForgeryName = '';
this.antiForgeryValue = '';
this.loginError = '';
this.submitted = false;
this.loginUrl = element.nativeElement.getAttribute('loginurl');
this.antiForgeryName = element.nativeElement.getAttribute('antiforgeryname');
this.antiForgeryValue = element.nativeElement.getAttribute('antiforgeryvalue');
this.loginError = element.nativeElement.getAttribute('loginError') == null ? "" : element.nativeElement.getAttribute('loginError');
}
};
script = __decorate([
core_1.Component({
selector: 'script',
templateUrl: '/Home/ScriptTemplate.html'
}),
__metadata('design:paramtypes', [core_1.ElementRef])
], script);
exports_1("script", script);
platform_browser_dynamic_1.bootstrap(script);
}
}
});
//# sourceMappingURL=script.js.map
Update
So changing to follwing solves the issue which means shims are needed:
...
var script = function script() {
function() constructor(element) {
this.loginUrl = '';
this.antiForgeryName = '';
this.antiForgeryValue = '';
this.loginError = '';
this.submitted = false;
this.loginUrl = element.nativeElement.getAttribute('loginurl');
this.antiForgeryName = element.nativeElement.getAttribute('antiforgeryname');
this.antiForgeryValue = element.nativeElement.getAttribute('antiforgeryvalue');
this.loginError = element.nativeElement.getAttribute('loginError') == null ? "" : element.nativeElement.getAttribute('loginError');
}
};
...
But this looks like es3 transpile, which thanks to typescript is super impossible as i have tried every single .d.ts out there and it still complains promise not found, set not found, etc...
see: https://github.com/angular/angular/issues/7280
Easy fix. Download the Typings folder from beta.15 and place it under your project, then use browser.d.ts or simply downgrade to beta.15. Although I've seen solutions by installing typings package, it didn't work for me in Visual Studio.

Categories