").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var 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(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return 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 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",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[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!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!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 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&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
--------------------------------------------------------------------------------
/static/main.js:
--------------------------------------------------------------------------------
1 | var country_name_map = {
2 | 'Brunei Darussalam': 'Brunei',
3 | 'Congo': 'Republic of the Congo',
4 | 'Congo, The Democratic Republic of the': 'Democratic Republic of the Congo',
5 | "Cote D'Ivoire": 'Ivory Coast',
6 | 'Falkland Islands (Malvinas)': 'Falkland Islands',
7 | 'French Southern Territories': 'French Southern and Antarctic Lands',
8 | 'Guinea-Bissa': 'Guinea Bissau',
9 | 'Iran, Islamic Republic of': 'Iran',
10 | "Korea, Democratic People's Republic of": 'North Korea',
11 | 'Korea, Republic of': 'South Korea',
12 | "Lao People's Democratic Republic": 'Laos',
13 | 'Moldova, Republic of': 'Moldova',
14 | 'Palestinian Territory': 'West Bank',
15 | 'Russian Federation': 'Russia',
16 | 'Serbia': 'Republic of Serbia',
17 | 'Syrian Arab Republic': 'Syria',
18 | 'Tanzania, United Republic of': 'United Republic of Tanzania',
19 | 'Timor-Leste': 'East Timor',
20 | 'United States': 'United States of America'
21 | };
22 |
23 | var total_edits = 0;
24 | var edit_times = [];
25 | var edit_intervals = [];
26 | var world_map;
27 | var open_con = []
28 |
29 | var log_rc = function(rc_str, limit) {
30 | $('#rc-list').prepend('
' + rc_str + '');
31 | if($('#rc-list li').length > limit) {
32 | $('#rc-list li').slice(limit, limit + 1).remove();
33 | }
34 | };
35 |
36 | var highlight_country = function(country_name) {
37 | return d3.select('path[data-country-name="' + country_name + '"]')
38 | .style('fill', '#eddc4e')
39 | .transition()
40 | .duration(5000)
41 | .style('fill', '#ccc');
42 | };
43 |
44 | var get_country_names = function() {
45 | var ret = [];
46 | d3.selectAll('path[data-country-name]')
47 | .each(function(d) {
48 | ret.push(d.properties.name);
49 | });
50 | return ret;
51 | };
52 |
53 | var addBubbles = function(bubbles) {
54 | var self = this;
55 | if (_.isUndefined(bubbles.length)) {
56 | bubbles = [];
57 | }
58 |
59 | var projection = this._map.get('projection');
60 | var options = this.options.bubble_config;
61 |
62 | var bubbleContainer = this.svg.append('g').attr('class', 'bubbles');
63 | bubbleContainer
64 | .selectAll('circle.bubble')
65 | .data(bubbles)
66 | .enter()
67 | .append('svg:circle')
68 | .on('mouseover', function(datum) {
69 | var hoverover = self.$el.find('.hoverover');
70 | var eventData = {
71 | data: datum
72 | };
73 |
74 | hoverover.css({position:'absolute'})
75 | .html(options.popupTemplate( eventData )).show();
76 |
77 | hoverover.data('width', self.$el.find('.hoverover').width());
78 |
79 | if (options.highlightOnHover) {
80 | d3.select(this)
81 | .style('fill', options.highlightFillColor)
82 | .style('stroke', options.highlightBorderColor)
83 | .style('stroke-width', options.highlightBorderWidth)
84 | .style('fill-opacity', options.highlightFillOpacity);
85 | }
86 | self.$el.trigger($.Event("bubble-mouseover"), eventData);
87 | })
88 | .on('mousemove', function() {
89 | self.updateHoverOverPosition(this);
90 | })
91 | .on('mouseout', function(datum) {
92 | self.$el.find('.hoverover').hide();
93 | var eventData = {
94 | data: datum
95 | };
96 |
97 | self.$el.trigger($.Event("bubble-mouseout"), eventData);
98 |
99 | if (options.highlightOnHover) {
100 | var el = d3.select(this);
101 | el.style('fill', el.attr('data-fill'))
102 | .style('stroke', options.borderColor)
103 | .style('stroke-width', options.borderWidth)
104 | .style('fill-opacity', options.fillOpacity);
105 | }
106 | })
107 | .on('touchstart', function(datum) {
108 | self.$el.trigger($.Event("bubble-touchstart"), {data: datum});
109 | })
110 | .on('click', function(datum) {
111 | self.$el.trigger($.Event("bubble-click"), {data: datum});
112 | })
113 | .attr('cx', function(datum) {
114 | return projection([datum.longitude, datum.latitude])[0];
115 | })
116 | .attr('cy', function(datum, index) {
117 | return projection([datum.longitude, datum.latitude])[1];
118 | })
119 | .style('fill', function(datum) {
120 | var fillColor = self.getFillColor(datum);
121 | d3.select(this).attr('data-fill', fillColor);
122 | return fillColor;
123 | })
124 | .style('stroke', function(datum) {
125 | return options.borderColor; //self.getFillColor(datum);
126 | })
127 | .attr('class', 'bubble')
128 | .style('stroke-width', options.borderWidth)
129 | .attr('fill-opacity', options.fillOpacity)
130 | .attr('r', 0)
131 | .transition()
132 | .duration(400)
133 | .attr('r', function(datum) {
134 | return datum.radius;
135 | })
136 | .each(function(d){
137 | total_edits += 1;
138 | edit_times.push(new Date().getTime());
139 | if (total_edits > 2) {
140 | var cur = edit_times[edit_times.length - 1];
141 | var prev = edit_times[edit_times.length - 2];
142 | edit_intervals.push(cur - prev);
143 | }
144 | var s = 0;
145 | for (var i = 0; i < edit_intervals.length; i ++) {
146 | s += edit_intervals[i];
147 | }
148 | var rate_avg = Math.ceil(((s / edit_intervals.length) / 1000) * 10);
149 | edit_times = edit_times.slice(0, 500);
150 | edit_intervals = edit_intervals.slice(0, 500);
151 | if (total_edits == 1) {
152 | $('#edit_counter').html('You have seen
' + total_edits + ' edit.');
153 | } else if (total_edits == 2) {
154 | $('#edit_counter').html('You have seen a total of
' + total_edits + ' edits.');
155 | } else{
156 | $('#edit_counter').html('You have seen a total of
' + total_edits + ' edits at an average interval of
' + rate_avg + ' seconds.');
157 | }
158 | var x = projection([d.longitude, d.latitude])[0];
159 | var y = projection([d.longitude, d.latitude])[1];
160 | var div = $('
').css({
161 | position:'absolute',
162 | 'top': y + 10,
163 | 'left': x + 10
164 | })
165 | .addClass('popup-box')
166 | .animate({opacity: 0}, 4000, null, function() {
167 | this.remove();
168 | });
169 |
170 | div.html(d.page_title + '
(' + d.lid + ')');
171 | $('#map').append(div);
172 | });
173 | };
174 |
175 | function wikipediaSocket() {
176 |
177 | }
178 |
179 |
180 | wikipediaSocket.init = function(ws_url, lid) {
181 | this.connect = function() {
182 | $('#' + lid + '-status').html('(connecting...)');
183 | var loading = true;
184 | // Terminate previous connection, if any
185 | if (this.connection)
186 | this.connection.close();
187 |
188 | if ('WebSocket' in window) {
189 | var connection = new ReconnectingWebSocket(ws_url);
190 | this.connection = connection;
191 | connection.onopen = function() {
192 | window.console && console.log('Connection open to ' + lid);
193 | $('#' + lid + '-status').html('(connected)');
194 | };
195 |
196 | connection.onclose = function() {
197 | window.console && console.log('Connection closed to ' + lid);
198 | $('#' + lid + '-status').html('(closed)');
199 | };
200 |
201 | connection.onerror = function(error) {
202 | $('#' + lid + '-status').html('Error');
203 | window.console && console.log('Connection Error to ' + lid + ': ' + error);
204 | };
205 |
206 | connection.onmessage = function(resp) {
207 | var data;
208 | if (loading) {
209 | $('#loading').remove();
210 | }
211 | try {
212 | data = JSON.parse(resp.data);
213 | } catch (e) {
214 | window.console && console.log(resp);
215 | return;
216 | }
217 | var fill_key;
218 | if (data.is_anon && data.ns === 'Main') {
219 | if (data.change_size > 0) {
220 | fill_key = 'add';
221 | } else {
222 | fill_key = 'subtract';
223 | }
224 | req_url = 'http://freegeoip.net/json/' + data.user;
225 | if (data.geo_ip) {
226 | fgi_resp = data.geo_ip;
227 | world_map.options.bubbles = world_map.options.bubbles.slice(-20);
228 | loc_str = fgi_resp.country_name;
229 | if (fgi_resp.region_name) {
230 | loc_str = fgi_resp.region_name + ', ' + loc_str;
231 | }
232 | if (fgi_resp.city) {
233 | loc_str = fgi_resp.city + ' (' + loc_str + ')';
234 | }
235 | log_rc_str = 'Someone in
' + loc_str + ' edited "
' + data.page_title + '"
(' + lid + ')';
236 | log_rc(log_rc_str, RC_LOG_SIZE);
237 | //console.log('An editor in ' + loc_str + ' edited "' + data.page_title + '"')
238 | $('.bubbles')
239 | .animate({opacity: 0,
240 | radius: 10},
241 | 40000,
242 | null,
243 | function(){
244 | this.remove();
245 | });
246 | world_map
247 | .addBubbles([{radius: 4,
248 | latitude: fgi_resp.latitude,
249 | longitude: fgi_resp.longitude,
250 | page_title: data.page_title,
251 | fillKey: fill_key,
252 | lid: lid
253 | }]);
254 | country_hl = highlight_country(fgi_resp.country_name);
255 |
256 | if (!country_hl[0][0]) {
257 | country_hl = highlight_country(country_name_map[fgi_resp.country_name]);
258 | if (!country_hl[0][0] && window.console) {
259 | console.log('Could not highlight country: ' + fgi_resp.country_name);
260 | }
261 | }
262 | } else {
263 | window.console && console.log('no geodata available for', data['url']);
264 | }
265 | }
266 | };
267 | }
268 | };
269 | this.close = function() {
270 | if (this.connection) {
271 | this.connection.close();
272 | }
273 | };
274 | };
275 |
--------------------------------------------------------------------------------
/static/reconnecting-websocket.min.js:
--------------------------------------------------------------------------------
1 | // https://github.com/joewalnes/reconnecting-websocket/
2 | function ReconnectingWebSocket(a){function f(g){c=new WebSocket(a);if(b.debug||ReconnectingWebSocket.debugAll){console.debug("ReconnectingWebSocket","attempt-connect",a)}var h=c;var i=setTimeout(function(){if(b.debug||ReconnectingWebSocket.debugAll){console.debug("ReconnectingWebSocket","connection-timeout",a)}e=true;h.close();e=false},b.timeoutInterval);c.onopen=function(c){clearTimeout(i);if(b.debug||ReconnectingWebSocket.debugAll){console.debug("ReconnectingWebSocket","onopen",a)}b.readyState=WebSocket.OPEN;g=false;b.onopen(c)};c.onclose=function(h){clearTimeout(i);c=null;if(d){b.readyState=WebSocket.CLOSED;b.onclose(h)}else{b.readyState=WebSocket.CONNECTING;if(!g&&!e){if(b.debug||ReconnectingWebSocket.debugAll){console.debug("ReconnectingWebSocket","onclose",a)}b.onclose(h)}setTimeout(function(){f(true)},b.reconnectInterval)}};c.onmessage=function(c){if(b.debug||ReconnectingWebSocket.debugAll){console.debug("ReconnectingWebSocket","onmessage",a,c.data)}b.onmessage(c)};c.onerror=function(c){if(b.debug||ReconnectingWebSocket.debugAll){console.debug("ReconnectingWebSocket","onerror",a,c)}b.onerror(c)}}this.debug=false;this.reconnectInterval=1e3;this.timeoutInterval=2e3;var b=this;var c;var d=false;var e=false;this.url=a;this.readyState=WebSocket.CONNECTING;this.URL=a;this.onopen=function(a){};this.onclose=function(a){};this.onmessage=function(a){};this.onerror=function(a){};f(a);this.send=function(d){if(c){if(b.debug||ReconnectingWebSocket.debugAll){console.debug("ReconnectingWebSocket","send",a,d)}return c.send(d)}else{throw"INVALID_STATE_ERR : Pausing to reconnect websocket"}};this.close=function(){if(c){d=true;c.close()}};this.refresh=function(){if(c){c.close()}}}ReconnectingWebSocket.debugAll=false
3 |
--------------------------------------------------------------------------------
/static/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0;
3 | }
4 |
5 | body {
6 | font-family: sans-serif;
7 | }
8 | h1 {
9 | padding: .5em;
10 | }
11 | p {
12 | line-height: 1.5em;
13 | margin-bottom: .5em;
14 | }
15 | a {
16 | color: #306596;
17 | }
18 | a:hover {
19 | color: #cc4731;
20 | }
21 | label {
22 | margin-left: .5em;
23 | }
24 | .about-link {
25 | float: right;
26 | font-weight: normal;
27 | font-style: normal;
28 | font-size: 1.5em;
29 | padding-right: 2em;
30 | padding-top: 1em;
31 | }
32 | .wrapper {
33 | overflow: hidden; /* To clear contents */
34 | zoom: 1; /* To fix IE6 bugs with floats */
35 | }
36 | .content {
37 | margin: 1em auto 4em auto;
38 | width: 960px;
39 | position:relative;
40 | }
41 | .popup-box {
42 | padding: 4px;
43 | border-radius: 1px;
44 | background-color: #FFF;
45 | box-shadow: 1px 1px 5px #CCC;
46 | font-size: .7em;
47 | border: 1px solid #CCC;
48 | }
49 | .lang {
50 | color: #bdc3c7;
51 | padding: auto .5em;
52 | }
53 | .loc {
54 | border-bottom: 1px dashed #ccc;
55 | }
56 | .bg {
57 | padding: 3px;
58 | background: #eee;
59 | border-radius: 3px;
60 | margin: 1em;
61 | }
62 | .rc-list {
63 | border: 1px solid #2f6fab;
64 | background: #f8f8f8;
65 | list-style-type: none;
66 | margin: 0.5em;
67 | line-height: 1.5em;
68 | font-size: .8em;
69 | }
70 | .rc-list ul {
71 | height: 30em;
72 | }
73 | .rc-list h3 {
74 | padding: .5em;
75 | margin: 0;
76 | background: #fff;
77 | border-bottom: 1px solid #d8e6ec;
78 | font-size: 2em;
79 | }
80 | .note {
81 | margin: 0;
82 | padding: .5em;
83 | background: #fff;
84 | border-top: 1px solid #d8e6ec;
85 | font-size: .8em;
86 | color: #ccc;
87 | padding-bottom: 1px;
88 | }
89 | .foot {
90 | padding: 1em .5em 0 .5em;
91 | margin: 1em;
92 | }
93 | .foot h3 {
94 | margin-bottom: 1em;
95 | border-bottom: 1px solid #d8e6ec;
96 | }
97 | .conStatus {
98 | color: #bdc3c7;
99 | }
100 | #lang-boxes p {
101 | float: left;
102 | width: 20em;
103 | font-size: .9em;
104 | }
105 |
106 | .clear br {
107 | clear: left;
108 | }
109 | #header {
110 | background: #f8f8f8;
111 | margin: 0;
112 | border-bottom: 1px solid #d8e6ec;
113 | }
114 | #edit_counter {
115 | font-size: 1.5em;
116 | color: #000;
117 | }
118 | #edit_counter span {
119 | color: #cc4731;
120 | }
121 | #map {
122 | height: 450px;
123 | width: 900;
124 | padding: .5em;
125 | }
126 | #loading {
127 | position:absolute;
128 | top:3em;
129 | left:0;
130 | right:0;
131 | margin-left:auto;
132 | margin-right:auto;
133 | padding: 0;
134 | font-size: 4em;
135 | color: #fff;
136 | background-color: rgba(189, 195, 199, 0.6);
137 | }
138 | #loading p {
139 | text-align: center;
140 | margin: 0.5em;
141 | }
142 |
--------------------------------------------------------------------------------
/static/wikipedia_map_smithsonian.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hatnote/rcmap/afe5eabefb56e467f8eb7ac22718f299fa8a37c1/static/wikipedia_map_smithsonian.gif
--------------------------------------------------------------------------------