").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.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",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.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,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){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===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.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=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],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=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.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&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.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)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.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 Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=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 l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.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,Fn.push(o)),s&&x.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){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.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,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.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,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.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||(x.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?x.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=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.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)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return 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=x.timers,a=x._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)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),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}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.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,x.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},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.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?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
11 |
12 | /*!
13 | * jQuery Cookie Plugin v1.3.1
14 | * https://github.com/carhartl/jquery-cookie
15 | *
16 | * Copyright 2013 Klaus Hartl
17 | * Released under the MIT license
18 | */
19 | (function ($, document, undefined) {
20 |
21 | var pluses = /\+/g;
22 |
23 | function raw(s) {
24 | return s;
25 | }
26 |
27 | function decoded(s) {
28 | return unRfc2068(decodeURIComponent(s.replace(pluses, ' ')));
29 | }
30 |
31 | function unRfc2068(value) {
32 | if (value.indexOf('"') === 0) {
33 | // This is a quoted cookie as according to RFC2068, unescape
34 | value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
35 | }
36 | return value;
37 | }
38 |
39 | function fromJSON(value) {
40 | return config.json ? JSON.parse(value) : value;
41 | }
42 |
43 | var config = $.cookie = function (key, value, options) {
44 |
45 | // write
46 | if (value !== undefined) {
47 | options = $.extend({}, config.defaults, options);
48 |
49 | if (value === null) {
50 | options.expires = -1;
51 | }
52 |
53 | if (typeof options.expires === 'number') {
54 | var days = options.expires, t = options.expires = new Date();
55 | t.setDate(t.getDate() + days);
56 | }
57 |
58 | value = config.json ? JSON.stringify(value) : String(value);
59 |
60 | return (document.cookie = [
61 | encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
62 | options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
63 | options.path ? '; path=' + options.path : '',
64 | options.domain ? '; domain=' + options.domain : '',
65 | options.secure ? '; secure' : ''
66 | ].join(''));
67 | }
68 |
69 | // read
70 | var decode = config.raw ? raw : decoded;
71 | var cookies = document.cookie.split('; ');
72 | var result = key ? null : {};
73 | for (var i = 0, l = cookies.length; i < l; i++) {
74 | var parts = cookies[i].split('=');
75 | var name = decode(parts.shift());
76 | var cookie = decode(parts.join('='));
77 |
78 | if (key && key === name) {
79 | result = fromJSON(cookie);
80 | break;
81 | }
82 |
83 | if (!key) {
84 | result[name] = fromJSON(cookie);
85 | }
86 | }
87 |
88 | return result;
89 | };
90 |
91 | config.defaults = {};
92 |
93 | $.removeCookie = function (key, options) {
94 | if ($.cookie(key) !== null) {
95 | $.cookie(key, null, options);
96 | return true;
97 | }
98 | return false;
99 | };
100 |
101 | })(jQuery, document);
102 |
103 | /*!
104 | * sprintf and vsprintf for jQuery
105 | * somewhat based on http://jan.moesen.nu/code/javascript/sprintf-and-printf-in-javascript/
106 | * Copyright (c) 2008 Sabin Iacob (m0n5t3r)
107 | * @license http://www.gnu.org/licenses/gpl.html
108 | * @project jquery.sprintf
109 | */
110 | (function(d){var a={b:function(e){return parseInt(e,10).toString(2)},c:function(e){return String.fromCharCode(parseInt(e,10))},d:function(e){return parseInt(e,10)},u:function(e){return Math.abs(e)},f:function(f,e){e=parseInt(e,10);f=parseFloat(f);if(isNaN(e&&f)){return NaN}return e&&f.toFixed(e)||f},o:function(e){return parseInt(e,10).toString(8)},s:function(e){return e},x:function(e){return(""+parseInt(e,10).toString(16)).toLowerCase()},X:function(e){return(""+parseInt(e,10).toString(16)).toUpperCase()}};var c=/%(?:(\d+)?(?:\.(\d+))?|\(([^)]+)\))([%bcdufosxX])/g;var b=function(f){if(f.length==1&&typeof f[0]=="object"){f=f[0];return function(i,h,k,j,g,m,l){return a[g](f[j])}}else{var e=0;return function(i,h,k,j,g,m,l){if(g=="%"){return"%"}return a[g](f[e++],k)}}};d.extend({sprintf:function(f){var e=Array.apply(null,arguments).slice(1);return f.replace(c,b(e))},vsprintf:function(f,e){return f.replace(c,b(e))}})})(jQuery);
111 |
112 | /*
113 | * jQuery Autocomplete plugin 1.2.3
114 | *
115 | * Copyright (c) 2009 Jörn Zaefferer
116 | *
117 | * Dual licensed under the MIT and GPL licenses:
118 | * http://www.opensource.org/licenses/mit-license.php
119 | * http://www.gnu.org/licenses/gpl.html
120 | *
121 | * With small modifications by Alfonso Gómez-Arzola.
122 | * See changelog for details.
123 | *
124 | */
125 |
126 | ;(function($) {
127 |
128 | $.fn.extend({
129 | autocomplete: function(urlOrData, options) {
130 | var isUrl = typeof urlOrData == "string";
131 | options = $.extend({}, $.Autocompleter.defaults, {
132 | url: isUrl ? urlOrData : null,
133 | data: isUrl ? null : urlOrData,
134 | delay: isUrl ? $.Autocompleter.defaults.delay : 10,
135 | max: options && !options.scroll ? 10 : 150,
136 | noRecord: "No Records."
137 | }, options);
138 |
139 | // if highlight is set to false, replace it with a do-nothing function
140 | options.highlight = options.highlight || function(value) { return value; };
141 |
142 | // if the formatMatch option is not specified, then use formatItem for backwards compatibility
143 | options.formatMatch = options.formatMatch || options.formatItem;
144 |
145 | return this.each(function() {
146 | new $.Autocompleter(this, options);
147 | });
148 | },
149 | result: function(handler) {
150 | return this.bind("result", handler);
151 | },
152 | search: function(handler) {
153 | return this.trigger("search", [handler]);
154 | },
155 | flushCache: function() {
156 | return this.trigger("flushCache");
157 | },
158 | setOptions: function(options){
159 | return this.trigger("setOptions", [options]);
160 | },
161 | unautocomplete: function() {
162 | return this.trigger("unautocomplete");
163 | }
164 | });
165 |
166 | $.Autocompleter = function(input, options) {
167 |
168 | var KEY = {
169 | UP: 38,
170 | DOWN: 40,
171 | DEL: 46,
172 | TAB: 9,
173 | RETURN: 13,
174 | ESC: 27,
175 | COMMA: 188,
176 | PAGEUP: 33,
177 | PAGEDOWN: 34,
178 | BACKSPACE: 8
179 | };
180 |
181 | var globalFailure = null;
182 | if(options.failure != null && typeof options.failure == "function") {
183 | globalFailure = options.failure;
184 | }
185 |
186 | // Create $ object for input element
187 | var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
188 |
189 | var timeout;
190 | var previousValue = "";
191 | var cache = $.Autocompleter.Cache(options);
192 | var hasFocus = 0;
193 | var lastKeyPressCode;
194 | var config = {
195 | mouseDownOnSelect: false
196 | };
197 | var select = $.Autocompleter.Select(options, input, selectCurrent, config);
198 |
199 | var blockSubmit;
200 |
201 | // prevent form submit in opera when selecting with return key
202 | navigator.userAgent.indexOf("Opera") != -1 && $(input.form).bind("submit.autocomplete", function() {
203 | if (blockSubmit) {
204 | blockSubmit = false;
205 | return false;
206 | }
207 | });
208 |
209 | // older versions of opera don't trigger keydown multiple times while pressed, others don't work with keypress at all
210 | $input.bind((navigator.userAgent.indexOf("Opera") != -1 && !'KeyboardEvent' in window ? "keypress" : "keydown") + ".autocomplete", function(event) {
211 | // a keypress means the input has focus
212 | // avoids issue where input had focus before the autocomplete was applied
213 | hasFocus = 1;
214 | // track last key pressed
215 | lastKeyPressCode = event.keyCode;
216 | switch(event.keyCode) {
217 |
218 | case KEY.UP:
219 | if ( select.visible() ) {
220 | event.preventDefault();
221 | select.prev();
222 | } else {
223 | onChange(0, true);
224 | }
225 | break;
226 |
227 | case KEY.DOWN:
228 | if ( select.visible() ) {
229 | event.preventDefault();
230 | select.next();
231 | } else {
232 | onChange(0, true);
233 | }
234 | break;
235 |
236 | case KEY.PAGEUP:
237 | if ( select.visible() ) {
238 | event.preventDefault();
239 | select.pageUp();
240 | } else {
241 | onChange(0, true);
242 | }
243 | break;
244 |
245 | case KEY.PAGEDOWN:
246 | if ( select.visible() ) {
247 | event.preventDefault();
248 | select.pageDown();
249 | } else {
250 | onChange(0, true);
251 | }
252 | break;
253 |
254 | // matches also semicolon
255 | case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
256 | case KEY.TAB:
257 | case KEY.RETURN:
258 | if( selectCurrent() ) {
259 | // stop default to prevent a form submit, Opera needs special handling
260 | event.preventDefault();
261 | blockSubmit = true;
262 | return false;
263 | }
264 | break;
265 |
266 | case KEY.ESC:
267 | select.hide();
268 | break;
269 |
270 | default:
271 | clearTimeout(timeout);
272 | timeout = setTimeout(onChange, options.delay);
273 | break;
274 | }
275 | }).focus(function(){
276 | // track whether the field has focus, we shouldn't process any
277 | // results if the field no longer has focus
278 | hasFocus++;
279 | }).blur(function() {
280 | hasFocus = 0;
281 | if (!config.mouseDownOnSelect) {
282 | hideResults();
283 | }
284 | }).click(function() {
285 | // show select when clicking in a focused field
286 | // but if clickFire is true, don't require field
287 | // to be focused to begin with; just show select
288 | if( options.clickFire ) {
289 | if ( !select.visible() ) {
290 | onChange(0, true);
291 | }
292 | } else {
293 | if ( hasFocus++ > 1 && !select.visible() ) {
294 | onChange(0, true);
295 | }
296 | }
297 | }).bind("search", function() {
298 | var fn = (arguments.length > 1) ? arguments[1] : null;
299 | function findValueCallback(q, data) {
300 | var result;
301 | if( data && data.length ) {
302 | for (var i=0; i < data.length; i++) {
303 | if( data[i].result.toLowerCase() == q.toLowerCase() ) {
304 | result = data[i];
305 | break;
306 | }
307 | }
308 | }
309 | if( typeof fn == "function" ) fn(result);
310 | else $input.trigger("result", result && [result.data, result.value]);
311 | }
312 | $.each(trimWords($input.val()), function(i, value) {
313 | request(value, findValueCallback, findValueCallback);
314 | });
315 | }).bind("flushCache", function() {
316 | cache.flush();
317 | }).bind("setOptions", function() {
318 | $.extend(true, options, arguments[1]);
319 | // if we've updated the data, repopulate
320 | if ( "data" in arguments[1] )
321 | cache.populate();
322 | }).bind("unautocomplete", function() {
323 | select.unbind();
324 | $input.unbind();
325 | $(input.form).unbind(".autocomplete");
326 | });
327 |
328 |
329 | function selectCurrent() {
330 | var selected = select.selected();
331 | if( !selected )
332 | return false;
333 |
334 | var v = selected.result;
335 | previousValue = v;
336 |
337 | if ( options.multiple ) {
338 | var words = trimWords($input.val());
339 | if ( words.length > 1 ) {
340 | var seperator = options.multipleSeparator.length;
341 | var cursorAt = $(input).selection().start;
342 | var wordAt, progress = 0;
343 | $.each(words, function(i, word) {
344 | progress += word.length;
345 | if (cursorAt <= progress) {
346 | wordAt = i;
347 | return false;
348 | }
349 | progress += seperator;
350 | });
351 | words[wordAt] = v;
352 | //$.Autocompleter.Selection(input, progress + seperator, progress + seperator);
353 | v = words.join( options.multipleSeparator );
354 | }
355 | v += options.multipleSeparator;
356 | }
357 |
358 | $input.val(v);
359 | hideResultsNow();
360 | $input.trigger("result", [selected.data, selected.value]);
361 | return true;
362 | }
363 |
364 | function onChange(crap, skipPrevCheck) {
365 | if( lastKeyPressCode == KEY.DEL ) {
366 | select.hide();
367 | return;
368 | }
369 |
370 | var currentValue = $input.val();
371 |
372 | if ( !skipPrevCheck && currentValue == previousValue )
373 | return;
374 |
375 | previousValue = currentValue;
376 |
377 | currentValue = lastWord(currentValue);
378 | if ( currentValue.length >= options.minChars) {
379 | $input.addClass(options.loadingClass);
380 | if (!options.matchCase)
381 | currentValue = currentValue.toLowerCase();
382 | request(currentValue, receiveData, hideResultsNow);
383 | } else {
384 | stopLoading();
385 | select.hide();
386 | }
387 | };
388 |
389 | function trimWords(value) {
390 | if (!value)
391 | return [""];
392 | if (!options.multiple)
393 | return [$.trim(value)];
394 | return $.map(value.split(options.multipleSeparator), function(word) {
395 | return $.trim(value).length ? $.trim(word) : null;
396 | });
397 | }
398 |
399 | function lastWord(value) {
400 | if ( !options.multiple )
401 | return value;
402 | var words = trimWords(value);
403 | if (words.length == 1)
404 | return words[0];
405 | var cursorAt = $(input).selection().start;
406 | if (cursorAt == value.length) {
407 | words = trimWords(value)
408 | } else {
409 | words = trimWords(value.replace(value.substring(cursorAt), ""));
410 | }
411 | return words[words.length - 1];
412 | }
413 |
414 | // fills in the input box w/the first match (assumed to be the best match)
415 | // q: the term entered
416 | // sValue: the first matching result
417 | function autoFill(q, sValue){
418 | // autofill in the complete box w/the first match as long as the user hasn't entered in more data
419 | // if the last user key pressed was backspace, don't autofill
420 | if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
421 | // fill in the value (keep the case the user has typed)
422 | $input.val($input.val() + sValue.substring(lastWord(previousValue).length));
423 | // select the portion of the value not typed by the user (so the next character will erase)
424 | $(input).selection(previousValue.length, previousValue.length + sValue.length);
425 | }
426 | };
427 |
428 | function hideResults() {
429 | clearTimeout(timeout);
430 | timeout = setTimeout(hideResultsNow, 200);
431 | };
432 |
433 | function hideResultsNow() {
434 | var wasVisible = select.visible();
435 | select.hide();
436 | clearTimeout(timeout);
437 | stopLoading();
438 | if (options.mustMatch) {
439 | // call search and run callback
440 | $input.search(
441 | function (result){
442 | // if no value found, clear the input box
443 | if( !result ) {
444 | if (options.multiple) {
445 | var words = trimWords($input.val()).slice(0, -1);
446 | $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
447 | }
448 | else {
449 | $input.val( "" );
450 | $input.trigger("result", null);
451 | }
452 | }
453 | }
454 | );
455 | }
456 | };
457 |
458 | function receiveData(q, data) {
459 | if ( data && data.length && hasFocus ) {
460 | stopLoading();
461 | select.display(data, q);
462 | autoFill(q, data[0].value);
463 | select.show();
464 | } else {
465 | hideResultsNow();
466 | }
467 | };
468 |
469 | function request(term, success, failure) {
470 | if (!options.matchCase)
471 | term = term.toLowerCase();
472 | var data = cache.load(term);
473 | // recieve the cached data
474 | if (data) {
475 | if(data.length) {
476 | success(term, data);
477 | }
478 | else{
479 | var parsed = options.parse && options.parse(options.noRecord) || parse(options.noRecord);
480 | success(term,parsed);
481 | }
482 | // if an AJAX url has been supplied, try loading the data now
483 | } else if( (typeof options.url == "string") && (options.url.length > 0) ){
484 |
485 | var extraParams = {
486 | timestamp: +new Date()
487 | };
488 | $.each(options.extraParams, function(key, param) {
489 | extraParams[key] = typeof param == "function" ? param() : param;
490 | });
491 |
492 | $.ajax({
493 | // try to leverage ajaxQueue plugin to abort previous requests
494 | mode: "abort",
495 | // limit abortion to this input
496 | port: "autocomplete" + input.name,
497 | dataType: options.dataType,
498 | url: options.url,
499 | data: $.extend({
500 | q: lastWord(term),
501 | limit: options.max
502 | }, extraParams),
503 | success: function(data) {
504 | var parsed = options.parse && options.parse(data) || parse(data);
505 | cache.add(term, parsed);
506 | success(term, parsed);
507 | }
508 | });
509 | } else {
510 | // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
511 | select.emptyList();
512 | if(globalFailure != null) {
513 | globalFailure();
514 | }
515 | else {
516 | failure(term);
517 | }
518 | }
519 | };
520 |
521 | function parse(data) {
522 | var parsed = [];
523 | var rows = data.split("\n");
524 | for (var i=0; i < rows.length; i++) {
525 | var row = $.trim(rows[i]);
526 | if (row) {
527 | row = row.split("|");
528 | parsed[parsed.length] = {
529 | data: row,
530 | value: row[0],
531 | result: options.formatResult && options.formatResult(row, row[0]) || row[0]
532 | };
533 | }
534 | }
535 | return parsed;
536 | };
537 |
538 | function stopLoading() {
539 | $input.removeClass(options.loadingClass);
540 | };
541 |
542 | };
543 |
544 | $.Autocompleter.defaults = {
545 | inputClass: "ac_input",
546 | resultsClass: "ac_results",
547 | loadingClass: "ac_loading",
548 | minChars: 1,
549 | delay: 400,
550 | matchCase: false,
551 | matchSubset: true,
552 | matchContains: false,
553 | cacheLength: 100,
554 | max: 1000,
555 | mustMatch: false,
556 | extraParams: {},
557 | selectFirst: true,
558 | formatItem: function(row) { return row[0]; },
559 | formatMatch: null,
560 | autoFill: false,
561 | width: 0,
562 | multiple: false,
563 | multipleSeparator: " ",
564 | inputFocus: true,
565 | clickFire: false,
566 | highlight: function(value, term) {
567 | return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1 ");
568 | },
569 | scroll: true,
570 | scrollHeight: 180,
571 | scrollJumpPosition: true
572 | };
573 |
574 | $.Autocompleter.Cache = function(options) {
575 |
576 | var data = {};
577 | var length = 0;
578 |
579 | function matchSubset(s, sub) {
580 | return (new RegExp(sub.toUpperCase().replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1").replace(/[A-Z0-9]/g, function(m, offset) {
581 | return offset === 0 ? '(?:' + m + '|^' + m.toLowerCase() + ')' : '(?:.*' + m + '|' + m.toLowerCase() + ')';
582 | }))).test(s); // find by initials
583 | };
584 |
585 | function add(q, value) {
586 | if (length > options.cacheLength){
587 | flush();
588 | }
589 | if (!data[q]){
590 | length++;
591 | }
592 | data[q] = value;
593 | }
594 |
595 | function populate(){
596 | if( !options.data ) return false;
597 | // track the matches
598 | var stMatchSets = {},
599 | nullData = 0;
600 |
601 | // no url was specified, we need to adjust the cache length to make sure it fits the local data store
602 | if( !options.url ) options.cacheLength = 1;
603 |
604 | // track all options for minChars = 0
605 | stMatchSets[""] = [];
606 |
607 | // loop through the array and create a lookup structure
608 | for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
609 | var rawValue = options.data[i];
610 | // if rawValue is a string, make an array otherwise just reference the array
611 | rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
612 |
613 | var value = options.formatMatch(rawValue, i+1, options.data.length);
614 | if ( typeof(value) === 'undefined' || value === false )
615 | continue;
616 |
617 | var firstChar = value.charAt(0).toLowerCase();
618 | // if no lookup array for this character exists, look it up now
619 | if( !stMatchSets[firstChar] )
620 | stMatchSets[firstChar] = [];
621 |
622 | // if the match is a string
623 | var row = {
624 | value: value,
625 | data: rawValue,
626 | result: options.formatResult && options.formatResult(rawValue) || value
627 | };
628 |
629 | // push the current match into the set list
630 | stMatchSets[firstChar].push(row);
631 |
632 | // keep track of minChars zero items
633 | if ( nullData++ < options.max ) {
634 | stMatchSets[""].push(row);
635 | }
636 | };
637 |
638 | // add the data items to the cache
639 | $.each(stMatchSets, function(i, value) {
640 | // increase the cache size
641 | options.cacheLength++;
642 | // add to the cache
643 | add(i, value);
644 | });
645 | }
646 |
647 | // populate any existing data
648 | setTimeout(populate, 25);
649 |
650 | function flush(){
651 | data = {};
652 | length = 0;
653 | }
654 |
655 | return {
656 | flush: flush,
657 | add: add,
658 | populate: populate,
659 | load: function(q) {
660 | if (!options.cacheLength || !length)
661 | return null;
662 | /*
663 | * if dealing w/local data and matchContains than we must make sure
664 | * to loop through all the data collections looking for matches
665 | */
666 | if( !options.url && options.matchContains ){
667 | // track all matches
668 | var csub = [];
669 | // loop through all the data grids for matches
670 | for( var k in data ){
671 | // don't search through the stMatchSets[""] (minChars: 0) cache
672 | // this prevents duplicates
673 | if( k.length > 0 ){
674 | var c = data[k];
675 | $.each(c, function(i, x) {
676 | // if we've got a match, add it to the array
677 | if (matchSubset(x.value, q)) {
678 | csub.push(x);
679 | }
680 | });
681 | }
682 | }
683 | return csub;
684 | } else
685 | // if the exact item exists, use it
686 | if (data[q]){
687 | return data[q];
688 | } else
689 | if (options.matchSubset) {
690 | for (var i = q.length - 1; i >= options.minChars; i--) {
691 | var c = data[q.substr(0, i)];
692 | if (c) {
693 | var csub = [];
694 | $.each(c, function(i, x) {
695 | if (matchSubset(x.value, q)) {
696 | csub[csub.length] = x;
697 | }
698 | });
699 | return csub;
700 | }
701 | }
702 | }
703 | return null;
704 | }
705 | };
706 | };
707 |
708 | $.Autocompleter.Select = function (options, input, select, config) {
709 | var CLASSES = {
710 | ACTIVE: "ac_over"
711 | };
712 |
713 | var listItems,
714 | active = -1,
715 | data,
716 | term = "",
717 | needsInit = true,
718 | element,
719 | list;
720 |
721 | // Create results
722 | function init() {
723 | if (!needsInit)
724 | return;
725 | element = $("
")
726 | .hide()
727 | .addClass(options.resultsClass)
728 | .css("position", "absolute")
729 | .appendTo(document.body)
730 | .hover(function(event) {
731 | // Browsers except FF do not fire mouseup event on scrollbars, resulting in mouseDownOnSelect remaining true, and results list not always hiding.
732 | if($(this).is(":visible")) {
733 | input.focus();
734 | }
735 | config.mouseDownOnSelect = false;
736 | });
737 |
738 | list = $("").appendTo(element).mouseover( function(event) {
739 | if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
740 | active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
741 | $(target(event)).addClass(CLASSES.ACTIVE);
742 | }
743 | }).click(function(event) {
744 | $(target(event)).addClass(CLASSES.ACTIVE);
745 | select();
746 | if( options.inputFocus )
747 | input.focus();
748 | return false;
749 | }).mousedown(function() {
750 | config.mouseDownOnSelect = true;
751 | }).mouseup(function() {
752 | config.mouseDownOnSelect = false;
753 | });
754 |
755 | if( options.width > 0 )
756 | element.css("width", options.width);
757 |
758 | needsInit = false;
759 | }
760 |
761 | function target(event) {
762 | var element = event.target;
763 | while(element && element.tagName != "LI")
764 | element = element.parentNode;
765 | // more fun with IE, sometimes event.target is empty, just ignore it then
766 | if(!element)
767 | return [];
768 | return element;
769 | }
770 |
771 | function moveSelect(step) {
772 | listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
773 | movePosition(step);
774 | var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
775 | if(options.scroll) {
776 | var offset = 0;
777 | listItems.slice(0, active).each(function() {
778 | offset += this.offsetHeight;
779 | });
780 | if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
781 | list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
782 | } else if(offset < list.scrollTop()) {
783 | list.scrollTop(offset);
784 | }
785 | }
786 | };
787 |
788 | function movePosition(step) {
789 | if (options.scrollJumpPosition || (!options.scrollJumpPosition && !((step < 0 && active == 0) || (step > 0 && active == listItems.size() - 1)) )) {
790 | active += step;
791 | if (active < 0) {
792 | active = listItems.size() - 1;
793 | } else if (active >= listItems.size()) {
794 | active = 0;
795 | }
796 | }
797 | }
798 |
799 |
800 | function limitNumberOfItems(available) {
801 | return options.max && options.max < available
802 | ? options.max
803 | : available;
804 | }
805 |
806 | function fillList() {
807 | list.empty();
808 | var max = limitNumberOfItems(data.length);
809 | for (var i=0; i < max; i++) {
810 | if (!data[i])
811 | continue;
812 | var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
813 | if ( formatted === false )
814 | continue;
815 | var li = $(" ").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
816 | $.data(li, "ac_data", data[i]);
817 | }
818 | listItems = list.find("li");
819 | if ( options.selectFirst ) {
820 | listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
821 | active = 0;
822 | }
823 | // apply bgiframe if available
824 | if ( $.fn.bgiframe )
825 | list.bgiframe();
826 | }
827 |
828 | return {
829 | display: function(d, q) {
830 | init();
831 | data = d;
832 | term = q;
833 | fillList();
834 | },
835 | next: function() {
836 | moveSelect(1);
837 | },
838 | prev: function() {
839 | moveSelect(-1);
840 | },
841 | pageUp: function() {
842 | if (active != 0 && active - 8 < 0) {
843 | moveSelect( -active );
844 | } else {
845 | moveSelect(-8);
846 | }
847 | },
848 | pageDown: function() {
849 | if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
850 | moveSelect( listItems.size() - 1 - active );
851 | } else {
852 | moveSelect(8);
853 | }
854 | },
855 | hide: function() {
856 | element && element.hide();
857 | listItems && listItems.removeClass(CLASSES.ACTIVE);
858 | active = -1;
859 | },
860 | visible : function() {
861 | return element && element.is(":visible");
862 | },
863 | current: function() {
864 | return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
865 | },
866 | show: function() {
867 | var offset = $(input).offset();
868 | element.css({
869 | width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
870 | top: offset.top + input.offsetHeight,
871 | left: offset.left
872 | }).show();
873 | if(options.scroll) {
874 | list.scrollTop(0);
875 | list.css({
876 | maxHeight: options.scrollHeight,
877 | overflow: 'auto'
878 | });
879 |
880 | if(navigator.userAgent.indexOf("MSIE") != -1 && typeof document.body.style.maxHeight === "undefined") {
881 | var listHeight = 0;
882 | listItems.each(function() {
883 | listHeight += this.offsetHeight;
884 | });
885 | var scrollbarsVisible = listHeight > options.scrollHeight;
886 | list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
887 | if (!scrollbarsVisible) {
888 | // IE doesn't recalculate width when scrollbar disappears
889 | listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
890 | }
891 | }
892 |
893 | }
894 | },
895 | selected: function() {
896 | var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
897 | return selected && selected.length && $.data(selected[0], "ac_data");
898 | },
899 | emptyList: function (){
900 | list && list.empty();
901 | },
902 | unbind: function() {
903 | element && element.remove();
904 | }
905 | };
906 | };
907 |
908 | $.fn.selection = function(start, end) {
909 | if (start !== undefined) {
910 | return this.each(function() {
911 | if( this.createTextRange ){
912 | var selRange = this.createTextRange();
913 | if (end === undefined || start == end) {
914 | selRange.move("character", start);
915 | selRange.select();
916 | } else {
917 | selRange.collapse(true);
918 | selRange.moveStart("character", start);
919 | selRange.moveEnd("character", end);
920 | selRange.select();
921 | }
922 | } else if( this.setSelectionRange ){
923 | this.setSelectionRange(start, end);
924 | } else if( this.selectionStart ){
925 | this.selectionStart = start;
926 | this.selectionEnd = end;
927 | }
928 | });
929 | }
930 | var field = this[0];
931 | if ( field.createTextRange ) {
932 | var range = document.selection.createRange(),
933 | orig = field.value,
934 | teststring = "<->",
935 | textLength = range.text.length;
936 | range.text = teststring;
937 | var caretAt = field.value.indexOf(teststring);
938 | field.value = orig;
939 | this.selection(caretAt, caretAt + textLength);
940 | return {
941 | start: caretAt,
942 | end: caretAt + textLength
943 | }
944 | } else if( field.selectionStart !== undefined ){
945 | return {
946 | start: field.selectionStart,
947 | end: field.selectionEnd
948 | }
949 | }
950 | };
951 |
952 | })(jQuery);
953 |
954 | /**
955 | * jQuery.fn.sortElements
956 | * --------------
957 | * @author James Padolsey (http://james.padolsey.com)
958 | * @version 0.11
959 | * @updated 18-MAR-2010
960 | * --------------
961 | * @param Function comparator:
962 | * Exactly the same behaviour as [1,2,3].sort(comparator)
963 | *
964 | * @param Function getSortable
965 | * A function that should return the element that is
966 | * to be sorted. The comparator will run on the
967 | * current collection, but you may want the actual
968 | * resulting sort to occur on a parent or another
969 | * associated element.
970 | *
971 | * E.g. $('td').sortElements(comparator, function(){
972 | * return this.parentNode;
973 | * })
974 | *
975 | * The 's parent ( ) will be sorted instead
976 | * of the itself.
977 | */
978 | jQuery.fn.sortElements = (function(){
979 |
980 | var sort = [].sort;
981 |
982 | return function(comparator, getSortable) {
983 |
984 | getSortable = getSortable || function(){return this;};
985 |
986 | var placements = this.map(function(){
987 |
988 | var sortElement = getSortable.call(this),
989 | parentNode = sortElement.parentNode,
990 |
991 | // Since the element itself will change position, we have
992 | // to have some way of storing it's original position in
993 | // the DOM. The easiest way is to have a 'flag' node:
994 | nextSibling = parentNode.insertBefore(
995 | document.createTextNode(''),
996 | sortElement.nextSibling
997 | );
998 |
999 | return function() {
1000 |
1001 | if (parentNode === this) {
1002 | throw new Error(
1003 | "You can't sort elements if any one is a descendant of another."
1004 | );
1005 | }
1006 |
1007 | // Insert before flag:
1008 | parentNode.insertBefore(this, nextSibling);
1009 | // Remove flag:
1010 | parentNode.removeChild(nextSibling);
1011 |
1012 | };
1013 |
1014 | });
1015 |
1016 | return sort.call(this, comparator).each(function(i){
1017 | placements[i].call(getSortable.call(this));
1018 | });
1019 |
1020 | };
1021 |
1022 | })();
1023 | $(window).load(function() {
1024 | var $document = $(document);
1025 | var $left = $('#left');
1026 | var $right = $('#right');
1027 | var $rightInner = $('#rightInner');
1028 | var $splitter = $('#splitter');
1029 | var $groups = $('#groups');
1030 | var $content = $('#content');
1031 |
1032 | // Menu
1033 |
1034 | // Hide deep packages and namespaces
1035 | $('ul span', $groups).click(function(event) {
1036 | event.preventDefault();
1037 | event.stopPropagation();
1038 | $(this)
1039 | .toggleClass('collapsed')
1040 | .parent()
1041 | .next('ul')
1042 | .toggleClass('collapsed');
1043 | }).click();
1044 |
1045 | $active = $('ul li.active', $groups);
1046 | if ($active.length > 0) {
1047 | // Open active
1048 | $('> a > span', $active).click();
1049 | } else {
1050 | $main = $('> ul > li.main', $groups);
1051 | if ($main.length > 0) {
1052 | // Open first level of the main project
1053 | $('> a > span', $main).click();
1054 | } else {
1055 | // Open first level of all
1056 | $('> ul > li > a > span', $groups).click();
1057 | }
1058 | }
1059 |
1060 | // Content
1061 |
1062 | // Search autocompletion
1063 | var autocompleteFound = false;
1064 | var autocompleteFiles = {'c': 'class', 'co': 'constant', 'f': 'function', 'm': 'class', 'mm': 'class', 'p': 'class', 'mp': 'class', 'cc': 'class'};
1065 | var $search = $('#search input[name=q]');
1066 | $search
1067 | .autocomplete(ApiGen.elements, {
1068 | matchContains: true,
1069 | scrollHeight: 200,
1070 | max: 20,
1071 | noRecord: '',
1072 | highlight: function(value, term) {
1073 | var term = term.toUpperCase().replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1").replace(/[A-Z0-9]/g, function(m, offset) {
1074 | return offset === 0 ? '(?:' + m + '|^' + m.toLowerCase() + ')' : '(?:(?:[^<>]|<[^<>]*>)*' + m + '|' + m.toLowerCase() + ')';
1075 | });
1076 | return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term + ")(?![^<>]*>)(?![^&;]+;)"), "$1 ");
1077 | },
1078 | formatItem: function(data) {
1079 | return data.length > 1 ? data[1].replace(/^(.+\\)(.+)$/, '$1 $2 ') : data[0];
1080 | },
1081 | formatMatch: function(data) {
1082 | return data[1];
1083 | },
1084 | formatResult: function(data) {
1085 | return data[1];
1086 | },
1087 | show: function($list) {
1088 | var $items = $('li span', $list);
1089 | var maxWidth = Math.max.apply(null, $items.map(function() {
1090 | return $(this).width();
1091 | }));
1092 | // 10px padding
1093 | $list
1094 | .width(Math.max(maxWidth + 10, $search.innerWidth()))
1095 | .css('left', $search.offset().left + $search.outerWidth() - $list.outerWidth());
1096 | }
1097 | }).result(function(event, data) {
1098 | autocompleteFound = true;
1099 | var location = window.location.href.split('/');
1100 | location.pop();
1101 | var parts = data[1].split(/::|$/);
1102 | var file = $.sprintf(ApiGen.config.templates[autocompleteFiles[data[0]]].filename, parts[0].replace(/\(\)/, '').replace(/[^\w]/g, '.'));
1103 | if (parts[1]) {
1104 | file += '#' + ('mm' === data[0] || 'mp' === data[0] ? 'm' : '') + parts[1].replace(/([\w]+)\(\)/, '_$1');
1105 | }
1106 | location.push(file);
1107 | window.location = location.join('/');
1108 |
1109 | // Workaround for Opera bug
1110 | $(this).closest('form').attr('action', location.join('/'));
1111 | }).closest('form')
1112 | .submit(function() {
1113 | var query = $search.val();
1114 | if ('' === query) {
1115 | return false;
1116 | }
1117 | return !autocompleteFound && '' !== $('#search input[name=cx]').val();
1118 | });
1119 |
1120 | // Save natural order
1121 | $('table.summary tr[data-order]', $content).each(function(index) {
1122 | do {
1123 | index = '0' + index;
1124 | } while (index.length < 3);
1125 | $(this).attr('data-order-natural', index);
1126 | });
1127 |
1128 | // Switch between natural and alphabetical order
1129 | var $caption = $('table.summary', $content)
1130 | .filter(':has(tr[data-order])')
1131 | .find('caption');
1132 | $caption
1133 | .click(function() {
1134 | var $this = $(this);
1135 | var order = $this.data('order') || 'natural';
1136 | order = 'natural' === order ? 'alphabetical' : 'natural';
1137 | $this.data('order', order);
1138 | $.cookie('order', order, {expires: 365});
1139 | var attr = 'alphabetical' === order ? 'data-order' : 'data-order-natural';
1140 | $this
1141 | .closest('table')
1142 | .find('tr').sortElements(function(a, b) {
1143 | return $(a).attr(attr) > $(b).attr(attr) ? 1 : -1;
1144 | });
1145 | return false;
1146 | })
1147 | .addClass('switchable')
1148 | .attr('title', 'Switch between natural and alphabetical order');
1149 | if ((null === $.cookie('order') && 'alphabetical' === ApiGen.config.options.elementsOrder) || 'alphabetical' === $.cookie('order')) {
1150 | $caption.click();
1151 | }
1152 |
1153 | // Open details
1154 | if (ApiGen.config.options.elementDetailsCollapsed) {
1155 | $('tr', $content).filter(':has(.detailed)')
1156 | .click(function() {
1157 | var $this = $(this);
1158 | $('.short', $this).hide();
1159 | $('.detailed', $this).show();
1160 | });
1161 | }
1162 |
1163 | // Splitter
1164 | var splitterWidth = $splitter.width();
1165 | var splitterPosition = $.cookie('splitter') ? parseInt($.cookie('splitter')) : null;
1166 | var splitterPositionBackup = $.cookie('splitterBackup') ? parseInt($.cookie('splitterBackup')) : null;
1167 | function setSplitterPosition(position)
1168 | {
1169 | splitterPosition = position;
1170 |
1171 | $left.width(position);
1172 | $right.css('margin-left', position + splitterWidth);
1173 | $splitter.css('left', position);
1174 | }
1175 | function setContentWidth()
1176 | {
1177 | var width = $rightInner.width();
1178 | $rightInner
1179 | .toggleClass('medium', width <= 960)
1180 | .toggleClass('small', width <= 650);
1181 | }
1182 | $splitter.mousedown(function() {
1183 | $splitter.addClass('active');
1184 |
1185 | $document.mousemove(function(event) {
1186 | if (event.pageX >= 230 && $document.width() - event.pageX >= 600 + splitterWidth) {
1187 | setSplitterPosition(event.pageX);
1188 | setContentWidth();
1189 | }
1190 | });
1191 |
1192 | $()
1193 | .add($splitter)
1194 | .add($document)
1195 | .mouseup(function() {
1196 | $splitter
1197 | .removeClass('active')
1198 | .unbind('mouseup');
1199 | $document
1200 | .unbind('mousemove')
1201 | .unbind('mouseup');
1202 |
1203 | $.cookie('splitter', splitterPosition, {expires: 365});
1204 | });
1205 |
1206 | return false;
1207 | });
1208 | $splitter.dblclick(function() {
1209 | if (splitterPosition) {
1210 | splitterPositionBackup = $left.width();
1211 | setSplitterPosition(0);
1212 | } else {
1213 | setSplitterPosition(splitterPositionBackup);
1214 | splitterPositionBackup = null;
1215 | }
1216 |
1217 | setContentWidth();
1218 |
1219 | $.cookie('splitter', splitterPosition, {expires: 365});
1220 | $.cookie('splitterBackup', splitterPositionBackup, {expires: 365});
1221 | });
1222 | if (null !== splitterPosition) {
1223 | setSplitterPosition(splitterPosition);
1224 | }
1225 | setContentWidth();
1226 | $(window).resize(setContentWidth);
1227 |
1228 | // Select selected lines
1229 | var matches = window.location.hash.substr(1).match(/^\d+(?:-\d+)?(?:,\d+(?:-\d+)?)*$/);
1230 | if (null !== matches) {
1231 | var lists = matches[0].split(',');
1232 | for (var i = 0; i < lists.length; i++) {
1233 | var lines = lists[i].split('-');
1234 | lines[0] = parseInt(lines[0]);
1235 | lines[1] = parseInt(lines[1] || lines[0]);
1236 | for (var j = lines[0]; j <= lines[1]; j++) {
1237 | $('#' + j).addClass('selected');
1238 | }
1239 | }
1240 |
1241 | var $firstLine = $('#' + parseInt(matches[0]));
1242 | if ($firstLine.length > 0) {
1243 | $document.scrollTop($firstLine.offset().top);
1244 | }
1245 | }
1246 |
1247 | // Save selected lines
1248 | var lastLine;
1249 | $('.l a').click(function(event) {
1250 | event.preventDefault();
1251 |
1252 | var $selectedLine = $(this).parent();
1253 | var selectedLine = parseInt($selectedLine.attr('id'));
1254 |
1255 | if (event.shiftKey) {
1256 | if (lastLine) {
1257 | for (var i = Math.min(selectedLine, lastLine); i <= Math.max(selectedLine, lastLine); i++) {
1258 | $('#' + i).addClass('selected');
1259 | }
1260 | } else {
1261 | $selectedLine.addClass('selected');
1262 | }
1263 | } else if (event.ctrlKey) {
1264 | $selectedLine.toggleClass('selected');
1265 | } else {
1266 | var $selected = $('.l.selected')
1267 | .not($selectedLine)
1268 | .removeClass('selected');
1269 | if ($selected.length > 0) {
1270 | $selectedLine.addClass('selected');
1271 | } else {
1272 | $selectedLine.toggleClass('selected');
1273 | }
1274 | }
1275 |
1276 | lastLine = $selectedLine.hasClass('selected') ? selectedLine : null;
1277 |
1278 | // Update hash
1279 | var lines = $('.l.selected')
1280 | .map(function() {
1281 | return parseInt($(this).attr('id'));
1282 | })
1283 | .get()
1284 | .sort(function(a, b) {
1285 | return a - b;
1286 | });
1287 |
1288 | var hash = [];
1289 | var list = [];
1290 | for (var j = 0; j < lines.length; j++) {
1291 | if (0 === j && j + 1 === lines.length) {
1292 | hash.push(lines[j]);
1293 | } else if (0 === j) {
1294 | list[0] = lines[j];
1295 | } else if (lines[j - 1] + 1 !== lines[j] && j + 1 === lines.length) {
1296 | hash.push(list.join('-'));
1297 | hash.push(lines[j]);
1298 | } else if (lines[j - 1] + 1 !== lines[j]) {
1299 | hash.push(list.join('-'));
1300 | list = [lines[j]];
1301 | } else if (j + 1 === lines.length) {
1302 | list[1] = lines[j];
1303 | hash.push(list.join('-'));
1304 | } else {
1305 | list[1] = lines[j];
1306 | }
1307 | }
1308 |
1309 | hash = hash.join(',');
1310 | $backup = $('#' + hash).removeAttr('id');
1311 | window.location.hash = hash;
1312 | $backup.attr('id', hash);
1313 | });
1314 | });
1315 |
1316 |
--------------------------------------------------------------------------------
/docs/resources/footer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InterativaDigital/php-translation-class/551180e92cab729deeb828045b26de59486a2edf/docs/resources/footer.png
--------------------------------------------------------------------------------
/docs/resources/inherit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InterativaDigital/php-translation-class/551180e92cab729deeb828045b26de59486a2edf/docs/resources/inherit.png
--------------------------------------------------------------------------------
/docs/resources/resize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InterativaDigital/php-translation-class/551180e92cab729deeb828045b26de59486a2edf/docs/resources/resize.png
--------------------------------------------------------------------------------
/docs/resources/sort.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InterativaDigital/php-translation-class/551180e92cab729deeb828045b26de59486a2edf/docs/resources/sort.png
--------------------------------------------------------------------------------
/docs/resources/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font: 13px/1.5 Verdana, 'Geneva CE', lucida, sans-serif;
3 | margin: 0;
4 | padding: 0;
5 | background: #ffffff;
6 | color: #333333;
7 | }
8 |
9 | h1, h2, h3, h4, caption {
10 | font-family: 'Trebuchet MS', 'Geneva CE', lucida, sans-serif;
11 | color: #053368;
12 | }
13 |
14 | h1 {
15 | color: #1e5eb6;
16 | font-size: 230%;
17 | font-weight: normal;
18 | margin: .3em 0;
19 | }
20 |
21 | h2 {
22 | color: #1e5eb6;
23 | font-size: 150%;
24 | font-weight: normal;
25 | margin: -.3em 0 .3em 0;
26 | }
27 |
28 | h3 {
29 | font-size: 1.6em;
30 | font-weight: normal;
31 | margin-bottom: 2px;
32 | }
33 |
34 | h4 {
35 | font-size: 100%;
36 | font-weight: bold;
37 | padding: 0;
38 | margin: 0;
39 | }
40 |
41 | caption {
42 | border: 1px solid #cccccc;
43 | background: #ecede5;
44 | font-weight: bold;
45 | font-size: 1.2em;
46 | padding: 3px 5px;
47 | text-align: left;
48 | margin-bottom: 0;
49 | }
50 |
51 | p {
52 | margin: .7em 0 1em;
53 | padding: 0;
54 | }
55 |
56 | hr {
57 | margin: 2em 0 1em;
58 | border: none;
59 | border-top: 1px solid #cccccc;
60 | height: 0;
61 | }
62 |
63 | a {
64 | color: #006aeb;
65 | padding: 3px 1px;
66 | text-decoration: none;
67 | }
68 |
69 | h1 a {
70 | color: #1e5eb6;
71 | }
72 |
73 | a:hover, a:active, a:focus, a:hover b, a:hover var {
74 | background-color: #006aeb;
75 | color: #ffffff !important;
76 | }
77 |
78 | code, var, pre {
79 | font-family: monospace;
80 | }
81 |
82 | var {
83 | font-weight: bold;
84 | font-style: normal;
85 | color: #ca8a04;
86 | }
87 |
88 | pre {
89 | margin: 0;
90 | }
91 |
92 | code a b {
93 | color: #000000;
94 | }
95 |
96 | .deprecated {
97 | text-decoration: line-through;
98 | opacity: .5;
99 | }
100 |
101 | .invalid {
102 | color: #e71818;
103 | }
104 |
105 | .hidden {
106 | display: none;
107 | }
108 |
109 | /* Left side */
110 | #left {
111 | overflow: auto;
112 | width: 270px;
113 | height: 100%;
114 | position: fixed;
115 | }
116 |
117 | /* Menu */
118 | #menu {
119 | padding: 10px;
120 | }
121 |
122 | #menu ul {
123 | list-style: none;
124 | padding: 0;
125 | margin: 0;
126 | }
127 |
128 | #menu ul ul {
129 | padding-left: 10px;
130 | }
131 |
132 | #menu li {
133 | white-space: nowrap;
134 | position: relative;
135 | }
136 |
137 | #menu a {
138 | display: block;
139 | padding: 0 2px;
140 | }
141 |
142 | #menu .active > a, #menu > span {
143 | color: #333333;
144 | background: none;
145 | font-weight: bold;
146 | }
147 |
148 | #menu .active > a.invalid {
149 | color: #e71818;
150 | }
151 |
152 | #menu .active > a:hover, #menu .active > a:active, #menu .active > a:focus {
153 | background-color: #006aeb;
154 | }
155 |
156 | #menu #groups span {
157 | position: absolute;
158 | top: 4px;
159 | right: 2px;
160 | cursor: pointer;
161 | display: block;
162 | width: 12px;
163 | height: 12px;
164 | background: url('collapsed.png') transparent 0 0 no-repeat;
165 | }
166 |
167 | #menu #groups span:hover {
168 | background-position: -12px 0;
169 | }
170 |
171 | #menu #groups span.collapsed {
172 | background-position: 0 -12px;
173 | }
174 |
175 | #menu #groups span.collapsed:hover {
176 | background-position: -12px -12px;
177 | }
178 |
179 | #menu #groups ul.collapsed {
180 | display: none;
181 | }
182 |
183 | /* Right side */
184 | #right {
185 | overflow: auto;
186 | margin-left: 275px;
187 | height: 100%;
188 | position: relative;
189 | left: 0;
190 | right: 0;
191 | }
192 |
193 | #rightInner {
194 | max-width: 1000px;
195 | min-width: 350px;
196 | }
197 |
198 | /* Search */
199 | #search {
200 | float: right;
201 | margin: 3px 8px;
202 | }
203 |
204 | #search input.text {
205 | padding: 3px 5px;
206 | width: 250px;
207 | }
208 |
209 | /* Autocomplete */
210 | .ac_results {
211 | padding: 0;
212 | border: 1px solid #cccccc;
213 | background-color: #ffffff;
214 | overflow: hidden;
215 | z-index: 99999;
216 | }
217 |
218 | .ac_results ul {
219 | width: 100%;
220 | list-style-position: outside;
221 | list-style: none;
222 | padding: 0;
223 | margin: 0;
224 | }
225 |
226 | .ac_results li {
227 | margin: 0;
228 | padding: 2px 5px;
229 | cursor: default;
230 | display: block;
231 | font: 12px 'Trebuchet MS', 'Geneva CE', lucida, sans-serif;
232 | line-height: 16px;
233 | overflow: hidden;
234 | white-space: nowrap;
235 | }
236 |
237 | .ac_results li strong {
238 | color: #000000;
239 | }
240 |
241 | .ac_odd {
242 | background-color: #eeeeee;
243 | }
244 |
245 | .ac_over {
246 | background-color: #006aeb;
247 | color: #ffffff;
248 | }
249 |
250 | .ac_results li.ac_over strong {
251 | color: #ffffff;
252 | }
253 |
254 | /* Navigation */
255 | #navigation {
256 | padding: 3px 8px;
257 | background-color: #f6f6f4;
258 | height: 26px;
259 | }
260 |
261 | #navigation ul {
262 | list-style: none;
263 | margin: 0 8px 4px 0;
264 | padding: 0;
265 | overflow: hidden;
266 | float: left;
267 | }
268 |
269 | #navigation ul + ul {
270 | border-left: 1px solid #000000;
271 | padding-left: 8px;
272 | }
273 |
274 | #navigation ul li {
275 | float: left;
276 | margin: 2px;
277 | padding: 0 3px;
278 | font-family: Verdana, 'Geneva CE', lucida, sans-serif;
279 | color: #808080;
280 | }
281 |
282 | #navigation ul li.active {
283 | background-color: #053368;
284 | color: #ffffff;
285 | font-weight: bold;
286 | }
287 |
288 | #navigation ul li a {
289 | color: #000000;
290 | font-weight: bold;
291 | padding: 0;
292 | }
293 |
294 | #navigation ul li span {
295 | float: left;
296 | padding: 0 3px;
297 | }
298 |
299 | #navigation ul li a:hover span, #navigation ul li a:active span, #navigation ul li a:focus span {
300 | background-color: #006aeb;
301 | }
302 |
303 | /* Content */
304 | #content {
305 | clear: both;
306 | padding: 5px 15px;
307 | }
308 |
309 | .description pre {
310 | padding: .6em;
311 | background: #fcfcf7;
312 | }
313 |
314 | #content > .description {
315 | background: #ecede5;
316 | padding: 1px 8px;
317 | margin: 1.2em 0;
318 | }
319 |
320 | #content > .description pre {
321 | margin: .5em 0;
322 | }
323 |
324 | dl.tree {
325 | margin: 1.2em 0;
326 | }
327 |
328 | dl.tree dd {
329 | margin: 0;
330 | padding: 0;
331 | }
332 |
333 | .info {
334 | margin: 1.2em 0;
335 | }
336 |
337 | .summary {
338 | border: 1px solid #cccccc;
339 | border-collapse: collapse;
340 | font-size: 1em;
341 | width: 100%;
342 | margin: 1.2em 0 2.4em;
343 | }
344 |
345 | .summary caption {
346 | border-width: 1px 1px 0;
347 | }
348 |
349 | .summary caption.switchable {
350 | background: #ecede5 url('sort.png') no-repeat center right;
351 | cursor: pointer;
352 | }
353 |
354 | .summary td {
355 | border: 1px solid #cccccc;
356 | margin: 0;
357 | padding: 3px 10px;
358 | font-size: 1em;
359 | vertical-align: top;
360 | }
361 |
362 | .summary td:first-child {
363 | text-align: right;
364 | }
365 |
366 | .summary td hr {
367 | margin: 3px -10px;
368 | }
369 |
370 | #packages.summary td:first-child, #namespaces.summary td:first-child, .inherited.summary td:first-child, .used.summary td:first-child {
371 | text-align: left;
372 | }
373 |
374 | .summary tr:hover td {
375 | background: #f6f6f4;
376 | }
377 |
378 | .summary .description pre {
379 | border: .5em solid #ecede5;
380 | }
381 |
382 | .summary .description p {
383 | margin: 0;
384 | }
385 |
386 | .summary .description p + p, .summary .description ul {
387 | margin: 3px 0 0 0;
388 | }
389 |
390 | .summary .description.detailed h4 {
391 | margin-top: 3px;
392 | }
393 |
394 | .summary dl {
395 | margin: 0;
396 | }
397 |
398 | .summary dd {
399 | margin: 0 0 0 25px;
400 | }
401 |
402 | .name, .attributes {
403 | white-space: nowrap;
404 | }
405 |
406 | .value code {
407 | white-space: pre-wrap;
408 | }
409 |
410 | td.name, td.attributes {
411 | width: 1%;
412 | }
413 |
414 | td.attributes {
415 | width: 1%;
416 | }
417 |
418 | .class .methods .name, .class .properties .name, .class .constants .name {
419 | width: auto;
420 | white-space: normal;
421 | }
422 |
423 | .class .methods .name > div > code {
424 | white-space: pre-wrap;
425 | }
426 |
427 | .class .methods .name > div > code span, .function .value > code {
428 | white-space: nowrap;
429 | }
430 |
431 | .class .methods td.name > div, .class td.value > div {
432 | position: relative;
433 | padding-right: 1em;
434 | }
435 |
436 | .anchor {
437 | position: absolute;
438 | top: 0;
439 | right: 0;
440 | line-height: 1;
441 | font-size: 85%;
442 | margin: 0;
443 | color: #006aeb !important;
444 | }
445 |
446 | .list {
447 | margin: 0 0 5px 25px;
448 | }
449 |
450 | div.invalid {
451 | background-color: #fae4e0;
452 | padding: 10px;
453 | }
454 |
455 | /* Splitter */
456 | #splitter {
457 | position: fixed;
458 | height: 100%;
459 | width: 5px;
460 | left: 270px;
461 | background: #1e5eb6 url('resize.png') left center no-repeat;
462 | cursor: e-resize;
463 | }
464 |
465 | #splitter.active {
466 | opacity: .5;
467 | }
468 |
469 | /* Footer */
470 | #footer {
471 | border-top: 1px solid #e9eeef;
472 | clear: both;
473 | color: #a7a7a7;
474 | font-size: 8pt;
475 | text-align: center;
476 | padding: 20px 0 0;
477 | margin: 3em 0 0;
478 | height: 90px;
479 | background: #ffffff url('footer.png') no-repeat center top;
480 | }
481 |
482 | /* Tree */
483 | div.tree ul {
484 | list-style: none;
485 | background: url('tree-vertical.png') left repeat-y;
486 | padding: 0;
487 | margin-left: 20px;
488 | }
489 |
490 | div.tree li {
491 | margin: 0;
492 | padding: 0;
493 | }
494 |
495 | div.tree div {
496 | padding-left: 30px;
497 | }
498 |
499 | div.tree div.notlast {
500 | background: url('tree-hasnext.png') left 10px no-repeat;
501 | }
502 |
503 | div.tree div.last {
504 | background: url('tree-last.png') left -240px no-repeat;
505 | }
506 |
507 | div.tree li.last {
508 | background: url('tree-cleaner.png') left center repeat-y;
509 | }
510 |
511 | div.tree span.padding {
512 | padding-left: 15px;
513 | }
514 |
515 | /* Source code */
516 | .php-keyword1 {
517 | color: #e71818;
518 | font-weight: bold;
519 | }
520 |
521 | .php-keyword2 {
522 | font-weight: bold;
523 | }
524 |
525 | .php-var {
526 | color: #d59401;
527 | font-weight: bold;
528 | }
529 |
530 | .php-num {
531 | color: #cd0673;
532 | }
533 |
534 | .php-quote {
535 | color: #008000;
536 | }
537 |
538 | .php-comment {
539 | color: #929292;
540 | }
541 |
542 | .xlang {
543 | color: #ff0000;
544 | font-weight: bold;
545 | }
546 |
547 | span.l {
548 | display: block;
549 | }
550 |
551 | span.l.selected {
552 | background: #f6f6f4;
553 | }
554 |
555 | span.l a {
556 | color: #333333;
557 | }
558 |
559 | span.l a:hover, div.l a:active, div.l a:focus {
560 | background: transparent;
561 | color: #333333 !important;
562 | }
563 |
564 | span.l .php-var a {
565 | color: #d59401;
566 | }
567 |
568 | span.l .php-var a:hover, span.l .php-var a:active, span.l .php-var a:focus {
569 | color: #d59401 !important;
570 | }
571 |
572 | span.l a.l {
573 | padding-left: 2px;
574 | color: #c0c0c0;
575 | }
576 |
577 | span.l a.l:hover, span.l a.l:active, span.l a.l:focus {
578 | background: transparent;
579 | color: #c0c0c0 !important;
580 | }
581 |
582 | #rightInner.medium #navigation {
583 | height: 52px;
584 | }
585 |
586 | #rightInner.medium #navigation ul:first-child + ul {
587 | clear: left;
588 | border: none;
589 | padding: 0;
590 | }
591 |
592 | #rightInner.medium .name, #rightInner.medium .attributes {
593 | white-space: normal;
594 | }
595 |
596 | #rightInner.small #search {
597 | float: left;
598 | }
599 |
600 | #rightInner.small #navigation {
601 | height: 78px;
602 | }
603 |
604 | #rightInner.small #navigation ul:first-child {
605 | clear: both;
606 | }
607 |
608 | /* global style */
609 | .left, .summary td.left {
610 | text-align: left;
611 | }
612 | .right, .summary td.right {
613 | text-align: right;
614 | }
615 |
--------------------------------------------------------------------------------
/docs/resources/tree-cleaner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InterativaDigital/php-translation-class/551180e92cab729deeb828045b26de59486a2edf/docs/resources/tree-cleaner.png
--------------------------------------------------------------------------------
/docs/resources/tree-hasnext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InterativaDigital/php-translation-class/551180e92cab729deeb828045b26de59486a2edf/docs/resources/tree-hasnext.png
--------------------------------------------------------------------------------
/docs/resources/tree-last.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InterativaDigital/php-translation-class/551180e92cab729deeb828045b26de59486a2edf/docs/resources/tree-last.png
--------------------------------------------------------------------------------
/docs/resources/tree-vertical.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InterativaDigital/php-translation-class/551180e92cab729deeb828045b26de59486a2edf/docs/resources/tree-vertical.png
--------------------------------------------------------------------------------
/docs/source-class-Translation.Translation.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | File Translation.php
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
56 |
57 |
58 |
59 |
60 | Overview
61 |
62 |
63 | Namespace
64 |
65 | Class
66 |
67 |
69 |
71 |
72 |
73 |
1: <?php
74 | 2: namespace Translation;
75 | 3:
76 | 4: use Exception;
77 | 5:
78 | 6: class Translation
79 | 7: {
80 | 8: 9: 10: 11:
84 | 12: protected static $localesDir = 'locales' ;
85 | 13:
86 | 14: 15: 16: 17:
90 | 18: protected static $defaultLanguage = 'en-US' ;
91 | 19:
92 | 20: 21: 22: 23:
96 | 24: protected static $loadedLocales = array ();
97 | 25:
98 | 26: 27: 28: 29:
102 | 30: protected static $currentLanguage = '' ;
103 | 31:
104 | 32: 33: 34: 35:
108 | 36: protected static $initialized = false ;
109 | 37:
110 | 38: 39: 40: 41:
114 | 42: protected static $parameterEnclosingChars = array ('{' , '}' );
115 | 43:
116 | 44: 45: 46: 47: 48: 49: 50: 51:
124 | 52: public static function of($localeKey , $parameters = array ())
125 | 53: {
126 | 54: static ::checkIfHasBeenInitialized();
127 | 55: static ::checkIfLocalesAreLoaded();
128 | 56:
129 | 57: if (is_string ($localeKey ) && !empty (static ::$loadedLocales [static ::$currentLanguage ][$localeKey ]))
130 | 58: {
131 | 59: $text = static ::$loadedLocales [static ::$currentLanguage ][$localeKey ];
132 | 60:
133 | 61: if (!empty ($parameters ) && is_array ($parameters ))
134 | 62: {
135 | 63: foreach ($parameters as $parameter => $replacement )
136 | 64: {
137 | 65: $text = str_replace (static ::$parameterEnclosingChars [0 ] . $parameter . static ::$parameterEnclosingChars [1 ], $replacement , $text );
138 | 66: }
139 | 67: }
140 | 68:
141 | 69: return $text ;
142 | 70: }
143 | 71:
144 | 72: return null ;
145 | 73: }
146 | 74:
147 | 75: 76: 77: 78:
151 | 79: public static function setLocalesDir($localesDir )
152 | 80: {
153 | 81: if (!empty ($localesDir ) && is_string ($localesDir ))
154 | 82: {
155 | 83: self::$localesDir = $localesDir ;
156 | 84: static ::checkIfLocalesDirExists();
157 | 85: }
158 | 86: }
159 | 87:
160 | 88: 89: 90: 91:
164 | 92: public static function setDefaultLanguage($defaultLanguage )
165 | 93: {
166 | 94: if (!empty ($defaultLanguage ) && is_string ($defaultLanguage ))
167 | 95: {
168 | 96: self::$defaultLanguage = $defaultLanguage ;
169 | 97: static ::checkIfLocaleForDefaultLanguageExists();
170 | 98: }
171 | 99: }
172 | 100:
173 | 101: 102: 103: 104: 105: 106:
179 | 107: public static function forceLanguage($language )
180 | 108: {
181 | 109: static ::checkIfHasBeenInitialized();
182 | 110: static ::$currentLanguage = (!empty ($language ) && is_string ($language )) ? $language : static ::getClientLanguage();
183 | 111: static ::checkIfLocalesAreLoaded();
184 | 112: }
185 | 113:
186 | 114: 115: 116: 117: 118:
191 | 119: public static function setParameterEnclosingChars($openingChar = '{' , $closingChar = '}' )
192 | 120: {
193 | 121: if (!empty ($openingChar ) && is_string ($openingChar ) && !empty ($closingChar ) && is_string ($closingChar ))
194 | 122: {
195 | 123: static ::$parameterEnclosingChars = array ($openingChar , $closingChar );
196 | 124: }
197 | 125: }
198 | 126:
199 | 127: 128: 129: 130:
203 | 131: protected static function checkIfLocalesAreLoaded()
204 | 132: {
205 | 133: if (empty (static ::$loadedLocales [static ::$currentLanguage ]))
206 | 134: {
207 | 135: static ::checkIfLocaleForCurrentLanguageExists();
208 | 136: static ::$loadedLocales [static ::$currentLanguage ] = require (static ::$localesDir . '/' . static ::$currentLanguage . '.php' );
209 | 137: }
210 | 138: }
211 | 139:
212 | 140: 141: 142: 143:
216 | 144: protected static function getClientLanguage()
217 | 145: {
218 | 146: return !empty ($_SERVER ['HTTP_ACCEPT_LANGUAGE' ]) ? substr ($_SERVER ['HTTP_ACCEPT_LANGUAGE' ], 0 , 5 ) : null ;
219 | 147: }
220 | 148:
221 | 149: 150: 151: 152:
225 | 153: protected static function checkIfLocalesDirExists()
226 | 154: {
227 | 155: if (!is_dir (static ::$localesDir ))
228 | 156: {
229 | 157: throw new Exception('Directory "' . static ::$localesDir . '" not found!' );
230 | 158: }
231 | 159: }
232 | 160:
233 | 161: 162: 163: 164:
237 | 165: protected static function checkIfLocaleForDefaultLanguageExists()
238 | 166: {
239 | 167: if (!file_exists (static ::$localesDir . '/' . static ::$defaultLanguage . '.php' ))
240 | 168: {
241 | 169: throw new Exception('Default language locale not found!' );
242 | 170: }
243 | 171: }
244 | 172:
245 | 173: 174: 175:
248 | 176: protected static function checkIfHasBeenInitialized()
249 | 177: {
250 | 178: if (!static ::$initialized )
251 | 179: {
252 | 180: static ::initialize();
253 | 181: }
254 | 182: }
255 | 183:
256 | 184: 185: 186: 187:
260 | 188: protected static function initialize()
261 | 189: {
262 | 190: static ::checkIfLocalesDirExists();
263 | 191: static ::checkIfLocaleForDefaultLanguageExists();
264 | 192: static ::$currentLanguage = static ::getClientLanguage();
265 | 193: static ::$initialized = true ;
266 | 194: }
267 | 195:
268 | 196: 197: 198:
271 | 199: protected static function checkIfLocaleForCurrentLanguageExists()
272 | 200: {
273 | 201: if (!file_exists (static ::$localesDir . '/' . static ::$currentLanguage . '.php' ))
274 | 202: {
275 | 203: static ::$currentLanguage = static ::$defaultLanguage ;
276 | 204: }
277 | 205: }
278 | 206: }
279 | 207:
280 |
281 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
--------------------------------------------------------------------------------
/example/index.php:
--------------------------------------------------------------------------------
1 | 'John Doe', 'email' => 'john@doe.com']) . PHP_EOL;
10 | echo '-------' . PHP_EOL;
11 |
12 | Translation::forceLanguage('es-ES');
13 |
14 | echo Translation::of('presentation') . PHP_EOL;
15 | echo Translation::of('user.login.message', ['name' => 'John Doe', 'email' => 'john@doe.com']) . PHP_EOL;
16 | echo '-------' . PHP_EOL;
17 |
18 | Translation::forceLanguage('pt-BR');
19 |
20 | echo Translation::of('presentation') . PHP_EOL;
21 | echo Translation::of('user.login.message', ['name' => 'John Doe', 'email' => 'john@doe.com']) . PHP_EOL;
22 | echo '-------' . PHP_EOL;
23 |
24 | Translation::forceLanguage('en-US');
25 |
26 | echo Translation::of('presentation') . PHP_EOL;
27 | echo Translation::of('user.login.message', ['name' => 'John Doe', 'email' => 'john@doe.com']) . PHP_EOL;
28 | echo '-------' . PHP_EOL;
29 |
30 | Translation::forceLanguage('ru-RU');
31 |
32 | echo Translation::of('presentation') . PHP_EOL;
33 | echo Translation::of('user.login.message', ['name' => 'John Doe', 'email' => 'john@doe.com']) . PHP_EOL;
34 | echo '-------' . PHP_EOL;
35 |
36 | Translation::forceLanguage(false);
37 |
38 | echo Translation::of('presentation') . PHP_EOL;
39 | echo Translation::of('user.login.message', ['name' => 'John Doe', 'email' => 'john@doe.com']) . PHP_EOL;
40 |
--------------------------------------------------------------------------------
/example/locales/en-US.php:
--------------------------------------------------------------------------------
1 | 'Now the messages are being printed in English.',
4 | 'user.login.message' => 'Logged in as {name} ({email})',
5 | ];
--------------------------------------------------------------------------------
/example/locales/es-ES.php:
--------------------------------------------------------------------------------
1 | 'Ahora los mensajes se imprimen en español.',
4 | 'user.login.message' => 'Conectado como {name} ({email})',
5 | ];
--------------------------------------------------------------------------------
/example/locales/pt-BR.php:
--------------------------------------------------------------------------------
1 | 'Agora as mensagens estão sendo impressas em português.',
4 | 'user.login.message' => 'Logado como {name} ({email})',
5 | ];
--------------------------------------------------------------------------------
/example/locales/ru-RU.php:
--------------------------------------------------------------------------------
1 | 'Теперь сообщения не на русском языке.',
4 | 'user.login.message' => 'Вы вошли как {name} ({email})',
5 | ];
--------------------------------------------------------------------------------