/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0="==e.substr(0,2)?(a="gte",n=e.substr(2)):"<="==e.substr(0,2)?(a="lte",n=e.substr(2)):">"==e.substr(0,1)?(a="gt",n=e.substr(1)):"<"==e.substr(0,1)?(a="lt",n=e.substr(1)):"!"==e.substr(0,1)?(a="not",n=e.substr(1)):(a="eq",n=e),n&&n in t.list)if(i=t.list[n],Array.isArray(i)){if(r=parseInt(i[0]),d=parseInt(i[1]),isNaN(r)){if(isNaN(d))return;c=i[1].substr(String(d).length)}else c=i[0].substr(String(r).length);if(isNaN(r))switch(a){case"gte":s="screen";break;case"lte":s="screen and (max-width: "+d+c+")";break;case"gt":s="screen and (min-width: "+(d+1)+c+")";break;case"lt":s="screen and (max-width: -1px)";break;case"not":s="screen and (min-width: "+(d+1)+c+")";break;default:s="screen and (max-width: "+d+c+")"}else if(isNaN(d))switch(a){case"gte":s="screen and (min-width: "+r+c+")";break;case"lte":s="screen";break;case"gt":s="screen and (max-width: -1px)";break;case"lt":s="screen and (max-width: "+(r-1)+c+")";break;case"not":s="screen and (max-width: "+(r-1)+c+")";break;default:s="screen and (min-width: "+r+c+")"}else switch(a){case"gte":s="screen and (min-width: "+r+c+")";break;case"lte":s="screen and (max-width: "+d+c+")";break;case"gt":s="screen and (min-width: "+(d+1)+c+")";break;case"lt":s="screen and (max-width: "+(r-1)+c+")";break;case"not":s="screen and (max-width: "+(r-1)+c+"), screen and (min-width: "+(d+1)+c+")";break;default:s="screen and (min-width: "+r+c+") and (max-width: "+d+c+")"}}else s="("==i.charAt(0)?"screen and "+i:i;t.media[e]=!!s&&s}return t.media[e]!==!1&&window.matchMedia(t.media[e]).matches},on:function(e,n){t.events.push({query:e,handler:n,state:!1}),t.active(e)&&n()},poll:function(){var e,n;for(e=0;e-1) { tmp = result.split('RES:OK:wechat[:]'); tmp = tmp[1].split('[:]'); AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=create_payment_request&provider=wechat&local_id='+window.uniqueid+'&item_name='+tmp[0]+'&item_id='+tmp[1]+'&item_amount='+tmp[2]+'&item_currency='+tmp[3],false,'qrCodeHandling'); setInterval(function() { checkUpdate(purchase_desc,purchase_id,currency); }, 1000); } if(result.indexOf('RES:OK:card')>-1) { tmp = result.split('RES:OK:card[:]'); tmp = tmp[1].split('[:]'); } if(result.indexOf('RES:OK:paypal')>-1) { //start pinging atf every 2 seconds for an update window.paid = false; setInterval(function() { AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=check_payment&uniqueid='+window.uniqueid,false,'paymentResponse'); }, 2000); } if(result.indexOf('RES:OK:alipay')>-1) { //start pinging atf every 2 seconds for an update window.paid = false; setInterval(function() { AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=check_payment&uniqueid='+window.uniqueid,false,'paymentResponse'); }, 2000); } } function checkUpdate() { if(window.last_payment_amount!=document.getElementById('amount').value) { clearInterval(window.check_payment_handle); AjaxCall('?new_payment_request&type='+window.last_payment_type+'&price='+document.getElementById('amount').value+'&desc='+document.getElementById('purchase_desc').value+'¤cy='+document.getElementById('currency').value+'&id='+document.getElementById(purchase_id).value,false,'showResponse'); } } function cardPaymentHandling(result) { //it worked or it didnt if(result.indexOf('<[RES[OK')>-1) { paymentSuccessful(); } else { document.getElementById('status_image').src = 'https://cdn.atfgroup.com.cn/l4CK7K7N5YpGfJwKnyRXLOQLGgA9Eq7R.png'; document.getElementById('status_image').width = '110'; document.getElementById('status_image').height = '100%'; document.getElementById('payment_status').innerHTML = 'Sorry, your payment was not accepted. try again'; } } function paymentSuccessful() { document.getElementById('status_image').src = 'https://cdn.atfgroup.com.cn/FtaTgKhXMlAlecKoiKky3J6TzYQ0i7Ct.png'; document.getElementById('status_image').width = '115'; document.getElementById('status_image').height = '115'; document.getElementById('payment_status').innerHTML = 'Payment successful!'; document.getElementById('back_to_payment_options').style.display = 'none'; window.paid = true; clearInterval(); } function reloadPaymentOptions() { if(window.payment_options!='') { document.getElementById('payment_div').innerHTML = window.payment_options; //reload stripe scripts showCardPayment(); } } function checkPaymentSuccess(payment_id) { //ping paymentid back, is it paid yet? payment_id AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=check_payment&payment_id='+payment_id,false,'paymentResponse'); } function paymentResponse(payload) { if(payload.indexOf('<[RES[PAID')>-1) { if(!window.paid) { paymentSuccessful(); } } } function qrCodeHandling(payload) { if(payload.indexOf('<[RES[SUCCESS[[')>-1) { tmp = payload.split('SUCCESS[['); tmp = tmp[1].split(']]]'); payload = JSON.parse(tmp[0]); document.getElementById('status_image').src = payload['qr_code']; //ping every 2 seconds for an update for payment window.paid = false; window.check_payment_handle = setInterval(function() { checkPaymentSuccess(payload.payment_id); }, 4000); } } function showCardPayment() { window.paymentHandler = StripeCheckout.configure({ key: 'pk_live_c6Pocns6JlCg5svExofTLjbP', image: 'https://stripe.com/img/documentation/checkout/marketplace.png', locale: 'auto', token: function(token) { //show charging card message and send token to core document.getElementById('payment_status').innerHTML = 'Charging your card... please wait'; AjaxCall('?type=charge_card&uniqueid='+window.uniqueid+'&token='+token.id,false,'cardPaymentHandling'); } }); document.getElementById('cardPayment').addEventListener('click', function(e) { window.last_payment_type='card'; // Open Checkout with further options: window.paymentHandler.open({ name: document.getElementById('purchase_desc').value, description: document.getElementById('purchase_desc').value, currency: document.getElementById('currency').value, amount: parseFloat(document.getElementById('amount').value+"00") }); // send update to us AjaxCall('?new_payment_request&type=card&price='+document.getElementById('amount').value+'&desc='+document.getElementById('purchase_desc').value+'¤cy='+document.getElementById('currency').value+'&id='+document.getElementById('purchase_id').value,false,'showResponse'); e.preventDefault(); }); // Close Checkout on page navigation: window.addEventListener('popstate', function() { window.paymentHandler.close(); }); } function loadScript(url, callback){ var script = document.createElement("script"); script.type = "text/javascript"; if (script.readyState){ //IE script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function(){ callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); } function ajaxRequest(){ var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; //activeX versions to check for in IE if(window.ActiveXObject) { //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken) for (var i=0; i maybe use this later, for now pass directly to returnFunction if setActive if (typeof window[returnFunction] == 'function') { window[returnFunction](this.response); } }; // Send the Data. xhr.send(formData); } function AjaxCall(url,returnId,returnFunction,append) { var mygetrequest=new ajaxRequest(); mygetrequest.onreadystatechange=function(){ if (mygetrequest.readyState==4){ if (mygetrequest.status==200 || window.location.href.indexOf("http")==-1){ if(typeof returnId != 'undefined'&returnId!=false) { if(typeof append != 'undefined'&append!=false) { document.getElementById(returnId).innerHTML=document.getElementById(returnId).innerHTML+mygetrequest.responseText; } else { document.getElementById(returnId).innerHTML=mygetrequest.responseText; } } if (typeof window[returnFunction] == 'function') { window[returnFunction](mygetrequest.responseText); } } } }; mygetrequest.open("GET", url, true); mygetrequest.send(null); } window.job_title = ''; window.account_id = 0; window.stored_html = ''; function showLogin() { window.login_div = createWindow("Login", '

Login
Haven\'t registered yet? register.

Username:
Password:
'); //detect enter key press detectKeyPress('lbpass','doLogin'); //login leadbox animate start /**var current = null; document.getElementById('lbemail').addEventListener('focus', function(e) { if (current) current.pause(); current = anime({ targets: '.check1', strokeDashoffset: { value: 0, duration: 700, easing: 'easeOutQuart' }, strokeDasharray: { value: '240 1386', duration: 700, easing: 'easeOutQuart' } }); }); document.getElementById('lbpass').addEventListener('focus', function(e) { if (current) current.pause(); current = anime({ targets: '.check1', strokeDashoffset: { value: -336, duration: 700, easing: 'easeOutQuart' }, strokeDasharray: { value: '240 1386', duration: 700, easing: 'easeOutQuart' } }); }); **/ //login leadbox animate end }; function doLogin() { window.username = document.getElementById('lbemail').value; password = document.getElementById('lbpass').value; if(window.username.length>3&&password.length>3) { //show waiting window.stored_html = document.getElementById('login_div').innerHTML; if(document.getElementById('login_button')){ //if login_button, just change that document.getElementById('login_button').value = "Logging in..."; document.getElementById('login_button').disabled = true; } else { document.getElementById('login_div').innerHTML = '



Checking credentials...'; } AjaxCall("?atf_do_login&username="+btoa(encodeURIComponent(window.username))+"&password="+btoa(encodeURIComponent(password)),false,"loginReply"); } else { if(document.getElementById('lbpass').value==''&&/^\d+$/.test(document.getElementById('lbemail').value)&&document.getElementById('lbemail').value.length>6) { sendCode(); } else { message = 'Please enter your phone number / username and password.'; if(document.getElementById('lbpass').placeholder=='密码'||window.lang=='cn') { window.lang = 'cn'; message = '请输入您的电话号码和密码。'; } document.getElementById('code_error').innerHTML = message; } } }; function loginReply(data) { if(data.indexOf('[RES[OK')>-1) { //show success //document.getElementById('biscuitsDialog').style.textAlign = 'center'; //document.getElementById('biscuitsDialog').style.padding = '8px'; if(document.getElementById('login_success')){ document.getElementById('login_success').innerHTML = "
Login successful!
"; document.getElementById('login_success').style.textAlign = 'center'; } else { document.getElementById('login_div').innerHTML = "


Login successful!
"; document.getElementById('login_div').style.textAlign = 'center'; } window.loggedin = true; //get the account_id tmp = data.split('[OK:'); tmp = tmp[1].split(']]'); window.account_id = tmp[0]; if(window.job_id>0) { sendAccountDetailsToClient(window.job_id,window.employer_id,window.job_title); } //wait 1 seconds and reload setTimeout(function(){ window.location.reload(1); }, 1000); } else { document.getElementById('login_div').innerHTML = window.stored_html; document.getElementById('lbemail').value = window.username; window.stored_html = ''; document.getElementById('code_error').innerHTML = "Sorry your username or password is incorrect."; } }; function sendAccountDetailsToClient(job_id,employer_id,account_id,job_title) { //show applying closeRegister(); var div = document.createElement('div'); div.setAttribute('id','biscuitsDialog'); div.style.position = 'fixed'; div.style.zIndex = '20'; div.style.background = '#fff'; div.style.color = 'black'; div.style.boxShadow = '2px 3px 2px #dde2ea'; div.style.textAlign = 'center'; div.style.padding = '8px'; div.style.paddingBottom = '25px'; document.body.appendChild(div); document.getElementById('biscuitsDialog').innerHTML = "



Sending your application to the employer..."; try { centerDialog('biscuitsDialog'); } catch(err) {} account_details = ""; if(typeof account_id != null&&account_id>0) { account_details = "&account_id="+account_id; } if(typeof job_title != null&&job_title!='') { account_details += "&title="+btoa(job_title); } if(typeof window.subject_prefix != null&&window.subject_prefix!='') { account_details += "&subject_prefix="+btoa(window.subject_prefix); } AjaxCall("?atf_send_application&job_id="+job_id+"&employer_id="+employer_id+account_details,false,"applicationReply"); }; function applicationReply(reply) { if(reply.indexOf('ERROR:notloggedin')>-1) { showLogin(); } else if(reply.indexOf('RES[nocv]')>-1) { showFinalStep(); } else if(reply.indexOf('RES[alreadyapplied]')>-1) { document.getElementById('biscuitsDialog').innerHTML = "

You\'ve already applied for this job. Please wait for a reply from the employer shortly."; } else if(reply.indexOf('RES[OK')>-1) { document.getElementById('biscuitsDialog').innerHTML = "



Application sent successfully!"; } else { document.getElementById('biscuitsDialog').innerHTML = "

Sorry, we couldnt process your application right now, please try again."; } if(reply.indexOf('ERROR:notloggedin')==-1) { window.loggedin = true; } try { centerDialog('biscuitsDialog'); } catch(err) { console.log("Dialog Error check") } }; function isLoggedIn() { if(!window.loggedin) { return window.loggedin; } else { return true; } }; function closeRegister() { if(document.getElementById('biscuitsDialog')) { var elem = document.getElementById("biscuitsDialog"); elem.parentElement.removeChild(elem); } }; function doFinalizeAccount() { //handle file var fileSelect = document.getElementById('cv'); var files = fileSelect.files; var formData = new FormData(); var validated = true; var validationErrors = ''; // Loop through each of the selected files. var filesAttachedCount = 0; for (var i = 0; i < files.length; i++) { var file = files[i]; // Check the file type. if (file.name.indexOf('.doc')==-1&&file.name.indexOf('.docx')==-1&&file.name.indexOf('.pdf')==-1&&file.name.indexOf('*.txt')==-1&&file.name.indexOf('.odt')==-1) { validationErrors += 'Sorry, could not add file: '+file.name+' because it is not a .doc, .docx, .pdf, .odt or .txt file'; continue; } // Add the file to the request. formData.append('cvs[]', file, file.name); filesAttachedCount++; } //sort out qualification and nationality nationality = document.getElementById('lbnationality').value; if(document.getElementById('lbnationality').value=='other') { nationality = document.getElementById('lbnationalitycustom').value; } qualification = document.getElementById('lbqualification').value; if(document.getElementById('lbqualification').value=='other') { qualification = document.getElementById('lbqualificationcustom').value; } //validation if(!(qualification.length>1)) { validated = false; validationErrors += 'You must select a qualification
'; } else if(!(nationality.length>3)) { validated = false; validationErrors += 'You must select your nationality
'; } else if(!(filesAttachedCount>0)) { validated = false; validationErrors += 'You must choose your C.V. or resume
'; } if(validated) { // add nationality and qualification formData.append('nationality', nationality); formData.append('qualification', qualification); formData.append('id', window.account_id); //send data AjaxPostCall('?upload_cv_nationality_qualification',formData,'doAccountFinalStep'); } else { document.getElementById('code_error').innerHTML = "Sorry, please check the following and click done again: "+validationErrors; } }; function doAccountFinalStep(res) { if (res.indexOf('RES[OK')>-1) { //handle final action if(window.job_id>0) { sendAccountDetailsToClient(window.job_id,window.employer_id,window.account_id); } else { //show success message document.getElementById('biscuitsDialog').style.textAlign = 'center'; document.getElementById('biscuitsDialog').style.padding = '8px'; document.getElementById('biscuitsDialog').innerHTML = "


Registration success!"; } } else { document.getElementById('code_error').innerHTML = 'Sorry, that didn\'t work, please try again.'; } }; function doNationality() { if(document.getElementById('lbnationality').value=='other') { document.getElementById('lbnationality').style.display = 'none'; document.getElementById('lbnationalitycustom').style.display = 'block'; } }; function doQualification() { if(document.getElementById('lbqualification').value=='other') { document.getElementById('lbqualification').style.display = 'none'; document.getElementById('lbqualificationcustom').style.display = 'block'; } }; function showFinalStep() { //go to next step div_html = "Your nationality:
Highest qualification:
Upload C.V. or Resume

"; try { document.getElementById('registration_fields').innerHTML = div_html; } catch(err) { document.getElementById('biscuitsDialog').innerHTML = '
Please complete your details to continue:

'+div_html; document.getElementById('biscuitsDialog').style.width = '200px'; document.getElementById('biscuitsDialog').style.textAlign = 'left'; } detectKeyPress('cv','doFinalizeAccount'); }; function _accountSettings(title, contentHtmlorLink) { //open a popup and point it at core createWindow(title, contentHtmlorLink); }; function codeReply(res) { if (res.indexOf('RES[ERROR:wait 60 seconds')>-1) { if(document.getElementById('code_error')) { document.getElementById('code_error').innerHTML = 'Code was sent, Please wait 60 seconds before sending another code'; } else { alert('Code was sent, Please wait 60 seconds before sending another code'); } } }; function sendCode() { phone = document.getElementById('lbemail').value; if(phone.startsWith("+")) { phone = phone.replace('+',"00"); } if(/^\d+$/.test(phone)&&phone.length>6) { document.getElementById('lbpass').setAttribute('type','text'); //type=text needed for tulkan, add support on other sites, need to detect type=input placeholder = 'Enter the code sent to your phone'; sent_message = 'Code Sent!'; if(document.getElementById('lbpass').placeholder=='密码'||window.lang=='cn') { placeholder = '输入发送到您手机的代码'; sent_message = '验证码已发送至您的手机,请查收!'; window.lang = 'cn'; } document.getElementById('lbpass').setAttribute('placeholder',placeholder); document.getElementById('code_error').innerHTML = ""+sent_message+""; AjaxCall("?new_code_request&contact="+btoa(encodeURIComponent(phone))+(window.lang?"&lang="+window.lang:""),false,"codeReply"); } else { message = "Please enter a numeric value for the Phone number, at least 6 digits long"; if(document.getElementById('lbpass').placeholder=='密码'||window.lang=='cn') { message = "请输入电话号码的数值,至少6位数字"; } if(document.getElementById('code_error')) { document.getElementById('code_error').innerHTML = message; } else { alert(message); } } }; function showConversation(html) { $('#previous_conversations').hide(); document.getElementById('result').innerHTML = JSON.parse(atob(html)); } function previousConversations(res) { killWindows(); windowShow('previous_conversations'); document.getElementById('previous_conversations_content').innerHTML = res; } function handleCode() { document.getElementById('login_div_password_div').style.display = 'block'; document.getElementById('login_div_new_password_div').style.display = 'block'; document.getElementById('lbpass').type = 'text'; document.getElementById('login_button').value = (window.lang=='en'?"Register":"注册"); document.getElementById('login_div1').setAttribute('onsubmit','checkCode();event.preventDefault();'); sendCode(); } function checkCode() { error = ''; if(document.getElementById('new_lbpass').value.length<5) { error += 'Password must be longer than 4 characters
'; } if(document.getElementById('new_lbpass_2').value!=document.getElementById('new_lbpass').value) { error += 'Password and Confirm Password must be the same
'; } if(document.getElementById('lbpass').value.length!=4) { error += "Code must be 4 characters long, please check"; } if(error=='') { //login AjaxCall("/?atf_do_login&username="+btoa(document.getElementById('lbemail').value)+"&password="+btoa(document.getElementById('lbpass').value),false,'setPassword'); document.getElementById('login_button').value = (window.lang=='en'?"Saving...":"请稍等。。。"); } else { document.getElementById('code_error').innerHTML = error; } } function setPassword() { AjaxCall("?atf_resetpassword="+document.getElementById('lbemail').value+"&code="+document.getElementById('new_lbpass').value,false,"passwordSetFinish"); } function passwordSetFinish() { window.location.href = '/'; } function registerReply(res) { //+"&new_password="+btoa(encodeURIComponent(document.getElementById('new_lbpass').value) if(res.indexOf('[OK:')>-1) { tmp = res.split('[OK:'); tmp = tmp[1].split(']]'); AjaxCall("?atf_resetpassword="+document.getElementById('lbemail').value+"&reset_code="+tmp[0]+"&new_password="+document.getElementById('lbpass').value,false,"registerReply"); } else { document.getElementById('code_error').innerHTML = (window.lang=='en'?"Sorry, an error occured, please try again":"抱歉,发生错误,请重试"); } } function showRegister() { windowShow('login_div'); document.getElementById('login_div_title').innerHTML = (window.lang=='en'?"Register":"注册账户"); document.getElementById('code_text').innerHTML = (window.lang=='en'?"Enter the code sent to your phone":"输入发送到您手机的验证码"); document.getElementById('lbpass').placeholder = (window.lang=='en'?"Enter code":"输入验证码"); windowHide("login_div_password_div"); document.getElementById('register_text').style.display = 'none'; document.getElementById('login_button').value = (window.lang=='en'?"Send Code":"发送验证码"); document.getElementById('login_div1').setAttribute('onsubmit', 'handleCode();event.preventDefault();'); } function windowShow(id){ document.getElementById(id).style.display='flex'; } function windowHide(id){ document.getElementById(id).style.display='none'; } function createWindow(title, contentHtmlorLink) { var div = document.createElement('div'); var div_id = 'contentDiv_'+Date.now(); div.setAttribute('id',div_id); div.style.position = 'fixed'; div.style.zIndex = '2000'; div.style.background = '#fff'; div.style.boxShadow = '2px 3px 2px #dde2ea'; div.style.color = 'black'; div.style.transform = 'scale(1)'; div.style.transition = 'opacity .2s ease-in-out,transform .2s ease-in-out,-webkit-transform .2s ease-in-out'; div.style.outline = '0'; div.style.backgroundColor = '#fff'; div.style.opacity = '1'; div.style.WebkitTapHighlightColor = 'transparent'; div.style.boxShadow = '0 12px 50px 0 rgba(37,32,31,.25)'; div.style.borderRadius = '.375rem'; div.style.padding = '1rem'; document.body.appendChild(div); if(contentHtmlorLink.substring(0,4)=='http') { //fetching link AjaxCall(contentHtmlorLink,"content_"+div_id,"centerContentWindow"); contentHtmlorLink = "Loading... Please wait"; } document.getElementById(div_id).innerHTML = '
'+title+'
X
'+contentHtmlorLink+'
'; if(window.is_mobile) { initializeMoveToCenter("lbemail",div_id); initializeMoveToCenter("lbpass",div_id); } try { centerDialog(div_id); } catch(err) {} //save the id for later if we need to clear everything if(typeof window.div_id_log == "undefined") { window.div_id_log = ''; } window.div_id_log += div_id+','; showNewOverlay(); return div_id; } function centerContentWindow() { tmp = window.div_id_log.split(','); for(i=0; i-1&&typeof document.getElementById(tmp[i]) != "null") { centerDialog(tmp[i]); } } } function showNewOverlay() { var div = document.createElement('div'); var div_id = 'overlayDiv_'+Date.now(); div.setAttribute('id',div_id); div.style.position = 'fixed'; div.style.top = '0'; div.style.right = '0'; div.style.bottom = '0'; div.style.left = '0'; div.style.zIndex = '1900'; div.style.WebkitTransition = 'opacity .2s ease-in-out'; div.style.OTransition = 'opacity .2s ease-in-out'; div.style.transition = 'opacity .2s ease-in-out'; div.style.backgroundColor = '#b2aebd'; div.style.opacity = '.7'; div.style.overflow = 'hidden'; document.body.appendChild(div); window.div_id_log += div_id+','; document.getElementById(div_id).onclick = function() { killNewWindows(); } } function killNewWindows() { tmp = window.div_id_log.split(','); for(i=0; i '; } function accountSaveEdit(field,secret) { //disable the field //show a loading document.getElementById('update_'+field).disabled = true; document.getElementById('save_button_'+field).innerHTML = ''; window.last_field = field; AjaxCall("?atf_edit_account&update="+field+"&value="+document.getElementById('update_'+field).value+"&secret="+secret,false,"accountFieldUpdateResult"); } function accountFieldUpdateResult(res) { if(res.indexOf('[OK]')>-1) { //ok document.getElementById('save_button_'+window.last_field).innerHTML = ''; document.getElementById('save_button_'+window.last_field).innerHTML = 'saved'; } else { //fail document.getElementById('save_button_'+window.last_field).innerHTML = 'failed to save'; } } function imageUploadWait(width) { showOverlay(); var div = document.createElement('div'); div.setAttribute('id', 'biscuitsDialog'); div.setAttribute('class','ajaxDialog'); if(typeof width != 'undefined') { div.style.width = width+"%"; } div.style.position = "absolute"; div.style.zIndex = "20"; div.innerHTML = '
Please Wait...<\/div>'; div.style.background = "#fff"; window.scrollTo(0,0); document.body.appendChild(div); centerDialog('biscuitsDialog'); } /////////////////////////OLD FUNCTIONS//////////////////////////// function centerDialog(id) { var win = getWindowSize(); var dialog = document.getElementById(id); n_top = (win.height / 2) - (dialog.offsetHeight / 2); if(window.is_mobile==1) { n_top = (n_top*0.7); } dialog.style.top = n_top + 'px'; /*dialog.style.left = (win.width / 2) - (dialog.offsetWidth / 2) + 'px';*/ dialog.style.width='100%'; } function getWindowSize() { var winW; var winH; if (navigator.appName.indexOf("Microsoft")!=-1) { winW = document.documentElement.clientWidth; winH = document.documentElement.clientHeight; } else { winW = window.innerWidth; winH = window.innerHeight; } return {width:winW, height:winH}; } /** * Moves a box input to the viewable part of the screen on mobile * Call with: if(window.is_mobile) { initializeMoveToCenter(\"element_on_click_do_action_id\",\"container_div_id\"); } **/ function initializeMoveToCenter(action_id,move_id) { var footer = document.getElementById(move_id); var ftInput = document.getElementById(action_id); ftInput.onfocus = function(){ setTimeout(function(){ /** footer.style.position = "relative"; **/ footer.style.position = "fixed"; /** footer.style.top= "80%"; **/ footer.style.top = "-5%"; ftInput.scrollIntoView(); document.addEventListener("touchmove",function(ev){ev.preventDefault()}); },10); }; ftInput.onblur = function(){ /**footer.style.position = "relative";**/ /**footer.style.top = "47px";**/ document.removeEventListener("touchmove",function(ev){ev.preventDefault()}); } /**window.onclick = function(){ document.removeEventListener("touchmove",handleScroll); }**/ } function killWindows(goReload) { var d1 = document.body; d1.removeChild(document.getElementById("biscuitsDialog")); if(typeof document.getElementById("biscuitsOverlay") != null) { d1.removeChild(document.getElementById("biscuitsOverlay")); } document.body.style.overflow = "auto"; if(goReload) { window.location.reload(); } } function cursorPointer(id) { if(typeof document.getElementById(id) != null) { document.getElementById(id).style.cursor = 'pointer'; document.getElementById(id).onmouseout = document.getElementById(id).style.cursor = ''; } } function showOverlay() { var div = document.createElement('div'); div.setAttribute('id', 'biscuitsOverlay'); div.style.width = "100%"; div.style.height = "100%"; div.style.position = "fixed"; div.style.top = "0px"; div.style.left = "0px"; div.style.background = "#000"; div.style.opacity = ".7"; div.style.filter = "alpha(opacity=70)"; div.style.cursor = "not-allowed"; div.style.zIndex="15"; document.body.style.overflow = "hidden"; document.body.appendChild(div); //add on click on overlay and hide document.getElementById("biscuitsOverlay").addEventListener("click", killWindows); } function detectKeyPress(input_key_id,trigger_function) { const node = document.getElementById(input_key_id); node.addEventListener("keyup", function(event,input_key_id) { if (event.key === "Enter") { // Do work if(typeof window[trigger_function] != null) { window[trigger_function](); } } }); } /*! * Lazy Load - JavaScript plugin for lazy loading images * * Copyright (c) 2007-2019 Mika Tuupola * * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php * * Project home: * https://appelsiini.net/projects/lazyload * * Version: 2.0.0-rc.2 * */ (function (root, factory) { if (typeof exports === "object") { module.exports = factory(root); } else if (typeof define === "function" && define.amd) { define([], factory); } else { root.LazyLoad = factory(root); } }) (typeof global !== "undefined" ? global : this.window || this.global, function (root) { "use strict"; if (typeof define === "function" && define.amd){ root = window; } const defaults = { src: "data-src", srcset: "data-srcset", selector: ".lazyload", root: null, rootMargin: "0px", threshold: 0 }; /** * Merge two or more objects. Returns a new object. * @private * @param {Boolean} deep If true, do a deep (or recursive) merge [optional] * @param {Object} objects The objects to merge together * @returns {Object} Merged values of defaults and options */ const extend = function () { let extended = {}; let deep = false; let i = 0; let length = arguments.length; /* Check if a deep merge */ if (Object.prototype.toString.call(arguments[0]) === "[object Boolean]") { deep = arguments[0]; i++; } /* Merge the object into the extended object */ let merge = function (obj) { for (let prop in obj) { if (Object.prototype.hasOwnProperty.call(obj, prop)) { /* If deep merge and property is an object, merge properties */ if (deep && Object.prototype.toString.call(obj[prop]) === "[object Object]") { extended[prop] = extend(true, extended[prop], obj[prop]); } else { extended[prop] = obj[prop]; } } } }; /* Loop through each object and conduct a merge */ for (; i < length; i++) { let obj = arguments[i]; merge(obj); } return extended; }; function LazyLoad(images, options) { this.settings = extend(defaults, options || {}); this.images = images || document.querySelectorAll(this.settings.selector); this.observer = null; this.init(); } LazyLoad.prototype = { init: function() { /* Without observers load everything and bail out early. */ if (!root.IntersectionObserver) { this.loadImages(); return; } let self = this; let observerConfig = { root: this.settings.root, rootMargin: this.settings.rootMargin, threshold: [this.settings.threshold] }; this.observer = new IntersectionObserver(function(entries) { Array.prototype.forEach.call(entries, function (entry) { if (entry.isIntersecting) { self.observer.unobserve(entry.target); let src = entry.target.getAttribute(self.settings.src); let srcset = entry.target.getAttribute(self.settings.srcset); if ("img" === entry.target.tagName.toLowerCase()) { if (src) { entry.target.src = src; } if (srcset) { entry.target.srcset = srcset; } } else { entry.target.style.backgroundImage = "url(" + src + ")"; } } }); }, observerConfig); Array.prototype.forEach.call(this.images, function (image) { self.observer.observe(image); }); }, loadAndDestroy: function () { if (!this.settings) { return; } this.loadImages(); this.destroy(); }, loadImages: function () { if (!this.settings) { return; } let self = this; Array.prototype.forEach.call(this.images, function (image) { let src = image.getAttribute(self.settings.src); let srcset = image.getAttribute(self.settings.srcset); if ("img" === image.tagName.toLowerCase()) { if (src) { image.src = src; } if (srcset) { image.srcset = srcset; } } else { image.style.backgroundImage = "url('" + src + "')"; } }); }, destroy: function () { if (!this.settings) { return; } this.observer.disconnect(); this.settings = null; } }; root.lazyload = function(images, options) { return new LazyLoad(images, options); }; if (root.jQuery) { const $ = root.jQuery; $.fn.lazyload = function (options) { options = options || {}; options.attribute = options.attribute || "data-src"; new LazyLoad($.makeArray(this), options); return this; }; } return LazyLoad; }); /* jquery.scrolly v1.0.0-dev | (c) @ajlkn | MIT licensed */ (function(e){function u(s,o){var u,a,f;if((u=e(s))[t]==0)return n;a=u[i]()[r];switch(o.anchor){case"middle":f=a-(e(window).height()-u.outerHeight())/2;break;default:case r:f=Math.max(a,0)}return typeof o[i]=="function"?f-=o[i]():f-=o[i],f}var t="length",n=null,r="top",i="offset",s="click.scrolly",o=e(window);e.fn.scrolly=function(i){var o,a,f,l,c=e(this);if(this[t]==0)return c;if(this[t]>1){for(o=0;o1){for(var r=0;r=i&&o>=t};break;case"bottom":h=function(t,e,n,i,o){return n>=i&&o>=n};break;case"middle":h=function(t,e,n,i,o){return e>=i&&o>=e};break;case"top-only":h=function(t,e,n,i,o){return i>=t&&n>=i};break;case"bottom-only":h=function(t,e,n,i,o){return n>=o&&o>=t};break;default:case"default":h=function(t,e,n,i,o){return n>=i&&o>=t}}return c=function(t){var i,o,l,s,r,a,u=this.state,h=!1,c=this.$element.offset();i=n.height(),o=t+i/2,l=t+i,s=this.$element.outerHeight(),r=c.top+e(this.options.top,s,i),a=c.top+s-e(this.options.bottom,s,i),h=this.test(t,o,l,r,a),h!=u&&(this.state=h,h?this.options.enter&&this.options.enter.apply(this.element):this.options.leave&&this.options.leave.apply(this.element)),this.options.scroll&&this.options.scroll.apply(this.element,[(o-r)/(a-r)])},p={id:a,options:u,test:h,handler:c,state:null,element:this,$element:s,timeoutId:null},o[a]=p,s.data("_scrollexId",p.id),p.options.initialize&&p.options.initialize.apply(this),s},jQuery.fn.unscrollex=function(){var e=t(this);if(0==this.length)return e;if(this.length>1){for(var n=0;n1)for(var o=0;o0&&t.add(n).on("mouseleave",function(e){window.clearTimeout(c),c=window.setTimeout(function(){t.trigger("doCollapse")},o.hideDelay)}),t.disableSelection_dropotron().hide().addClass(o.menuClass).css("position","absolute").on("mouseenter",function(e){window.clearTimeout(c)}).on("doExpand",function(){if(t.is(":visible"))return!1;window.clearTimeout(c),s.each(function(){var t=e(this);e.contains(t.get(0),n.get(0))||t.trigger("doCollapse")});var i,a,d,f,u=n.offset(),p=n.position(),h=(n.parent().position(),n.outerWidth()),g=t.outerWidth(),v=t.css("z-index")==o.baseZIndex;if(v){switch(i=o.detach?u:p,f=i.top+n.outerHeight()+o.globalOffsetY,a=o.alignment,t.removeClass("left").removeClass("right").removeClass("center"),o.alignment){case"right":d=i.left-g+h,0>d&&(d=i.left,a="left");break;case"center":d=i.left-Math.floor((g-h)/2),0>d?(d=i.left,a="left"):d+g>l.width()&&(d=i.left-g+h,a="right");break;case"left":default:d=i.left,d+g>l.width()&&(d=i.left-g+h,a="right")}t.addClass(a)}else switch("relative"==n.css("position")||"absolute"==n.css("position")?(f=o.offsetY,d=-1*p.left):(f=p.top+o.offsetY,d=0),o.alignment){case"right":d+=-1*n.parent().outerWidth()+o.offsetX;break;case"center":case"left":default:d+=n.parent().outerWidth()+o.offsetX}navigator.userAgent.match(/MSIE ([0-9]+)\./)&&RegExp.$1<8&&(d+=o.IEOffsetX,f+=o.IEOffsetY),t.css("left",d+"px").css("top",f+"px").css("opacity","0.01").show();var C=!1;switch(d="relative"==n.css("position")||"absolute"==n.css("position")?-1*p.left:0,t.offset().left<0?(d+=n.parent().outerWidth()-o.offsetX,C=!0):t.offset().left+g>l.width()&&(d+=-1*n.parent().outerWidth()-o.offsetX,C=!0),C&&t.css("left",d+"px"),t.hide().css("opacity","1"),o.mode){case"zoom":r=!0,n.addClass(o.openerActiveClass),t.animate({width:"toggle",height:"toggle"},o.speed,o.easing,function(){r=!1});break;case"slide":r=!0,n.addClass(o.openerActiveClass),t.animate({height:"toggle"},o.speed,o.easing,function(){r=!1});break;case"fade":if(r=!0,v&&!o.noOpenerFade){var C;C="slow"==o.speed?80:"fast"==o.speed?40:Math.floor(o.speed/2),n.fadeTo(C,.01,function(){n.addClass(o.openerActiveClass),n.fadeTo(o.speed,1),t.fadeIn(o.speed,function(){r=!1})})}else n.addClass(o.openerActiveClass),n.fadeTo(o.speed,1),t.fadeIn(o.speed,function(){r=!1});break;case"instant":default:n.addClass(o.openerActiveClass),t.show()}return!1}).on("doCollapse",function(){return t.is(":visible")?(t.hide(),n.removeClass(o.openerActiveClass),t.find("."+o.openerActiveClass).removeClass(o.openerActiveClass),t.find("ul").hide(),!1):!1}).on("doToggle",function(e){return t.is(":visible")?t.trigger("doCollapse"):t.trigger("doExpand"),!1}),n.disableSelection_dropotron().addClass("opener").css("cursor","pointer").on("click touchend",function(e){r||(e.preventDefault(),e.stopPropagation(),t.trigger("doToggle"))}),"hover"==o.expandMode&&n.hover(function(e){r||(d=window.setTimeout(function(){t.trigger("doExpand")},o.hoverDelay))},function(e){window.clearTimeout(d)})}),s.find("a").css("display","block").on("click touchend",function(t){r||e(this).attr("href").length<1&&t.preventDefault()}),n.find("li").css("white-space","nowrap").each(function(){var t=e(this),o=t.children("a"),s=t.children("ul"),i=o.attr("href");o.on("click touchend",function(e){0==i.length||"#"==i?e.preventDefault():e.stopPropagation()}),o.length>0&&0==s.length&&t.on("click touchend",function(e){r||(n.trigger("doCollapseAll"),e.stopPropagation())})}),n.children("li").each(function(){var t,n=e(this),s=n.children("ul");if(s.length>0){o.detach&&(o.cloneOnDetach&&(t=s.clone(),t.attr("class","").hide().appendTo(s.parent())),s.detach().appendTo(i));for(var a=o.baseZIndex,l=1,r=s;r.length>0;l++)r.css("z-index",a++),o.submenuClassPrefix&&r.addClass(o.submenuClassPrefix+(a-1-o.baseZIndex)),r=r.find("> li > ul")}}),l.on("scroll",function(){n.trigger("doCollapseAll")}).on("keypress",function(e){r||27!=e.keyCode||(e.preventDefault(),n.trigger("doCollapseAll"))}),a.on("click touchend",function(){r||n.trigger("doCollapseAll")})}}(jQuery); (function($) { /** * Generate an indented list of links from a nav. Meant for use with panel(). * @return {jQuery} jQuery object. */ $.fn.navList = function() { var $this = $(this); $a = $this.find('a'), b = []; $a.each(function() { var $this = $(this), indent = Math.max(0, $this.parents('li').length - 1), href = $this.attr('href'), target = $this.attr('target'); b.push( '' + '' + $this.text() + '' ); }); return b.join(''); }; /** * Panel-ify an element. * @param {object} userConfig User config. * @return {jQuery} jQuery object. */ $.fn.panel = function(userConfig) { // No elements? if (this.length == 0) return $this; // Multiple elements? if (this.length > 1) { for (var i=0; i < this.length; i++) $(this[i]).panel(userConfig); return $this; } // Vars. var $this = $(this), $body = $('body'), $window = $(window), id = $this.attr('id'), config; // Config. config = $.extend({ // Delay. delay: 0, // Hide panel on link click. hideOnClick: false, // Hide panel on escape keypress. hideOnEscape: false, // Hide panel on swipe. hideOnSwipe: false, // Reset scroll position on hide. resetScroll: false, // Reset forms on hide. resetForms: false, // Side of viewport the panel will appear. side: null, // Target element for "class". target: $this, // Class to toggle. visibleClass: 'visible' }, userConfig); // Expand "target" if it's not a jQuery object already. if (typeof config.target != 'jQuery') { config.target = $(config.target); } // Panel. // Methods. $this._hide = function(event) { // Already hidden? Bail. if (!config.target.hasClass(config.visibleClass)) return; // If an event was provided, cancel it. if (event) { event.preventDefault(); event.stopPropagation(); } // Hide. config.target.removeClass(config.visibleClass); // Post-hide stuff. window.setTimeout(function() { // Reset scroll position. if (config.resetScroll) { $this.scrollTop(0); }; // Reset forms. if (config.resetForms) { $this.find('form').each(function() { this.reset(); }); }; }, config.delay); }; // Vendor fixes. $this .css('-ms-overflow-style', '-ms-autohiding-scrollbar') .css('-webkit-overflow-scrolling', 'touch'); // Hide on click. if (config.hideOnClick) { $this.find('a') .css('-webkit-tap-highlight-color', 'rgba(0,0,0,0)'); $this .on('click', 'a', function(event) { var $a = $(this), href = $a.attr('href'), target = $a.attr('target'); if (!href || href == '#' || href == '' || href == '#' + id) return; // Cancel original event. event.preventDefault(); event.stopPropagation(); // Hide panel. $this._hide(); // Redirect to href. window.setTimeout(function() { if (target == '_blank') window.open(href); else window.location.href = href; }, config.delay + 10); }); }; // Event: Touch stuff. $this.on('touchstart', function(event) { $this.touchPosX = event.originalEvent.touches[0].pageX; $this.touchPosY = event.originalEvent.touches[0].pageY; }); $this.on('touchmove', function(event) { if ($this.touchPosX === null || $this.touchPosY === null) return; var diffX = $this.touchPosX - event.originalEvent.touches[0].pageX, diffY = $this.touchPosY - event.originalEvent.touches[0].pageY, th = $this.outerHeight(), ts = ($this.get(0).scrollHeight - $this.scrollTop()); // Hide on swipe? if (config.hideOnSwipe) { var result = false, boundary = 20, delta = 50; switch (config.side) { case 'left': result = (diffY < boundary && diffY > (-1 * boundary)) && (diffX > delta); break; case 'right': result = (diffY < boundary && diffY > (-1 * boundary)) && (diffX < (-1 * delta)); break; case 'top': result = (diffX < boundary && diffX > (-1 * boundary)) && (diffY > delta); break; case 'bottom': result = (diffX < boundary && diffX > (-1 * boundary)) && (diffY < (-1 * delta)); break; default: break; } if (result) { $this.touchPosX = null; $this.touchPosY = null; $this._hide(); return false; } } // Prevent vertical scrolling past the top or bottom. if (($this.scrollTop() < 0 && diffY < 0) || (ts > (th - 2) && ts < (th + 2) && diffY > 0)) { event.preventDefault(); event.stopPropagation(); } }); // Event: Prevent certain events inside the panel from bubbling. $this.on('click touchend touchstart touchmove', function(event) { event.stopPropagation(); }); // Event: Hide panel if a child anchor tag pointing to its ID is clicked. $this.on('click', 'a[href="#' + id + '"]', function(event) { event.preventDefault(); event.stopPropagation(); config.target.removeClass(config.visibleClass); }); // Body. // Event: Hide panel on body click/tap. $body.on('click touchend', function(event) { $this._hide(event); }); // Event: Toggle. $body.on('click', 'a[href="#' + id + '"]', function(event) { event.preventDefault(); event.stopPropagation(); config.target.toggleClass(config.visibleClass); }); // Window. // Event: Hide on ESC. if (config.hideOnEscape) $window.on('keydown', function(event) { if (event.keyCode == 27) $this._hide(event); }); return $this; }; /** * Apply "placeholder" attribute polyfill to one or more forms. * @return {jQuery} jQuery object. */ $.fn.placeholder = function() { // Browser natively supports placeholders? Bail. if (typeof (document.createElement('input')).placeholder != 'undefined') return $(this); // No elements? if (this.length == 0) return $this; // Multiple elements? if (this.length > 1) { for (var i=0; i < this.length; i++) $(this[i]).placeholder(); return $this; } // Vars. var $this = $(this); // Text, TextArea. $this.find('input[type=text],textarea') .each(function() { var i = $(this); if (i.val() == '' || i.val() == i.attr('placeholder')) i .addClass('polyfill-placeholder') .val(i.attr('placeholder')); }) .on('blur', function() { var i = $(this); if (i.attr('name').match(/-polyfill-field$/)) return; if (i.val() == '') i .addClass('polyfill-placeholder') .val(i.attr('placeholder')); }) .on('focus', function() { var i = $(this); if (i.attr('name').match(/-polyfill-field$/)) return; if (i.val() == i.attr('placeholder')) i .removeClass('polyfill-placeholder') .val(''); }); // Password. $this.find('input[type=password]') .each(function() { var i = $(this); var x = $( $('
') .append(i.clone()) .remove() .html() .replace(/type="password"/i, 'type="text"') .replace(/type=password/i, 'type=text') ); if (i.attr('id') != '') x.attr('id', i.attr('id') + '-polyfill-field'); if (i.attr('name') != '') x.attr('name', i.attr('name') + '-polyfill-field'); x.addClass('polyfill-placeholder') .val(x.attr('placeholder')).insertAfter(i); if (i.val() == '') i.hide(); else x.hide(); i .on('blur', function(event) { event.preventDefault(); var x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]'); if (i.val() == '') { i.hide(); x.show(); } }); x .on('focus', function(event) { event.preventDefault(); var i = x.parent().find('input[name=' + x.attr('name').replace('-polyfill-field', '') + ']'); x.hide(); i .show() .focus(); }) .on('keypress', function(event) { event.preventDefault(); x.val(''); }); }); // Events. $this .on('submit', function() { $this.find('input[type=text],input[type=password],textarea') .each(function(event) { var i = $(this); if (i.attr('name').match(/-polyfill-field$/)) i.attr('name', ''); if (i.val() == i.attr('placeholder')) { i.removeClass('polyfill-placeholder'); i.val(''); } }); }) .on('reset', function(event) { event.preventDefault(); $this.find('select') .val($('option:first').val()); $this.find('input,textarea') .each(function() { var i = $(this), x; i.removeClass('polyfill-placeholder'); switch (this.type) { case 'submit': case 'reset': break; case 'password': i.val(i.attr('defaultValue')); x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]'); if (i.val() == '') { i.hide(); x.show(); } else { i.show(); x.hide(); } break; case 'checkbox': case 'radio': i.attr('checked', i.attr('defaultValue')); break; case 'text': case 'textarea': i.val(i.attr('defaultValue')); if (i.val() == '') { i.addClass('polyfill-placeholder'); i.val(i.attr('placeholder')); } break; default: i.val(i.attr('defaultValue')); break; } }); }); return $this; }; /** * Moves elements to/from the first positions of their respective parents. * @param {jQuery} $elements Elements (or selector) to move. * @param {bool} condition If true, moves elements to the top. Otherwise, moves elements back to their original locations. */ $.prioritize = function($elements, condition) { var key = '__prioritize'; // Expand $elements if it's not already a jQuery object. if (typeof $elements != 'jQuery') $elements = $($elements); // Step through elements. $elements.each(function() { var $e = $(this), $p, $parent = $e.parent(); // No parent? Bail. if ($parent.length == 0) return; // Not moved? Move it. if (!$e.data(key)) { // Condition is false? Bail. if (!condition) return; // Get placeholder (which will serve as our point of reference for when this element needs to move back). $p = $e.prev(); // Couldn't find anything? Means this element's already at the top, so bail. if ($p.length == 0) return; // Move element to top of parent. $e.prependTo($parent); // Mark element as moved. $e.data(key, $p); } // Moved already? else { // Condition is true? Bail. if (condition) return; $p = $e.data(key); // Move element back to its original location (using our placeholder). $e.insertAfter($p); // Unmark element as moved. $e.removeData(key); } }); }; // Play initial animations on page load. document.addEventListener('DOMContentLoaded', function() { window.setTimeout(function() { $('body').removeClass('is-preload'); }, 100); }); })(jQuery); $(document).ready(function() { // Breakpoints. breakpoints({ wide: [ '1281px', '1680px' ], normal: [ '981px', '1280px' ], narrow: [ '841px', '980px' ], narrower: [ '737px', '840px' ], mobile: [ null, '736px' ] }); // Header. if (!browser.mobile && $('#header').hasClass('alt') && $('#header').length > 0) { $('#header').on('load', function() { $banner.scrollex({ bottom: $header.outerHeight(), terminate: function() { $('#header').removeClass('alt'); }, enter: function() { $('#header').addClass('alt reveal'); }, leave: function() { $('#header').removeClass('alt'); } }); }); } // Scrolly. $('.scrolly').scrolly({ speed: 1000, offset: function() { return $header.height() + 10; } }); // Dropdowns. $('#nav > ul').dropotron({ mode: 'fade', noOpenerFade: true, expandMode: (browser.mobile ? 'click' : 'hover') }); // Fix: Remove navPanel transitions on WP<10 (poor/buggy performance). if (browser.os == 'wp' && browser.osVersion < 10) { $('#navButton, #navPanel, #page-wrapper') .css('transition', 'none'); }; // Button. $('' ).appendTo($('body')); // Panel. $( '' ).appendTo($('body')) .panel({ delay: 500, hideOnClick: true, hideOnSwipe: true, resetScroll: true, resetForms: true, side: 'left', target: $('body'), visibleClass: 'navPanel-visible' }); }); /** * * support functions **/ window.finished_typing = true; function checkScroll(ajax_url,target_function) { // Get the scrollable height of the document var scrollHeight = Math.max( document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight ); // Get the current scroll position var scrollTop = window.pageYOffset || document.documentElement.scrollTop; // Get the viewport height var clientHeight = window.innerHeight || document.documentElement.clientHeight; // Check if the user has scrolled to the bottom if (scrollTop + clientHeight >= scrollHeight - 10) { // Subtracting 10 pixels to account for potential rounding errors AjaxCall(ajax_url,false,target_function); } } function askResponseReturn(got) { result = ''; end_detected = false; if(got.indexOf('[RES[')>-1) { tmp = got.split('[RES['); tmp = tmp[1].split(']]>'); result = tmp[0]; if(result.indexOf('[END]')>-1) { tmp = result.split('[END]'); result = tmp[0]; end_detected = true; } if(result.indexOf('[THINKING]')>-1) { console.log("detected [THINKING]"); result = result.replace('[THINKING]',''); document.getElementById('ask_button').value = 'Thinking...'; } } if(result != '') { document.getElementById('ask_button').value = 'Ask another question'; document.getElementById('ask_error').innerHTML = ""; if(document.getElementById('questions').innerHTML.indexOf('Answer')==-1) { document.getElementById('questions').innerHTML = original_question_html+'
Answer: 
'; } if((result.length-window.final_text.length)>2) { result_length = countChinese(result); if(result_length==0) { result_length = result.length; } final_text_length = countChinese(window.final_text); if(final_text_length==0) { final_text_length = window.final_text.length; } window.last_text_length = result_length-final_text_length; // console.log("last text length:"+window.last_text_length); } // console.log("last text length:"+window.last_text_length); if(window.final_text=='') { window.final_text = result; $('#current_response').removeAttr('id'); $('#result').append('
'); type_next_element(0); } else { window.final_text = result; if(window.finished_typing) { window.finished_typing = false; type_next_element($('#current_response').length); } } } if(!end_detected&&window.cycle_count < 100) { window.cycle_count++; setTimeout(function(){ AjaxCall('?q_status='+window.status_code,false,'askResponseReturn'); }); } } function countChinese(str) { let chineseCount = 0; for (let i = 0; i < str.length; i++) { if (str.charCodeAt(i) >= 19968 && str.charCodeAt(i) <= 40959) { chineseCount++; } } return chineseCount; } function type_next_element(index) { var current_element = $('#current_response'); if(window.last_index_length==0) { current_element.html("").show(); } function type_next_character(element, i) { if(i>window.last_index_length) { window.last_index_length = i; } element.html( window.final_text.substr(0, i) ); if(typeof window.type_speed === 'undefined') { window.type_speed = 60; // if(window.last_text_length>36) { // window.type_speed = 50; // } } // if(window.last_text_length>36) { // window.type_speed = 50; // } // console.log('type_speed:'+window.type_speed); if (window.final_text.length >= i) { setTimeout(function() { type_next_character(element, i+1); }, window.type_speed); } else { if (++index < $('#current_response').length) { type_next_element(index); } else { window.finished_typing = true; if($('#current_response').length>window.last_index_length) { window.last_index_length = $('#current_response').length; } } } } if(window.last_index_length>0) { type_next_character(current_element, window.last_index_length); } else { type_next_character(current_element, 0); } } function askQuestionAnswer(result) { tmp = result.split('prun:'); tmp = tmp[1].split(']'); if(tmp[0].length==8) { document.getElementById('ask_button').value = 'Asked successfully, responding...'; original_question_html = document.getElementById('questions').innerHTML; window.status_code = tmp[0]; window.cycle_count = 0; window.final_text = ''; window.last_index_length = 0; AjaxCall('?q_status='+tmp[0],false,'askResponseReturn'); } else { document.getElementById('ask_error').innerHTML = "Sorry an error occured, please try again"; document.getElementById('ask_button').value = 'SUBMIT'; } } function doAskQuestion() { question = document.getElementById('lbquestion').value; job_id = document.getElementById('job_id').value; if(!window.finished_typing||document.getElementById('ask_button').value.indexOf('response is')>-1||document.getElementById('ask_button').value.indexOf('please wait')>-1) { document.getElementById('ask_error').innerHTML = "Please wait for the previous question to finish before asking another one."; } else if(question.length>3) { document.getElementById('questions').innerHTML = "
You: "+question+"
"; document.getElementById('lbquestion').value = ''; document.getElementById('ask_button').value = 'ASKING...please wait a moment'; formData = new FormData(); formData.append("job_id",job_id); formData.append("question",question); AjaxPostCall("/questions-and-answers",formData,'askQuestionAnswer'); } else { document.getElementById('ask_error').innerHTML = "Please write a full question to ask"; } } function showAskQuestionWithPopulatedAnswer(question,answer,job_id) { windowShow('ask_question'); document.getElementById('job_id').value = job_id; document.getElementById('questions').innerHTML = "
You: "+question+"
"; if(answer!='') { document.getElementById('questions').innerHTML += '
Answer: 
'+answer+'
'; } else { document.getElementById('lbquestion').value = ''; document.getElementById('ask_button').value = 'ASKING...please wait a moment'; formData = new FormData(); formData.append("job_id",job_id); formData.append("question",question); AjaxPostCall("/questions-and-answers",formData,'askQuestionAnswer'); } } function applyJob(job_id,job_title) { windowShow('apply_div'); document.getElementById('apply_div_title').innerHTML = "Apply for Job: "+job_title.substring(0,100); document.getElementById('apply_div_title').style="text-align: center;line-height: 16pt;"; //create job id input const el = document.createElement("input"); el.name = "job_id"; el.value = job_id; el.type = "hidden"; const form = document.getElementById("apply_div1"); form.appendChild(el); } function doApply() { fullname = document.getElementById('lbfullname').value; cv = document.getElementById('UploadcvCv').value; console.log(cv); if(fullname.length>3&&cv.length>3) { document.getElementById('baidu_emp_login').value = "Submitting..."; document.getElementById('apply_div1').submit(); } else { document.getElementById('apply_error').innerHTML = "Please enter your full name and attach a CV"; } };