mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-23 15:12:44 +03:00
1265 lines
128 KiB
JavaScript
1265 lines
128 KiB
JavaScript
|
|
||
|
var ApiGen = ApiGen || {};
|
||
|
ApiGen.config = {"require":{"min":"2.8.0"},"resources":{"resources":"resources"},"templates":{"common":{"overview.latte":"index.html","combined.js.latte":"resources\/combined.js","elementlist.js.latte":"elementlist.js","404.latte":"404.html"},"optional":{"sitemap":{"filename":"sitemap.xml","template":"sitemap.xml.latte"},"opensearch":{"filename":"opensearch.xml","template":"opensearch.xml.latte"},"robots":{"filename":"robots.txt","template":"robots.txt.latte"}},"main":{"package":{"filename":"package-%s.html","template":"package.latte"},"namespace":{"filename":"namespace-%s.html","template":"namespace.latte"},"class":{"filename":"class-%s.html","template":"class.latte"},"constant":{"filename":"constant-%s.html","template":"constant.latte"},"function":{"filename":"function-%s.html","template":"function.latte"},"source":{"filename":"source-%s.html","template":"source.latte"},"tree":{"filename":"tree.html","template":"tree.latte"},"deprecated":{"filename":"deprecated.html","template":"deprecated.latte"},"todo":{"filename":"todo.html","template":"todo.latte"}}},"options":{"elementDetailsCollapsed":true,"elementsOrder":"natural"},"config":"C:\\wamp\\bin\\php\\php5.4.3\\data\\ApiGen\\templates\\default\\config.neon"};
|
||
|
|
||
|
|
||
|
/*! jQuery v1.7 jquery.com | jquery.org/license */
|
||
|
(function(a,b){function cA(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cx(a){if(!cm[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cn||(cn=c.createElement("iframe"),cn.frameBorder=cn.width=cn.height=0),b.appendChild(cn);if(!co||!cn.createElement)co=(cn.contentWindow||cn.contentDocument).document,co.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),co.close();d=co.createElement(a),co.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cn)}cm[a]=e}return cm[a]}function cw(a,b){var c={};f.each(cs.concat.apply([],cs.slice(0,b)),function(){c[this]=a});return c}function cv(){ct=b}function cu(){setTimeout(cv,0);return ct=f.now()}function cl(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ck(){try{return new a.XMLHttpRequest}catch(b){}}function ce(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cd(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function cc(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bG.test(a)?d(a,e):cc(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)cc(a+"["+e+"]",b[e],c,d);else d(a,b)}function cb(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function ca(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bV,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=ca(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=ca(a,c,d,e,"*",g));return l}function b_(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bR),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bE(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bz:bA;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bB(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function br(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bi,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bq(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bp(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bp)}function bp(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bo(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bn(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=
|
||
|
(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},K=function(a,b){return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||a.id===b[2])&&(!b[3]||b[3].test(a.className))},L=function(a){return f.event.special.hover?a:a.replace(F,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=L(c).split(" ");for(k=0;k<c.length;k++){l=E.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,namespace:n.join(".")},p),g&&(o.quick=J(g),!o.quick&&f.expr.match.POS.test(g)&&(o.isPositional=!0)),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d){var e=f.hasData(a)&&f._data(a),g,h,i,j,k,l,m,n,o,p,q;if(!!e&&!!(m=e.events)){b=L(b||"").split(" ");for(g=0;g<b.length;g++){h=E.exec(b[g])||[],i=h[1],j=h[2];if(!i){j=j?"."+j:"";for(l in m)f.event.remove(a,l+j,c,d);return}n=f.event.special[i]||{},i=(d?n.delegateType:n.bindType)||i,p=m[i]||[],k=p.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;if(c||j||d||n.remove)for(l=0;l<p.length;l++){q=p[l];if(!c||c.guid===q.guid)if(!j||j.test(q.namespace))if(!d||d===q.selector||d==="**"&&q.selector)p.splice(l--,1),q.selector&&p.delegateCount--,n.remove&&n.remove.call(a,q)}else p.length=0;p.length===0&&k!==p.length&&((!n.teardown||n.teardown.call(a,j)===!1)&&f.removeEvent(a,i,e.handle),delete m[i])}f.isEmptyObject(m)&&(o=e.handle,o&&(o.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"",(g||!e)&&c.preventDefault();if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,n=null;for(m=e.parentNode;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length;l++){m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d);if(c.isPropagationStopped())break}c.type=h,c.isDefaultPrevented()||(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=(f.event.special[c.type]||{}).handle,j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click"))for(m=c.target;m!=
|
||
|
,arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Z,""):null;if(typeof a=="string"&&!bd.test(a)&&(f.support.leadingWhitespace||!$.test(a))&&!bj[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(_,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bg.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bl(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,br)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!be.test(j)&&(f.support.checkClone||!bg.test(j))&&!f.support.unknownElems&&bf.test(j)&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bn(a,d),e=bo(a),g=bo(d);for(h=0;e[h];++h)g[h]&&bn(e[h],g[h])}if(b){bm(a,d);if(c){e=bo(a),g=bo(d);for(h=0;e[h];++h)bm(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bc.test(k))k=b.createTextNode(k);else{k=k.replace(_,"<$1></$2>");var l=(ba.exec(k)||["",""])[1].toLowerCase(),m=bj[l]||bj._default,n=m[0],o=b.createElement("div");b===c?bk.appendChild(o):X(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=bb.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.node
|
||
|
/**
|
||
|
* Cookie plugin
|
||
|
*
|
||
|
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
|
||
|
* Dual licensed under the MIT and GPL licenses:
|
||
|
* http://www.opensource.org/licenses/mit-license.php
|
||
|
* http://www.gnu.org/licenses/gpl.html
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Create a cookie with the given name and value and other optional parameters.
|
||
|
*
|
||
|
* @example $.cookie('the_cookie', 'the_value');
|
||
|
* @desc Set the value of a cookie.
|
||
|
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
||
|
* @desc Create a cookie with all available options.
|
||
|
* @example $.cookie('the_cookie', 'the_value');
|
||
|
* @desc Create a session cookie.
|
||
|
* @example $.cookie('the_cookie', null);
|
||
|
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
|
||
|
* used when the cookie was set.
|
||
|
*
|
||
|
* @param String name The name of the cookie.
|
||
|
* @param String value The value of the cookie.
|
||
|
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
||
|
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
||
|
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
||
|
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
||
|
* when the the browser exits.
|
||
|
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
||
|
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
||
|
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
||
|
* require a secure protocol (like HTTPS).
|
||
|
* @type undefined
|
||
|
*
|
||
|
* @name $.cookie
|
||
|
* @cat Plugins/Cookie
|
||
|
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Get the value of a cookie with the given name.
|
||
|
*
|
||
|
* @example $.cookie('the_cookie');
|
||
|
* @desc Get the value of a cookie.
|
||
|
*
|
||
|
* @param String name The name of the cookie.
|
||
|
* @return The value of the cookie.
|
||
|
* @type String
|
||
|
*
|
||
|
* @name $.cookie
|
||
|
* @cat Plugins/Cookie
|
||
|
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||
|
*/
|
||
|
jQuery.cookie = function(name, value, options) {
|
||
|
if (typeof value != 'undefined') { // name and value given, set cookie
|
||
|
options = options || {};
|
||
|
if (value === null) {
|
||
|
value = '';
|
||
|
options.expires = -1;
|
||
|
}
|
||
|
var expires = '';
|
||
|
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
||
|
var date;
|
||
|
if (typeof options.expires == 'number') {
|
||
|
date = new Date();
|
||
|
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
|
||
|
} else {
|
||
|
date = options.expires;
|
||
|
}
|
||
|
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
|
||
|
}
|
||
|
// CAUTION: Needed to parenthesize options.path and options.domain
|
||
|
// in the following expressions, otherwise they evaluate to undefined
|
||
|
// in the packed version for some reason...
|
||
|
var path = options.path ? '; path=' + (options.path) : '';
|
||
|
var domain = options.domain ? '; domain=' + (options.domain) : '';
|
||
|
var secure = options.secure ? '; secure' : '';
|
||
|
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
|
||
|
} else { // only name given, get cookie
|
||
|
var cookieValue = null;
|
||
|
if (document.cookie && document.cookie != '') {
|
||
|
var cookies = document.cookie.split(';');
|
||
|
for (var i = 0; i < cookies.length; i++) {
|
||
|
var cookie = jQuery.trim(cookies[i]);
|
||
|
// Does this cookie string begin with the name we want?
|
||
|
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
||
|
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return cookieValue;
|
||
|
}
|
||
|
};
|
||
|
/*!
|
||
|
* sprintf and vsprintf for jQuery
|
||
|
* somewhat based on http://jan.moesen.nu/code/javascript/sprintf-and-printf-in-javascript/
|
||
|
* Copyright (c) 2008 Sabin Iacob (m0n5t3r) <iacobs@m0n5t3r.info>
|
||
|
* @license http://www.gnu.org/licenses/gpl.html
|
||
|
* @project jquery.sprintf
|
||
|
*/
|
||
|
(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);
|
||
|
|
||
|
/*!
|
||
|
* jQuery Autocomplete plugin 1.1
|
||
|
*
|
||
|
* Copyright (c) 2009 Jörn Zaefferer
|
||
|
*
|
||
|
* Dual licensed under the MIT and GPL licenses:
|
||
|
* http://www.opensource.org/licenses/mit-license.php
|
||
|
* http://www.gnu.org/licenses/gpl.html
|
||
|
*
|
||
|
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
|
||
|
*/
|
||
|
|
||
|
;(function($) {
|
||
|
|
||
|
$.fn.extend({
|
||
|
autocomplete: function(urlOrData, options) {
|
||
|
var isUrl = typeof urlOrData == "string";
|
||
|
options = $.extend({}, $.Autocompleter.defaults, {
|
||
|
url: isUrl ? urlOrData : null,
|
||
|
data: isUrl ? null : urlOrData,
|
||
|
delay: isUrl ? $.Autocompleter.defaults.delay : 10,
|
||
|
max: options && !options.scroll ? 10 : 150
|
||
|
}, options);
|
||
|
|
||
|
// if highlight is set to false, replace it with a do-nothing function
|
||
|
options.highlight = options.highlight || function(value) { return value; };
|
||
|
|
||
|
// if the formatMatch option is not specified, then use formatItem for backwards compatibility
|
||
|
options.formatMatch = options.formatMatch || options.formatItem;
|
||
|
|
||
|
options.show = options.show || function(list) {};
|
||
|
|
||
|
return this.each(function() {
|
||
|
new $.Autocompleter(this, options);
|
||
|
});
|
||
|
},
|
||
|
result: function(handler) {
|
||
|
return this.bind("result", handler);
|
||
|
},
|
||
|
search: function(handler) {
|
||
|
return this.trigger("search", [handler]);
|
||
|
},
|
||
|
flushCache: function() {
|
||
|
return this.trigger("flushCache");
|
||
|
},
|
||
|
setOptions: function(options){
|
||
|
return this.trigger("setOptions", [options]);
|
||
|
},
|
||
|
unautocomplete: function() {
|
||
|
return this.trigger("unautocomplete");
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$.Autocompleter = function(input, options) {
|
||
|
|
||
|
var KEY = {
|
||
|
UP: 38,
|
||
|
DOWN: 40,
|
||
|
DEL: 46,
|
||
|
TAB: 9,
|
||
|
RETURN: 13,
|
||
|
ESC: 27,
|
||
|
COMMA: 188,
|
||
|
PAGEUP: 33,
|
||
|
PAGEDOWN: 34,
|
||
|
BACKSPACE: 8
|
||
|
};
|
||
|
|
||
|
// Create $ object for input element
|
||
|
var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
|
||
|
|
||
|
var timeout;
|
||
|
var previousValue = "";
|
||
|
var cache = $.Autocompleter.Cache(options);
|
||
|
var hasFocus = 0;
|
||
|
var lastKeyPressCode;
|
||
|
var config = {
|
||
|
mouseDownOnSelect: false
|
||
|
};
|
||
|
var select = $.Autocompleter.Select(options, input, selectCurrent, config);
|
||
|
|
||
|
// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
|
||
|
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
|
||
|
// a keypress means the input has focus
|
||
|
// avoids issue where input had focus before the autocomplete was applied
|
||
|
hasFocus = 1;
|
||
|
// track last key pressed
|
||
|
lastKeyPressCode = event.keyCode;
|
||
|
switch(event.keyCode) {
|
||
|
|
||
|
case KEY.UP:
|
||
|
event.preventDefault();
|
||
|
if ( select.visible() ) {
|
||
|
select.prev();
|
||
|
} else {
|
||
|
onChange(0, true);
|
||
|
}
|
||
|
break;
|
||
|
|
||
|
case KEY.DOWN:
|
||
|
event.preventDefault();
|
||
|
if ( select.visible() ) {
|
||
|
select.next();
|
||
|
} else {
|
||
|
onChange(0, true);
|
||
|
}
|
||
|
break;
|
||
|
|
||
|
case KEY.PAGEUP:
|
||
|
event.preventDefault();
|
||
|
if ( select.visible() ) {
|
||
|
select.pageUp();
|
||
|
} else {
|
||
|
onChange(0, true);
|
||
|
}
|
||
|
break;
|
||
|
|
||
|
case KEY.PAGEDOWN:
|
||
|
event.preventDefault();
|
||
|
if ( select.visible() ) {
|
||
|
select.pageDown();
|
||
|
} else {
|
||
|
onChange(0, true);
|
||
|
}
|
||
|
break;
|
||
|
|
||
|
// matches also semicolon
|
||
|
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
|
||
|
case KEY.TAB:
|
||
|
case KEY.RETURN:
|
||
|
if( selectCurrent() ) {
|
||
|
//event.preventDefault();
|
||
|
//return false;
|
||
|
}
|
||
|
break;
|
||
|
|
||
|
case KEY.ESC:
|
||
|
select.hide();
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
clearTimeout(timeout);
|
||
|
timeout = setTimeout(onChange, options.delay);
|
||
|
break;
|
||
|
}
|
||
|
}).focus(function(){
|
||
|
// track whether the field has focus, we shouldn't process any
|
||
|
// results if the field no longer has focus
|
||
|
hasFocus++;
|
||
|
}).blur(function() {
|
||
|
hasFocus = 0;
|
||
|
if (!config.mouseDownOnSelect) {
|
||
|
hideResults();
|
||
|
}
|
||
|
}).click(function() {
|
||
|
// show select when clicking in a focused field
|
||
|
if ( hasFocus++ > 1 && !select.visible() ) {
|
||
|
onChange(0, true);
|
||
|
}
|
||
|
}).bind("search", function() {
|
||
|
// TODO why not just specifying both arguments?
|
||
|
var fn = (arguments.length > 1) ? arguments[1] : null;
|
||
|
function findValueCallback(q, data) {
|
||
|
var result;
|
||
|
if( data && data.length ) {
|
||
|
for (var i=0; i < data.length; i++) {
|
||
|
if( data[i].result.toLowerCase() == q.toLowerCase() ) {
|
||
|
result = data[i];
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if( typeof fn == "function" ) fn(result);
|
||
|
else $input.trigger("result", result && [result.data, result.value]);
|
||
|
}
|
||
|
$.each(trimWords($input.val()), function(i, value) {
|
||
|
request(value, findValueCallback, findValueCallback);
|
||
|
});
|
||
|
}).bind("flushCache", function() {
|
||
|
cache.flush();
|
||
|
}).bind("setOptions", function() {
|
||
|
$.extend(options, arguments[1]);
|
||
|
// if we've updated the data, repopulate
|
||
|
if ( "data" in arguments[1] )
|
||
|
cache.populate();
|
||
|
}).bind("unautocomplete", function() {
|
||
|
select.unbind();
|
||
|
$input.unbind();
|
||
|
$(input.form).unbind(".autocomplete");
|
||
|
});
|
||
|
|
||
|
|
||
|
function selectCurrent() {
|
||
|
var selected = select.selected();
|
||
|
if( !selected )
|
||
|
return false;
|
||
|
|
||
|
var v = selected.result;
|
||
|
previousValue = v;
|
||
|
|
||
|
if ( options.multiple ) {
|
||
|
var words = trimWords($input.val());
|
||
|
if ( words.length > 1 ) {
|
||
|
var seperator = options.multipleSeparator.length;
|
||
|
var cursorAt = $(input).selection().start;
|
||
|
var wordAt, progress = 0;
|
||
|
$.each(words, function(i, word) {
|
||
|
progress += word.length;
|
||
|
if (cursorAt <= progress) {
|
||
|
wordAt = i;
|
||
|
return false;
|
||
|
}
|
||
|
progress += seperator;
|
||
|
});
|
||
|
words[wordAt] = v;
|
||
|
// TODO this should set the cursor to the right position, but it gets overriden somewhere
|
||
|
//$.Autocompleter.Selection(input, progress + seperator, progress + seperator);
|
||
|
v = words.join( options.multipleSeparator );
|
||
|
}
|
||
|
v += options.multipleSeparator;
|
||
|
}
|
||
|
|
||
|
$input.val(v);
|
||
|
hideResultsNow();
|
||
|
$input.trigger("result", [selected.data, selected.value]);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
function onChange(crap, skipPrevCheck) {
|
||
|
if( lastKeyPressCode == KEY.DEL ) {
|
||
|
select.hide();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
var currentValue = $input.val();
|
||
|
|
||
|
if ( !skipPrevCheck && currentValue == previousValue )
|
||
|
return;
|
||
|
|
||
|
previousValue = currentValue;
|
||
|
|
||
|
currentValue = lastWord(currentValue);
|
||
|
if ( currentValue.length >= options.minChars) {
|
||
|
$input.addClass(options.loadingClass);
|
||
|
if (!options.matchCase)
|
||
|
currentValue = currentValue.toLowerCase();
|
||
|
request(currentValue, receiveData, hideResultsNow);
|
||
|
} else {
|
||
|
stopLoading();
|
||
|
select.hide();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function trimWords(value) {
|
||
|
if (!value)
|
||
|
return [""];
|
||
|
if (!options.multiple)
|
||
|
return [$.trim(value)];
|
||
|
return $.map(value.split(options.multipleSeparator), function(word) {
|
||
|
return $.trim(value).length ? $.trim(word) : null;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function lastWord(value) {
|
||
|
if ( !options.multiple )
|
||
|
return value;
|
||
|
var words = trimWords(value);
|
||
|
if (words.length == 1)
|
||
|
return words[0];
|
||
|
var cursorAt = $(input).selection().start;
|
||
|
if (cursorAt == value.length) {
|
||
|
words = trimWords(value)
|
||
|
} else {
|
||
|
words = trimWords(value.replace(value.substring(cursorAt), ""));
|
||
|
}
|
||
|
return words[words.length - 1];
|
||
|
}
|
||
|
|
||
|
// fills in the input box w/the first match (assumed to be the best match)
|
||
|
// q: the term entered
|
||
|
// sValue: the first matching result
|
||
|
function autoFill(q, sValue){
|
||
|
// autofill in the complete box w/the first match as long as the user hasn't entered in more data
|
||
|
// if the last user key pressed was backspace, don't autofill
|
||
|
if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
|
||
|
// fill in the value (keep the case the user has typed)
|
||
|
$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
|
||
|
// select the portion of the value not typed by the user (so the next character will erase)
|
||
|
$(input).selection(previousValue.length, previousValue.length + sValue.length);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function hideResults() {
|
||
|
clearTimeout(timeout);
|
||
|
timeout = setTimeout(hideResultsNow, 200);
|
||
|
};
|
||
|
|
||
|
function hideResultsNow() {
|
||
|
var wasVisible = select.visible();
|
||
|
select.hide();
|
||
|
clearTimeout(timeout);
|
||
|
stopLoading();
|
||
|
if (options.mustMatch) {
|
||
|
// call search and run callback
|
||
|
$input.search(
|
||
|
function (result){
|
||
|
// if no value found, clear the input box
|
||
|
if( !result ) {
|
||
|
if (options.multiple) {
|
||
|
var words = trimWords($input.val()).slice(0, -1);
|
||
|
$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
|
||
|
}
|
||
|
else {
|
||
|
$input.val( "" );
|
||
|
$input.trigger("result", null);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function receiveData(q, data) {
|
||
|
if ( data && data.length && hasFocus ) {
|
||
|
stopLoading();
|
||
|
select.display(data, q);
|
||
|
autoFill(q, data[0].value);
|
||
|
select.show();
|
||
|
} else {
|
||
|
hideResultsNow();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function request(term, success, failure) {
|
||
|
if (!options.matchCase)
|
||
|
term = term.toLowerCase();
|
||
|
var data = cache.load(term);
|
||
|
// recieve the cached data
|
||
|
if (data && data.length) {
|
||
|
success(term, data);
|
||
|
// if an AJAX url has been supplied, try loading the data now
|
||
|
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
|
||
|
|
||
|
var extraParams = {
|
||
|
timestamp: +new Date()
|
||
|
};
|
||
|
$.each(options.extraParams, function(key, param) {
|
||
|
extraParams[key] = typeof param == "function" ? param() : param;
|
||
|
});
|
||
|
|
||
|
$.ajax({
|
||
|
// try to leverage ajaxQueue plugin to abort previous requests
|
||
|
mode: "abort",
|
||
|
// limit abortion to this input
|
||
|
port: "autocomplete" + input.name,
|
||
|
dataType: options.dataType,
|
||
|
url: options.url,
|
||
|
data: $.extend({
|
||
|
q: lastWord(term),
|
||
|
limit: options.max
|
||
|
}, extraParams),
|
||
|
success: function(data) {
|
||
|
var parsed = options.parse && options.parse(data) || parse(data);
|
||
|
cache.add(term, parsed);
|
||
|
success(term, parsed);
|
||
|
}
|
||
|
});
|
||
|
} else {
|
||
|
// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
|
||
|
select.emptyList();
|
||
|
failure(term);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function parse(data) {
|
||
|
var parsed = [];
|
||
|
var rows = data.split("\n");
|
||
|
for (var i=0; i < rows.length; i++) {
|
||
|
var row = $.trim(rows[i]);
|
||
|
if (row) {
|
||
|
row = row.split("|");
|
||
|
parsed[parsed.length] = {
|
||
|
data: row,
|
||
|
value: row[0],
|
||
|
result: options.formatResult && options.formatResult(row, row[0]) || row[0]
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
return parsed;
|
||
|
};
|
||
|
|
||
|
function stopLoading() {
|
||
|
$input.removeClass(options.loadingClass);
|
||
|
};
|
||
|
|
||
|
};
|
||
|
|
||
|
$.Autocompleter.defaults = {
|
||
|
inputClass: "ac_input",
|
||
|
resultsClass: "ac_results",
|
||
|
loadingClass: "ac_loading",
|
||
|
minChars: 1,
|
||
|
delay: 400,
|
||
|
matchCase: false,
|
||
|
matchSubset: true,
|
||
|
matchContains: false,
|
||
|
cacheLength: 10,
|
||
|
max: 100,
|
||
|
mustMatch: false,
|
||
|
extraParams: {},
|
||
|
selectFirst: true,
|
||
|
formatItem: function(row) { return row[0]; },
|
||
|
formatMatch: null,
|
||
|
autoFill: false,
|
||
|
width: 0,
|
||
|
multiple: false,
|
||
|
multipleSeparator: ", ",
|
||
|
highlight: function(value, term) {
|
||
|
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
|
||
|
},
|
||
|
scroll: true,
|
||
|
scrollHeight: 180
|
||
|
};
|
||
|
|
||
|
$.Autocompleter.Cache = function(options) {
|
||
|
|
||
|
var data = {};
|
||
|
var length = 0;
|
||
|
|
||
|
function matchSubset(s, sub) {
|
||
|
if (!options.matchCase)
|
||
|
s = s.toLowerCase();
|
||
|
var i = s.indexOf(sub);
|
||
|
if (options.matchContains == "word"){
|
||
|
i = s.toLowerCase().search("\\b" + sub.toLowerCase());
|
||
|
}
|
||
|
if (i == -1) return false;
|
||
|
return i == 0 || options.matchContains;
|
||
|
};
|
||
|
|
||
|
function add(q, value) {
|
||
|
if (length > options.cacheLength){
|
||
|
flush();
|
||
|
}
|
||
|
if (!data[q]){
|
||
|
length++;
|
||
|
}
|
||
|
data[q] = value;
|
||
|
}
|
||
|
|
||
|
function populate(){
|
||
|
if( !options.data ) return false;
|
||
|
// track the matches
|
||
|
var stMatchSets = {},
|
||
|
nullData = 0;
|
||
|
|
||
|
// no url was specified, we need to adjust the cache length to make sure it fits the local data store
|
||
|
if( !options.url ) options.cacheLength = 1;
|
||
|
|
||
|
// track all options for minChars = 0
|
||
|
stMatchSets[""] = [];
|
||
|
|
||
|
// loop through the array and create a lookup structure
|
||
|
for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
|
||
|
var rawValue = options.data[i];
|
||
|
// if rawValue is a string, make an array otherwise just reference the array
|
||
|
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
|
||
|
|
||
|
var value = options.formatMatch(rawValue, i+1, options.data.length);
|
||
|
if ( value === false )
|
||
|
continue;
|
||
|
|
||
|
var firstChar = value.charAt(0).toLowerCase();
|
||
|
// if no lookup array for this character exists, look it up now
|
||
|
if( !stMatchSets[firstChar] )
|
||
|
stMatchSets[firstChar] = [];
|
||
|
|
||
|
// if the match is a string
|
||
|
var row = {
|
||
|
value: value,
|
||
|
data: rawValue,
|
||
|
result: options.formatResult && options.formatResult(rawValue) || value
|
||
|
};
|
||
|
|
||
|
// push the current match into the set list
|
||
|
stMatchSets[firstChar].push(row);
|
||
|
|
||
|
// keep track of minChars zero items
|
||
|
if ( nullData++ < options.max ) {
|
||
|
stMatchSets[""].push(row);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// add the data items to the cache
|
||
|
$.each(stMatchSets, function(i, value) {
|
||
|
// increase the cache size
|
||
|
options.cacheLength++;
|
||
|
// add to the cache
|
||
|
add(i, value);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
// populate any existing data
|
||
|
setTimeout(populate, 25);
|
||
|
|
||
|
function flush(){
|
||
|
data = {};
|
||
|
length = 0;
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
flush: flush,
|
||
|
add: add,
|
||
|
populate: populate,
|
||
|
load: function(q) {
|
||
|
if (!options.cacheLength || !length)
|
||
|
return null;
|
||
|
/*
|
||
|
* if dealing w/local data and matchContains than we must make sure
|
||
|
* to loop through all the data collections looking for matches
|
||
|
*/
|
||
|
if( !options.url && options.matchContains ){
|
||
|
// track all matches
|
||
|
var csub = [];
|
||
|
// loop through all the data grids for matches
|
||
|
for( var k in data ){
|
||
|
// don't search through the stMatchSets[""] (minChars: 0) cache
|
||
|
// this prevents duplicates
|
||
|
if( k.length > 0 ){
|
||
|
var c = data[k];
|
||
|
$.each(c, function(i, x) {
|
||
|
// if we've got a match, add it to the array
|
||
|
if (matchSubset(x.value, q)) {
|
||
|
csub.push(x);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
return csub;
|
||
|
} else
|
||
|
// if the exact item exists, use it
|
||
|
if (data[q]){
|
||
|
return data[q];
|
||
|
} else
|
||
|
if (options.matchSubset) {
|
||
|
for (var i = q.length - 1; i >= options.minChars; i--) {
|
||
|
var c = data[q.substr(0, i)];
|
||
|
if (c) {
|
||
|
var csub = [];
|
||
|
$.each(c, function(i, x) {
|
||
|
if (matchSubset(x.value, q)) {
|
||
|
csub[csub.length] = x;
|
||
|
}
|
||
|
});
|
||
|
return csub;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
|
||
|
$.Autocompleter.Select = function (options, input, select, config) {
|
||
|
var CLASSES = {
|
||
|
ACTIVE: "ac_over"
|
||
|
};
|
||
|
|
||
|
var listItems,
|
||
|
active = -1,
|
||
|
data,
|
||
|
term = "",
|
||
|
needsInit = true,
|
||
|
element,
|
||
|
list;
|
||
|
|
||
|
// Create results
|
||
|
function init() {
|
||
|
if (!needsInit)
|
||
|
return;
|
||
|
element = $("<div/>")
|
||
|
.hide()
|
||
|
.addClass(options.resultsClass)
|
||
|
.css("position", "absolute")
|
||
|
.appendTo(document.body);
|
||
|
|
||
|
list = $("<ul/>").appendTo(element).mouseover( function(event) {
|
||
|
if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
|
||
|
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
|
||
|
$(target(event)).addClass(CLASSES.ACTIVE);
|
||
|
}
|
||
|
}).click(function(event) {
|
||
|
$(target(event)).addClass(CLASSES.ACTIVE);
|
||
|
select();
|
||
|
// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
|
||
|
input.focus();
|
||
|
return false;
|
||
|
}).mousedown(function() {
|
||
|
config.mouseDownOnSelect = true;
|
||
|
}).mouseup(function() {
|
||
|
config.mouseDownOnSelect = false;
|
||
|
});
|
||
|
|
||
|
if( options.width > 0 )
|
||
|
element.css("width", options.width);
|
||
|
|
||
|
needsInit = false;
|
||
|
}
|
||
|
|
||
|
function target(event) {
|
||
|
var element = event.target;
|
||
|
while(element && element.tagName != "LI")
|
||
|
element = element.parentNode;
|
||
|
// more fun with IE, sometimes event.target is empty, just ignore it then
|
||
|
if(!element)
|
||
|
return [];
|
||
|
return element;
|
||
|
}
|
||
|
|
||
|
function moveSelect(step) {
|
||
|
listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
|
||
|
movePosition(step);
|
||
|
var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
|
||
|
if(options.scroll) {
|
||
|
var offset = 0;
|
||
|
listItems.slice(0, active).each(function() {
|
||
|
offset += this.offsetHeight;
|
||
|
});
|
||
|
if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
|
||
|
list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
|
||
|
} else if(offset < list.scrollTop()) {
|
||
|
list.scrollTop(offset);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function movePosition(step) {
|
||
|
active += step;
|
||
|
if (active < 0) {
|
||
|
active = listItems.size() - 1;
|
||
|
} else if (active >= listItems.size()) {
|
||
|
active = 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function limitNumberOfItems(available) {
|
||
|
return options.max && options.max < available
|
||
|
? options.max
|
||
|
: available;
|
||
|
}
|
||
|
|
||
|
function fillList() {
|
||
|
list.empty();
|
||
|
var max = limitNumberOfItems(data.length);
|
||
|
for (var i=0; i < max; i++) {
|
||
|
if (!data[i])
|
||
|
continue;
|
||
|
var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
|
||
|
if ( formatted === false )
|
||
|
continue;
|
||
|
var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
|
||
|
$.data(li, "ac_data", data[i]);
|
||
|
}
|
||
|
listItems = list.find("li");
|
||
|
if ( options.selectFirst ) {
|
||
|
listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
|
||
|
active = 0;
|
||
|
}
|
||
|
// apply bgiframe if available
|
||
|
if ( $.fn.bgiframe )
|
||
|
list.bgiframe();
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
display: function(d, q) {
|
||
|
init();
|
||
|
data = d;
|
||
|
term = q;
|
||
|
fillList();
|
||
|
},
|
||
|
next: function() {
|
||
|
moveSelect(1);
|
||
|
},
|
||
|
prev: function() {
|
||
|
moveSelect(-1);
|
||
|
},
|
||
|
pageUp: function() {
|
||
|
if (active != 0 && active - 8 < 0) {
|
||
|
moveSelect( -active );
|
||
|
} else {
|
||
|
moveSelect(-8);
|
||
|
}
|
||
|
},
|
||
|
pageDown: function() {
|
||
|
if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
|
||
|
moveSelect( listItems.size() - 1 - active );
|
||
|
} else {
|
||
|
moveSelect(8);
|
||
|
}
|
||
|
},
|
||
|
hide: function() {
|
||
|
element && element.hide();
|
||
|
listItems && listItems.removeClass(CLASSES.ACTIVE);
|
||
|
active = -1;
|
||
|
},
|
||
|
visible : function() {
|
||
|
return element && element.is(":visible");
|
||
|
},
|
||
|
current: function() {
|
||
|
return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
|
||
|
},
|
||
|
show: function() {
|
||
|
var offset = $(input).offset();
|
||
|
element.css({
|
||
|
width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).innerWidth(),
|
||
|
top: offset.top + input.offsetHeight,
|
||
|
left: offset.left
|
||
|
}).show();
|
||
|
options.show(element);
|
||
|
if(options.scroll) {
|
||
|
list.scrollTop(0);
|
||
|
list.css({
|
||
|
maxHeight: options.scrollHeight,
|
||
|
overflow: 'auto'
|
||
|
});
|
||
|
|
||
|
if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
|
||
|
var listHeight = 0;
|
||
|
listItems.each(function() {
|
||
|
listHeight += this.offsetHeight;
|
||
|
});
|
||
|
var scrollbarsVisible = listHeight > options.scrollHeight;
|
||
|
list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
|
||
|
if (!scrollbarsVisible) {
|
||
|
// IE doesn't recalculate width when scrollbar disappears
|
||
|
listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
},
|
||
|
selected: function() {
|
||
|
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
|
||
|
return selected && selected.length && $.data(selected[0], "ac_data");
|
||
|
},
|
||
|
emptyList: function (){
|
||
|
list && list.empty();
|
||
|
},
|
||
|
unbind: function() {
|
||
|
element && element.remove();
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
|
||
|
$.fn.selection = function(start, end) {
|
||
|
if (start !== undefined) {
|
||
|
return this.each(function() {
|
||
|
if( this.createTextRange ){
|
||
|
var selRange = this.createTextRange();
|
||
|
if (end === undefined || start == end) {
|
||
|
selRange.move("character", start);
|
||
|
selRange.select();
|
||
|
} else {
|
||
|
selRange.collapse(true);
|
||
|
selRange.moveStart("character", start);
|
||
|
selRange.moveEnd("character", end);
|
||
|
selRange.select();
|
||
|
}
|
||
|
} else if( this.setSelectionRange ){
|
||
|
this.setSelectionRange(start, end);
|
||
|
} else if( this.selectionStart ){
|
||
|
this.selectionStart = start;
|
||
|
this.selectionEnd = end;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
var field = this[0];
|
||
|
if ( field.createTextRange ) {
|
||
|
var range = document.selection.createRange(),
|
||
|
orig = field.value,
|
||
|
teststring = "<->",
|
||
|
textLength = range.text.length;
|
||
|
range.text = teststring;
|
||
|
var caretAt = field.value.indexOf(teststring);
|
||
|
field.value = orig;
|
||
|
this.selection(caretAt, caretAt + textLength);
|
||
|
return {
|
||
|
start: caretAt,
|
||
|
end: caretAt + textLength
|
||
|
}
|
||
|
} else if( field.selectionStart !== undefined ){
|
||
|
return {
|
||
|
start: field.selectionStart,
|
||
|
end: field.selectionEnd
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
})(jQuery);
|
||
|
/**
|
||
|
* jQuery.fn.sortElements
|
||
|
* --------------
|
||
|
* @author James Padolsey (http://james.padolsey.com)
|
||
|
* @version 0.11
|
||
|
* @updated 18-MAR-2010
|
||
|
* --------------
|
||
|
* @param Function comparator:
|
||
|
* Exactly the same behaviour as [1,2,3].sort(comparator)
|
||
|
*
|
||
|
* @param Function getSortable
|
||
|
* A function that should return the element that is
|
||
|
* to be sorted. The comparator will run on the
|
||
|
* current collection, but you may want the actual
|
||
|
* resulting sort to occur on a parent or another
|
||
|
* associated element.
|
||
|
*
|
||
|
* E.g. $('td').sortElements(comparator, function(){
|
||
|
* return this.parentNode;
|
||
|
* })
|
||
|
*
|
||
|
* The <td>'s parent (<tr>) will be sorted instead
|
||
|
* of the <td> itself.
|
||
|
*/
|
||
|
jQuery.fn.sortElements = (function(){
|
||
|
|
||
|
var sort = [].sort;
|
||
|
|
||
|
return function(comparator, getSortable) {
|
||
|
|
||
|
getSortable = getSortable || function(){return this;};
|
||
|
|
||
|
var placements = this.map(function(){
|
||
|
|
||
|
var sortElement = getSortable.call(this),
|
||
|
parentNode = sortElement.parentNode,
|
||
|
|
||
|
// Since the element itself will change position, we have
|
||
|
// to have some way of storing it's original position in
|
||
|
// the DOM. The easiest way is to have a 'flag' node:
|
||
|
nextSibling = parentNode.insertBefore(
|
||
|
document.createTextNode(''),
|
||
|
sortElement.nextSibling
|
||
|
);
|
||
|
|
||
|
return function() {
|
||
|
|
||
|
if (parentNode === this) {
|
||
|
throw new Error(
|
||
|
"You can't sort elements if any one is a descendant of another."
|
||
|
);
|
||
|
}
|
||
|
|
||
|
// Insert before flag:
|
||
|
parentNode.insertBefore(this, nextSibling);
|
||
|
// Remove flag:
|
||
|
parentNode.removeChild(nextSibling);
|
||
|
|
||
|
};
|
||
|
|
||
|
});
|
||
|
|
||
|
return sort.call(this, comparator).each(function(i){
|
||
|
placements[i].call(getSortable.call(this));
|
||
|
});
|
||
|
|
||
|
};
|
||
|
|
||
|
})();
|
||
|
/*!
|
||
|
* ApiGen 2.8.0 - API documentation generator for PHP 5.3+
|
||
|
*
|
||
|
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
|
||
|
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
|
||
|
* Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville)
|
||
|
*
|
||
|
* For the full copyright and license information, please view
|
||
|
* the file LICENSE.md that was distributed with this source code.
|
||
|
*/
|
||
|
|
||
|
$(function() {
|
||
|
var $document = $(document);
|
||
|
var $left = $('#left');
|
||
|
var $right = $('#right');
|
||
|
var $rightInner = $('#rightInner');
|
||
|
var $splitter = $('#splitter');
|
||
|
var $groups = $('#groups');
|
||
|
var $content = $('#content');
|
||
|
|
||
|
// Menu
|
||
|
|
||
|
// Hide deep packages and namespaces
|
||
|
$('ul span', $groups).click(function(event) {
|
||
|
event.preventDefault();
|
||
|
event.stopPropagation();
|
||
|
$(this)
|
||
|
.toggleClass('collapsed')
|
||
|
.parent()
|
||
|
.next('ul')
|
||
|
.toggleClass('collapsed');
|
||
|
}).click();
|
||
|
|
||
|
$active = $('ul li.active', $groups);
|
||
|
if ($active.length > 0) {
|
||
|
// Open active
|
||
|
$('> a > span', $active).click();
|
||
|
} else {
|
||
|
$main = $('> ul > li.main', $groups);
|
||
|
if ($main.length > 0) {
|
||
|
// Open first level of the main project
|
||
|
$('> a > span', $main).click();
|
||
|
} else {
|
||
|
// Open first level of all
|
||
|
$('> ul > li > a > span', $groups).click();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Content
|
||
|
|
||
|
// Search autocompletion
|
||
|
var autocompleteFound = false;
|
||
|
var autocompleteFiles = {'c': 'class', 'co': 'constant', 'f': 'function', 'm': 'class', 'mm': 'class', 'p': 'class', 'mp': 'class', 'cc': 'class'};
|
||
|
var $search = $('#search input[name=q]');
|
||
|
$search
|
||
|
.autocomplete(ApiGen.elements, {
|
||
|
matchContains: true,
|
||
|
scrollHeight: 200,
|
||
|
max: 20,
|
||
|
formatItem: function(data) {
|
||
|
return data[1].replace(/^(.+\\)(.+)$/, '<span><small>$1</small>$2</span>');
|
||
|
},
|
||
|
formatMatch: function(data) {
|
||
|
return data[1];
|
||
|
},
|
||
|
formatResult: function(data) {
|
||
|
return data[1];
|
||
|
},
|
||
|
show: function($list) {
|
||
|
var $items = $('li span', $list);
|
||
|
var maxWidth = Math.max.apply(null, $items.map(function() {
|
||
|
return $(this).width();
|
||
|
}));
|
||
|
// 10px padding
|
||
|
$list
|
||
|
.width(Math.max(maxWidth + 10, $search.innerWidth()))
|
||
|
.css('left', $search.offset().left + $search.outerWidth() - $list.outerWidth());
|
||
|
}
|
||
|
}).result(function(event, data) {
|
||
|
autocompleteFound = true;
|
||
|
var location = window.location.href.split('/');
|
||
|
location.pop();
|
||
|
var parts = data[1].split(/::|$/);
|
||
|
var file = $.sprintf(ApiGen.config.templates.main[autocompleteFiles[data[0]]].filename, parts[0].replace(/[^\w]/g, '.'));
|
||
|
if (parts[1]) {
|
||
|
file += '#' + ('mm' === data[0] || 'mp' === data[0] ? 'm' : '') + parts[1].replace(/([\w]+)\(\)/, '_$1');
|
||
|
}
|
||
|
location.push(file);
|
||
|
window.location = location.join('/');
|
||
|
|
||
|
// Workaround for Opera bug
|
||
|
$(this).closest('form').attr('action', location.join('/'));
|
||
|
}).closest('form')
|
||
|
.submit(function() {
|
||
|
var query = $search.val();
|
||
|
if ('' === query) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
var label = $('#search input[name=more]').val();
|
||
|
if (!autocompleteFound && label && -1 === query.indexOf('more:')) {
|
||
|
$search.val(query + ' more:' + label);
|
||
|
}
|
||
|
|
||
|
return !autocompleteFound && '' !== $('#search input[name=cx]').val();
|
||
|
});
|
||
|
|
||
|
// Save natural order
|
||
|
$('table.summary tr[data-order]', $content).each(function(index) {
|
||
|
do {
|
||
|
index = '0' + index;
|
||
|
} while (index.length < 3);
|
||
|
$(this).attr('data-order-natural', index);
|
||
|
});
|
||
|
|
||
|
// Switch between natural and alphabetical order
|
||
|
var $caption = $('table.summary', $content)
|
||
|
.filter(':has(tr[data-order])')
|
||
|
.find('caption');
|
||
|
$caption
|
||
|
.click(function() {
|
||
|
var $this = $(this);
|
||
|
var order = $this.data('order') || 'natural';
|
||
|
order = 'natural' === order ? 'alphabetical' : 'natural';
|
||
|
$this.data('order', order);
|
||
|
$.cookie('order', order, {expires: 365});
|
||
|
var attr = 'alphabetical' === order ? 'data-order' : 'data-order-natural';
|
||
|
$this
|
||
|
.closest('table')
|
||
|
.find('tr').sortElements(function(a, b) {
|
||
|
return $(a).attr(attr) > $(b).attr(attr) ? 1 : -1;
|
||
|
});
|
||
|
return false;
|
||
|
})
|
||
|
.addClass('switchable')
|
||
|
.attr('title', 'Switch between natural and alphabetical order');
|
||
|
if ((null === $.cookie('order') && 'alphabetical' === ApiGen.config.options.elementsOrder) || 'alphabetical' === $.cookie('order')) {
|
||
|
$caption.click();
|
||
|
}
|
||
|
|
||
|
// Open details
|
||
|
if (ApiGen.config.options.elementDetailsCollapsed) {
|
||
|
$('tr', $content).filter(':has(.detailed)')
|
||
|
.click(function() {
|
||
|
var $this = $(this);
|
||
|
$('.short', $this).hide();
|
||
|
$('.detailed', $this).show();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
// Splitter
|
||
|
var splitterWidth = $splitter.width();
|
||
|
function setSplitterPosition(position)
|
||
|
{
|
||
|
$left.width(position);
|
||
|
$right.css('margin-left', position + splitterWidth);
|
||
|
$splitter.css('left', position);
|
||
|
}
|
||
|
function setNavigationPosition()
|
||
|
{
|
||
|
var width = $rightInner.width();
|
||
|
$rightInner
|
||
|
.toggleClass('medium', width <= 960)
|
||
|
.toggleClass('small', width <= 650);
|
||
|
}
|
||
|
$splitter.mousedown(function() {
|
||
|
$splitter.addClass('active');
|
||
|
|
||
|
$document.mousemove(function(event) {
|
||
|
if (event.pageX >= 230 && $document.width() - event.pageX >= 600 + splitterWidth) {
|
||
|
setSplitterPosition(event.pageX);
|
||
|
setNavigationPosition();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$()
|
||
|
.add($splitter)
|
||
|
.add($document)
|
||
|
.mouseup(function() {
|
||
|
$splitter
|
||
|
.removeClass('active')
|
||
|
.unbind('mouseup');
|
||
|
$document
|
||
|
.unbind('mousemove')
|
||
|
.unbind('mouseup');
|
||
|
|
||
|
$.cookie('splitter', parseInt($splitter.css('left')), {expires: 365});
|
||
|
});
|
||
|
|
||
|
return false;
|
||
|
});
|
||
|
var splitterPosition = $.cookie('splitter');
|
||
|
if (null !== splitterPosition) {
|
||
|
setSplitterPosition(parseInt(splitterPosition));
|
||
|
}
|
||
|
setNavigationPosition();
|
||
|
$(window).resize(setNavigationPosition);
|
||
|
|
||
|
// Select selected lines
|
||
|
var matches = window.location.hash.substr(1).match(/^\d+(?:-\d+)?(?:,\d+(?:-\d+)?)*$/);
|
||
|
if (null !== matches) {
|
||
|
var lists = matches[0].split(',');
|
||
|
for (var i = 0; i < lists.length; i++) {
|
||
|
var lines = lists[i].split('-');
|
||
|
lines[1] = lines[1] || lines[0];
|
||
|
for (var j = lines[0]; j <= lines[1]; j++) {
|
||
|
$('#' + j).addClass('selected');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var $firstLine = $('#' + parseInt(matches[0]));
|
||
|
if ($firstLine.length > 0) {
|
||
|
$right.scrollTop($firstLine.offset().top);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Save selected lines
|
||
|
var lastLine;
|
||
|
$('a.l').click(function(event) {
|
||
|
event.preventDefault();
|
||
|
|
||
|
var $selectedLine = $(this).parent();
|
||
|
var selectedLine = parseInt($selectedLine.attr('id'));
|
||
|
|
||
|
if (event.shiftKey) {
|
||
|
if (lastLine) {
|
||
|
for (var i = Math.min(selectedLine, lastLine); i <= Math.max(selectedLine, lastLine); i++) {
|
||
|
$('#' + i).addClass('selected');
|
||
|
}
|
||
|
} else {
|
||
|
$selectedLine.addClass('selected');
|
||
|
}
|
||
|
} else if (event.ctrlKey) {
|
||
|
$selectedLine.toggleClass('selected');
|
||
|
} else {
|
||
|
var $selected = $('.l.selected')
|
||
|
.not($selectedLine)
|
||
|
.removeClass('selected');
|
||
|
if ($selected.length > 0) {
|
||
|
$selectedLine.addClass('selected');
|
||
|
} else {
|
||
|
$selectedLine.toggleClass('selected');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
lastLine = $selectedLine.hasClass('selected') ? selectedLine : null;
|
||
|
|
||
|
// Update hash
|
||
|
var lines = $('.l.selected')
|
||
|
.map(function() {
|
||
|
return parseInt($(this).attr('id'));
|
||
|
})
|
||
|
.get()
|
||
|
.sort(function(a, b) {
|
||
|
return a - b;
|
||
|
});
|
||
|
|
||
|
var hash = [];
|
||
|
var list = [];
|
||
|
for (var j = 0; j < lines.length; j++) {
|
||
|
if (0 === j && j + 1 === lines.length) {
|
||
|
hash.push(lines[j]);
|
||
|
} else if (0 === j) {
|
||
|
list[0] = lines[j];
|
||
|
} else if (lines[j - 1] + 1 !== lines[j] && j + 1 === lines.length) {
|
||
|
hash.push(list.join('-'));
|
||
|
hash.push(lines[j]);
|
||
|
} else if (lines[j - 1] + 1 !== lines[j]) {
|
||
|
hash.push(list.join('-'));
|
||
|
list = [lines[j]];
|
||
|
} else if (j + 1 === lines.length) {
|
||
|
list[1] = lines[j];
|
||
|
hash.push(list.join('-'));
|
||
|
} else {
|
||
|
list[1] = lines[j];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
window.location.hash = hash.join(',');
|
||
|
});
|
||
|
});
|
||
|
|