File jquery.min.js
has 3469 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*! jQuery v1.8.3 jquery.com | jquery.org/license */
(function(e, t) {
function _(e) {
var t = M[e] = {};
return v.each(e.split(y), function(e, n) {
Consider simplifying this complex logical expression. Open
if (!s || s.nodeType !== 3 && s.nodeType !== 8) {
var u, a, f, l, c, h, p, d, m, g, y = n.type || n,
b = [];
if (Y.test(y + v.event.triggered)) return;
y.indexOf("!") >= 0 && (y = y.slice(0, -1), a = !0), y.indexOf(".") >= 0 && (b = y.split("."), y = b.shift(), b.sort());
Function ajax
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
ajax: function(e, n) {
function T(e, n, s, a) {
var l, y, b, w, S, T = n;
if (E === 2) return;
E = 2, u && clearTimeout(u), o = t, i = a || "", x.readyState = e > 0 ? 4 : 0, s && (w = An(c, x, s));
Consider simplifying this complex logical expression. Open
if (!n.crossDomain || v.support.cors) {
var r;
return {
send: function(i, s) {
var o, u, a = n.xhr();
Function Callbacks
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
v.Callbacks = function(e) {
e = typeof e == "string" ? M[e] || _(e) : v.extend({}, e);
var n, r, i, s, o, u, a = [],
f = !e.once && [],
l = function(t) {
Consider simplifying this complex logical expression. Open
if (typeof e == "string" && !yt.test(e) && (v.support.htmlSerialize || !wt.test(e)) && (v.support.leadingWhitespace || !pt.test(e)) && !Nt[(vt.exec(e) || ["", ""])[1].toLowerCase()]) {
e = e.replace(dt, "<$1></$2>");
try {
for (; r < i; r++) n = this[r] || {}, n.nodeType === 1 && (v.cleanData(n.getElementsByTagName("*")), n.innerHTML = e);
n = 0
Function Kn
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Kn(e, t, n) {
var r, i = 0,
s = 0,
o = Xn.length,
u = v.Deferred().always(function() {
Function support
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
}), v.support = function() {
var t, n, r, s, o, u, a, f, l, c, h, p = i.createElement("div");
p.setAttribute("className", "t"), p.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>", n = p.getElementsByTagName("*"), r = p.getElementsByTagName("a")[0];
if (!n || !r || !n.length) return {};
s = i.createElement("select"), o = s.appendChild(i.createElement("option")), u = p.getElementsByTagName("input")[0], r.style.cssText = "top:1px;float:left;opacity:.5", t = {
Consider simplifying this complex logical expression. Open
if (y || !n.namespace && !c.namespace || n.namespace_re && n.namespace_re.test(c.namespace)) n.data = c.data, n.handleObj = c, o = ((v.event.special[c.origType] || {}).handle || c.handler).apply(a.elem, g), o !== t && (n.result = o, o === !1 && (n.preventDefault(), n.stopPropagation()))
Function Deferred
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Deferred: function(e) {
var t = [
["resolve", "done", v.Callbacks("once memory"), "resolved"],
["reject", "fail", v.Callbacks("once memory"), "rejected"],
["notify", "progress", v.Callbacks("memory")]
Function pt
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function pt(e, t) {
var r = t.length > 0,
s = e.length > 0,
o = function(u, a, f, l, h) {
var p, d, v, m = [],
Function On
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function On(e, t) {
var n, r, i, s, o = e.dataTypes.slice(),
u = o[0],
a = {},
f = 0;
Consider simplifying this complex logical expression. Open
if (o) {
u = v._data(e, "fxshow") || v._data(e, "fxshow", {}), "hidden" in u && (g = u.hidden), a && (u.hidden = !g), g ? v(e).show() : h.done(function() {
v(e).hide()
}), h.done(function() {
var t;
Consider simplifying this complex logical expression. Open
if (!o && !p.noBubble && !v.isWindow(s)) {
g = p.delegateType || y, l = Y.test(g + y) ? s : s.parentNode;
for (c = s; l; l = l.parentNode) m.push([l, g]), c = l;
c === (s.ownerDocument || i) && m.push([c.defaultView || c.parentWindow || e, g])
}
Consider simplifying this complex logical expression. Open
if (n.dataTypes[0] === "jsonp" || c || h) return s = n.jsonpCallback = v.isFunction(n.jsonpCallback) ? n.jsonpCallback() : n.jsonpCallback, o = e[s], c ? n.url = f.replace(Dn, "$1" + s) : h ? n.data = a.replace(Dn, "$1" + s) : l && (n.url += (_n.test(f) ? "&" : "?") + n.jsonp + "=" + s), n.converters["script json"] = function() {
return u || v.error(s + " was not called"), u[0]
}, n.dataTypes[0] = "json", e[s] = function() {
u = arguments
}, i.always(function() {
Function Gn
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Gn(e, t, n) {
var r, i, s, o, u, a, f, l, c, h = this,
p = e.style,
d = {},
m = [],
Function domManip
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
domManip: function(e, n, r) {
e = [].concat.apply([], e);
var i, s, o, u, a = 0,
f = e[0],
l = [],
Function send
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
send: function(i, s) {
var o, u, a = n.xhr();
n.username ? a.open(n.type, n.url, n.async, n.username, n.password) : a.open(n.type, n.url, n.async);
if (n.xhrFields) for (u in n.xhrFields) a[u] = n.xhrFields[u];
n.mimeType && a.overrideMimeType && a.overrideMimeType(n.mimeType), !n.crossDomain && !i["X-Requested-With"] && (i["X-Requested-With"] = "XMLHttpRequest");
Function o
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
o = function(u, a, f, l, h) {
var p, d, v, m = [],
y = 0,
w = "0",
x = u && [],
Function dispatch
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
dispatch: function(n) {
n = v.event.fix(n || e.event);
var r, i, s, o, u, a, f, c, h, p, d = (v._data(this, "events") || {})[n.type] || [],
m = d.delegateCount,
g = l.call(arguments),
Function clean
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
clean: function(e, t, n, r) {
var s, o, u, a, f, l, c, h, p, d, m, g, y = t === i && Ct,
b = [];
if (!t || typeof t.createDocumentFragment == "undefined") t = i;
for (s = 0;
Function trigger
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
trigger: function(n, r, s, o) {
if (!s || s.nodeType !== 3 && s.nodeType !== 8) {
var u, a, f, l, c, h, p, d, m, g, y = n.type || n,
b = [];
if (Y.test(y + v.event.triggered)) return;
Consider simplifying this complex logical expression. Open
if (a) {
var t = a.length;
(function r(t) {
v.each(t, function(t, n) {
var i = v.type(n);
Consider simplifying this complex logical expression. Open
if (this[0]) {
i = v.buildFragment(e, this, l), o = i.fragment, s = o.firstChild, o.childNodes.length === 1 && (o = s);
if (s) {
n = n && v.nodeName(s, "tr");
for (u = i.cacheable || c - 1; a < c; a++) r.call(n && v.nodeName(this[a], "table") ? Lt(this[a], "tbody") : this[a], a === u ? o : v.clone(o, !0, !0))
Consider simplifying this complex logical expression. Open
if (t && e.nodeType === 1) {
r = t.split(y);
for (; o < r.length; o++) i = r[o], i && (n = v.propFix[i] || i, s = X.test(i), s || v.attr(e, i, ""), e.removeAttribute(V ? i : n), s && n in e && (e[n] = !1))
}
Consider simplifying this complex logical expression. Open
for (; a < f; a++) if ((e = arguments[a]) != null) for (n in e) {
r = u[n], i = e[n];
if (u === i) continue;
l && i && (v.isPlainObject(i) || (s = v.isArray(i))) ? (s ? (s = !1, o = r && v.isArray(r) ? r : []) : o = r && v.isPlainObject(r) ? r : {}, u[n] = v.extend(l, o, i)) : i !== t && (u[n] = i)
}
Consider simplifying this complex logical expression. Open
if (i) a.readyState !== 4 && a.abort();
else {
u = a.status, l = a.getAllResponseHeaders(), c = {}, h = a.responseXML, h && h.documentElement && (c.xml = h);
try {
c.text = a.responseText
Consider simplifying this complex logical expression. Open
if (r !== "px" && u) {
u = v.css(i.elem, e, !0) || n || 1;
do a = a || ".5", u /= a, v.style(i.elem, e, u + r);
while (a !== (a = i.cur() / o) && a !== 1 && --f)
}
Function access
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
access: function(e, n, r, i, s, o, u) {
Function kn
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function kn(e, n, r, i, s, o) {
Avoid deeply nested control flow statements. Open
if (t > 0) for (i = r; i < o.length; i++) for (s = 0; s < r; s++) if (o[s] === o[i]) {
o.splice(i--, 1);
break
}
Avoid deeply nested control flow statements. Open
if (n !== !0) if (n && e["throws"]) t = n(t);
else try {
t = n(t)
} catch (l) {
return {
Avoid deeply nested control flow statements. Open
if (t.sizset) return t
Avoid deeply nested control flow statements. Open
for (o = p.length - 1; o >= 0; --o) v.nodeName(p[o], "tbody") && !p[o].childNodes.length && p[o].parentNode.removeChild(p[o])
Avoid deeply nested control flow statements. Open
for (; r < s; r++) if (i.relative[e[r].type]) break;
Avoid deeply nested control flow statements. Open
if (!e) return S.apply(n, x.call(r, 0)), n;
Avoid deeply nested control flow statements. Open
if (n.events) for (s in n.events) l[s] ? v.event.remove(i, s) : v.removeEvent(i, s, n.handle);
Avoid deeply nested control flow statements. Open
if (!n) for (r in a) {
s = r.split(" ");
if (s[1] === i) {
n = a[u + " " + s[0]] || a["* " + s[0]];
if (n) {
Avoid deeply nested control flow statements. Open
for (o = 0, u = t.length; o < u; o++) s.indexOf(" " + t[o] + " ") < 0 && (s += t[o] + " ");
Avoid deeply nested control flow statements. Open
if (s.id === f) return n.push(s), n
Avoid deeply nested control flow statements. Open
if (!s || !s.parentNode) return n;
Avoid deeply nested control flow statements. Open
} else if (t.ownerDocument && (s = t.ownerDocument.getElementById(f)) && u(t, s) && s.id === f) return n.push(s), n
Avoid deeply nested control flow statements. Open
if (e(t, r, u)) return t.sizset = !0, t;
Function ct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function ct(e, t, n, r, i, s) {
Function init
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
init: function(e, t, n, r, i, s) {
Avoid deeply nested control flow statements. Open
for (s = 0, o = n.length; s < o; s++) while (r.indexOf(" " + n[s] + " ") >= 0) r = r.replace(" " + n[s] + " ", " ");
Consider simplifying this complex logical expression. Open
if (r && w !== y) {
for (d = 0; v = t[d]; d++) v(x, m, a, f);
if (u) {
if (y > 0) while (w--)!x[w] && !m[w] && (m[w] = E.call(l));
m = lt(m)
Consider simplifying this complex logical expression. Open
if (n[d]) {
r = ++a;
for (; r < s; r++) if (i.relative[e[r].type]) break;
return ct(a > 1 && ft(h), a > 1 && e.slice(0, a - 1).join("").replace(j, "$1"), n, a < r && ht(e.slice(a, r)), r < s && ht(e = e.slice(r)), r < s && e.join(""))
}
Consider simplifying this complex logical expression. Open
if (typeof u == "string") if (!gt.test(u)) u = t.createTextNode(u);
else {
y = y || lt(t), c = t.createElement("div"), y.appendChild(c), u = u.replace(dt, "<$1></$2>"), a = (vt.exec(u) || ["", ""])[1].toLowerCase(), f = Nt[a] || Nt._default, l = f[0], c.innerHTML = f[1] + u + f[2];
while (l--) c = c.lastChild;
if (!v.support.tbody) {
Consider simplifying this complex logical expression. Open
if (e >= 200 && e < 300 || e === 304) c.ifModified && (S = x.getResponseHeader("Last-Modified"), S && (v.lastModified[r] = S), S = x.getResponseHeader("Etag"), S && (v.etag[r] = S)), e === 304 ? (T = "notmodified", l = !0) : (l = On(c, w), T = l.state, y = l.data, b = l.error, l = !b);
else {
b = T;
if (!T || e) T = "error", e < 0 && (e = 0)
}
Consider simplifying this complex logical expression. Open
if (n) o[n] && o[n].stop && i(o[n]);
else for (n in o) o[n] && o[n].stop && Wn.test(n) && i(o[n]);
Consider simplifying this complex logical expression. Open
if ((!c || !l[c] || !i && !l[c].data) && a && r === t) return;
Consider simplifying this complex logical expression. Open
if ((!v.support.noCloneEvent || !v.support.noCloneChecked) && (e.nodeType === 1 || e.nodeType === 11) && !v.isXMLDoc(e)) {
Ot(e, o), r = Mt(e), i = Mt(o);
for (s = 0; r[s]; ++s) i[s] && Ot(r[s], i[s])
}
Consider simplifying this complex logical expression. Open
if (i || !n.readyState || /loaded|complete/.test(n.readyState)) n.onload = n.onreadystatechange = null, r && n.parentNode && r.removeChild(n), n = t, i || o(200, "success")
Consider simplifying this complex logical expression. Open
if (!v.support.tbody) {
h = mt.test(u), p = a === "table" && !h ? c.firstChild && c.firstChild.childNodes : f[1] === "<table>" && !h ? c.childNodes : [];
for (o = p.length - 1; o >= 0; --o) v.nodeName(p[o], "tbody") && !p[o].childNodes.length && p[o].parentNode.removeChild(p[o])
}!v.support.leadingWhitespace && pt.test(u) && c.insertBefore(t.createTextNode(pt.exec(u)[0]), c.firstChild), u = c.childNodes, c.parentNode.removeChild(c)
Function lt
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function lt(e, t, n, r, i) {
Function o
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
o = function(u, a, f, l, h) {
Function on
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
on: function(e, n, r, i, s) {
Function vt
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function vt(e, t, n, r, s) {
Function Yn
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function Yn(e, t, n, r, i) {
Function remove
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
remove: function(e, t, n, r, i) {
Function add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
add: function(e, n, r, i, s) {
Avoid too many return
statements within this function. Open
return !n || n.jquery ? (n || r).find(e) : this.constructor(n).find(e)
Avoid too many return
statements within this function. Open
return this.context = i, this.selector = e, this
Avoid too many return
statements within this function. Open
return o && "set" in o && u && (s = o.set(e, r, n)) !== t ? s : (e.setAttribute(n, r + ""), r)
Avoid too many return
statements within this function. Open
if ((f = i[3]) && Z && t.getElementsByClassName) return S.apply(n, x.call(t.getElementsByClassName(f), 0)), n
Avoid too many return
statements within this function. Open
for (var f = 0; f < n && f < r; f++) if (i[f] !== s[f]) return ot(i[f], s[f]);
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return n.type = y, !o && !n.isDefaultPrevented() && (!p._default || p._default.apply(s.ownerDocument, r) === !1) && (y !== "click" || !v.nodeName(s, "a")) && v.acceptData(s) && h && s[y] && (y !== "focus" && y !== "blur" || n.target.offsetWidth !== 0) && !v.isWindow(s) && (c = s[h], c && (s[h] = null), v.event.triggered = y, s[y](), v.event.triggered = t, c && (s[h] = c)), n.result
Avoid too many return
statements within this function. Open
return f === n ? ot(e, s[f], -1) : ot(i[f], t, 1)
Avoid too many return
statements within this function. Open
} else if (t.ownerDocument && (s = t.ownerDocument.getElementById(f)) && u(t, s) && s.id === f) return n.push(s), n
Avoid too many return
statements within this function. Open
if (!u) return 1;
Avoid too many return
statements within this function. Open
return v.isFunction(e) ? r.ready(e) : (e.selector !== t && (this.selector = e.selector, this.context = e.context), v.makeArray(e, this))
Avoid too many return
statements within this function. Open
if (i[2]) return S.apply(n, x.call(t.getElementsByTagName(e), 0)), n;
Avoid too many return
statements within this function. Open
return vt(e.replace(j, "$1"), t, n, r, a)
Avoid too many return
statements within this function. Open
return o && "get" in o && u && (s = o.get(e, n)) !== null ? s : (s = e.getAttribute(n), s === null ? t : s)
Identical blocks of code found in 2 locations. Consider refactoring. Open
(function(e, t) {
function _(e) {
var t = M[e] = {};
return v.each(e.split(y), function(e, n) {
t[n] = !0
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62268.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76