").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);
/**
* http://www.JSON.org/json2.js 2011-02-23
*/
var JSON;JSON||(JSON={}),function(){"use strict";function f(t){return 10>t?"0"+t:t}function quote(t){return escapable.lastIndex=0,escapable.test(t)?'"'+t.replace(escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var r,n,o,f,u,i=gap,p=e[t];switch(p&&"object"==typeof p&&"function"==typeof p.toJSON&&(p=p.toJSON(t)),"function"==typeof rep&&(p=rep.call(e,t,p)),typeof p){case"string":return quote(p);case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":return String(p);case"object":if(!p)return"null";if(gap+=indent,u=[],"[object Array]"===Object.prototype.toString.apply(p)){for(f=p.length,r=0;f>r;r+=1)u[r]=str(r,p)||"null";return o=0===u.length?"[]":gap?"[\n"+gap+u.join(",\n"+gap)+"\n"+i+"]":"["+u.join(",")+"]",gap=i,o}if(rep&&"object"==typeof rep)for(f=rep.length,r=0;f>r;r+=1)"string"==typeof rep[r]&&(n=rep[r],o=str(n,p),o&&u.push(quote(n)+(gap?": ":":")+o));else for(n in p)Object.prototype.hasOwnProperty.call(p,n)&&(o=str(n,p),o&&u.push(quote(n)+(gap?": ":":")+o));return o=0===u.length?"{}":gap?"{\n"+gap+u.join(",\n"+gap)+"\n"+i+"}":"{"+u.join(",")+"}",gap=i,o}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(t,e,r){var n;if(gap="",indent="","number"==typeof r)for(n=0;r>n;n+=1)indent+=" ";else"string"==typeof r&&(indent=r);if(rep=e,e&&"function"!=typeof e&&("object"!=typeof e||"number"!=typeof e.length))throw new Error("JSON.stringify");return str("",{"":t})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(t,e){var r,n,o=t[e];if(o&&"object"==typeof o)for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n=walk(o,r),void 0!==n?o[r]=n:delete o[r]);return reviver.call(t,e,o)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}();
/**
* JStorage
* Author: Andris Reinman, andris.reinman@gmail.com
* Project homepage: www.jstorage.info
*/
!function(){"use strict";function e(){var e=!1;if("localStorage"in window)try{window.localStorage.setItem("_tmptest","tmpval"),e=!0,window.localStorage.removeItem("_tmptest")}catch(t){}if(e)try{window.localStorage&&(b=window.localStorage,T="localStorage",O=b.jStorage_update)}catch(o){}else if("globalStorage"in window)try{window.globalStorage&&(b="localhost"==window.location.hostname?window.globalStorage["localhost.localdomain"]:window.globalStorage[window.location.hostname],T="globalStorage",O=b.jStorage_update)}catch(n){}else{if(y=document.createElement("link"),!y.addBehavior)return void(y=null);y.style.behavior="url(#default#userData)",document.getElementsByTagName("head")[0].appendChild(y);try{y.load("jStorage")}catch(i){y.setAttribute("jStorage","{}"),y.save("jStorage"),y.load("jStorage")}var u="{}";try{u=y.getAttribute("jStorage")}catch(g){}try{O=y.getAttribute("jStorage_update")}catch(l){}b.jStorage=u,T="userDataBehavior"}s(),c(),r(),_(),"addEventListener"in window&&window.addEventListener("pageshow",function(e){e.persisted&&a()},!1)}function t(){var e="{}";if("userDataBehavior"==T){y.load("jStorage");try{e=y.getAttribute("jStorage")}catch(t){}try{O=y.getAttribute("jStorage_update")}catch(r){}b.jStorage=e}s(),c(),_()}function r(){"localStorage"==T||"globalStorage"==T?"addEventListener"in window?window.addEventListener("storage",a,!1):document.attachEvent("onstorage",a):"userDataBehavior"==T&&setInterval(a,1e3)}function a(){var e;clearTimeout(L),L=setTimeout(function(){if("localStorage"==T||"globalStorage"==T)e=b.jStorage_update;else if("userDataBehavior"==T){y.load("jStorage");try{e=y.getAttribute("jStorage_update")}catch(t){}}e&&e!=O&&(O=e,o())},25)}function o(){var e,r=h.parse(h.stringify(p.__jstorage_meta.CRC32));t(),e=h.parse(h.stringify(p.__jstorage_meta.CRC32));var a,o=[],i=[];for(a in r)if(r.hasOwnProperty(a)){if(!e[a]){i.push(a);continue}r[a]!=e[a]&&"2."==String(r[a]).substr(0,2)&&o.push(a)}for(a in e)e.hasOwnProperty(a)&&(r[a]||o.push(a));n(o,"updated"),n(i,"deleted")}function n(e,t){e=[].concat(e||[]);var r,a,o,n;if("flushed"==t){e=[];for(var i in C)C.hasOwnProperty(i)&&e.push(i);t="deleted"}for(r=0,o=e.length;o>r;r++){if(C[e[r]])for(a=0,n=C[e[r]].length;n>a;a++)C[e[r]][a](e[r],t);if(C["*"])for(a=0,n=C["*"].length;n>a;a++)C["*"][a](e[r],t)}}function i(){var e=(+new Date).toString();if("localStorage"==T||"globalStorage"==T)try{b.jStorage_update=e}catch(t){T=!1}else"userDataBehavior"==T&&(y.setAttribute("jStorage_update",e),y.save("jStorage"));a()}function s(){if(b.jStorage)try{p=h.parse(String(b.jStorage))}catch(e){b.jStorage="{}"}else b.jStorage="{}";v=b.jStorage?String(b.jStorage).length:0,p.__jstorage_meta||(p.__jstorage_meta={}),p.__jstorage_meta.CRC32||(p.__jstorage_meta.CRC32={})}function u(){d();try{b.jStorage=h.stringify(p),y&&(y.setAttribute("jStorage",b.jStorage),y.save("jStorage")),v=b.jStorage?String(b.jStorage).length:0}catch(e){}}function g(e){if("string"!=typeof e&&"number"!=typeof e)throw new TypeError("Key name must be string or numeric");if("__jstorage_meta"==e)throw new TypeError("Reserved key name");return!0}function c(){var e,t,r,a,o=1/0,s=!1,g=[];if(clearTimeout(m),p.__jstorage_meta&&"object"==typeof p.__jstorage_meta.TTL){e=+new Date,r=p.__jstorage_meta.TTL,a=p.__jstorage_meta.CRC32;for(t in r)r.hasOwnProperty(t)&&(r[t]<=e?(delete r[t],delete a[t],delete p[t],s=!0,g.push(t)):r[t]=0;e--)r=p.__jstorage_meta.PubSub[e],r[0]>D&&(a=r[0],o.unshift(r));for(e=o.length-1;e>=0;e--)l(o[e][1],o[e][2]);D=a}}function l(e,t){if(P[e])for(var r=0,a=P[e].length;a>r;r++)try{P[e][r](e,h.parse(h.stringify(t)))}catch(o){}}function d(){if(p.__jstorage_meta.PubSub){for(var e=+new Date-2e3,t=0,r=p.__jstorage_meta.PubSub.length;r>t;t++)if(p.__jstorage_meta.PubSub[t][0]<=e){p.__jstorage_meta.PubSub.splice(t,p.__jstorage_meta.PubSub.length-t);break}p.__jstorage_meta.PubSub.length||delete p.__jstorage_meta.PubSub}}function f(e,t){p.__jstorage_meta||(p.__jstorage_meta={}),p.__jstorage_meta.PubSub||(p.__jstorage_meta.PubSub=[]),p.__jstorage_meta.PubSub.unshift([+new Date,e,t]),u(),i()}function S(e,t){for(var r,a=e.length,o=t^a,n=0;a>=4;)r=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24,r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16),r^=r>>>24,r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^r,a-=4,++n;switch(a){case 3:o^=(255&e.charCodeAt(n+2))<<16;case 2:o^=(255&e.charCodeAt(n+1))<<8;case 1:o^=255&e.charCodeAt(n),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)}return o^=o>>>13,o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16),o^=o>>>15,o>>>0}var j="0.4.12",w=window.jQuery||window.$||(window.$={}),h={parse:window.JSON&&(window.JSON.parse||window.JSON.decode)||String.prototype.evalJSON&&function(e){return String(e).evalJSON()}||w.parseJSON||w.evalJSON,stringify:Object.toJSON||window.JSON&&(window.JSON.stringify||window.JSON.encode)||w.toJSON};if("function"!=typeof h.parse||"function"!=typeof h.stringify)throw new Error("No JSON support found, include //cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js to page");var m,p={__jstorage_meta:{CRC32:{}}},b={jStorage:"{}"},y=null,v=0,T=!1,C={},L=!1,O=0,P={},D=+new Date,A={isXML:function(e){var t=(e?e.ownerDocument||e:0).documentElement;return t?"HTML"!==t.nodeName:!1},encode:function(e){if(!this.isXML(e))return!1;try{return(new XMLSerializer).serializeToString(e)}catch(t){try{return e.xml}catch(r){}}return!1},decode:function(e){var t,r="DOMParser"in window&&(new DOMParser).parseFromString||window.ActiveXObject&&function(e){var t=new ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t};return r?(t=r.call("DOMParser"in window&&new DOMParser||window,e,"text/xml"),this.isXML(t)?t:!1):!1}};w.jStorage={version:j,set:function(e,t,r){if(g(e),r=r||{},"undefined"==typeof t)return this.deleteKey(e),t;if(A.isXML(t))t={_is_xml:!0,xml:A.encode(t)};else{if("function"==typeof t)return void 0;t&&"object"==typeof t&&(t=h.parse(h.stringify(t)))}return p[e]=t,p.__jstorage_meta.CRC32[e]="2."+S(h.stringify(t),2538058380),this.setTTL(e,r.TTL||0),n(e,"updated"),t},get:function(e,t){return g(e),e in p?p[e]&&"object"==typeof p[e]&&p[e]._is_xml?A.decode(p[e].xml):p[e]:"undefined"==typeof t?null:t},deleteKey:function(e){return g(e),e in p?(delete p[e],"object"==typeof p.__jstorage_meta.TTL&&e in p.__jstorage_meta.TTL&&delete p.__jstorage_meta.TTL[e],delete p.__jstorage_meta.CRC32[e],u(),i(),n(e,"deleted"),!0):!1},setTTL:function(e,t){var r=+new Date;return g(e),t=Number(t)||0,e in p?(p.__jstorage_meta.TTL||(p.__jstorage_meta.TTL={}),t>0?p.__jstorage_meta.TTL[e]=r+t:delete p.__jstorage_meta.TTL[e],u(),c(),i(),!0):!1},getTTL:function(e){var t,r=+new Date;return g(e),e in p&&p.__jstorage_meta.TTL&&p.__jstorage_meta.TTL[e]?(t=p.__jstorage_meta.TTL[e]-r,t||0):0},flush:function(){return p={__jstorage_meta:{CRC32:{}}},u(),i(),n(null,"flushed"),!0},STORAGE_OBJ:function(){function e(){}return e.prototype=p,new e},index:function(){var e,t=[];for(e in p)p.hasOwnProperty(e)&&"__jstorage_meta"!=e&&t.push(e);return t},storageSize:function(){return v},currentBackend:function(){return T},storageAvailable:function(){return!!T},listenKeyChange:function(e,t){g(e),C[e]||(C[e]=[]),C[e].push(t)},stopListening:function(e,t){if(g(e),C[e]){if(!t)return void delete C[e];for(var r=C[e].length-1;r>=0;r--)C[e][r]==t&&C[e].splice(r,1)}},subscribe:function(e,t){if(e=(e||"").toString(),!e)throw new TypeError("Channel not defined");P[e]||(P[e]=[]),P[e].push(t)},publish:function(e,t){if(e=(e||"").toString(),!e)throw new TypeError("Channel not defined");f(e,t)},reInit:function(){t()},noConflict:function(e){return delete window.$.jStorage,e&&(window.jStorage=this),this}},e()}();
/**
* JQuery Cookie (compressed)
* https://github.com/carhartl/jquery-cookie
**/
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){function n(e){return u.raw?e:encodeURIComponent(e)}function o(e){return u.raw?e:decodeURIComponent(e)}function i(e){return n(u.json?JSON.stringify(e):String(e))}function t(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(c," ")),u.json?JSON.parse(e):e}catch(n){}}function r(n,o){var i=u.raw?n:t(n);return e.isFunction(o)?o(i):i}var c=/\+/g,u=e.cookie=function(t,c,s){if(arguments.length>1&&!e.isFunction(c)){if(s=e.extend({},u.defaults,s),"number"==typeof s.expires){var a=s.expires,d=s.expires=new Date;d.setMilliseconds(d.getMilliseconds()+864e5*a)}return document.cookie=[n(t),"=",i(c),s.expires?"; expires="+s.expires.toUTCString():"",s.path?"; path="+s.path:"",s.domain?"; domain="+s.domain:"",s.secure?"; secure":""].join("")}for(var f=t?void 0:{},p=document.cookie?document.cookie.split("; "):[],l=0,m=p.length;m>l;l++){var x=p[l].split("="),g=o(x.shift()),j=x.join("=");if(t===g){f=r(j,c);break}t||void 0===(j=r(j))||(f[g]=j)}return f};u.defaults={},e.removeCookie=function(n,o){return e.cookie(n,"",e.extend({},o,{expires:-1})),!e.cookie(n)}});
if (true) {
if( typeof jQuery == "undefined" ){
throw "I couldn't load jQuery library";
}
jQuery(function($) {
"use strict";
/**
* Informational div class, appends div absolutely positioned into the document and allows to display it next to any HTML element
* APPLICATION INDEPENDEND CLASS
* DEPENDENT ON: jQuery library
*/
function InfoAbsoluteDivClass(OPTIONS) {
"use strict";
if(typeof $ == "undefined"){
throw "jQuery library not found!!";
}
$.extend(OPTS,OPTIONS);
var INFO_DIV_CLASS = this;
var uniqueId = "InfoAbsoluteDiv"+((new Date()).getTime());
var getInfoDivStyle = function(){
return INFO_DIV_CLASS.getIdWithHash() + ' { ' + OPTS.css + ' } ';
};
var OPTS = {
rightFromObject: 70,
upFromObject: 70,
css: 'position:absolute; padding:20px 30px; top:0; left:0; border:1px solid black; background:#fff; z-index:9999; font-size:15px; display:none;'
};
////////////////// PUBLIC /////////////////////////////////////////////////////////
this.appendToDocument = function(){
$('head').append("");
var div = '
';
$(document.body).prepend(div);
};
this.showNextToObject = function(currentObject, info){
var obj = $(currentObject);
var position = obj.offset();
var pTop = (parseInt(position.top) - OPTS.upFromObject);
var pLeft = (parseInt(position.left) + OPTS.rightFromObject);
$(INFO_DIV_CLASS.getIdWithHash()).css({ left:pLeft+"px", top:pTop+"px"}).html(info).show();
};
this.hide = function(){
$(INFO_DIV_CLASS.getIdWithHash()).hide();
};
this.getId = function(){
return uniqueId;
};
this.getIdWithHash = function(){
return "#" + uniqueId;
};
}
///////////////////////////// STORAGE IMPLEMENTATION WITH jStorage usage ////////////////////////////////////////////////////////
/**
* storage object is a class that uses jStorage library to easy set, get and remove values from it
* APPLICATION INDEPENDENT CLASS
* example usage:
*
* var SO = new StorageObjectClass();
* SO.setValue("OK"); //value is stored in StorageObjectClass
* console.log( SO.getValue() ); // "OK"
*
*/
function StorageObjectClass(OPTIONS){
"use strict";
if(typeof $ == "undefined"){
throw "jQuery library not found!!";
}
if(typeof $.jStorage == "undefined"){
throw "jStorage plugin not found!!";
}
var OPTS = {
keyName: "facebookHidePost",
TTL: 1000*3600*24*356 /* 1 year */
};
$.extend(OPTS,OPTIONS);
$.jStorage.setTTL(OPTS.keyName, OPTS.TTL);
$.jStorage.reInit();
this.getValue = function(){
return $.jStorage.get(OPTS.keyName, "");
};
this.getSize = function(){
return $.jStorage.storageSize(OPTS.keyName);
};
this.setValue = function(value){
$.jStorage.set(OPTS.keyName, value, { TTL: OPTS.TTL });
};
this.removeValue = function(){
$.jStorage.deleteKey(OPTS.keyName);
};
this.reInit = function(){
$.jStorage.reInit();
};
}
/** class used to bind MutationObserver events to the specified elements (selector)
* which is triggerd while elements are changed dynamically
* more: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
* APPLICATION INDEPENDENT CLASS
* DEPENDENT ON: jQuery library
* example usage:
*
* var MO = new MutationObserverClass()
* MO.observeAddedNodesIn("#myDiv", function(addedNodes){ $(addedNodes).remove() } ); //instantly remove added nodes
*/
function MutationObserverClass(OPTIONS){
"use strict";
if(typeof $ == "undefined"){
throw "jQuery library not found!!";
}
var OPTS = {
defaultAddedConfig: { childList: true, characterData: true, attributes: true, subtree: true },
filterCSSRule: "" /** Adds jQuery css filter rule jQuery(mutation.addedNodes).filter(filterCSSRule) */
};
$.extend(OPTS,OPTIONS);
var addedNodesAdditionalCallbacks = [];
/**
* You can pass additional callback to once defined mutation observer,
* So it will be called while nodes will be added to the observed container
*/
this.addAddedNodesCallback = function(callback){
if(typeof callback != "function"){
throw "callback is not a function";
}
addedNodesAdditionalCallbacks.push(callback);
};
this.clearAddedNodesCallbacks = function(){
addedNodesAdditionalCallbacks = [];
};
this.observeAddedNodesIn = function(selector, mutationAddedNodesCallback){
function addedNodesHandler(mutationRecords) {
mutationRecords.forEach(function(mutation) {
if (typeof mutation.addedNodes == "object") {
var addedNodes = $(mutation.addedNodes);
if(OPTS.filterCSSRule.length > 0){
addedNodes = addedNodes.filter(OPTS.filterCSSRule);
}
if(addedNodesAdditionalCallbacks.length > 0){
for (var i=0; i=0){ n++; pos+=step; } else break;
}
return(n);
},
/**
* This function is substitute to:
* "aa,bb,cc".split(",").length
*
*/
countLikeSplittedArray: function(string, separator){
if(string.length < 1){
return 0;
}
var occurences = DOMINIK_TOOLS.string.occurrencesOfSubstring(string,separator);
return (occurences + 1);
},
/**
* Function checks if @search param is in the @baseStr, but as it would be an array splitted by @separator
* In other words this code:
* function searchBySplit(str){
* var arr = str.split(",");
* for(var i=0; i 0;
};
this.getFacebookPostIdByDivId = function (strId) {
if (strId.indexOf('_') == - 1) {
OPTS.DOMINIK_TOOLS.debug('Error parsing facebook post id... wrong div id format: ' + strId);
return null;
}
var s = strId.split('_') [2];
if(s.length < 1){
OPTS.DOMINIK_TOOLS.debug('Error parsing facebook post id... can\'t split post id string: ' + strId);
return null;
}
return s;
};
this.removePosts = function(){
OPTS.STORAGE_OBJ.removeValue();
};
this.getPostsIdsArray = function(){
try {
var store = OPTS.STORAGE_OBJ.getValue();
} catch (err){
console.log(err);
}
return OPTS.DOMINIK_TOOLS.string.toArray( store );
};
this.getPostsIdsArrayLength = function(){
return OPTS.DOMINIK_TOOLS.string.countLikeSplittedArray(OPTS.STORAGE_OBJ.getValue(), ",");
};
this.isPostIdInStorage = function(id) {
//faster version of previous code which splits string to array and searches by looping over it
return OPTS.DOMINIK_TOOLS.string.checkLikeInArray(OPTS.STORAGE_OBJ.getValue(), id, ",");
};
this.savePostIdToStorage = function(id) {
if (!FACEBOOK_TOOLS.isPostIdInStorage(id)) {
var ids = OPTS.DOMINIK_TOOLS.string.toArray(OPTS.STORAGE_OBJ.getValue());
ids.push(id);
OPTS.STORAGE_OBJ.setValue(OPTS.DOMINIK_TOOLS.array.toString(ids));
}
};
this.setVar = function(name, value){
OPTS.DOMINIK_TOOLS.globalVar.set(name, value);
};
this.getVar = function(name){
return OPTS.DOMINIK_TOOLS.globalVar.get(name);
};
this.appendHidePostLinkCSS = function(){
$('head').append('');
};
/**
* function puts post to hidden and removes it's div from the document
*/
this.savePostToHiddenAndRemoveByDivId = function(postDivId){
if(!postDivId){
console.log("postDivId is empty");
return;
}
var facebookPostId = FACEBOOK_TOOLS.getFacebookPostIdByDivId(postDivId);
FACEBOOK_TOOLS.savePostIdToStorage(facebookPostId);
FACEBOOK_TOOLS.removePostDivFromHTML(postDivId);
FACEBOOK_TOOLS.setVar('currentPostsInStorage', FACEBOOK_TOOLS.getVar('currentPostsInStorage')+1);
};
this.getHideAndSavePostLink = function(){
var INFO_ABSOLUTE_DIV = OPTS.INFO_ABSOLUTE_DIV;
var linkObject = $('Hide&Save')
.click(function () {
INFO_ABSOLUTE_DIV.hide();
var postDivId = $(this).parent().attr('id');
FACEBOOK_TOOLS.savePostToHiddenAndRemoveByDivId( postDivId );
}).hover(function(){
var info = "Hide post and save to hidden so after page reload they'll be atomatically hidden.";
info += ' You\'ve now added ';
info += FACEBOOK_TOOLS.getVar('currentPostsInStorage');
info += ' / ';
info += FACEBOOK_TOOLS.getVar('maxPostsInStorage');
info += 'posts (storage size is limited to 5 MB)';
INFO_ABSOLUTE_DIV.showNextToObject(this, info);
}, function(){
INFO_ABSOLUTE_DIV.hide();
});
return linkObject;
};
this.getHidePostLink = function(){
var INFO_ABSOLUTE_DIV = OPTS.INFO_ABSOLUTE_DIV;
var linkObject = $('Hide')
.click(function () {
INFO_ABSOLUTE_DIV.hide();
var postDivId = $(this).parent().attr('id');
FACEBOOK_TOOLS.removePostDivFromHTML(postDivId);
}).hover(function(){
var info = "Click this to just hide the post without saving to hidden.";
info += "It will be visible again if you reload the page";
INFO_ABSOLUTE_DIV.showNextToObject(this, info);
}, function(){
INFO_ABSOLUTE_DIV.hide();
});
return linkObject;
};
/**
* Escapes colon in facebook post id, jQuery doesn't tolarate colons in id's
*/
this.getjQueryPostIdByDivId = function(postDivId){
return '[id="' + postDivId.replace(new RegExp(":", 'g'),"\\:") + '"]';
};
this.removePostDivFromHTML = function(postObjOrPostId){
if(typeof postObjOrPostId == "string"){
postObjOrPostId = FACEBOOK_TOOLS.getjQueryPostIdByDivId(postObjOrPostId);
}
if($(postObjOrPostId).size() < 1){
console.log("There is no post with id: " + postObjOrPostId);
return;
}
$(postObjOrPostId).unbind().remove();
};
this.getClearHiddenLink = function(){
var INFO_ABSOLUTE_DIV = OPTS.INFO_ABSOLUTE_DIV;
var linkObject = $('Clear-Hidden')
.click(function(){
if(confirm("You're sure you want to remove all the hidden posts?")){
FACEBOOK_TOOLS.removePosts();
INFO_ABSOLUTE_DIV.hide();
if(confirm("Do you want to refresh the page to show previously hidden posts?")){
location.reload();
}
}
}).hover(function(){
var info = 'By clicking this, you will clear hidden posts, and refresh the page';
INFO_ABSOLUTE_DIV.showNextToObject(this, info);
}, function(){
INFO_ABSOLUTE_DIV.hide();
});
return linkObject;
};
this.checkIfThisIsFacebookPostDiv = function(obj){
return $(obj).is(OPTS.postCSS);
};
this.appendFunctionalLinksToPosts = function(selectorOrObjects){
$(selectorOrObjects).each(function () {
var t = $(this);
if(!FACEBOOK_TOOLS.checkIfThisIsFacebookPostDiv(t)){
return true;
}
//console.log(t.attr("id") + "\n");
if (t.prop(OPTS.hidePostLinkCSSClass)) {
return true;
}
var divId = t.attr('id');
if(typeof divId == "undefined"){
//console.log("PROBLEM WITH OBJECT : ");
//console.log(t);
return true;
}
var facebookPostId = FACEBOOK_TOOLS.getFacebookPostIdByDivId(divId);
if (FACEBOOK_TOOLS.isPostIdInStorage(facebookPostId)) {
//console.log("I removed: " + divId);
FACEBOOK_TOOLS.removePostDivFromHTML(t);
return true;
}
t.prop(OPTS.hidePostLinkCSSClass, true)
.prepend(' ')
.prepend( FACEBOOK_TOOLS.getHidePostsOnPage() )
.prepend( FACEBOOK_TOOLS.getHidePostsToDateLink() )
.prepend( FACEBOOK_TOOLS.getClearHiddenLink() )
.prepend( FACEBOOK_TOOLS.getHideAndSavePostLink() )
.prepend( FACEBOOK_TOOLS.getHidePostLink() );
//console.log("Added links to: " + divId);
});
};
/**
* Returns first found post id size and treat it as average post id size.
*/
this.getAveragePostIdSize = function(){
var divId = $(OPTS.postCSS).eq(0).attr("id");
if(typeof divId == "undefined"){
var e = "getAveragePostIdSize(): Post wasn't loaded on time, getting facebook div id size as 22 chars";
console.log(e);
return 22;
}
var postId = FACEBOOK_TOOLS.getFacebookPostIdByDivId(divId);
return postId.length;
};
this.prepareGlobalVars = function(){
FACEBOOK_TOOLS.setVar('averagePostIdSize', FACEBOOK_TOOLS.getAveragePostIdSize()); //MAX 20 chars is a post id
FACEBOOK_TOOLS.setVar('maxPostsInStorage', parseInt(5000000 / FACEBOOK_TOOLS.getVar('averagePostIdSize')) ); //5MB is storage object size in modern browsers
FACEBOOK_TOOLS.setVar('currentPostsInStorage', parseInt(FACEBOOK_TOOLS.getPostsIdsArrayLength()));
};
this.intervalFunction = function(selectorOrObjects){
FACEBOOK_TOOLS.appendFunctionalLinksToPosts(selectorOrObjects);
};
this.initStorage = function(){
OPTS.STORAGE_OBJ.reInit();
};
///////////////////////// HIDING CUSTOM POSTS ///////////////////////////////////
///////////////////////// HIDING CUSTOM POSTS ///////////////////////////////////
///////////////////////// HIDING CUSTOM POSTS ///////////////////////////////////
///////////////////////// HIDING CUSTOM POSTS ///////////////////////////////////
this.getHidePostsOnPage = function(){
var INFO_ABSOLUTE_DIV = OPTS.INFO_ABSOLUTE_DIV;
var linkObject = $('Hide-Visible')
.click(function(){
INFO_ABSOLUTE_DIV.hide();
$(FACEBOOK_TOOLS.getOPTS().postCSS).each(function(){
FACEBOOK_TOOLS.savePostToHiddenAndRemoveByDivId( $(this).attr('id') );
});
}).hover(function(){
var info = 'By clicking this, you will hide all posts that are currently visible on page';
INFO_ABSOLUTE_DIV.showNextToObject(this, info);
}, function(){
INFO_ABSOLUTE_DIV.hide();
});
return linkObject;
};
this.getHidePostsToDateLink = function(){
var INFO_ABSOLUTE_DIV = OPTS.INFO_ABSOLUTE_DIV;
if(typeof FACEBOOK_TOOLS.__DATE_PICK_ABSOLUTE_DIV == "undefined"){
var DATE_PICK_ABSOLUTE_DIV = new InfoAbsoluteDivClass();
FACEBOOK_TOOLS.__DATE_PICK_ABSOLUTE_DIV = DATE_PICK_ABSOLUTE_DIV;
DATE_PICK_ABSOLUTE_DIV.appendToDocument();
} else {
var DATE_PICK_ABSOLUTE_DIV = FACEBOOK_TOOLS.__DATE_PICK_ABSOLUTE_DIV;
}
var linkObject = $('Hide-To-Date')
.click(function () {
INFO_ABSOLUTE_DIV.hide();
var hidePostsButtonId = DATE_PICK_ABSOLUTE_DIV.getId() +'_hidePosts';
var hideAndSavePostsButtonId = DATE_PICK_ABSOLUTE_DIV.getId() +'_hideAndSavePosts';
var dateFieldId = DATE_PICK_ABSOLUTE_DIV.getId() +'_dateField';
var postObject = $(this).parents(FACEBOOK_TOOLS.getOPTS().postCSS).eq(0);
var postDDMMYYYY = FACEBOOK_TOOLS.getPostDDMMYYYY(postObject);
var info = '
Put date in format DD-MM-YYYY, to which all post newer should be hidden ';
info += 'NOTE: that it may take time if you give some old date, because all dynamically added posts (while scrolling down) will be hiding. ';
info += 'NOTE: "Just hide newer posts!" will just hide posts, "Hide&Save newer posts!" will hide and save posts to hidden (they won\'t show after page reload) ';
info += 'Date: ';
info += ' ';
info += ' ';
info += '';
info += '
';
DATE_PICK_ABSOLUTE_DIV.showNextToObject(this, info);
$(".datePickAbsoluteDivInfo").css({ fontSize:"13px"});
// Hide&Save post button action
$("#" + hideAndSavePostsButtonId).click(function(){
var DDMMYYYY = $("#" + dateFieldId).val();
if(!DDMMYYYY.match(/\d{2}-\d{2}-\d{4}/)){
alert("Given date has wrong format you have to give something like 11-12-2015");
return;
}
if(confirm("You're sure you want to hide posts newer than: " + DDMMYYYY + "\n" + "All newer posts will be dynamically removed,\nuntil you refresh the page.")){
FACEBOOK_TOOLS.hideAndSavePostsAndStartHidingObserver(DDMMYYYY);
}
DATE_PICK_ABSOLUTE_DIV.hide();
});
// Just hide button action
$("#" + hidePostsButtonId).click(function(){
var DDMMYYYY = $("#" + dateFieldId).val();
if(!DDMMYYYY.match(/\d{2}-\d{2}-\d{4}/)){
alert("Given date has wrong format you have to give something like 11-12-2015");
return;
}
if(confirm("You're sure you want to hide posts newer than: " + DDMMYYYY + "\n" + "All newer posts will be dynamically removed,\nuntil you refresh the page.")){
FACEBOOK_TOOLS.hidePostsAndStartHidingObserver(DDMMYYYY);
}
DATE_PICK_ABSOLUTE_DIV.hide();
});
}).hover(function(){
var info = 'Click this to show date picker menu, where you can hide posts newer than choosed date';
INFO_ABSOLUTE_DIV.showNextToObject(this, info);
}, function(){
INFO_ABSOLUTE_DIV.hide();
});
return linkObject;
};
this.getPostUtime = function(postObject){
return $(postObject).find("abbr._5ptz").attr("data-utime");
};
/**
* Gets formatted date from the postObject in format DD-MM-YYYY
*/
this.getPostDDMMYYYY = function(postObject){
var postUtime = FACEBOOK_TOOLS.getPostUtime(postObject);
var DDMMYYYY = OPTS.DOMINIK_TOOLS.date.DDMMYYYYFromMicrotime(postUtime);
return DDMMYYYY;
};
/**
* Hides facebook posts that are never than date DDMMYYYY
* @param DDMMYYYY - date in format like 22-02-2015
* @param postsObjects - array of DOM objects of posts divs
* @param justHide - boolean, if TRUE posts are gonna be just hidden (removed from HTML),
* if FALSE posts are gonna be removed from HTML, and saved as hidden to storage object of the browser
*/
this.hideAndSavePostsNewerThanDateDDMMYYYY = function(DDMMYYYY, postsObjects, justHide){
var time = (OPTS.DOMINIK_TOOLS.date.parseDateDDMMYYYY(DDMMYYYY).getTime())/1000;
// here we must add 24h because we need to hide posts up to day after the date inclusive
time += 3600*24;
if(!time){
console.log("time is empty");
return;
}
$(postsObjects).each(function(){
var p = $(this);
var postDivId = p.attr("id");
var postTime = FACEBOOK_TOOLS.getPostUtime(p);
if(postTime > time){
if(!justHide){
//save to hidden and remove from HTML
FACEBOOK_TOOLS.savePostToHiddenAndRemoveByDivId(postDivId);
} else {
//only remove from HTML
FACEBOOK_TOOLS.removePostDivFromHTML(postDivId);
}
}
});
};
/**
* Starts observer of incoming posts. All newly added will be observed and removed if they'll have microtime bigger that defined by the user
* @param DDMMYYYY - date in format like 22-02-2015
* @param justHide - boolean, if TRUE posts are gonna be just hidden (removed from HTML),
* if FALSE posts are gonna be removed from HTML, and saved as hidden to storage object of the browser
*/
this.__hideOrSavePostsAndStartHidingObserver = function(DDMMYYYY, justHide){
//hide currently existent posts on the page
FACEBOOK_TOOLS.hideAndSavePostsNewerThanDateDDMMYYYY(DDMMYYYY, $(OPTS.postCSS), justHide);
//clear previously added nodes
OPTS.MUTATION_OBSERVER.clearAddedNodesCallbacks();
//init hiding observer
OPTS.MUTATION_OBSERVER.addAddedNodesCallback(function(addedNodes){
FACEBOOK_TOOLS.hideAndSavePostsNewerThanDateDDMMYYYY(DDMMYYYY, addedNodes, justHide);
});
};
/**
* Starts observer of incoming posts. All newly added will be observed and removed if they'll have microtime bigger that defined by the user
* @param DDMMYYYY - date in format like 22-02-2015
*/
this.hideAndSavePostsAndStartHidingObserver = function(DDMMYYYY){
FACEBOOK_TOOLS.__hideOrSavePostsAndStartHidingObserver(DDMMYYYY,false);
};
/**
* Starts observer of incoming posts. All newly added will be observed and removed if they'll have microtime bigger that defined by the user
* @param DDMMYYYY - date in format like 22-02-2015
*/
this.hidePostsAndStartHidingObserver = function(DDMMYYYY){
FACEBOOK_TOOLS.__hideOrSavePostsAndStartHidingObserver(DDMMYYYY,true);
};
///////////////////////// HIDING CUSTOM POSTS EMD ///////////////////////////////////
///////////////////////// HIDING CUSTOM POSTS EMD ///////////////////////////////////
///////////////////////// HIDING CUSTOM POSTS EMD ///////////////////////////////////
///////////////////////// HIDING CUSTOM POSTS EMD ///////////////////////////////////
///////////////////////////// INIT METHODS ////////////////////////////////////
///////////////////////////// INIT METHODS ////////////////////////////////////
///////////////////////////// INIT METHODS ////////////////////////////////////
///////////////////////////// INIT METHODS ////////////////////////////////////
this.init = function(){
FACEBOOK_TOOLS.appendHidePostLinkCSS();
FACEBOOK_TOOLS.initStorage();
OPTS.INFO_ABSOLUTE_DIV.appendToDocument();
FACEBOOK_TOOLS.prepareGlobalVars();
console.log("init(): OK");
};
this.startObserver = function(){
//-------------- triggering interval function ----------------------------------
// no need to pass filter here, because CSS_RULE is accurate
FACEBOOK_TOOLS.intervalFunction(OPTS.postCSS);
// observe added nodes and apply intervalFunction action
OPTS.MUTATION_OBSERVER.observeAddedNodesIn(OPTS.groupPostsCSS, function(addedNodes){
FACEBOOK_TOOLS.intervalFunction(addedNodes);
});
console.log("startObserver(): OK");
};
}//facebookTools
function loadFacebookTools(){
try {
var FACEBOOK_TOOLS = new facebookTools(); //pass Storage object of the application
//temporary globalize
//-------------------------- INVOKE FUNCTIONS / SETUP GLOBALS ----------------------------------------------------
FACEBOOK_TOOLS.init();
var postsCheckTimeout = 20;
var cnt = 0;
var intervalID = setInterval(function(){
if(++cnt >= postsCheckTimeout){
window.clearInterval(intervalID);
}
if(!FACEBOOK_TOOLS.checkIfPostsAreLoaded()){
console.log("No posts loaded yet!");
return;
}
try { FACEBOOK_TOOLS.startObserver(); }
catch(err){ console.log(err); }
finally { window.clearInterval(intervalID); }
}, 1000);
} //try end
catch (err1) {
console.log(err1);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
loadFacebookTools();
// Overwrite pushState method of history object
(function(history){
var pushState = history.pushState;
history.pushState = function(state) {
if (typeof history.onpushstate == "function") {
history.onpushstate({state: state});
}
// here we can add our own functionality
loadFacebookTools();
//
return pushState.apply(history, arguments);
};
})(window.history);
//to browser history back/next buttons
window.addEventListener('popstate', function() {
loadFacebookTools();
});
}); //jQuery
}
} //FacebookHidePostWhole