").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);
function AllotIconMain()
{
var version = "Icon version: TelefonicaSMB 15.1.15.19";
// Redmine #37487 (CP040): This variable is used to determine the screen percentege that icon size takes up
var iconSizeScreenPercentage = 7;
var iconMinSizePx = 25;
var iconMaxSizePx = 40;
// Redmine #37736: This variable is used to determine if the icon must be removed when MutationObserver detects an attack
var destroyIfMutationDetected = true;
// Redmine #38369: This variable is used to determine if "Explanation Text" module must be shown
var showExplanationTextModule = true;
// Redmine #38369: This variable is used to determine if "Config Button" module must be shown
var showConfigButtonModule = true;
// #38822: This variable is used to determine if "Download URL" module must be shown
var showDownloadURL = true;
'use strict';
var dom = {};
dom.jquery = jQuery.noConflict(true);
var obs;
var launchAuditRequest = true;
///////////////////
// Configuration //
///////////////////
var AllotSettingsURL = 'http://www.conexionseguraempresas.movistar.es' ;
///////////
// Texts //
///////////
var overlayText = dom.jquery.parseJSON(
'{' +
'"header" : "Conexión Segura Empresas",' +
'"explanationTextHeader" : "DEGUSTACIÓN",' +
'"explanationTextBody" : "",' +
'"contactText" : "Cualquier consulta, contacte con el Administrador de su empresa",' +
'"moreInfoText" : "Consulte más información y contrate el servicio: www.movistar.es/empresas/aplicacionesdigitales/conexion-segura-empresas",' +
'"settingsButton" : "Accede a la configuración del servicio",' +
'"downloadURLText" : "Download your Unified Security app now:",' +
'"W" : "Filtrado Web",' +
'"V" : "Antivirus",' +
'"A" : "AdsFree",' +
'"P" : "Antiphishing",' +
'"L" : "Wolf"' +
'}'
);
var IconAllotStylesheetId = generateRandomID();
var IconAllotContainerId = generateRandomID();
var IconAllotWholeId = generateRandomID();
var IconAllotOrangeId = generateRandomID();
var iconbarId = generateRandomID();
var iconbarbgId = generateRandomID();
var iconbarimageId = generateRandomID();
var IconAllotPanelId = generateRandomID();
var IconAllotPanelLinksId = generateRandomID();
var IconAllotPanelLeftClass = generateRandomID();
var IconAllotPanelLeftId = generateRandomID();
var IconAllotPopularId = generateRandomID();
var iconbariconId = generateRandomID();
var IconAllotTabId = generateRandomID();
var IconAllotTabId2 = generateRandomID();
var IconAllotTabId3 = generateRandomID();
var IconAllotPanel2Id = generateRandomID();
var explanationTextId = generateRandomID();
var explanationTextParentId = generateRandomID();
var IconAllotButtonBarId = generateRandomID();
var IconAllotStatsId = generateRandomID();
var iconCBimage = generateRandomID();
var iconChevronImage = generateRandomID();
var downloadURLId = generateRandomID();
var downloadURLLinkId = generateRandomID();
var IconAllotServicesStatusId = generateRandomID();
var contactId = generateRandomID();
var moreInfoId = generateRandomID();
var moreInfoTabId = generateRandomID();
//////////////////////////////////////////
// Checks if vertical scroll is present //
//////////////////////////////////////////
function verticalScrollPresent() {
return (getViewportWidth().width !== document.documentElement.clientWidth);
}
//////////////////////////
// Get the scroll width //
//////////////////////////
function getScrollbarWidth() {
var outer = document.createElement("div");
outer.style.visibility = "hidden";
outer.style.width = "100px";
outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
document.body.appendChild(outer);
var widthNoScroll = outer.offsetWidth;
// force scrollbars
outer.style.overflow = "scroll";
// add inner div
var inner = document.createElement("div");
inner.style.width = "100%";
outer.appendChild(inner);
var widthWithScroll = inner.offsetWidth;
// remove divs
outer.parentNode.removeChild(outer);
return widthNoScroll - widthWithScroll;
}
//////////////////////////////////////////
// Get the width for the icon container //
//////////////////////////////////////////
function getIconContainerWidth()
{
var iconContainerWidth = getViewportWidth().width;
if(verticalScrollPresent()) {
iconContainerWidth = iconContainerWidth - getScrollbarWidth();
}
containerElem = document.getElementById(IconAllotContainerId);
if(containerElem) {
var bordT = dom.jquery("#" + IconAllotContainerId).outerWidth() - dom.jquery("#" + IconAllotContainerId).innerWidth();
var paddT = dom.jquery("#" + IconAllotContainerId).innerWidth() - dom.jquery("#" + IconAllotContainerId).width();
var margT = dom.jquery("#" + IconAllotContainerId).outerWidth(true) - dom.jquery("#" + IconAllotContainerId).outerWidth();
iconContainerWidth = iconContainerWidth - bordT - paddT - margT;
}
// minus default values
else {
iconContainerWidth = iconContainerWidth - 20; // 10 (padding-right) + 10 (padding-left) + 0 (border) + 0 (margin)
}
return iconContainerWidth;
}
///////////////////////
// Generation of IDs //
///////////////////////
function generateRandomID() {
var resID = "";
var charList = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
// Variable IDlength = Random number between 3 and 15 [Math.floor(Math.random()*(max-min+1)+min)]
var IDlength = Math.floor(Math.random() * 13) + 3;
for(var i = 0; i < IDlength; i++ )
resID += charList.charAt(Math.floor(Math.random() * charList.length));
return resID;
}
/////////////////////////////////
// Detection of mobile devices //
/////////////////////////////////
window.mobilecheck = function() {
return 'ontouchstart' in window || navigator.maxTouchPoints;
// 'ontouchstart' in window works on most browsers
// navigator.maxTouchPoints works on IE10/11 and Surface
};
////////////////////////////////////////////////
// Check if overalay icon data panel is shown //
////////////////////////////////////////////////
function isOpen() {
return dom.jquery("div#" + IconAllotPanelId).is(':visible');
}
/////////////////////////////////
// Draggable without jQuery UI //
/////////////////////////////////
(function(jq) {
jq.fn.drags = function(opt) {
opt = jq.extend({handle:"",cursor:"pointer"}, opt);
if(opt.handle === "") {
var $el = this;
} else {
var $el = this.find(opt.handle);
}
if(window.mobilecheck()) {
return $el.css('cursor', opt.cursor).on("touchstart", function(event) {
// Disconnecting MutationObserver object to avoid detecting user clicks on the icon/bar
if((obs) && (event) && (event.originalEvent)) {
if (event.originalEvent.hasOwnProperty("isTrusted")) {
if (event.originalEvent.isTrusted)
obs.disconnect();
} else
obs.disconnect();
}
var e = event.originalEvent;
if(opt.handle === "") {
var $drag = jq(this).addClass('draggable');
} else {
var $drag = jq(this).addClass('active-handle').parent().addClass('draggable');
}
var z_idx = $drag.css('z-index'),
drg_h = $drag.outerHeight(),
drg_w = $drag.outerWidth(),
pos_y = $drag.offset().top + drg_h - e.targetTouches[0].pageY,
pos_x = $drag.offset().left + drg_w - e.targetTouches[0].pageX;
jq(this).on("touchmove", function(event) {
var e = event.originalEvent;
e.preventDefault();
// Redmine 37360: Avoid undesirable effect in iOS >= 9 when moving the overlay icon
// Redmine: 44711: Icon is movable completely out of screen with the mobile in landscape mode.
var curr_pos = e.targetTouches[0].pageX + pos_x - drg_w;
if(curr_pos > 0 && curr_pos < getIconContainerWidth())
jq('.draggable').css('left', curr_pos + 'px');
});
}).on("touchend", function() {
if(opt.handle === "") {
jq(this).removeClass('draggable');
} else {
jq(this).removeClass('active-handle').parent().removeClass('draggable');
}
});
} else {
return $el.css('cursor', opt.cursor).on("mousedown", function(e) {
// Disconnecting MutationObserver object to avoid detecting user clicks on the icon/bar
if((obs) && (e) && (e.originalEvent)) {
if (e.originalEvent.hasOwnProperty("isTrusted")) {
if (e.originalEvent.isTrusted)
obs.disconnect();
} else
obs.disconnect();
}
if(opt.handle === "") {
var $drag = jq(this).addClass('draggable');
} else {
var $drag = jq(this).addClass('active-handle').parent().addClass('draggable');
}
var z_idx = $drag.css('z-index'),
drg_h = $drag.outerHeight(),
drg_w = $drag.outerWidth(),
pos_y = $drag.offset().top + drg_h - e.pageY,
pos_x = $drag.offset().left + drg_w - e.pageX;
$drag.css('z-index', 1000).parents().on("mousemove", function(e) {
var curr_pos = e.pageX + pos_x - drg_w;
if(curr_pos > 0 && curr_pos < getIconContainerWidth())
jq('.draggable').css('left', curr_pos + 'px');
});
e.preventDefault(); // disable selection
}).on("mouseup", function() {
if(opt.handle === "") {
jq(this).removeClass('draggable');
} else {
jq(this).removeClass('active-handle').parent().removeClass('draggable');
}
});
}
}
})(dom.jquery);
///////////////////////////////////////
// Click event on overlay icon/panel //
///////////////////////////////////////
function onTabOpenClick(p_event) {
// Disconnecting MutationObserver object to avoid detecting user clicks on the icon/bar
if((obs) && (p_event) && (p_event.originalEvent)) {
if (p_event.originalEvent.hasOwnProperty("isTrusted")) {
if (p_event.originalEvent.isTrusted)
obs.disconnect();
} else
obs.disconnect();
}
var __isOpen = isOpen();
var __panel1 = dom.jquery("div#" + IconAllotPanelId);
var __panel2 = dom.jquery("div#" + IconAllotPanel2Id);
if (p_event) {
p_event.stopPropagation();
}
if (!__isOpen) {
var newMargin = dom.jquery("#" + IconAllotPanelId).height() + dom.jquery("#" + IconAllotPanel2Id).height() + 15;
dom.jquery("#" + IconAllotContainerId).css('margin-bottom', newMargin);
}
else if (dom.jquery("#" + IconAllotContainerId).css('position') == 'relative') {
dom.jquery("#" + IconAllotContainerId).css('margin-bottom', "auto");
}
__panel1.slideToggle('slow');
__panel2.slideToggle('slow');
if(__isOpen) {
setTimeout(function(){
dom.jquery("#" + IconAllotWholeId).show();
},700);
// Redmine 37262: Make icon content scrollable just when it takes up all the screen
dom.jquery("div#" + IconAllotContainerId).css("height", "5px");
dom.jquery("div#" + IconAllotContainerId).css("overflow", "visible");
} else {
dom.jquery("#" + IconAllotWholeId).hide();
// Redmine 37262: Make icon content scrollable just when it takes up all the screen (and just for mobile devices)
dom.jquery("div#" + IconAllotContainerId).css("height", newMargin - 15);
if(window.mobilecheck() && ((navigator.userAgent.match(/iPad/i) == null) || (window.orientation == 0)) &&
(parseInt(dom.jquery("div#" + IconAllotContainerId).css("height")) >= getViewportWidth().height))
{
dom.jquery("div#" + IconAllotContainerId).css("height", "100%");
//dom.jquery("div#" + IconAllotContainerId).css("overflow", "scroll");
} else
dom.jquery("div#" + IconAllotContainerId).css("overflow", "visible");
}
dom.jquery("#" + iconbarId).removeClass('draggable');
}
//////////////////////////////////////////////
// Click event on whatever area of document //
//////////////////////////////////////////////
function onDocumentClick(p_event) {
if (isOpen() && (p_event.which == 1)) {
onTabOpenClick();
} else {
dom.jquery("#" + iconbarId).removeClass('draggable');
}
}
/////////////////////////////////////////////////
// Mouse up event on whatever area of document //
/////////////////////////////////////////////////
function onDocumentMouseUp(p_event) {
dom.jquery("#" + iconbarId).removeClass('draggable');
}
////////////////////////////////////////////////////////////////////////////
// Get the value of an URL parameter of the "OPTSmartBannerScript" script //
////////////////////////////////////////////////////////////////////////////
function getURLVarFromScript(name){
var regexp = new RegExp("[?|&]" + name + "(?:=([^&]*))?", "i");
var res = regexp.exec(decodeURIComponent(dom.jquery("#OPTSmartBannerScript").attr("src")));
if(res === null)
return undefined;
return res[1] || "";
}
///////////////////////////////////
// Get viewport width and height //
///////////////////////////////////
function getViewportWidth() {
var e = document.documentElement || document.body;
var a = 'client';
//console.log('window[innerWidth]' + window["innerWidth"] + '**e.tagName: ' + e.tagName + '**document.documentElement[clientWidth]: ' + document.documentElement["clientWidth"] + '**document.body[clientWidth]: ' + document.body["clientWidth"] + '**width : e[ ' + a + 'Width ]');
return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
}
dom.jquery(document).ready(
function() {
// Redmine #36691: Use the variable "version" to avoid minify tools remove it
// Redmine #38451: Move console.log to "ready" function
console.log(version);
// Avoid several icons when the host webpage is composed of several frames
for(var i=0; i
' +
'html{box-sizing:border-box;-moz-box-sizing:border-box;}' +
'div#' + IconAllotContainerId + ' {' +
' display: none;' +
' height: 5px;' +
//Redmine: 42689
' box-sizing:content-box;' +
' padding-left: 10px !important;' +
' padding-right: 10px !important;' +
' margin: 0px auto;' +
' overflow:visible;' +
' position: absolute;' +
' top: 0px !important;' +
' width: ' + getIconContainerWidth() + 'px;' +
' z-index: 2147483647 !important;' +
' font-size: 13px !important;' +
'}' +
' div#' + IconAllotContainerId + ' * {' +
' background: none;' +
' border: none !important;' +
' float: none !important;' +
' font-size: 90%;' +
' font-family: Arial, Helvetica, sans-serif !important;' +
' font-weight: normal !important;' +
' left:auto;' +
' line-height: 2ex !important;' +
' letter-spacing:0;' +
' margin: 0 !important;' +
' outline:none !important;' +
' padding: 0 !important;' +
' text-decoration: none !important;' +
' text-transform: none !important;' +
' text-shadow:none !important;' +
' vertical-align:middle !important;' +
' white-space:nowrap !important;' +
' z-index: 2147483647 !important;' +
' zoom: 1;' +
'}' +
' div#' + IconAllotContainerId + ' td {' +
' text-align: left !important;' +
'}' +
' div#' + IconAllotContainerId + ' {' +
' bottom : 0;' +
' clear : both !important;' +
' margin-bottom: 10px !important;' +
//inigo' margin-right : 13px !important;' +
// ' position : absolute !important;' +
//' width : 100% !important;' +
'}' +
' div#' + IconAllotButtonBarId + ' {' +
' bottom : 0;' +
' clear : both !important;' +
' margin-bottom: 0px !important;' +
' margin-right : 13px !important;' +
' width : 96% !important;' +
'}' +
' div#' + IconAllotContainerId + ' button {' +
' cursor : pointer' +
' display : inline !important;' +
' margin : 10px 2px !important;' +
' padding : 5px 10px !important;' +
'}' +
' div#' + IconAllotContainerId + ' button img {' +
' margin : 0 5px 0 0 !important;' +
'}' +
' div#' + IconAllotContainerId + ' button span {' +
' font-size : 1.8em;' +
' font-weight : bold !important;' +
' line-height : 1em !important;' +
'}' +
' div#' + IconAllotPanelId + ', div#' + IconAllotPanel2Id + ' {' +
' background-repeat: repeat-x !important;' +
' background-position: 0 100% !important;' +
' background-color: #ffffff !important;' +
' -moz-box-sizing: content-box;' +
' -moz-box-shadow: 0 5px 5px 5px #ccc;' +
' -ms-box-shadow: 0 5px 5px 5px #ccc;' +
' -o-box-shadow: 0 5px 5px 5px #ccc;' +
' -webkit-box-shadow: 0 5px 5px 5px #ccc;' +
' text-shadow: 0 1px 0 rgba(255, 255, 255, .8);' +
' -moz-border-radius-bottomright: 5px;' +
' -moz-border-radius-bottomleft: 5px;' +
' -ms-border-radius-bottomright: 5px;' +
' -ms-border-radius-bottomleft: 5px;' +
' -o-border-radius-bottomright: 5px;' +
' -o-border-radius-bottomleft: 5px;' +
' -webkit-border-radius-bottomright: 5px;' +
' -webkit-border-radius-bottomleft: 5px;' +
' color: #999999;' +
' display: none;' +
' overflow: hidden !important;' +
' position: relative !important;' +
' white-space: nowrap !important;' +
' width: 100%;' +
' height: auto;' +
'}' +
' div#' + IconAllotWholeId + ', div#' + IconAllotPanel2Id + ' {' +
' text-align: left !important;' +
'}' +
' div#' + IconAllotPanelId + ', div#' + IconAllotPanel2Id + ' div.' + IconAllotPanelLeftId + ', div#' + IconAllotPanelId + ' {' +
' overflow-x:hidden !important;' +
' overflow-y:auto !important;' +
' position: absolute;' +
' top: 0px !important;' +
' width: 100% !important;' +
' white-space:nowrap;' +
'}' +
' div#' + IconAllotPanelId + ', div#' + IconAllotPanel2Id + ' .' + IconAllotPanelLeftClass + ' {' +
' left: 0 !important;' +
'}' +
' div#' + IconAllotContainerId + ' div#' + IconAllotOrangeId + ' {' +
' overflow:visible !important;' +
' cursor: pointer' +
'}' +
' img#' + iconbarimageId + ', img#' + iconbariconId + ', img#' + iconbarbgId + ' {' +
' box-shadow : none !important;' +
' display : inline !important;' +
'}' +
' div#' + IconAllotContainerId + ' span {' +
' white-space: -moz-pre-wrap !important;' + /* Mozilla, since 1999 */
' white-space: -pre-wrap !important;' + /* Opera 4-6 */
' white-space: -o-pre-wrap !important;' + /* Opera 7 */
' white-space: pre-wrap !important;' + /* css-3 */
' word-wrap: break-word !important;' + /* Internet Explorer 5.5+ */
' white-space: normal !important;' +
'}' +
' img#' + iconCBimage + ' {' +
' box-shadow : none !important;' +
' display : inline !important;' +
'}' +
' img#' + iconChevronImage + ' {' +
' box-shadow : none !important;' +
' display : inline !important;' +
'}' +
' svg { ' +
' display : inline !important;' +
'}' +
''
);
var closeIcon = '' +
'';
var configIcon = '' +
'';
var chevronIcon = '' +
'';
var onIcon = '';
var offIcon = '';
dom.jquery('body').prepend('' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
overlayText.header +
'' +
'
' +
'
' +
'
' +
closeIcon +
'
' +
'
' +
'
' +
'
' +
'
' +
'' + overlayText.explanationTextHeader + ''+
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'' + overlayText.moreInfoText + '' +
'
' +
'
' +
'
' +
'
' +
'' + overlayText.contactText + '' +
'
' +
'
' +
'
' + overlayText.downloadURLText + '' +
'' + '' +
'
' +
'
' +
'
' +
'
'
);
if( !showExplanationTextModule ) {
dom.jquery('#' + explanationTextId).hide();
}
if( showConfigButtonModule ){
dom.jquery("#" + iconCBimage).append(configIcon);
dom.jquery("#" + iconCBimage + " svg").css("width", "32px").css("height", "32px");
dom.jquery("#" + iconChevronImage).append(chevronIcon);
dom.jquery("#" + iconChevronImage + " svg").css("width", "24px").css("height", "24px");
} else {
dom.jquery('#' + IconAllotButtonBarId).hide();
}
// Make the icon draggable
dom.jquery("#" + iconbarId).drags();
// Definition of SVG format of image
/*var orangeIcon = '';*/
var orangeIcon = '';
// Append images to corresponding divs and set SVGs width and height
dom.jquery("#" + iconbarimageId).append(orangeIcon);
dom.jquery("#" + iconbarbgId + " svg, #" + iconbarimageId + " svg, #" + iconbarId).css("width", "48px").css("height", "48px");
dom.jquery("#" + iconbariconId).append(orangeIcon);
dom.jquery("#" + iconbariconId + " svg").css("width", "32px").css("height", "32px");
// Tunning width's and height's depending on device type and device orientation
if(window.mobilecheck() && ((navigator.userAgent.match(/iPad/i) == null) || (window.orientation == 0))) {
dom.jquery("#" + IconAllotOrangeId).css('height','200%');
if((dom.jquery("#" + IconAllotOrangeId).css('height') == "0px") || (parseInt(dom.jquery("#" + IconAllotOrangeId).css('height')) > 2))
dom.jquery("#" + IconAllotOrangeId).css('height', '2px');
// Redmine #37487: Determining icon width and height depending on the configuration variables
var iconSizeFactor;
if((typeof iconSizeScreenPercentage === "undefined") || (iconSizeScreenPercentage < 1) || (iconSizeScreenPercentage > 100))
iconSizeFactor = 100/7;
else
iconSizeFactor = 100/iconSizeScreenPercentage;
var iconSize;
if(getViewportWidth().width/iconSizeFactor < iconMinSizePx)
iconSize = iconMinSizePx;
else if(getViewportWidth().width/iconSizeFactor > iconMaxSizePx)
iconSize = iconMaxSizePx;
else
iconSize = getViewportWidth().width/iconSizeFactor;
dom.jquery("#" + iconbarimageId + " svg, #" + iconbarbgId + " svg, #" + iconbarId)
.css("width", iconSize)
.css("height", iconSize);
} else {
dom.jquery("#" + IconAllotPanel2Id).css("min-width", "400px");
dom.jquery("#" + IconAllotPanel2Id).css("width", "26%");
dom.jquery("#" + IconAllotPanelId).css("min-width", "400px");
dom.jquery("#" + IconAllotPanelId).attr("style", function(i,s) { return s + 'width: 26% !important;' });
dom.jquery("#" + IconAllotOrangeId).css('height', '2px');
dom.jquery("#" + iconbarId).css('height', '');
dom.jquery("#" + iconbarimageId + ", #" + iconbarbgId).css('height','');
}
// Get the value of the parameters received from WebFilter
var view, uriMutationRequest, uriAuditRequest, downloadURL, servicesStatus, servicesType;
if(window.g_icon_parameters) { // Global variable does exist => New version of WebFilter
if(window.g_icon_parameters.hasOwnProperty("view"))
view = window.g_icon_parameters.view;
else
view = getURLVarFromScript('view');
if(window.g_icon_parameters.hasOwnProperty("uriMutationRequest"))
uriMutationRequest = window.g_icon_parameters.uriMutationRequest;
else
uriMutationRequest = getURLVarFromScript("uriMutationRequest");
if(window.g_icon_parameters.hasOwnProperty("uriAuditRequest"))
uriAuditRequest = window.g_icon_parameters.uriAuditRequest;
else
uriAuditRequest = getURLVarFromScript("uriAuditRequest");
if(window.g_icon_parameters.hasOwnProperty("DownloadURL"))
downloadURL = window.g_icon_parameters.DownloadURL;
else
downloadURL = getURLVarFromScript('DownloadURL');
if(window.g_icon_parameters.hasOwnProperty("servicesStatus"))
servicesStatus = window.g_icon_parameters.servicesStatus;
else
servicesStatus = getURLVarFromScript('servicesStatus');
if(window.g_icon_parameters.hasOwnProperty("type"))
servicesType = window.g_icon_parameters.servicesType;
else
servicesType = getURLVarFromScript('type');
} else { // Global variable does NOT exist => Old version of WebFilter
view = getURLVarFromScript('view');
uriMutationRequest = getURLVarFromScript("uriMutationRequest");
uriAuditRequest = getURLVarFromScript("uriAuditRequest");
downloadURL = getURLVarFromScript('DownloadURL');
servicesStatus = getURLVarFromScript('servicesStatus');
servicesType = getURLVarFromScript('type');
}
//type (degustacion, service) to show / hide text
if(servicesType == "degustacion") {
dom.jquery("#" + explanationTextParentId).show();
dom.jquery("#" + IconAllotTabId3).show();
dom.jquery("#" + moreInfoId).show();
dom.jquery("#" + moreInfoTabId).show();
}
// Set view style
if(view == "small")
dom.jquery("#" + IconAllotOrangeId).hide();
// #38822: Hide DownloadURL section if WebFilter sends a "-" (or empty) => installed_devices = true
if((!showDownloadURL) || (!downloadURL) || (downloadURL == "-") || (downloadURL == ""))
dom.jquery("#" + downloadURLId).hide();
else {
dom.jquery("#" + downloadURLLinkId).attr("href", downloadURL);
dom.jquery("#" + downloadURLLinkId).html(downloadURL);
dom.jquery("#" + downloadURLId).show();
}
// #46371, #45690: Show services status
if((servicesStatus === undefined) || (servicesStatus == "")) {
dom.jquery("#" + IconAllotServicesStatusId).hide();
dom.jquery("#" + IconAllotTabId2).hide();
} else {
servicesStatusArr = servicesStatus.split(";");
for(var i = 0; i < servicesStatusArr.length; ++i) {
if(servicesStatusArr[i] != "") {
var service = servicesStatusArr[i].split("=")[0];
var status = servicesStatusArr[i].split("=")[1];
var serviceName;
if(service == "W")
serviceName = overlayText.W;
else if(service == "V")
serviceName = overlayText.V;
else if(service == "A")
serviceName = overlayText.A;
else if(service == "P")
serviceName = overlayText.P;
else if(service == "L")
serviceName = overlayText.L;
var statusIcon = (status == 1) ? onIcon : offIcon;
dom.jquery("#" + IconAllotServicesStatusId).append(''+
'
'+
serviceName+
''+
'
'+
statusIcon+
'
'+
'
');
}
}
}
// Set events
var eventsSetInterval = setInterval(function() {
dom.jquery(document).off('click').on('click', onDocumentClick);
dom.jquery(document).on("mouseup", onDocumentMouseUp);
dom.jquery("#" + IconAllotButtonBarId).off('click').on('click', function (p_event) {
location.href = AllotSettingsURL;
});
dom.jquery("#" + IconAllotContainerId).off('click').on('click', onTabOpenClick);
dom.jquery(window).off("resize").on("resize", function(event) {
// Disconnecting MutationObserver object to avoid detecting user orientation change
if((obs) && (event) && (event.originalEvent)) {
if (event.originalEvent.hasOwnProperty("isTrusted")) {
if (event.originalEvent.isTrusted)
obs.disconnect();
} else
obs.disconnect();
}
// Redmine #37487: Determining icon width and height depending on the configuration variables
var iconSizeFactor, iconSize;
if((typeof iconSizeScreenPercentage === "undefined") || (iconSizeScreenPercentage < 1) || (iconSizeScreenPercentage > 100))
iconSizeFactor = 100/7;
else
iconSizeFactor = 100/iconSizeScreenPercentage;
if(getViewportWidth().width/iconSizeFactor < iconMinSizePx)
iconSize = iconMinSizePx;
else if(getViewportWidth().width/iconSizeFactor > iconMaxSizePx)
iconSize = iconMaxSizePx;
else
iconSize = getViewportWidth().width/iconSizeFactor;
dom.jquery("#" + iconbarimageId + " svg, #" + iconbarbgId + " svg")
.css("width", iconSize)
.css("height", iconSize);
dom.jquery("#" + IconAllotContainerId).css("width", getIconContainerWidth() + "px");
// #37262: Make icon content scrollable just when it takes up all the screen (and just for mobile devices)
if (isOpen()) {
var newHeight = dom.jquery("#" + IconAllotPanelId).height() + dom.jquery("#" + IconAllotPanel2Id).height() + 15;
dom.jquery("div#" + IconAllotContainerId).css("height", newHeight - 15);
if(window.mobilecheck() && ((navigator.userAgent.match(/iPad/i) == null) || (window.orientation == 0)) &&
(parseInt(dom.jquery("div#" + IconAllotContainerId).css("height")) >= getViewportWidth().height))
{
dom.jquery("div#" + IconAllotContainerId).css("height", "100%");
//dom.jquery("div#" + IconAllotContainerId).css("overflow", "scroll");
} else
dom.jquery("div#" + IconAllotContainerId).css("overflow", "visible");
}
});
}, 3000);
// Creating MutationObserver object
obs = new MutationObserver(function(mutations, observer){
mutations.forEach(function(mutation) {
clearInterval(eventsSetInterval);
clearInterval(stylesSetInterval);
// If detecting an attack, NO Audit Request must be launch for indicating that the icon has been loaded
launchAuditRequest = false;
// Remove overlay icon from DOM when detecting an attack
if(destroyIfMutationDetected)
dom.jquery("#" + IconAllotContainerId).remove();
// Launch GET request to indicate WF that an attack to overlay icon has been made (uriMutationRequest)
if(uriMutationRequest)
dom.jquery.get(uriMutationRequest, function( data ) {});
});
});
// Activating MutationObserver object
obs.observe( document.getElementById(IconAllotContainerId), { attributes:true, childList:true, subtree:true, characterData:true });
// Detect styles than may affect the icon
var stylesSetInterval = setInterval(function(){
var sheets = document.styleSheets;
var mySheetStyleRules = [];
var hostSheetStyleRules = [];
for (var i=0; i < sheets.length; ++i) {
var rules = sheets[i].rules || sheets[i].cssRules;
if(rules) {
for (var r=0; r < rules.length; ++r) {
if(rules[r].selectorText) {
var ruleSet = rules[r].selectorText.split(',');
for(var j=0; j < ruleSet.length; ++j) {
var currentRule = ruleSet[j].split(' ');
for(var k=0; k < currentRule.length; k++) {
var hashPosition = currentRule[k].indexOf('#');
if(hashPosition >= 0) {
if(sheets[i].ownerNode.id == IconAllotStylesheetId)
mySheetStyleRules.push(currentRule[k].substring(hashPosition));
else
hostSheetStyleRules.push(currentRule[k].substring(hashPosition));
}
}
}
}
}
}
}
var found = false;
var mySheetIndex = 0;
var hostSheetIndex = 0;
while((!found) && (mySheetIndex < mySheetStyleRules.length)) {
var currId = mySheetStyleRules[mySheetIndex];
while((!found) && (hostSheetIndex < hostSheetStyleRules.length)) {
if(hostSheetStyleRules[hostSheetIndex].indexOf(currId) >= 0) {
found = true;
clearInterval(eventsSetInterval);
clearInterval(stylesSetInterval);
// If detecting an attack, NO Audit Request must be launch for indicating that the icon has been loaded
launchAuditRequest = false;
// Remove overlay icon from DOM when detecting an attack
if(destroyIfMutationDetected)
dom.jquery("#" + IconAllotContainerId).remove();
// Launch GET request to indicate WF that an attack to overlay icon has been made (uriMutationRequest)
if(uriMutationRequest)
dom.jquery.get(uriMutationRequest, function( data ) {});
}
else
hostSheetIndex++;
}
if(!found)
mySheetIndex++;
}
}, 3000);
// Launch GET request to indicate WF that overlay icon has been correctly loaded (uriAuditRequest)
if(launchAuditRequest)
if(uriAuditRequest)
dom.jquery.get(uriAuditRequest, function( data ) {});
}
);
}
(function AllotIconLoader(i)
{
var script
, head = document.getElementsByTagName('head')[0]
, makeScript = function () {
script = document.createElement('script');
script.type = 'text/javascript';
}
, loadLocal = function (fn) {
makeScript();
script.textContent = '(' + fn.toString() + ')();';
head.appendChild(script);
}
;
(function (i) {
loadLocal(AllotIconMain);
})(i || 0);
})();