/*! jQuery v3.5.1 | (c) JS 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},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.5.1",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.namespaceURI,n=(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},D=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 D(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||j,"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,j=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 qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(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 Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.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(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.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,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Ut.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):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),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]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.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=o.clientWidth&&n>=o.clientHeight}),l=0a[e]&&!t.escapeWithReference&&(n=Q(f[o],a[e]-('right'===e?f.width:f.height))),ae({},o,n)}};return l.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';f=le({},f,m[t](e))}),e.offsets.popper=f,e},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,o=t.popper,n=t.reference,i=e.placement.split('-')[0],r=Z,p=-1!==['top','bottom'].indexOf(i),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]r(n[s])&&(e.offsets.popper[d]=r(n[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,o){var n;if(!K(e.instance.modifiers,'arrow','keepTogether'))return e;var i=o.element;if('string'==typeof i){if(i=e.instance.popper.querySelector(i),!i)return e;}else if(!e.instance.popper.contains(i))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var r=e.placement.split('-')[0],p=e.offsets,s=p.popper,d=p.reference,a=-1!==['left','right'].indexOf(r),l=a?'height':'width',f=a?'Top':'Left',m=f.toLowerCase(),h=a?'left':'top',c=a?'bottom':'right',u=S(i)[l];d[c]-us[c]&&(e.offsets.popper[m]+=d[m]+u-s[c]),e.offsets.popper=g(e.offsets.popper);var b=d[m]+d[l]/2-u/2,w=t(e.instance.popper),y=parseFloat(w['margin'+f],10),E=parseFloat(w['border'+f+'Width'],10),v=b-e.offsets.popper[m]-y-E;return v=ee(Q(s[l]-u,v),0),e.arrowElement=i,e.offsets.arrow=(n={},ae(n,m,$(v)),ae(n,h,''),n),e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(W(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var o=v(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),n=e.placement.split('-')[0],i=T(n),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case ce.FLIP:p=[n,i];break;case ce.CLOCKWISE:p=G(n);break;case ce.COUNTERCLOCKWISE:p=G(n,!0);break;default:p=t.behavior;}return p.forEach(function(s,d){if(n!==s||p.length===d+1)return e;n=e.placement.split('-')[0],i=T(n);var a=e.offsets.popper,l=e.offsets.reference,f=Z,m='left'===n&&f(a.right)>f(l.left)||'right'===n&&f(a.left)f(l.top)||'bottom'===n&&f(a.top)f(o.right),g=f(a.top)f(o.bottom),b='left'===n&&h||'right'===n&&c||'top'===n&&g||'bottom'===n&&u,w=-1!==['top','bottom'].indexOf(n),y=!!t.flipVariations&&(w&&'start'===r&&h||w&&'end'===r&&c||!w&&'start'===r&&g||!w&&'end'===r&&u),E=!!t.flipVariationsByContent&&(w&&'start'===r&&c||w&&'end'===r&&h||!w&&'start'===r&&u||!w&&'end'===r&&g),v=y||E;(m||b||v)&&(e.flipped=!0,(m||b)&&(n=p[d+1]),v&&(r=z(r)),e.placement=n+(r?'-'+r:''),e.offsets.popper=le({},e.offsets.popper,C(e.instance.popper,e.offsets.reference,e.placement)),e=P(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundariesElement:'viewport',flipVariations:!1,flipVariationsByContent:!1},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,o=t.split('-')[0],n=e.offsets,i=n.popper,r=n.reference,p=-1!==['left','right'].indexOf(o),s=-1===['top','left'].indexOf(o);return i[p?'left':'top']=r[o]-(s?i[p?'width':'height']:0),e.placement=T(t),e.offsets.popper=g(i),e}},hide:{order:800,enabled:!0,fn:function(e){if(!K(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,o=D(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottomo.right||t.top>o.bottom||t.rightwindow.devicePixelRatio||!fe),c='bottom'===o?'top':'bottom',g='right'===n?'left':'right',b=B('transform');if(d='bottom'==c?'HTML'===l.nodeName?-l.clientHeight+h.bottom:-f.height+h.bottom:h.top,s='right'==g?'HTML'===l.nodeName?-l.clientWidth+h.right:-f.width+h.right:h.left,a&&b)m[b]='translate3d('+s+'px, '+d+'px, 0)',m[c]=0,m[g]=0,m.willChange='transform';else{var w='bottom'==c?-1:1,y='right'==g?-1:1;m[c]=d*w,m[g]=s*y,m.willChange=c+', '+g}var E={"x-placement":e.placement};return e.attributes=le({},E,e.attributes),e.styles=le({},m,e.styles),e.arrowStyles=le({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:'bottom',y:'right'},applyStyle:{order:900,enabled:!0,fn:function(e){return V(e.instance.popper,e.styles),j(e.instance.popper,e.attributes),e.arrowElement&&Object.keys(e.arrowStyles).length&&V(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,o,n,i){var r=L(i,t,e,o.positionFixed),p=O(o.placement,r,t,e,o.modifiers.flip.boundariesElement,o.modifiers.flip.padding);return t.setAttribute('x-placement',p),V(t,{position:o.positionFixed?'fixed':'absolute'}),o},gpuAcceleration:void 0}}},ge}); //# sourceMappingURL=popper.min.js.map /*! * Bootstrap v4.5.0 (https://getbootstrap.com/) * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],e):e((t=t||self).bootstrap={},t.jQuery,t.Popper)}(this,(function(t,e,n){"use strict";function i(t,e){for(var n=0;n=4)throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}};c.jQueryDetection(),e.fn.emulateTransitionEnd=l,e.event.special[c.TRANSITION_END]={bindType:"transitionend",delegateType:"transitionend",handle:function(t){if(e(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}};var h="alert",u=e.fn[h],d=function(){function t(t){this._element=t}var n=t.prototype;return n.close=function(t){var e=this._element;t&&(e=this._getRootElement(t)),this._triggerCloseEvent(e).isDefaultPrevented()||this._removeElement(e)},n.dispose=function(){e.removeData(this._element,"bs.alert"),this._element=null},n._getRootElement=function(t){var n=c.getSelectorFromElement(t),i=!1;return n&&(i=document.querySelector(n)),i||(i=e(t).closest(".alert")[0]),i},n._triggerCloseEvent=function(t){var n=e.Event("close.bs.alert");return e(t).trigger(n),n},n._removeElement=function(t){var n=this;if(e(t).removeClass("show"),e(t).hasClass("fade")){var i=c.getTransitionDurationFromElement(t);e(t).one(c.TRANSITION_END,(function(e){return n._destroyElement(t,e)})).emulateTransitionEnd(i)}else this._destroyElement(t)},n._destroyElement=function(t){e(t).detach().trigger("closed.bs.alert").remove()},t._jQueryInterface=function(n){return this.each((function(){var i=e(this),o=i.data("bs.alert");o||(o=new t(this),i.data("bs.alert",o)),"close"===n&&o[n](this)}))},t._handleDismiss=function(t){return function(e){e&&e.preventDefault(),t.close(this)}},o(t,null,[{key:"VERSION",get:function(){return"4.5.0"}}]),t}();e(document).on("click.bs.alert.data-api",'[data-dismiss="alert"]',d._handleDismiss(new d)),e.fn[h]=d._jQueryInterface,e.fn[h].Constructor=d,e.fn[h].noConflict=function(){return e.fn[h]=u,d._jQueryInterface};var f=e.fn.button,g=function(){function t(t){this._element=t}var n=t.prototype;return n.toggle=function(){var t=!0,n=!0,i=e(this._element).closest('[data-toggle="buttons"]')[0];if(i){var o=this._element.querySelector('input:not([type="hidden"])');if(o){if("radio"===o.type)if(o.checked&&this._element.classList.contains("active"))t=!1;else{var s=i.querySelector(".active");s&&e(s).removeClass("active")}t&&("checkbox"!==o.type&&"radio"!==o.type||(o.checked=!this._element.classList.contains("active")),e(o).trigger("change")),o.focus(),n=!1}}this._element.hasAttribute("disabled")||this._element.classList.contains("disabled")||(n&&this._element.setAttribute("aria-pressed",!this._element.classList.contains("active")),t&&e(this._element).toggleClass("active"))},n.dispose=function(){e.removeData(this._element,"bs.button"),this._element=null},t._jQueryInterface=function(n){return this.each((function(){var i=e(this).data("bs.button");i||(i=new t(this),e(this).data("bs.button",i)),"toggle"===n&&i[n]()}))},o(t,null,[{key:"VERSION",get:function(){return"4.5.0"}}]),t}();e(document).on("click.bs.button.data-api",'[data-toggle^="button"]',(function(t){var n=t.target,i=n;if(e(n).hasClass("btn")||(n=e(n).closest(".btn")[0]),!n||n.hasAttribute("disabled")||n.classList.contains("disabled"))t.preventDefault();else{var o=n.querySelector('input:not([type="hidden"])');if(o&&(o.hasAttribute("disabled")||o.classList.contains("disabled")))return void t.preventDefault();"LABEL"===i.tagName&&o&&"checkbox"===o.type&&t.preventDefault(),g._jQueryInterface.call(e(n),"toggle")}})).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',(function(t){var n=e(t.target).closest(".btn")[0];e(n).toggleClass("focus",/^focus(in)?$/.test(t.type))})),e(window).on("load.bs.button.data-api",(function(){for(var t=[].slice.call(document.querySelectorAll('[data-toggle="buttons"] .btn')),e=0,n=t.length;e0,this._pointerEvent=Boolean(window.PointerEvent||window.MSPointerEvent),this._addEventListeners()}var n=t.prototype;return n.next=function(){this._isSliding||this._slide("next")},n.nextWhenVisible=function(){!document.hidden&&e(this._element).is(":visible")&&"hidden"!==e(this._element).css("visibility")&&this.next()},n.prev=function(){this._isSliding||this._slide("prev")},n.pause=function(t){t||(this._isPaused=!0),this._element.querySelector(".carousel-item-next, .carousel-item-prev")&&(c.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},n.cycle=function(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},n.to=function(t){var n=this;this._activeElement=this._element.querySelector(".active.carousel-item");var i=this._getItemIndex(this._activeElement);if(!(t>this._items.length-1||t<0))if(this._isSliding)e(this._element).one("slid.bs.carousel",(function(){return n.to(t)}));else{if(i===t)return this.pause(),void this.cycle();var o=t>i?"next":"prev";this._slide(o,this._items[t])}},n.dispose=function(){e(this._element).off(p),e.removeData(this._element,"bs.carousel"),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},n._getConfig=function(t){return t=a(a({},v),t),c.typeCheckConfig(m,t,b),t},n._handleSwipe=function(){var t=Math.abs(this.touchDeltaX);if(!(t<=40)){var e=t/this.touchDeltaX;this.touchDeltaX=0,e>0&&this.prev(),e<0&&this.next()}},n._addEventListeners=function(){var t=this;this._config.keyboard&&e(this._element).on("keydown.bs.carousel",(function(e){return t._keydown(e)})),"hover"===this._config.pause&&e(this._element).on("mouseenter.bs.carousel",(function(e){return t.pause(e)})).on("mouseleave.bs.carousel",(function(e){return t.cycle(e)})),this._config.touch&&this._addTouchEventListeners()},n._addTouchEventListeners=function(){var t=this;if(this._touchSupported){var n=function(e){t._pointerEvent&&y[e.originalEvent.pointerType.toUpperCase()]?t.touchStartX=e.originalEvent.clientX:t._pointerEvent||(t.touchStartX=e.originalEvent.touches[0].clientX)},i=function(e){t._pointerEvent&&y[e.originalEvent.pointerType.toUpperCase()]&&(t.touchDeltaX=e.originalEvent.clientX-t.touchStartX),t._handleSwipe(),"hover"===t._config.pause&&(t.pause(),t.touchTimeout&&clearTimeout(t.touchTimeout),t.touchTimeout=setTimeout((function(e){return t.cycle(e)}),500+t._config.interval))};e(this._element.querySelectorAll(".carousel-item img")).on("dragstart.bs.carousel",(function(t){return t.preventDefault()})),this._pointerEvent?(e(this._element).on("pointerdown.bs.carousel",(function(t){return n(t)})),e(this._element).on("pointerup.bs.carousel",(function(t){return i(t)})),this._element.classList.add("pointer-event")):(e(this._element).on("touchstart.bs.carousel",(function(t){return n(t)})),e(this._element).on("touchmove.bs.carousel",(function(e){return function(e){e.originalEvent.touches&&e.originalEvent.touches.length>1?t.touchDeltaX=0:t.touchDeltaX=e.originalEvent.touches[0].clientX-t.touchStartX}(e)})),e(this._element).on("touchend.bs.carousel",(function(t){return i(t)})))}},n._keydown=function(t){if(!/input|textarea/i.test(t.target.tagName))switch(t.which){case 37:t.preventDefault(),this.prev();break;case 39:t.preventDefault(),this.next()}},n._getItemIndex=function(t){return this._items=t&&t.parentNode?[].slice.call(t.parentNode.querySelectorAll(".carousel-item")):[],this._items.indexOf(t)},n._getItemByDirection=function(t,e){var n="next"===t,i="prev"===t,o=this._getItemIndex(e),s=this._items.length-1;if((i&&0===o||n&&o===s)&&!this._config.wrap)return e;var r=(o+("prev"===t?-1:1))%this._items.length;return-1===r?this._items[this._items.length-1]:this._items[r]},n._triggerSlideEvent=function(t,n){var i=this._getItemIndex(t),o=this._getItemIndex(this._element.querySelector(".active.carousel-item")),s=e.Event("slide.bs.carousel",{relatedTarget:t,direction:n,from:o,to:i});return e(this._element).trigger(s),s},n._setActiveIndicatorElement=function(t){if(this._indicatorsElement){var n=[].slice.call(this._indicatorsElement.querySelectorAll(".active"));e(n).removeClass("active");var i=this._indicatorsElement.children[this._getItemIndex(t)];i&&e(i).addClass("active")}},n._slide=function(t,n){var i,o,s,r=this,a=this._element.querySelector(".active.carousel-item"),l=this._getItemIndex(a),h=n||a&&this._getItemByDirection(t,a),u=this._getItemIndex(h),d=Boolean(this._interval);if("next"===t?(i="carousel-item-left",o="carousel-item-next",s="left"):(i="carousel-item-right",o="carousel-item-prev",s="right"),h&&e(h).hasClass("active"))this._isSliding=!1;else if(!this._triggerSlideEvent(h,s).isDefaultPrevented()&&a&&h){this._isSliding=!0,d&&this.pause(),this._setActiveIndicatorElement(h);var f=e.Event("slid.bs.carousel",{relatedTarget:h,direction:s,from:l,to:u});if(e(this._element).hasClass("slide")){e(h).addClass(o),c.reflow(h),e(a).addClass(i),e(h).addClass(i);var g=parseInt(h.getAttribute("data-interval"),10);g?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,this._config.interval=g):this._config.interval=this._config.defaultInterval||this._config.interval;var m=c.getTransitionDurationFromElement(a);e(a).one(c.TRANSITION_END,(function(){e(h).removeClass(i+" "+o).addClass("active"),e(a).removeClass("active "+o+" "+i),r._isSliding=!1,setTimeout((function(){return e(r._element).trigger(f)}),0)})).emulateTransitionEnd(m)}else e(a).removeClass("active"),e(h).addClass("active"),this._isSliding=!1,e(this._element).trigger(f);d&&this.cycle()}},t._jQueryInterface=function(n){return this.each((function(){var i=e(this).data("bs.carousel"),o=a(a({},v),e(this).data());"object"==typeof n&&(o=a(a({},o),n));var s="string"==typeof n?n:o.slide;if(i||(i=new t(this,o),e(this).data("bs.carousel",i)),"number"==typeof n)i.to(n);else if("string"==typeof s){if("undefined"==typeof i[s])throw new TypeError('No method named "'+s+'"');i[s]()}else o.interval&&o.ride&&(i.pause(),i.cycle())}))},t._dataApiClickHandler=function(n){var i=c.getSelectorFromElement(this);if(i){var o=e(i)[0];if(o&&e(o).hasClass("carousel")){var s=a(a({},e(o).data()),e(this).data()),r=this.getAttribute("data-slide-to");r&&(s.interval=!1),t._jQueryInterface.call(e(o),s),r&&e(o).data("bs.carousel").to(r),n.preventDefault()}}},o(t,null,[{key:"VERSION",get:function(){return"4.5.0"}},{key:"Default",get:function(){return v}}]),t}();e(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",E._dataApiClickHandler),e(window).on("load.bs.carousel.data-api",(function(){for(var t=[].slice.call(document.querySelectorAll('[data-ride="carousel"]')),n=0,i=t.length;n0&&(this._selector=r,this._triggerArray.push(s))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var n=t.prototype;return n.toggle=function(){e(this._element).hasClass("show")?this.hide():this.show()},n.show=function(){var n,i,o=this;if(!this._isTransitioning&&!e(this._element).hasClass("show")&&(this._parent&&0===(n=[].slice.call(this._parent.querySelectorAll(".show, .collapsing")).filter((function(t){return"string"==typeof o._config.parent?t.getAttribute("data-parent")===o._config.parent:t.classList.contains("collapse")}))).length&&(n=null),!(n&&(i=e(n).not(this._selector).data("bs.collapse"))&&i._isTransitioning))){var s=e.Event("show.bs.collapse");if(e(this._element).trigger(s),!s.isDefaultPrevented()){n&&(t._jQueryInterface.call(e(n).not(this._selector),"hide"),i||e(n).data("bs.collapse",null));var r=this._getDimension();e(this._element).removeClass("collapse").addClass("collapsing"),this._element.style[r]=0,this._triggerArray.length&&e(this._triggerArray).removeClass("collapsed").attr("aria-expanded",!0),this.setTransitioning(!0);var a="scroll"+(r[0].toUpperCase()+r.slice(1)),l=c.getTransitionDurationFromElement(this._element);e(this._element).one(c.TRANSITION_END,(function(){e(o._element).removeClass("collapsing").addClass("collapse show"),o._element.style[r]="",o.setTransitioning(!1),e(o._element).trigger("shown.bs.collapse")})).emulateTransitionEnd(l),this._element.style[r]=this._element[a]+"px"}}},n.hide=function(){var t=this;if(!this._isTransitioning&&e(this._element).hasClass("show")){var n=e.Event("hide.bs.collapse");if(e(this._element).trigger(n),!n.isDefaultPrevented()){var i=this._getDimension();this._element.style[i]=this._element.getBoundingClientRect()[i]+"px",c.reflow(this._element),e(this._element).addClass("collapsing").removeClass("collapse show");var o=this._triggerArray.length;if(o>0)for(var s=0;s0},i._getOffset=function(){var t=this,e={};return"function"==typeof this._config.offset?e.fn=function(e){return e.offsets=a(a({},e.offsets),t._config.offset(e.offsets,t._element)||{}),e}:e.offset=this._config.offset,e},i._getPopperConfig=function(){var t={placement:this._getPlacement(),modifiers:{offset:this._getOffset(),flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}};return"static"===this._config.display&&(t.modifiers.applyStyle={enabled:!1}),a(a({},t),this._config.popperConfig)},t._jQueryInterface=function(n){return this.each((function(){var i=e(this).data("bs.dropdown");if(i||(i=new t(this,"object"==typeof n?n:null),e(this).data("bs.dropdown",i)),"string"==typeof n){if("undefined"==typeof i[n])throw new TypeError('No method named "'+n+'"');i[n]()}}))},t._clearMenus=function(n){if(!n||3!==n.which&&("keyup"!==n.type||9===n.which))for(var i=[].slice.call(document.querySelectorAll('[data-toggle="dropdown"]')),o=0,s=i.length;o0&&r--,40===n.which&&rdocument.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},n._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},n._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=Math.round(t.left+t.right)
',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",sanitize:!0,sanitizeFn:null,whiteList:F,popperConfig:null},Y={HIDE:"hide.bs.tooltip",HIDDEN:"hidden.bs.tooltip",SHOW:"show.bs.tooltip",SHOWN:"shown.bs.tooltip",INSERTED:"inserted.bs.tooltip",CLICK:"click.bs.tooltip",FOCUSIN:"focusin.bs.tooltip",FOCUSOUT:"focusout.bs.tooltip",MOUSEENTER:"mouseenter.bs.tooltip",MOUSELEAVE:"mouseleave.bs.tooltip"},$=function(){function t(t,e){if("undefined"==typeof n)throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org/)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var i=t.prototype;return i.enable=function(){this._isEnabled=!0},i.disable=function(){this._isEnabled=!1},i.toggleEnabled=function(){this._isEnabled=!this._isEnabled},i.toggle=function(t){if(this._isEnabled)if(t){var n=this.constructor.DATA_KEY,i=e(t.currentTarget).data(n);i||(i=new this.constructor(t.currentTarget,this._getDelegateConfig()),e(t.currentTarget).data(n,i)),i._activeTrigger.click=!i._activeTrigger.click,i._isWithActiveTrigger()?i._enter(null,i):i._leave(null,i)}else{if(e(this.getTipElement()).hasClass("show"))return void this._leave(null,this);this._enter(null,this)}},i.dispose=function(){clearTimeout(this._timeout),e.removeData(this.element,this.constructor.DATA_KEY),e(this.element).off(this.constructor.EVENT_KEY),e(this.element).closest(".modal").off("hide.bs.modal",this._hideModalHandler),this.tip&&e(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},i.show=function(){var t=this;if("none"===e(this.element).css("display"))throw new Error("Please use show on visible elements");var i=e.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){e(this.element).trigger(i);var o=c.findShadowRoot(this.element),s=e.contains(null!==o?o:this.element.ownerDocument.documentElement,this.element);if(i.isDefaultPrevented()||!s)return;var r=this.getTipElement(),a=c.getUID(this.constructor.NAME);r.setAttribute("id",a),this.element.setAttribute("aria-describedby",a),this.setContent(),this.config.animation&&e(r).addClass("fade");var l="function"==typeof this.config.placement?this.config.placement.call(this,r,this.element):this.config.placement,h=this._getAttachment(l);this.addAttachmentClass(h);var u=this._getContainer();e(r).data(this.constructor.DATA_KEY,this),e.contains(this.element.ownerDocument.documentElement,this.tip)||e(r).appendTo(u),e(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new n(this.element,r,this._getPopperConfig(h)),e(r).addClass("show"),"ontouchstart"in document.documentElement&&e(document.body).children().on("mouseover",null,e.noop);var d=function(){t.config.animation&&t._fixTransition();var n=t._hoverState;t._hoverState=null,e(t.element).trigger(t.constructor.Event.SHOWN),"out"===n&&t._leave(null,t)};if(e(this.tip).hasClass("fade")){var f=c.getTransitionDurationFromElement(this.tip);e(this.tip).one(c.TRANSITION_END,d).emulateTransitionEnd(f)}else d()}},i.hide=function(t){var n=this,i=this.getTipElement(),o=e.Event(this.constructor.Event.HIDE),s=function(){"show"!==n._hoverState&&i.parentNode&&i.parentNode.removeChild(i),n._cleanTipClass(),n.element.removeAttribute("aria-describedby"),e(n.element).trigger(n.constructor.Event.HIDDEN),null!==n._popper&&n._popper.destroy(),t&&t()};if(e(this.element).trigger(o),!o.isDefaultPrevented()){if(e(i).removeClass("show"),"ontouchstart"in document.documentElement&&e(document.body).children().off("mouseover",null,e.noop),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1,e(this.tip).hasClass("fade")){var r=c.getTransitionDurationFromElement(i);e(i).one(c.TRANSITION_END,s).emulateTransitionEnd(r)}else s();this._hoverState=""}},i.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},i.isWithContent=function(){return Boolean(this.getTitle())},i.addAttachmentClass=function(t){e(this.getTipElement()).addClass("bs-tooltip-"+t)},i.getTipElement=function(){return this.tip=this.tip||e(this.config.template)[0],this.tip},i.setContent=function(){var t=this.getTipElement();this.setElementContent(e(t.querySelectorAll(".tooltip-inner")),this.getTitle()),e(t).removeClass("fade show")},i.setElementContent=function(t,n){"object"!=typeof n||!n.nodeType&&!n.jquery?this.config.html?(this.config.sanitize&&(n=H(n,this.config.whiteList,this.config.sanitizeFn)),t.html(n)):t.text(n):this.config.html?e(n).parent().is(t)||t.empty().append(n):t.text(e(n).text())},i.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},i._getPopperConfig=function(t){var e=this;return a(a({},{placement:t,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:".arrow"},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){return e._handlePopperPlacementChange(t)}}),this.config.popperConfig)},i._getOffset=function(){var t=this,e={};return"function"==typeof this.config.offset?e.fn=function(e){return e.offsets=a(a({},e.offsets),t.config.offset(e.offsets,t.element)||{}),e}:e.offset=this.config.offset,e},i._getContainer=function(){return!1===this.config.container?document.body:c.isElement(this.config.container)?e(this.config.container):e(document).find(this.config.container)},i._getAttachment=function(t){return K[t.toUpperCase()]},i._setListeners=function(){var t=this;this.config.trigger.split(" ").forEach((function(n){if("click"===n)e(t.element).on(t.constructor.Event.CLICK,t.config.selector,(function(e){return t.toggle(e)}));else if("manual"!==n){var i="hover"===n?t.constructor.Event.MOUSEENTER:t.constructor.Event.FOCUSIN,o="hover"===n?t.constructor.Event.MOUSELEAVE:t.constructor.Event.FOCUSOUT;e(t.element).on(i,t.config.selector,(function(e){return t._enter(e)})).on(o,t.config.selector,(function(e){return t._leave(e)}))}})),this._hideModalHandler=function(){t.element&&t.hide()},e(this.element).closest(".modal").on("hide.bs.modal",this._hideModalHandler),this.config.selector?this.config=a(a({},this.config),{},{trigger:"manual",selector:""}):this._fixTitle()},i._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},i._enter=function(t,n){var i=this.constructor.DATA_KEY;(n=n||e(t.currentTarget).data(i))||(n=new this.constructor(t.currentTarget,this._getDelegateConfig()),e(t.currentTarget).data(i,n)),t&&(n._activeTrigger["focusin"===t.type?"focus":"hover"]=!0),e(n.getTipElement()).hasClass("show")||"show"===n._hoverState?n._hoverState="show":(clearTimeout(n._timeout),n._hoverState="show",n.config.delay&&n.config.delay.show?n._timeout=setTimeout((function(){"show"===n._hoverState&&n.show()}),n.config.delay.show):n.show())},i._leave=function(t,n){var i=this.constructor.DATA_KEY;(n=n||e(t.currentTarget).data(i))||(n=new this.constructor(t.currentTarget,this._getDelegateConfig()),e(t.currentTarget).data(i,n)),t&&(n._activeTrigger["focusout"===t.type?"focus":"hover"]=!1),n._isWithActiveTrigger()||(clearTimeout(n._timeout),n._hoverState="out",n.config.delay&&n.config.delay.hide?n._timeout=setTimeout((function(){"out"===n._hoverState&&n.hide()}),n.config.delay.hide):n.hide())},i._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},i._getConfig=function(t){var n=e(this.element).data();return Object.keys(n).forEach((function(t){-1!==V.indexOf(t)&&delete n[t]})),"number"==typeof(t=a(a(a({},this.constructor.Default),n),"object"==typeof t&&t?t:{})).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),c.typeCheckConfig(U,t,this.constructor.DefaultType),t.sanitize&&(t.template=H(t.template,t.whiteList,t.sanitizeFn)),t},i._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},i._cleanTipClass=function(){var t=e(this.getTipElement()),n=t.attr("class").match(W);null!==n&&n.length&&t.removeClass(n.join(""))},i._handlePopperPlacementChange=function(t){this.tip=t.instance.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},i._fixTransition=function(){var t=this.getTipElement(),n=this.config.animation;null===t.getAttribute("x-placement")&&(e(t).removeClass("fade"),this.config.animation=!1,this.hide(),this.show(),this.config.animation=n)},t._jQueryInterface=function(n){return this.each((function(){var i=e(this).data("bs.tooltip"),o="object"==typeof n&&n;if((i||!/dispose|hide/.test(n))&&(i||(i=new t(this,o),e(this).data("bs.tooltip",i)),"string"==typeof n)){if("undefined"==typeof i[n])throw new TypeError('No method named "'+n+'"');i[n]()}}))},o(t,null,[{key:"VERSION",get:function(){return"4.5.0"}},{key:"Default",get:function(){return X}},{key:"NAME",get:function(){return U}},{key:"DATA_KEY",get:function(){return"bs.tooltip"}},{key:"Event",get:function(){return Y}},{key:"EVENT_KEY",get:function(){return".bs.tooltip"}},{key:"DefaultType",get:function(){return z}}]),t}();e.fn[U]=$._jQueryInterface,e.fn[U].Constructor=$,e.fn[U].noConflict=function(){return e.fn[U]=M,$._jQueryInterface};var J="popover",G=e.fn[J],Z=new RegExp("(^|\\s)bs-popover\\S+","g"),tt=a(a({},$.Default),{},{placement:"right",trigger:"click",content:"",template:''}),et=a(a({},$.DefaultType),{},{content:"(string|element|function)"}),nt={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"},it=function(t){var n,i;function s(){return t.apply(this,arguments)||this}i=t,(n=s).prototype=Object.create(i.prototype),n.prototype.constructor=n,n.__proto__=i;var r=s.prototype;return r.isWithContent=function(){return this.getTitle()||this._getContent()},r.addAttachmentClass=function(t){e(this.getTipElement()).addClass("bs-popover-"+t)},r.getTipElement=function(){return this.tip=this.tip||e(this.config.template)[0],this.tip},r.setContent=function(){var t=e(this.getTipElement());this.setElementContent(t.find(".popover-header"),this.getTitle());var n=this._getContent();"function"==typeof n&&(n=n.call(this.element)),this.setElementContent(t.find(".popover-body"),n),t.removeClass("fade show")},r._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},r._cleanTipClass=function(){var t=e(this.getTipElement()),n=t.attr("class").match(Z);null!==n&&n.length>0&&t.removeClass(n.join(""))},s._jQueryInterface=function(t){return this.each((function(){var n=e(this).data("bs.popover"),i="object"==typeof t?t:null;if((n||!/dispose|hide/.test(t))&&(n||(n=new s(this,i),e(this).data("bs.popover",n)),"string"==typeof t)){if("undefined"==typeof n[t])throw new TypeError('No method named "'+t+'"');n[t]()}}))},o(s,null,[{key:"VERSION",get:function(){return"4.5.0"}},{key:"Default",get:function(){return tt}},{key:"NAME",get:function(){return J}},{key:"DATA_KEY",get:function(){return"bs.popover"}},{key:"Event",get:function(){return nt}},{key:"EVENT_KEY",get:function(){return".bs.popover"}},{key:"DefaultType",get:function(){return et}}]),s}($);e.fn[J]=it._jQueryInterface,e.fn[J].Constructor=it,e.fn[J].noConflict=function(){return e.fn[J]=G,it._jQueryInterface};var ot="scrollspy",st=e.fn[ot],rt={offset:10,method:"auto",target:""},at={offset:"number",method:"string",target:"(string|element)"},lt=function(){function t(t,n){var i=this;this._element=t,this._scrollElement="BODY"===t.tagName?window:t,this._config=this._getConfig(n),this._selector=this._config.target+" .nav-link,"+this._config.target+" .list-group-item,"+this._config.target+" .dropdown-item",this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,e(this._scrollElement).on("scroll.bs.scrollspy",(function(t){return i._process(t)})),this.refresh(),this._process()}var n=t.prototype;return n.refresh=function(){var t=this,n=this._scrollElement===this._scrollElement.window?"offset":"position",i="auto"===this._config.method?n:this._config.method,o="position"===i?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),[].slice.call(document.querySelectorAll(this._selector)).map((function(t){var n,s=c.getSelectorFromElement(t);if(s&&(n=document.querySelector(s)),n){var r=n.getBoundingClientRect();if(r.width||r.height)return[e(n)[i]().top+o,s]}return null})).filter((function(t){return t})).sort((function(t,e){return t[0]-e[0]})).forEach((function(e){t._offsets.push(e[0]),t._targets.push(e[1])}))},n.dispose=function(){e.removeData(this._element,"bs.scrollspy"),e(this._scrollElement).off(".bs.scrollspy"),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null},n._getConfig=function(t){if("string"!=typeof(t=a(a({},rt),"object"==typeof t&&t?t:{})).target&&c.isElement(t.target)){var n=e(t.target).attr("id");n||(n=c.getUID(ot),e(t.target).attr("id",n)),t.target="#"+n}return c.typeCheckConfig(ot,t,at),t},n._getScrollTop=function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop},n._getScrollHeight=function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},n._getOffsetHeight=function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height},n._process=function(){var t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),n=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=n){var i=this._targets[this._targets.length-1];this._activeTarget!==i&&this._activate(i)}else{if(this._activeTarget&&t0)return this._activeTarget=null,void this._clear();for(var o=this._offsets.length;o--;){this._activeTarget!==this._targets[o]&&t>=this._offsets[o]&&("undefined"==typeof this._offsets[o+1]||t li > .active":".active";i=(i=e.makeArray(e(o).find(r)))[i.length-1]}var a=e.Event("hide.bs.tab",{relatedTarget:this._element}),l=e.Event("show.bs.tab",{relatedTarget:i});if(i&&e(i).trigger(a),e(this._element).trigger(l),!l.isDefaultPrevented()&&!a.isDefaultPrevented()){s&&(n=document.querySelector(s)),this._activate(this._element,o);var h=function(){var n=e.Event("hidden.bs.tab",{relatedTarget:t._element}),o=e.Event("shown.bs.tab",{relatedTarget:i});e(i).trigger(n),e(t._element).trigger(o)};n?this._activate(n,n.parentNode,h):h()}}},n.dispose=function(){e.removeData(this._element,"bs.tab"),this._element=null},n._activate=function(t,n,i){var o=this,s=(!n||"UL"!==n.nodeName&&"OL"!==n.nodeName?e(n).children(".active"):e(n).find("> li > .active"))[0],r=i&&s&&e(s).hasClass("fade"),a=function(){return o._transitionComplete(t,s,i)};if(s&&r){var l=c.getTransitionDurationFromElement(s);e(s).removeClass("show").one(c.TRANSITION_END,a).emulateTransitionEnd(l)}else a()},n._transitionComplete=function(t,n,i){if(n){e(n).removeClass("active");var o=e(n.parentNode).find("> .dropdown-menu .active")[0];o&&e(o).removeClass("active"),"tab"===n.getAttribute("role")&&n.setAttribute("aria-selected",!1)}if(e(t).addClass("active"),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!0),c.reflow(t),t.classList.contains("fade")&&t.classList.add("show"),t.parentNode&&e(t.parentNode).hasClass("dropdown-menu")){var s=e(t).closest(".dropdown")[0];if(s){var r=[].slice.call(s.querySelectorAll(".dropdown-toggle"));e(r).addClass("active")}t.setAttribute("aria-expanded",!0)}i&&i()},t._jQueryInterface=function(n){return this.each((function(){var i=e(this),o=i.data("bs.tab");if(o||(o=new t(this),i.data("bs.tab",o)),"string"==typeof n){if("undefined"==typeof o[n])throw new TypeError('No method named "'+n+'"');o[n]()}}))},o(t,null,[{key:"VERSION",get:function(){return"4.5.0"}}]),t}();e(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',(function(t){t.preventDefault(),ht._jQueryInterface.call(e(this),"show")})),e.fn.tab=ht._jQueryInterface,e.fn.tab.Constructor=ht,e.fn.tab.noConflict=function(){return e.fn.tab=ct,ht._jQueryInterface};var ut=e.fn.toast,dt={animation:"boolean",autohide:"boolean",delay:"number"},ft={animation:!0,autohide:!0,delay:500},gt=function(){function t(t,e){this._element=t,this._config=this._getConfig(e),this._timeout=null,this._setListeners()}var n=t.prototype;return n.show=function(){var t=this,n=e.Event("show.bs.toast");if(e(this._element).trigger(n),!n.isDefaultPrevented()){this._config.animation&&this._element.classList.add("fade");var i=function(){t._element.classList.remove("showing"),t._element.classList.add("show"),e(t._element).trigger("shown.bs.toast"),t._config.autohide&&(t._timeout=setTimeout((function(){t.hide()}),t._config.delay))};if(this._element.classList.remove("hide"),c.reflow(this._element),this._element.classList.add("showing"),this._config.animation){var o=c.getTransitionDurationFromElement(this._element);e(this._element).one(c.TRANSITION_END,i).emulateTransitionEnd(o)}else i()}},n.hide=function(){if(this._element.classList.contains("show")){var t=e.Event("hide.bs.toast");e(this._element).trigger(t),t.isDefaultPrevented()||this._close()}},n.dispose=function(){clearTimeout(this._timeout),this._timeout=null,this._element.classList.contains("show")&&this._element.classList.remove("show"),e(this._element).off("click.dismiss.bs.toast"),e.removeData(this._element,"bs.toast"),this._element=null,this._config=null},n._getConfig=function(t){return t=a(a(a({},ft),e(this._element).data()),"object"==typeof t&&t?t:{}),c.typeCheckConfig("toast",t,this.constructor.DefaultType),t},n._setListeners=function(){var t=this;e(this._element).on("click.dismiss.bs.toast",'[data-dismiss="toast"]',(function(){return t.hide()}))},n._close=function(){var t=this,n=function(){t._element.classList.add("hide"),e(t._element).trigger("hidden.bs.toast")};if(this._element.classList.remove("show"),this._config.animation){var i=c.getTransitionDurationFromElement(this._element);e(this._element).one(c.TRANSITION_END,n).emulateTransitionEnd(i)}else n()},t._jQueryInterface=function(n){return this.each((function(){var i=e(this),o=i.data("bs.toast");if(o||(o=new t(this,"object"==typeof n&&n),i.data("bs.toast",o)),"string"==typeof n){if("undefined"==typeof o[n])throw new TypeError('No method named "'+n+'"');o[n](this)}}))},o(t,null,[{key:"VERSION",get:function(){return"4.5.0"}},{key:"DefaultType",get:function(){return dt}},{key:"Default",get:function(){return ft}}]),t}();e.fn.toast=gt._jQueryInterface,e.fn.toast.Constructor=gt,e.fn.toast.noConflict=function(){return e.fn.toast=ut,gt._jQueryInterface},t.Alert=d,t.Button=g,t.Carousel=E,t.Collapse=D,t.Dropdown=j,t.Modal=R,t.Popover=it,t.Scrollspy=lt,t.Tab=ht,t.Toast=gt,t.Tooltip=$,t.Util=c,Object.defineProperty(t,"__esModule",{value:!0})})); /*! * jQuery Mobile Events * by Ben Major (www.ben-major.co.uk) * * Copyright 2011, Ben Major * Licensed under the MIT License: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ (function ($) { $.attrFn = $.attrFn || {}; // navigator.userAgent.toLowerCase() isn't reliable for Chrome installs // on mobile devices. As such, we will create a boolean isChromeDesktop // The reason that we need to do this is because Chrome annoyingly // purports support for touch events even if the underlying hardware // does not! var agent = navigator.userAgent.toLowerCase(), isChromeDesktop = (agent.indexOf('chrome') > -1 && ((agent.indexOf('windows') > -1) || (agent.indexOf('macintosh') > -1) || (agent.indexOf('linux') > -1)) && agent.indexOf('mobile') < 0 && agent.indexOf('android') < 0), settings = { tap_pixel_range: 5, swipe_h_threshold: 50, swipe_v_threshold: 50, taphold_threshold: 750, doubletap_int: 500, touch_capable: ('ontouchstart' in window && !isChromeDesktop), orientation_support: ('orientation' in window && 'onorientationchange' in window), startevent: ('ontouchstart' in window && !isChromeDesktop) ? 'touchstart' : 'mousedown', endevent: ('ontouchstart' in window && !isChromeDesktop) ? 'touchend' : 'mouseup', moveevent: ('ontouchstart' in window && !isChromeDesktop) ? 'touchmove' : 'mousemove', tapevent: ('ontouchstart' in window && !isChromeDesktop) ? 'tap' : 'click', scrollevent: ('ontouchstart' in window && !isChromeDesktop) ? 'touchmove' : 'scroll', hold_timer: null, tap_timer: null }; // Convenience functions: $.isTouchCapable = function() { return settings.touch_capable; }; $.getStartEvent = function() { return settings.startevent; }; $.getEndEvent = function() { return settings.endevent; }; $.getMoveEvent = function() { return settings.moveevent; }; $.getTapEvent = function() { return settings.tapevent; }; $.getScrollEvent = function() { return settings.scrollevent; }; // Add Event shortcuts: $.each(['tapstart', 'tapend', 'tapmove', 'tap', 'tap2', 'tap3', 'tap4', 'singletap', 'doubletap', 'taphold', 'swipe', 'swipeup', 'swiperight', 'swipedown', 'swipeleft', 'swipeend', 'scrollstart', 'scrollend', 'orientationchange'], function (i, name) { $.fn[name] = function (fn) { return fn ? this.on(name, fn) : this.trigger(name); }; $.attrFn[name] = true; }); // tapstart Event: $.event.special.tapstart = { setup: function () { var thisObject = this, $this = $(thisObject); $this.on(settings.startevent, function (e) { $this.data('callee', arguments.callee); if (e.which && e.which !== 1) { return false; } var origEvent = e.originalEvent, touchData = { 'position': { 'x': ((settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX), 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? origEvent.touches[0].pageX - origEvent.touches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.touches[0].pageY - origEvent.touches[0].target.offsetTop : e.offsetY }, 'time': Date.now(), 'target': e.target }; triggerCustomEvent(thisObject, 'tapstart', e, touchData); return true; }); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee); } }; // tapmove Event: $.event.special.tapmove = { setup: function() { var thisObject = this, $this = $(thisObject); $this.on(settings.moveevent, function(e) { $this.data('callee', arguments.callee); var origEvent = e.originalEvent, touchData = { 'position': { 'x': ((settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX), 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? origEvent.touches[0].pageX - origEvent.touches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.touches[0].pageY - origEvent.touches[0].target.offsetTop : e.offsetY }, 'time': Date.now(), 'target': e.target }; triggerCustomEvent(thisObject, 'tapmove', e, touchData); return true; }); }, remove: function() { $(this).off(settings.moveevent, $(this).data.callee); } } // tapend Event: $.event.special.tapend = { setup: function () { var thisObject = this, $this = $(thisObject); $this.on(settings.endevent, function (e) { // Touch event data: $this.data('callee', arguments.callee); var origEvent = e.originalEvent; var touchData = { 'position': { 'x': (settings.touch_capable) ? origEvent.changedTouches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.changedTouches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? origEvent.changedTouches[0].pageX - origEvent.changedTouches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.changedTouches[0].pageY - origEvent.changedTouches[0].target.offsetTop : e.offsetY }, 'time': Date.now(), 'target': e.target }; triggerCustomEvent(thisObject, 'tapend', e, touchData); return true; }); }, remove: function () { $(this).off(settings.endevent, $(this).data.callee); } }; // taphold Event: $.event.special.taphold = { setup: function () { var thisObject = this, $this = $(thisObject), origTarget, timer, start_pos = { x: 0, y: 0 }, end_x = 0, end_y = 0; $this.on(settings.startevent, function (e) { if (e.which && e.which !== 1) { return false; } else { $this.data('tapheld', false); origTarget = e.target; var origEvent = e.originalEvent; var start_time = Date.now(), startPosition = { 'x': (settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, startOffset = { 'x': (settings.touch_capable) ? origEvent.touches[0].pageX - origEvent.touches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.touches[0].pageY - origEvent.touches[0].target.offsetTop : e.offsetY }; start_pos.x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; start_pos.y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; end_x = start_pos.x; end_y = start_pos.y; settings.hold_timer = window.setTimeout(function () { var diff_x = (start_pos.x - end_x), diff_y = (start_pos.y - end_y); if (e.target == origTarget && ((start_pos.x == end_x && start_pos.y == end_y) || (diff_x >= -(settings.tap_pixel_range) && diff_x <= settings.tap_pixel_range && diff_y >= -(settings.tap_pixel_range) && diff_y <= settings.tap_pixel_range))) { $this.data('tapheld', true); var end_time = Date.now(), endPosition = { 'x': (settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, endOffset = { 'x': (settings.touch_capable) ? origEvent.touches[0].pageX - origEvent.touches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.touches[0].pageY - origEvent.touches[0].target.offsetTop : e.offsetY }; duration = end_time - start_time; // Build the touch data: var touchData = { 'startTime': start_time, 'endTime': end_time, 'startPosition': startPosition, 'startOffset': startOffset, 'endPosition': endPosition, 'endOffset': endOffset, 'duration': duration, 'target': e.target } $this.data('callee1', arguments.callee); triggerCustomEvent(thisObject, 'taphold', e, touchData); } }, settings.taphold_threshold); return true; } }).on(settings.endevent, function () { $this.data('callee2', arguments.callee); $this.data('tapheld', false); window.clearTimeout(settings.hold_timer); }) .on(settings.moveevent, function (e) { $this.data('callee3', arguments.callee); end_x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; end_y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; }); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee1).off(settings.endevent, $(this).data.callee2).off(settings.moveevent, $(this).data.callee3); } }; // doubletap Event: $.event.special.doubletap = { setup: function () { var thisObject = this, $this = $(thisObject), origTarget, action, firstTap, origEvent, cooloff, cooling = false; $this.on(settings.startevent, function (e) { if (e.which && e.which !== 1) { return false; } $this.data('doubletapped', false); origTarget = e.target; $this.data('callee1', arguments.callee); origEvent = e.originalEvent; firstTap = { 'position': { 'x': (settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? origEvent.touches[0].pageX - origEvent.touches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.touches[0].pageY - origEvent.touches[0].target.offsetTop : e.offsetY }, 'time': Date.now(), 'target': e.target }; return true; }).on(settings.endevent, function (e) { var now = Date.now(); var lastTouch = $this.data('lastTouch') || now + 1; var delta = now - lastTouch; window.clearTimeout(action); $this.data('callee2', arguments.callee); if (delta < settings.doubletap_int && (e.target == origTarget) && delta > 100) { $this.data('doubletapped', true); window.clearTimeout(settings.tap_timer); // Now get the current event: var lastTap = { 'position': { 'x': (settings.touch_capable) ? e.originalEvent.changedTouches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? e.originalEvent.changedTouches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? e.originalEvent.changedTouches[0].pageX - e.originalEvent.changedTouches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? e.originalEvent.changedTouches[0].pageY - e.originalEvent.changedTouches[0].target.offsetTop : e.offsetY }, 'time': Date.now(), 'target': e.target } var touchData = { 'firstTap': firstTap, 'secondTap': lastTap, 'interval': lastTap.time - firstTap.time }; if (!cooling) { triggerCustomEvent(thisObject, 'doubletap', e, touchData); } cooling = true; cooloff = window.setTimeout(function (e) { cooling = false; }, settings.doubletap_int); } else { $this.data('lastTouch', now); action = window.setTimeout(function (e) { window.clearTimeout(action); }, settings.doubletap_int, [e]); } $this.data('lastTouch', now); }); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee1).off(settings.endevent, $(this).data.callee2); } }; // singletap Event: // This is used in conjuction with doubletap when both events are needed on the same element $.event.special.singletap = { setup: function () { var thisObject = this, $this = $(thisObject), origTarget = null, startTime = null, start_pos = { x: 0, y: 0 }; $this.on(settings.startevent, function (e) { if (e.which && e.which !== 1) { return false; } else { startTime = Date.now(); origTarget = e.target; $this.data('callee1', arguments.callee); // Get the start x and y position: start_pos.x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; start_pos.y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; return true; } }).on(settings.endevent, function (e) { $this.data('callee2', arguments.callee); if (e.target == origTarget) { // Get the end point: end_pos_x = (e.originalEvent.changedTouches) ? e.originalEvent.changedTouches[0].pageX : e.pageX; end_pos_y = (e.originalEvent.changedTouches) ? e.originalEvent.changedTouches[0].pageY : e.pageY; // We need to check if it was a taphold: settings.tap_timer = window.setTimeout(function () { if (!$this.data('doubletapped') && !$this.data('tapheld') && (start_pos.x == end_pos_x) && (start_pos.y == end_pos_y)) { var origEvent = e.originalEvent; var touchData = { 'position': { 'x': (settings.touch_capable) ? origEvent.changedTouches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.changedTouches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? origEvent.changedTouches[0].pageX - origEvent.changedTouches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.changedTouches[0].pageY - origEvent.changedTouches[0].target.offsetTop : e.offsetY }, 'time': Date.now(), 'target': e.target }; // Was it a taphold? if((touchData.time - startTime) < settings.taphold_threshold) { triggerCustomEvent(thisObject, 'singletap', e, touchData); } } }, settings.doubletap_int); } }); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee1).off(settings.endevent, $(this).data.callee2); } }; // tap Event: $.event.special.tap = { setup: function () { var thisObject = this, $this = $(thisObject), started = false, origTarget = null, start_time, start_pos = { x: 0, y: 0 }, touches; $this.on(settings.startevent, function (e) { $this.data('callee1', arguments.callee); if (e.which && e.which !== 1) { return false; } else { started = true; start_pos.x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; start_pos.y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; start_time = Date.now(); origTarget = e.target; touches = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches : [ e ]; return true; } }).on(settings.endevent, function (e) { $this.data('callee2', arguments.callee); // Only trigger if they've started, and the target matches: var end_x = (e.originalEvent.targetTouches) ? e.originalEvent.changedTouches[0].pageX : e.pageX, end_y = (e.originalEvent.targetTouches) ? e.originalEvent.changedTouches[0].pageY : e.pageY, diff_x = (start_pos.x - end_x), diff_y = (start_pos.y - end_y), eventName; if (origTarget == e.target && started && ((Date.now() - start_time) < settings.taphold_threshold) && ((start_pos.x == end_x && start_pos.y == end_y) || (diff_x >= -(settings.tap_pixel_range) && diff_x <= settings.tap_pixel_range && diff_y >= -(settings.tap_pixel_range) && diff_y <= settings.tap_pixel_range))) { var origEvent = e.originalEvent; var touchData = [ ]; for( var i = 0; i < touches.length; i++) { var touch = { 'position': { 'x': (settings.touch_capable) ? origEvent.changedTouches[i].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.changedTouches[i].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? origEvent.changedTouches[i].pageX - origEvent.changedTouches[i].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.changedTouches[i].pageY - origEvent.changedTouches[i].target.offsetTop : e.offsetY }, 'time': Date.now(), 'target': e.target }; touchData.push( touch ); } switch( touches.length ) { case 1: eventName = 'tap'; break; case 2: eventName = 'tap2'; break; case 3: eventName = 'tap3'; break; case 4: eventName = 'tap4'; break; } triggerCustomEvent(thisObject, eventName, e, touchData); } }); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee1).off(settings.endevent, $(this).data.callee2); } }; // swipe Event (also handles swipeup, swiperight, swipedown and swipeleft): $.event.special.swipe = { setup: function () { var thisObject = this, $this = $(thisObject), started = false, hasSwiped = false, originalCoord = { x: 0, y: 0 }, finalCoord = { x: 0, y: 0 }, startEvnt; // Screen touched, store the original coordinate function touchStart(e) { $this = $(e.currentTarget); $this.data('callee1', arguments.callee); originalCoord.x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; originalCoord.y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; finalCoord.x = originalCoord.x; finalCoord.y = originalCoord.y; started = true; var origEvent = e.originalEvent; // Read event data into our startEvt: startEvnt = { 'position': { 'x': (settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? origEvent.touches[0].pageX - origEvent.touches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.touches[0].pageY - origEvent.touches[0].target.offsetTop : e.offsetY }, 'time': Date.now(), 'target': e.target }; } // Store coordinates as finger is swiping function touchMove(e) { $this = $(e.currentTarget); $this.data('callee2', arguments.callee); finalCoord.x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; finalCoord.y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; var swipedir; // We need to check if the element to which the event was bound contains a data-xthreshold | data-vthreshold: var ele_x_threshold = ($this.parent().data('xthreshold')) ? $this.parent().data('xthreshold') : $this.data('xthreshold'), ele_y_threshold = ($this.parent().data('ythreshold')) ? $this.parent().data('ythreshold') : $this.data('ythreshold'), h_threshold = (typeof ele_x_threshold !== 'undefined' && ele_x_threshold !== false && parseInt(ele_x_threshold)) ? parseInt(ele_x_threshold) : settings.swipe_h_threshold, v_threshold = (typeof ele_y_threshold !== 'undefined' && ele_y_threshold !== false && parseInt(ele_y_threshold)) ? parseInt(ele_y_threshold) : settings.swipe_v_threshold; if (originalCoord.y > finalCoord.y && (originalCoord.y - finalCoord.y > v_threshold)) { swipedir = 'swipeup'; } if (originalCoord.x < finalCoord.x && (finalCoord.x - originalCoord.x > h_threshold)) { swipedir = 'swiperight'; } if (originalCoord.y < finalCoord.y && (finalCoord.y - originalCoord.y > v_threshold)) { swipedir = 'swipedown'; } if (originalCoord.x > finalCoord.x && (originalCoord.x - finalCoord.x > h_threshold)) { swipedir = 'swipeleft'; } if (swipedir != undefined && started) { originalCoord.x = 0; originalCoord.y = 0; finalCoord.x = 0; finalCoord.y = 0; started = false; // Read event data into our endEvnt: var origEvent = e.originalEvent; endEvnt = { 'position': { 'x': (settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? origEvent.touches[0].pageX - origEvent.touches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.touches[0].pageY - origEvent.touches[0].target.offsetTop : e.offsetY }, 'time': Date.now(), 'target': e.target }; // Calculate the swipe amount (normalized): var xAmount = Math.abs(startEvnt.position.x - endEvnt.position.x), yAmount = Math.abs(startEvnt.position.y - endEvnt.position.y); var touchData = { 'startEvnt': startEvnt, 'endEvnt': endEvnt, 'direction': swipedir.replace('swipe', ''), 'xAmount': xAmount, 'yAmount': yAmount, 'duration': endEvnt.time - startEvnt.time } hasSwiped = true; $this.trigger('swipe', touchData).trigger(swipedir, touchData); } } function touchEnd(e) { $this = $(e.currentTarget); var swipedir = ""; $this.data('callee3', arguments.callee); if (hasSwiped) { // We need to check if the element to which the event was bound contains a data-xthreshold | data-vthreshold: var ele_x_threshold = $this.data('xthreshold'), ele_y_threshold = $this.data('ythreshold'), h_threshold = (typeof ele_x_threshold !== 'undefined' && ele_x_threshold !== false && parseInt(ele_x_threshold)) ? parseInt(ele_x_threshold) : settings.swipe_h_threshold, v_threshold = (typeof ele_y_threshold !== 'undefined' && ele_y_threshold !== false && parseInt(ele_y_threshold)) ? parseInt(ele_y_threshold) : settings.swipe_v_threshold; var origEvent = e.originalEvent; endEvnt = { 'position': { 'x': (settings.touch_capable) ? origEvent.changedTouches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.changedTouches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? origEvent.changedTouches[0].pageX - origEvent.changedTouches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.changedTouches[0].pageY - origEvent.changedTouches[0].target.offsetTop : e.offsetY }, 'time': Date.now(), 'target': e.target }; // Read event data into our endEvnt: if (startEvnt.position.y > endEvnt.position.y && (startEvnt.position.y - endEvnt.position.y > v_threshold)) { swipedir = 'swipeup'; } if (startEvnt.position.x < endEvnt.position.x && (endEvnt.position.x - startEvnt.position.x > h_threshold)) { swipedir = 'swiperight'; } if (startEvnt.position.y < endEvnt.position.y && (endEvnt.position.y - startEvnt.position.y > v_threshold)) { swipedir = 'swipedown'; } if (startEvnt.position.x > endEvnt.position.x && (startEvnt.position.x - endEvnt.position.x > h_threshold)) { swipedir = 'swipeleft'; } // Calculate the swipe amount (normalized): var xAmount = Math.abs(startEvnt.position.x - endEvnt.position.x), yAmount = Math.abs(startEvnt.position.y - endEvnt.position.y); var touchData = { 'startEvnt': startEvnt, 'endEvnt': endEvnt, 'direction': swipedir.replace('swipe', ''), 'xAmount': xAmount, 'yAmount': yAmount, 'duration': endEvnt.time - startEvnt.time } $this.trigger('swipeend', touchData); } started = false; hasSwiped = false; } $this.on(settings.startevent, touchStart); $this.on(settings.moveevent, touchMove); $this.on(settings.endevent, touchEnd); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee1).off(settings.moveevent, $(this).data.callee2).off(settings.endevent, $(this).data.callee3); } }; // scrollstart Event (also handles scrollend): $.event.special.scrollstart = { setup: function () { var thisObject = this, $this = $(thisObject), scrolling, timer; function trigger(event, state) { scrolling = state; triggerCustomEvent(thisObject, scrolling ? 'scrollstart' : 'scrollend', event); } // iPhone triggers scroll after a small delay; use touchmove instead $this.on(settings.scrollevent, function (event) { $this.data('callee', arguments.callee); if (!scrolling) { trigger(event, true); } clearTimeout(timer); timer = setTimeout(function () { trigger(event, false); }, 50); }); }, remove: function () { $(this).off(settings.scrollevent, $(this).data.callee); } }; // This is the orientation change (largely borrowed from jQuery Mobile): var win = $(window), special_event, get_orientation, last_orientation, initial_orientation_is_landscape, initial_orientation_is_default, portrait_map = { '0': true, '180': true }; if (settings.orientation_support) { var ww = window.innerWidth || win.width(), wh = window.innerHeight || win.height(), landscape_threshold = 50; initial_orientation_is_landscape = ww > wh && (ww - wh) > landscape_threshold; initial_orientation_is_default = portrait_map[window.orientation]; if ((initial_orientation_is_landscape && initial_orientation_is_default) || (!initial_orientation_is_landscape && !initial_orientation_is_default)) { portrait_map = { '-90': true, '90': true }; } } $.event.special.orientationchange = special_event = { setup: function () { // If the event is supported natively, return false so that jQuery // will on to the event using DOM methods. if (settings.orientation_support) { return false; } // Get the current orientation to avoid initial double-triggering. last_orientation = get_orientation(); win.on('throttledresize', handler); return true; }, teardown: function () { if (settings.orientation_support) { return false; } win.off('throttledresize', handler); return true; }, add: function (handleObj) { // Save a reference to the bound event handler. var old_handler = handleObj.handler; handleObj.handler = function (event) { event.orientation = get_orientation(); return old_handler.apply(this, arguments); }; } }; // If the event is not supported natively, this handler will be bound to // the window resize event to simulate the orientationchange event. function handler() { // Get the current orientation. var orientation = get_orientation(); if (orientation !== last_orientation) { // The orientation has changed, so trigger the orientationchange event. last_orientation = orientation; win.trigger("orientationchange"); } } $.event.special.orientationchange.orientation = get_orientation = function () { var isPortrait = true, elem = document.documentElement; if (settings.orientation_support) { isPortrait = portrait_map[window.orientation]; } else { isPortrait = elem && elem.clientWidth / elem.clientHeight < 1.1; } return isPortrait ? 'portrait' : 'landscape'; }; // throttle Handler: $.event.special.throttledresize = { setup: function () { $(this).on('resize', throttle_handler); }, teardown: function () { $(this).off('resize', throttle_handler); } }; var throttle = 250, throttle_handler = function () { curr = Date.now(); diff = curr - lastCall; if (diff >= throttle) { lastCall = curr; $(this).trigger('throttledresize'); } else { if (heldCall) { window.clearTimeout(heldCall); } // Promise a held call will still execute heldCall = window.setTimeout(handler, throttle - diff); } }, lastCall = 0, heldCall, curr, diff; // Trigger a custom event: function triggerCustomEvent(obj, eventType, event, touchData) { var originalType = event.type; event.type = eventType; $.event.dispatch.call(obj, event, touchData); event.type = originalType; } // Correctly on anything we've overloaded: $.each({ scrollend: 'scrollstart', swipeup: 'swipe', swiperight: 'swipe', swipedown: 'swipe', swipeleft: 'swipe', swipeend: 'swipe', tap2: 'tap' }, function (e, srcE, touchData) { $.event.special[e] = { setup: function () { $(this).on(srcE, $.noop); } }; }); })(jQuery); /*! lightgallery - v1.7.1 - 2020-06-13 * http://sachinchoolur.github.io/lightGallery/ * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ /*! lightgallery - v1.7.1 - 2020-06-13 * http://sachinchoolur.github.io/lightGallery/ * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module unless amdModuleId is set define(['jquery'], function (a0) { return (factory(a0)); }); } else if (typeof module === 'object' && module.exports) { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. module.exports = factory(require('jquery')); } else { factory(root["jQuery"]); } }(this, function ($) { (function () { 'use strict'; var defaults = { mode: 'lg-slide', // Ex : 'ease' cssEasing: 'ease', //'for jquery animation' easing: 'linear', speed: 600, height: '100%', width: '100%', addClass: '', startClass: 'lg-start-zoom', backdropDuration: 150, hideBarsDelay: 6000, useLeft: false, // aria-labelledby attribute fot gallery ariaLabelledby: '', //aria-describedby attribute for gallery ariaDescribedby: '', closable: true, loop: true, escKey: true, keyPress: true, controls: true, slideEndAnimatoin: true, hideControlOnEnd: false, mousewheel: true, getCaptionFromTitleOrAlt: true, // .lg-item || '.lg-sub-html' appendSubHtmlTo: '.lg-sub-html', subHtmlSelectorRelative: false, /** * @desc number of preload slides * will exicute only after the current slide is fully loaded. * * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th * slide will be loaded in the background after the 4th slide is fully loaded.. * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ... * */ preload: 1, showAfterLoad: true, selector: '', selectWithin: '', nextHtml: '', prevHtml: '', // 0, 1 index: false, iframeMaxWidth: '100%', download: true, counter: true, appendCounterTo: '.lg-toolbar', swipeThreshold: 50, enableSwipe: true, enableDrag: true, dynamic: false, dynamicEl: [], galleryId: 1 }; function Plugin(element, options) { // Current lightGallery element this.el = element; // Current jquery element this.$el = $(element); // lightGallery settings this.s = $.extend({}, defaults, options); // When using dynamic mode, ensure dynamicEl is an array if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) { throw ('When using dynamic mode, you must also define dynamicEl as an Array.'); } // lightGallery modules this.modules = {}; // false when lightgallery complete first slide; this.lGalleryOn = false; this.lgBusy = false; // Timeout function for hiding controls; this.hideBartimeout = false; // To determine browser supports for touch events; this.isTouch = ('ontouchstart' in document.documentElement); // Disable hideControlOnEnd if sildeEndAnimation is true if (this.s.slideEndAnimatoin) { this.s.hideControlOnEnd = false; } // Gallery items if (this.s.dynamic) { this.$items = this.s.dynamicEl; } else { if (this.s.selector === 'this') { this.$items = this.$el; } else if (this.s.selector !== '') { if (this.s.selectWithin) { this.$items = $(this.s.selectWithin).find(this.s.selector); } else { this.$items = this.$el.find($(this.s.selector)); } } else { this.$items = this.$el.children(); } } // .lg-item this.$slide = ''; // .lg-outer this.$outer = ''; this.init(); return this; } Plugin.prototype.init = function () { var _this = this; // s.preload should not be more than $item.length if (_this.s.preload > _this.$items.length) { _this.s.preload = _this.$items.length; } // if dynamic option is enabled execute immediately var _hash = window.location.hash; if (_hash.indexOf('lg=' + this.s.galleryId) > 0) { _this.index = parseInt(_hash.split('&slide=')[1], 10); $('body').addClass('lg-from-hash'); if (!$('body').hasClass('lg-on')) { setTimeout(function () { _this.build(_this.index); }); $('body').addClass('lg-on'); } } if (_this.s.dynamic) { _this.$el.trigger('onBeforeOpen.lg'); _this.index = _this.s.index || 0; // prevent accidental double execution if (!$('body').hasClass('lg-on')) { setTimeout(function () { _this.build(_this.index); $('body').addClass('lg-on'); }); } } else { // Using different namespace for click because click event should not unbind if selector is same object('this') _this.$items.on('click.lgcustom', function (event) { // For IE8 try { event.preventDefault(); event.preventDefault(); } catch (er) { event.returnValue = false; } _this.$el.trigger('onBeforeOpen.lg'); _this.index = _this.s.index || _this.$items.index(this); // prevent accidental double execution if (!$('body').hasClass('lg-on')) { _this.build(_this.index); $('body').addClass('lg-on'); } }); } }; Plugin.prototype.build = function (index) { var _this = this; _this.structure(); // module constructor $.each($.fn.lightGallery.modules, function (key) { _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el); }); // initiate slide function _this.slide(index, false, false, false); if (_this.s.keyPress) { _this.keyPress(); } if (_this.$items.length > 1) { _this.arrow(); setTimeout(function () { _this.enableDrag(); _this.enableSwipe(); }, 50); if (_this.s.mousewheel) { _this.mousewheel(); } } else { _this.$slide.on('click.lg', function () { _this.$el.trigger('onSlideClick.lg'); }); } _this.counter(); _this.closeGallery(); _this.$el.trigger('onAfterOpen.lg'); // Hide controllers if mouse doesn't move for some period _this.$outer.on('mousemove.lg click.lg touchstart.lg', function () { _this.$outer.removeClass('lg-hide-items'); clearTimeout(_this.hideBartimeout); // Timeout will be cleared on each slide movement also _this.hideBartimeout = setTimeout(function () { _this.$outer.addClass('lg-hide-items'); }, _this.s.hideBarsDelay); }); _this.$outer.trigger('mousemove.lg'); }; Plugin.prototype.structure = function () { var list = ''; var controls = ''; var i = 0; var subHtmlCont = ''; var template; var _this = this; $('body').append('
'); $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms'); // Create gallery items for (i = 0; i < this.$items.length; i++) { list += '
'; } // Create controlls if (this.s.controls && this.$items.length > 1) { controls = '
' + '' + '' + '
'; } if (this.s.appendSubHtmlTo === '.lg-sub-html') { subHtmlCont = '
'; } var ariaLabelledby = this.s.ariaLabelledby ? 'aria-labelledby="' + this.s.ariaLabelledby + '"' : ''; var ariaDescribedby = this.s.ariaDescribedby ? 'aria-describedby="' + this.s.ariaDescribedby + '"' : ''; template = ''; $('body').append(template); this.$outer = $('.lg-outer'); this.$outer.focus(); this.$slide = this.$outer.find('.lg-item'); if (this.s.useLeft) { this.$outer.addClass('lg-use-left'); // Set mode lg-slide if use left is true; this.s.mode = 'lg-slide'; } else { this.$outer.addClass('lg-use-css3'); } // For fixed height gallery _this.setTop(); $(window).on('resize.lg orientationchange.lg', function () { setTimeout(function () { _this.setTop(); }, 100); }); // add class lg-current to remove initial transition this.$slide.eq(this.index).addClass('lg-current'); // add Class for css support and transition mode if (this.doCss()) { this.$outer.addClass('lg-css3'); } else { this.$outer.addClass('lg-css'); // Set speed 0 because no animation will happen if browser doesn't support css3 this.s.speed = 0; } this.$outer.addClass(this.s.mode); if (this.s.enableDrag && this.$items.length > 1) { this.$outer.addClass('lg-grab'); } if (this.s.showAfterLoad) { this.$outer.addClass('lg-show-after-load'); } if (this.doCss()) { var $inner = this.$outer.find('.lg-inner'); $inner.css('transition-timing-function', this.s.cssEasing); $inner.css('transition-duration', this.s.speed + 'ms'); } setTimeout(function () { $('.lg-backdrop').addClass('in'); }); setTimeout(function () { _this.$outer.addClass('lg-visible'); }, this.s.backdropDuration); if (this.s.download) { this.$outer.find('.lg-toolbar').append(''); } // Store the current scroll top value to scroll back after closing the gallery.. this.prevScrollTop = $(window).scrollTop(); }; // For fixed height gallery Plugin.prototype.setTop = function () { if (this.s.height !== '100%') { var wH = $(window).height(); var top = (wH - parseInt(this.s.height, 10)) / 2; var $lGallery = this.$outer.find('.lg'); if (wH >= parseInt(this.s.height, 10)) { $lGallery.css('top', top + 'px'); } else { $lGallery.css('top', '0px'); } } }; // Find css3 support Plugin.prototype.doCss = function () { // check for css animation support var support = function () { var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition']; var root = document.documentElement; var i = 0; for (i = 0; i < transition.length; i++) { if (transition[i] in root.style) { return true; } } }; if (support()) { return true; } return false; }; /** * @desc Check the given src is video * @param {String} src * @return {Object} video type * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] } */ Plugin.prototype.isVideo = function (src, index) { var html; if (this.s.dynamic) { html = this.s.dynamicEl[index].html; } else { html = this.$items.eq(index).attr('data-html'); } if (!src) { if (html) { return { html5: true }; } else { console.error('lightGallery :- data-src is not provided on slide item ' + (index + 1) + '. Please make sure the selector property is properly configured. More info - http://sachinchoolur.github.io/lightGallery/demos/html-markup.html'); return false; } } var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i); var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i); var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i); var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i); if (youtube) { return { youtube: youtube }; } else if (vimeo) { return { vimeo: vimeo }; } else if (dailymotion) { return { dailymotion: dailymotion }; } else if (vk) { return { vk: vk }; } }; /** * @desc Create image counter * Ex: 1/10 */ Plugin.prototype.counter = function () { if (this.s.counter) { $(this.s.appendCounterTo).append('
' + (parseInt(this.index, 10) + 1) + ' / ' + this.$items.length + '
'); } }; /** * @desc add sub-html into the slide * @param {Number} index - index of the slide */ Plugin.prototype.addHtml = function (index) { var subHtml = null; var subHtmlUrl; var $currentEle; if (this.s.dynamic) { if (this.s.dynamicEl[index].subHtmlUrl) { subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl; } else { subHtml = this.s.dynamicEl[index].subHtml; } } else { $currentEle = this.$items.eq(index); if ($currentEle.attr('data-sub-html-url')) { subHtmlUrl = $currentEle.attr('data-sub-html-url'); } else { subHtml = $currentEle.attr('data-sub-html'); if (this.s.getCaptionFromTitleOrAlt && !subHtml) { subHtml = $currentEle.attr('title') || $currentEle.find('img').first().attr('alt'); } } } if (!subHtmlUrl) { if (typeof subHtml !== 'undefined' && subHtml !== null) { // get first letter of subhtml // if first letter starts with . or # get the html form the jQuery object var fL = subHtml.substring(0, 1); if (fL === '.' || fL === '#') { if (this.s.subHtmlSelectorRelative && !this.s.dynamic) { subHtml = $currentEle.find(subHtml).html(); } else { subHtml = $(subHtml).html(); } } } else { subHtml = ''; } } if (this.s.appendSubHtmlTo === '.lg-sub-html') { if (subHtmlUrl) { this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl); } else { this.$outer.find(this.s.appendSubHtmlTo).html(subHtml); } } else { if (subHtmlUrl) { this.$slide.eq(index).load(subHtmlUrl); } else { this.$slide.eq(index).append(subHtml); } } // Add lg-empty-html class if title doesn't exist if (typeof subHtml !== 'undefined' && subHtml !== null) { if (subHtml === '') { this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html'); } else { this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html'); } } this.$el.trigger('onAfterAppendSubHtml.lg', [index]); }; /** * @desc Preload slides * @param {Number} index - index of the slide */ Plugin.prototype.preload = function (index) { var i = 1; var j = 1; for (i = 1; i <= this.s.preload; i++) { if (i >= this.$items.length - index) { break; } this.loadContent(index + i, false, 0); } for (j = 1; j <= this.s.preload; j++) { if (index - j < 0) { break; } this.loadContent(index - j, false, 0); } }; /** * @desc Load slide content into slide. * @param {Number} index - index of the slide. * @param {Boolean} rec - if true call loadcontent() function again. * @param {Boolean} delay - delay for adding complete class. it is 0 except first time. */ Plugin.prototype.loadContent = function (index, rec, delay) { var _this = this; var _hasPoster = false; var _$img; var _src; var _poster; var _srcset; var _sizes; var _html; var _alt; var getResponsiveSrc = function (srcItms) { var rsWidth = []; var rsSrc = []; for (var i = 0; i < srcItms.length; i++) { var __src = srcItms[i].split(' '); // Manage empty space if (__src[0] === '') { __src.splice(0, 1); } rsSrc.push(__src[0]); rsWidth.push(__src[1]); } var wWidth = $(window).width(); for (var j = 0; j < rsWidth.length; j++) { if (parseInt(rsWidth[j], 10) > wWidth) { _src = rsSrc[j]; break; } } }; if (_this.s.dynamic) { if (_this.s.dynamicEl[index].poster) { _hasPoster = true; _poster = _this.s.dynamicEl[index].poster; } _html = _this.s.dynamicEl[index].html; _src = _this.s.dynamicEl[index].src; _alt = _this.s.dynamicEl[index].alt; if (_this.s.dynamicEl[index].responsive) { var srcDyItms = _this.s.dynamicEl[index].responsive.split(','); getResponsiveSrc(srcDyItms); } _srcset = _this.s.dynamicEl[index].srcset; _sizes = _this.s.dynamicEl[index].sizes; } else { var $currentEle = _this.$items.eq(index); if ($currentEle.attr('data-poster')) { _hasPoster = true; _poster = $currentEle.attr('data-poster'); } _html = $currentEle.attr('data-html'); _src = $currentEle.attr('href') || $currentEle.attr('data-src'); _alt = $currentEle.attr('title') || $currentEle.find('img').first().attr('alt'); if ($currentEle.attr('data-responsive')) { var srcItms = $currentEle.attr('data-responsive').split(','); getResponsiveSrc(srcItms); } _srcset = $currentEle.attr('data-srcset'); _sizes = $currentEle.attr('data-sizes'); } //if (_src || _srcset || _sizes || _poster) { var iframe = false; if (_this.s.dynamic) { if (_this.s.dynamicEl[index].iframe) { iframe = true; } } else { if (_this.$items.eq(index).attr('data-iframe') === 'true') { iframe = true; } } var _isVideo = _this.isVideo(_src, index); if (!_this.$slide.eq(index).hasClass('lg-loaded')) { if (iframe) { _this.$slide.eq(index).prepend('
'); } else if (_hasPoster) { var videoClass = ''; if (_isVideo && _isVideo.youtube) { videoClass = 'lg-has-youtube'; } else if (_isVideo && _isVideo.vimeo) { videoClass = 'lg-has-vimeo'; } else { videoClass = 'lg-has-html5'; } _this.$slide.eq(index).prepend('
'); } else if (_isVideo) { _this.$slide.eq(index).prepend('
'); _this.$el.trigger('hasVideo.lg', [index, _src, _html]); } else { _alt = _alt ? 'alt="' + _alt + '"' : ''; _this.$slide.eq(index).prepend('
'); } _this.$el.trigger('onAferAppendSlide.lg', [index]); _$img = _this.$slide.eq(index).find('.lg-object'); if (_sizes) { _$img.attr('sizes', _sizes); } if (_srcset) { _$img.attr('srcset', _srcset); try { picturefill({ elements: [_$img[0]] }); } catch (e) { console.warn('lightGallery :- If you want srcset to be supported for older browser please include picturefil version 2 javascript library in your document.'); } } if (this.s.appendSubHtmlTo !== '.lg-sub-html') { _this.addHtml(index); } _this.$slide.eq(index).addClass('lg-loaded'); } _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function () { // For first time add some delay for displaying the start animation. var _speed = 0; // Do not change the delay value because it is required for zoom plugin. // If gallery opened from direct url (hash) speed value should be 0 if (delay && !$('body').hasClass('lg-from-hash')) { _speed = delay; } setTimeout(function () { _this.$slide.eq(index).addClass('lg-complete'); _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]); }, _speed); }); // @todo check load state for html5 videos if (_isVideo && _isVideo.html5 && !_hasPoster) { _this.$slide.eq(index).addClass('lg-complete'); } if (rec === true) { if (!_this.$slide.eq(index).hasClass('lg-complete')) { _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function () { _this.preload(index); }); } else { _this.preload(index); } } //} }; /** * @desc slide function for lightgallery ** Slide() gets call on start ** ** Set lg.on true once slide() function gets called. ** Call loadContent() on slide() function inside setTimeout ** ** On first slide we do not want any animation like slide of fade ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately ** ** Else loadContent() should wait for the transition to complete. ** ** So set timeout s.speed + 50 <=> ** loadContent() will load slide content in to the particular slide ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function. ** ** preload will execute only when the previous slide is fully loaded (images iframe) ** ** avoid simultaneous image load <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value ** loadContent() <====> Preload(); * @param {Number} index - index of the slide * @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag * @param {Boolean} fromThumb - true if slide function called via thumbnail click * @param {String} direction - Direction of the slide(next/prev) */ Plugin.prototype.slide = function (index, fromTouch, fromThumb, direction) { var _prevIndex = this.$outer.find('.lg-current').index(); var _this = this; // Prevent if multiple call // Required for hsh plugin if (_this.lGalleryOn && (_prevIndex === index)) { return; } var _length = this.$slide.length; var _time = _this.lGalleryOn ? this.s.speed : 0; if (!_this.lgBusy) { if (this.s.download) { var _src; if (_this.s.dynamic) { _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src); } else { _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src')); } if (_src) { $('#lg-download').attr('href', _src); _this.$outer.removeClass('lg-hide-download'); } else { _this.$outer.addClass('lg-hide-download'); } } this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); _this.lgBusy = true; clearTimeout(_this.hideBartimeout); // Add title if this.s.appendSubHtmlTo === lg-sub-html if (this.s.appendSubHtmlTo === '.lg-sub-html') { // wait for slide animation to complete setTimeout(function () { _this.addHtml(index); }, _time); } this.arrowDisable(index); if (!direction) { if (index < _prevIndex) { direction = 'prev'; } else if (index > _prevIndex) { direction = 'next'; } } if (!fromTouch) { // remove all transitions _this.$outer.addClass('lg-no-trans'); this.$slide.removeClass('lg-prev-slide lg-next-slide'); if (direction === 'prev') { //prevslide this.$slide.eq(index).addClass('lg-prev-slide'); this.$slide.eq(_prevIndex).addClass('lg-next-slide'); } else { // next slide this.$slide.eq(index).addClass('lg-next-slide'); this.$slide.eq(_prevIndex).addClass('lg-prev-slide'); } // give 50 ms for browser to add/remove class setTimeout(function () { _this.$slide.removeClass('lg-current'); //_this.$slide.eq(_prevIndex).removeClass('lg-current'); _this.$slide.eq(index).addClass('lg-current'); // reset all transitions _this.$outer.removeClass('lg-no-trans'); }, 50); } else { this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide'); var touchPrev; var touchNext; if (_length > 2) { touchPrev = index - 1; touchNext = index + 1; if ((index === 0) && (_prevIndex === _length - 1)) { // next slide touchNext = 0; touchPrev = _length - 1; } else if ((index === _length - 1) && (_prevIndex === 0)) { // prev slide touchNext = 0; touchPrev = _length - 1; } } else { touchPrev = 0; touchNext = 1; } if (direction === 'prev') { _this.$slide.eq(touchNext).addClass('lg-next-slide'); } else { _this.$slide.eq(touchPrev).addClass('lg-prev-slide'); } _this.$slide.eq(index).addClass('lg-current'); } if (_this.lGalleryOn) { setTimeout(function () { _this.loadContent(index, true, 0); }, this.s.speed + 50); setTimeout(function () { _this.lgBusy = false; _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); }, this.s.speed); } else { _this.loadContent(index, true, _this.s.backdropDuration); _this.lgBusy = false; _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); } _this.lGalleryOn = true; if (this.s.counter) { $('#lg-counter-current').text(index + 1); } } _this.index = index; }; /** * @desc Go to next slide * @param {Boolean} fromTouch - true if slide function called via touch event */ Plugin.prototype.goToNextSlide = function (fromTouch) { var _this = this; var _loop = _this.s.loop; if (fromTouch && _this.$slide.length < 3) { _loop = false; } if (!_this.lgBusy) { if ((_this.index + 1) < _this.$slide.length) { _this.index++; _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); _this.slide(_this.index, fromTouch, false, 'next'); } else { if (_loop) { _this.index = 0; _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); _this.slide(_this.index, fromTouch, false, 'next'); } else if (_this.s.slideEndAnimatoin && !fromTouch) { _this.$outer.addClass('lg-right-end'); setTimeout(function () { _this.$outer.removeClass('lg-right-end'); }, 400); } } } }; /** * @desc Go to previous slide * @param {Boolean} fromTouch - true if slide function called via touch event */ Plugin.prototype.goToPrevSlide = function (fromTouch) { var _this = this; var _loop = _this.s.loop; if (fromTouch && _this.$slide.length < 3) { _loop = false; } if (!_this.lgBusy) { if (_this.index > 0) { _this.index--; _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); _this.slide(_this.index, fromTouch, false, 'prev'); } else { if (_loop) { _this.index = _this.$items.length - 1; _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); _this.slide(_this.index, fromTouch, false, 'prev'); } else if (_this.s.slideEndAnimatoin && !fromTouch) { _this.$outer.addClass('lg-left-end'); setTimeout(function () { _this.$outer.removeClass('lg-left-end'); }, 400); } } } }; Plugin.prototype.keyPress = function () { var _this = this; if (this.$items.length > 1) { $(window).on('keyup.lg', function (e) { if (_this.$items.length > 1) { if (e.keyCode === 37) { e.preventDefault(); _this.goToPrevSlide(); } if (e.keyCode === 39) { e.preventDefault(); _this.goToNextSlide(); } } }); } $(window).on('keydown.lg', function (e) { if (_this.s.escKey === true && e.keyCode === 27) { e.preventDefault(); if (!_this.$outer.hasClass('lg-thumb-open')) { _this.destroy(); } else { _this.$outer.removeClass('lg-thumb-open'); } } }); }; Plugin.prototype.arrow = function () { var _this = this; this.$outer.find('.lg-prev').on('click.lg', function () { _this.goToPrevSlide(); }); this.$outer.find('.lg-next').on('click.lg', function () { _this.goToNextSlide(); }); }; Plugin.prototype.arrowDisable = function (index) { // Disable arrows if s.hideControlOnEnd is true if (!this.s.loop && this.s.hideControlOnEnd) { if ((index + 1) < this.$slide.length) { this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled'); } else { this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled'); } if (index > 0) { this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled'); } else { this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled'); } } }; Plugin.prototype.setTranslate = function ($el, xValue, yValue) { // jQuery supports Automatic CSS prefixing since jQuery 1.8.0 if (this.s.useLeft) { $el.css('left', xValue); } else { $el.css({ transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)' }); } }; Plugin.prototype.touchMove = function (startCoords, endCoords) { var distance = endCoords - startCoords; if (Math.abs(distance) > 15) { // reset opacity and transition duration this.$outer.addClass('lg-dragging'); // move current slide this.setTranslate(this.$slide.eq(this.index), distance, 0); // move next and prev slide with current slide this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0); this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0); } }; Plugin.prototype.touchEnd = function (distance) { var _this = this; // keep slide animation for any mode while dragg/swipe if (_this.s.mode !== 'lg-slide') { _this.$outer.addClass('lg-slide'); } this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0'); // set transition duration setTimeout(function () { _this.$outer.removeClass('lg-dragging'); if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { _this.goToNextSlide(true); } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { _this.goToPrevSlide(true); } else if (Math.abs(distance) < 5) { // Trigger click if distance is less than 5 pix _this.$el.trigger('onSlideClick.lg'); } _this.$slide.removeAttr('style'); }); // remove slide class once drag/swipe is completed if mode is not slide setTimeout(function () { if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') { _this.$outer.removeClass('lg-slide'); } }, _this.s.speed + 100); }; Plugin.prototype.enableSwipe = function () { var _this = this; var startCoords = 0; var endCoords = 0; var isMoved = false; if (_this.s.enableSwipe && _this.doCss()) { _this.$slide.on('touchstart.lg', function (e) { if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) { e.preventDefault(); _this.manageSwipeClass(); startCoords = e.originalEvent.targetTouches[0].pageX; } }); _this.$slide.on('touchmove.lg', function (e) { if (!_this.$outer.hasClass('lg-zoomed')) { e.preventDefault(); endCoords = e.originalEvent.targetTouches[0].pageX; _this.touchMove(startCoords, endCoords); isMoved = true; } }); _this.$slide.on('touchend.lg', function () { if (!_this.$outer.hasClass('lg-zoomed')) { if (isMoved) { isMoved = false; _this.touchEnd(endCoords - startCoords); } else { _this.$el.trigger('onSlideClick.lg'); } } }); } }; Plugin.prototype.enableDrag = function () { var _this = this; var startCoords = 0; var endCoords = 0; var isDraging = false; var isMoved = false; if (_this.s.enableDrag && _this.doCss()) { _this.$slide.on('mousedown.lg', function (e) { if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy && !$(e.target).text().trim()) { e.preventDefault(); _this.manageSwipeClass(); startCoords = e.pageX; isDraging = true; // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 _this.$outer.scrollLeft += 1; _this.$outer.scrollLeft -= 1; // * _this.$outer.removeClass('lg-grab').addClass('lg-grabbing'); _this.$el.trigger('onDragstart.lg'); } }); $(window).on('mousemove.lg', function (e) { if (isDraging) { isMoved = true; endCoords = e.pageX; _this.touchMove(startCoords, endCoords); _this.$el.trigger('onDragmove.lg'); } }); $(window).on('mouseup.lg', function (e) { if (isMoved) { isMoved = false; _this.touchEnd(endCoords - startCoords); _this.$el.trigger('onDragend.lg'); } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { _this.$el.trigger('onSlideClick.lg'); } // Prevent execution on click if (isDraging) { isDraging = false; _this.$outer.removeClass('lg-grabbing').addClass('lg-grab'); } }); } }; Plugin.prototype.manageSwipeClass = function () { var _touchNext = this.index + 1; var _touchPrev = this.index - 1; if (this.s.loop && this.$slide.length > 2) { if (this.index === 0) { _touchPrev = this.$slide.length - 1; } else if (this.index === this.$slide.length - 1) { _touchNext = 0; } } this.$slide.removeClass('lg-next-slide lg-prev-slide'); if (_touchPrev > -1) { this.$slide.eq(_touchPrev).addClass('lg-prev-slide'); } this.$slide.eq(_touchNext).addClass('lg-next-slide'); }; Plugin.prototype.mousewheel = function () { var _this = this; _this.$outer.on('mousewheel.lg', function (e) { if (!e.deltaY) { return; } if (e.deltaY > 0) { _this.goToPrevSlide(); } else { _this.goToNextSlide(); } e.preventDefault(); }); }; Plugin.prototype.closeGallery = function () { var _this = this; var mousedown = false; this.$outer.find('.lg-close').on('click.lg', function () { _this.destroy(); }); if (_this.s.closable) { // If you drag the slide and release outside gallery gets close on chrome // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer _this.$outer.on('mousedown.lg', function (e) { if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) { mousedown = true; } else { mousedown = false; } }); _this.$outer.on('mousemove.lg', function () { mousedown = false; }); _this.$outer.on('mouseup.lg', function (e) { if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) { if (!_this.$outer.hasClass('lg-dragging')) { _this.destroy(); } } }); } }; Plugin.prototype.destroy = function (d) { var _this = this; if (!d) { _this.$el.trigger('onBeforeClose.lg'); $(window).scrollTop(_this.prevScrollTop); } /** * if d is false or undefined destroy will only close the gallery * plugins instance remains with the element * * if d is true destroy will completely remove the plugin */ if (d) { if (!_this.s.dynamic) { // only when not using dynamic mode is $items a jquery collection this.$items.off('click.lg click.lgcustom'); } $.removeData(_this.el, 'lightGallery'); } // Unbind all events added by lightGallery this.$el.off('.lg.tm'); // destroy all lightGallery modules $.each($.fn.lightGallery.modules, function (key) { if (_this.modules[key]) { _this.modules[key].destroy(); } }); this.lGalleryOn = false; clearTimeout(_this.hideBartimeout); this.hideBartimeout = false; $(window).off('.lg'); $('body').removeClass('lg-on lg-from-hash'); if (_this.$outer) { _this.$outer.removeClass('lg-visible'); } $('.lg-backdrop').removeClass('in'); setTimeout(function () { if (_this.$outer) { _this.$outer.remove(); } $('.lg-backdrop').remove(); if (!d) { _this.$el.trigger('onCloseAfter.lg'); } _this.$el.focus(); }, _this.s.backdropDuration + 50); }; $.fn.lightGallery = function (options) { return this.each(function () { if (!$.data(this, 'lightGallery')) { $.data(this, 'lightGallery', new Plugin(this, options)); } else { try { $(this).data('lightGallery').init(); } catch (err) { console.error('lightGallery has not initiated properly'); } } }); }; $.fn.lightGallery.modules = {}; })(); })); /*! lg-autoplay - v1.2.1 - 2020-06-13 * http://sachinchoolur.github.io/lightGallery * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module unless amdModuleId is set define(['jquery'], function (a0) { return (factory(a0)); }); } else if (typeof module === 'object' && module.exports) { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. module.exports = factory(require('jquery')); } else { factory(root["jQuery"]); } }(this, function ($) { (function () { 'use strict'; var defaults = { autoplay: false, pause: 5000, progressBar: true, fourceAutoplay: false, autoplayControls: true, appendAutoplayControlsTo: '.lg-toolbar' }; /** * Creates the autoplay plugin. * @param {object} element - lightGallery element */ var Autoplay = function (element) { this.core = $(element).data('lightGallery'); this.$el = $(element); // Execute only if items are above 1 if (this.core.$items.length < 2) { return false; } this.core.s = $.extend({}, defaults, this.core.s); this.interval = false; // Identify if slide happened from autoplay this.fromAuto = true; // Identify if autoplay canceled from touch/drag this.canceledOnTouch = false; // save fourceautoplay value this.fourceAutoplayTemp = this.core.s.fourceAutoplay; // do not allow progress bar if browser does not support css3 transitions if (!this.core.doCss()) { this.core.s.progressBar = false; } this.init(); return this; }; Autoplay.prototype.init = function () { var _this = this; // append autoplay controls if (_this.core.s.autoplayControls) { _this.controls(); } // Create progress bar if (_this.core.s.progressBar) { _this.core.$outer.find('.lg').append('
'); } // set progress _this.progress(); // Start autoplay if (_this.core.s.autoplay) { _this.$el.one('onSlideItemLoad.lg.tm', function () { _this.startlAuto(); }); } // cancel interval on touchstart and dragstart _this.$el.on('onDragstart.lg.tm touchstart.lg.tm', function () { if (_this.interval) { _this.cancelAuto(); _this.canceledOnTouch = true; } }); // restore autoplay if autoplay canceled from touchstart / dragstart _this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', function () { if (!_this.interval && _this.canceledOnTouch) { _this.startlAuto(); _this.canceledOnTouch = false; } }); }; Autoplay.prototype.progress = function () { var _this = this; var _$progressBar; var _$progress; _this.$el.on('onBeforeSlide.lg.tm', function () { // start progress bar animation if (_this.core.s.progressBar && _this.fromAuto) { _$progressBar = _this.core.$outer.find('.lg-progress-bar'); _$progress = _this.core.$outer.find('.lg-progress'); if (_this.interval) { _$progress.removeAttr('style'); _$progressBar.removeClass('lg-start'); setTimeout(function () { _$progress.css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s'); _$progressBar.addClass('lg-start'); }, 20); } } // Remove setinterval if slide is triggered manually and fourceautoplay is false if (!_this.fromAuto && !_this.core.s.fourceAutoplay) { _this.cancelAuto(); } _this.fromAuto = false; }); }; // Manage autoplay via play/stop buttons Autoplay.prototype.controls = function () { var _this = this; var _html = ''; // Append autoplay controls $(this.core.s.appendAutoplayControlsTo).append(_html); _this.core.$outer.find('.lg-autoplay-button').on('click.lg', function () { if ($(_this.core.$outer).hasClass('lg-show-autoplay')) { _this.cancelAuto(); _this.core.s.fourceAutoplay = false; } else { if (!_this.interval) { _this.startlAuto(); _this.core.s.fourceAutoplay = _this.fourceAutoplayTemp; } } }); }; // Autostart gallery Autoplay.prototype.startlAuto = function () { var _this = this; _this.core.$outer.find('.lg-progress').css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s'); _this.core.$outer.addClass('lg-show-autoplay'); _this.core.$outer.find('.lg-progress-bar').addClass('lg-start'); _this.interval = setInterval(function () { if (_this.core.index + 1 < _this.core.$items.length) { _this.core.index++; } else { _this.core.index = 0; } _this.fromAuto = true; _this.core.slide(_this.core.index, false, false, 'next'); }, _this.core.s.speed + _this.core.s.pause); }; // cancel Autostart Autoplay.prototype.cancelAuto = function () { clearInterval(this.interval); this.interval = false; this.core.$outer.find('.lg-progress').removeAttr('style'); this.core.$outer.removeClass('lg-show-autoplay'); this.core.$outer.find('.lg-progress-bar').removeClass('lg-start'); }; Autoplay.prototype.destroy = function () { this.cancelAuto(); this.core.$outer.find('.lg-progress-bar').remove(); }; $.fn.lightGallery.modules.autoplay = Autoplay; })(); })); /*! lg-fullscreen - v1.2.1 - 2020-06-13 * http://sachinchoolur.github.io/lightGallery * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module unless amdModuleId is set define(['jquery'], function (a0) { return (factory(a0)); }); } else if (typeof module === 'object' && module.exports) { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. module.exports = factory(require('jquery')); } else { factory(root["jQuery"]); } }(this, function ($) { (function () { 'use strict'; var defaults = { fullScreen: true }; function isFullScreen() { return ( document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement ); } var Fullscreen = function (element) { // get lightGallery core plugin data this.core = $(element).data('lightGallery'); this.$el = $(element); // extend module defalut settings with lightGallery core settings this.core.s = $.extend({}, defaults, this.core.s); this.init(); return this; }; Fullscreen.prototype.init = function () { var fullScreen = ''; if (this.core.s.fullScreen) { // check for fullscreen browser support if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled && !document.mozFullScreenEnabled && !document.msFullscreenEnabled) { return; } else { fullScreen = ''; this.core.$outer.find('.lg-toolbar').append(fullScreen); this.fullScreen(); } } }; Fullscreen.prototype.requestFullscreen = function () { var el = document.documentElement; if (el.requestFullscreen) { el.requestFullscreen(); } else if (el.msRequestFullscreen) { el.msRequestFullscreen(); } else if (el.mozRequestFullScreen) { el.mozRequestFullScreen(); } else if (el.webkitRequestFullscreen) { el.webkitRequestFullscreen(); } }; Fullscreen.prototype.exitFullscreen = function () { if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.msExitFullscreen) { document.msExitFullscreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); } }; // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode Fullscreen.prototype.fullScreen = function () { var _this = this; $(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', function () { _this.core.$outer.toggleClass('lg-fullscreen-on'); }); this.core.$outer.find('.lg-fullscreen').on('click.lg', function () { if (isFullScreen()) { _this.exitFullscreen(); } else { _this.requestFullscreen(); } }); }; Fullscreen.prototype.destroy = function () { // exit from fullscreen if activated if (isFullScreen()) { this.exitFullscreen(); } $(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg'); }; $.fn.lightGallery.modules.fullscreen = Fullscreen; })(); })); /*! lg-pager - v1.0.2 - 2017-01-22 * http://sachinchoolur.github.io/lightGallery * Copyright (c) 2017 Sachin N; Licensed GPLv3 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module unless amdModuleId is set define(['jquery'], function (a0) { return (factory(a0)); }); } else if (typeof exports === 'object') { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. module.exports = factory(require('jquery')); } else { factory(jQuery); } }(this, function ($) { (function () { 'use strict'; var defaults = { pager: false }; var Pager = function (element) { this.core = $(element).data('lightGallery'); this.$el = $(element); this.core.s = $.extend({}, defaults, this.core.s); if (this.core.s.pager && this.core.$items.length > 1) { this.init(); } return this; }; Pager.prototype.init = function () { var _this = this; var pagerList = ''; var $pagerCont; var $pagerOuter; var timeout; _this.core.$outer.find('.lg').append('
'); if (_this.core.s.dynamic) { for (var i = 0; i < _this.core.s.dynamicEl.length; i++) { pagerList += '
'; } } else { _this.core.$items.each(function () { if (!_this.core.s.exThumbImage) { pagerList += '
'; } else { pagerList += '
'; } }); } $pagerOuter = _this.core.$outer.find('.lg-pager-outer'); $pagerOuter.html(pagerList); $pagerCont = _this.core.$outer.find('.lg-pager-cont'); $pagerCont.on('click.lg touchend.lg', function () { var _$this = $(this); _this.core.index = _$this.index(); _this.core.slide(_this.core.index, false, true, false); }); $pagerOuter.on('mouseover.lg', function () { clearTimeout(timeout); $pagerOuter.addClass('lg-pager-hover'); }); $pagerOuter.on('mouseout.lg', function () { timeout = setTimeout(function () { $pagerOuter.removeClass('lg-pager-hover'); }); }); _this.core.$el.on('onBeforeSlide.lg.tm', function (e, prevIndex, index) { $pagerCont.removeClass('lg-pager-active'); $pagerCont.eq(index).addClass('lg-pager-active'); }); }; Pager.prototype.destroy = function () { }; $.fn.lightGallery.modules.pager = Pager; })(); })); /*! lg-thumbnail - v1.2.1 - 2020-06-13 * http://sachinchoolur.github.io/lightGallery * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module unless amdModuleId is set define(['jquery'], function (a0) { return (factory(a0)); }); } else if (typeof module === 'object' && module.exports) { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. module.exports = factory(require('jquery')); } else { factory(root["jQuery"]); } }(this, function ($) { (function () { 'use strict'; var defaults = { thumbnail: true, animateThumb: true, currentPagerPosition: 'middle', thumbWidth: 100, thumbHeight: '80px', thumbContHeight: 100, thumbMargin: 5, exThumbImage: false, showThumbByDefault: true, toogleThumb: true, pullCaptionUp: true, enableThumbDrag: true, enableThumbSwipe: true, swipeThreshold: 50, loadYoutubeThumbnail: true, youtubeThumbSize: 1, loadVimeoThumbnail: true, vimeoThumbSize: 'thumbnail_small', loadDailymotionThumbnail: true }; var Thumbnail = function (element) { // get lightGallery core plugin data this.core = $(element).data('lightGallery'); // extend module default settings with lightGallery core settings this.core.s = $.extend({}, defaults, this.core.s); this.$el = $(element); this.$thumbOuter = null; this.thumbOuterWidth = 0; this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin)); this.thumbIndex = this.core.index; if (this.core.s.animateThumb) { this.core.s.thumbHeight = '100%'; } // Thumbnail animation value this.left = 0; this.init(); return this; }; Thumbnail.prototype.init = function () { var _this = this; if (this.core.s.thumbnail && this.core.$items.length > 1) { if (this.core.s.showThumbByDefault) { setTimeout(function () { _this.core.$outer.addClass('lg-thumb-open'); }, 700); } if (this.core.s.pullCaptionUp) { this.core.$outer.addClass('lg-pull-caption-up'); } this.build(); if (this.core.s.animateThumb && this.core.doCss()) { if (this.core.s.enableThumbDrag) { this.enableThumbDrag(); } if (this.core.s.enableThumbSwipe) { this.enableThumbSwipe(); } this.thumbClickable = false; } else { this.thumbClickable = true; } this.toogle(); this.thumbkeyPress(); } }; Thumbnail.prototype.build = function () { var _this = this; var thumbList = ''; var vimeoErrorThumbSize = ''; var $thumb; var html = '
' + '
' + '
' + '
'; switch (this.core.s.vimeoThumbSize) { case 'thumbnail_large': vimeoErrorThumbSize = '640'; break; case 'thumbnail_medium': vimeoErrorThumbSize = '200x150'; break; case 'thumbnail_small': vimeoErrorThumbSize = '100x75'; } _this.core.$outer.addClass('lg-has-thumb'); _this.core.$outer.find('.lg').append(html); _this.$thumbOuter = _this.core.$outer.find('.lg-thumb-outer'); _this.thumbOuterWidth = _this.$thumbOuter.width(); if (_this.core.s.animateThumb) { _this.core.$outer.find('.lg-thumb').css({ width: _this.thumbTotalWidth + 'px', position: 'relative' }); } if (this.core.s.animateThumb) { _this.$thumbOuter.css('height', _this.core.s.thumbContHeight + 'px'); } function getThumb(src, thumb, index) { var isVideo = _this.core.isVideo(src, index) || {}; var thumbImg; var vimeoId = ''; if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) { if (isVideo.youtube) { if (_this.core.s.loadYoutubeThumbnail) { thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/' + _this.core.s.youtubeThumbSize + '.jpg'; } else { thumbImg = thumb; } } else if (isVideo.vimeo) { if (_this.core.s.loadVimeoThumbnail) { thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg'; vimeoId = isVideo.vimeo[1]; } else { thumbImg = thumb; } } else if (isVideo.dailymotion) { if (_this.core.s.loadDailymotionThumbnail) { thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1]; } else { thumbImg = thumb; } } } else { thumbImg = thumb; } thumbList += '
'; vimeoId = ''; } if (_this.core.s.dynamic) { for (var i = 0; i < _this.core.s.dynamicEl.length; i++) { getThumb(_this.core.s.dynamicEl[i].src, _this.core.s.dynamicEl[i].thumb, i); } } else { _this.core.$items.each(function (i) { if (!_this.core.s.exThumbImage) { getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i); } else { getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).attr(_this.core.s.exThumbImage), i); } }); } _this.core.$outer.find('.lg-thumb').html(thumbList); $thumb = _this.core.$outer.find('.lg-thumb-item'); // Load vimeo thumbnails $thumb.each(function () { var $this = $(this); var vimeoVideoId = $this.attr('data-vimeo-id'); if (vimeoVideoId) { $.getJSON('//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', { format: 'json' }, function (data) { $this.find('img').attr('src', data[0][_this.core.s.vimeoThumbSize]); }); } }); // manage active class for thumbnail $thumb.eq(_this.core.index).addClass('active'); _this.core.$el.on('onBeforeSlide.lg.tm', function () { $thumb.removeClass('active'); $thumb.eq(_this.core.index).addClass('active'); }); $thumb.on('click.lg touchend.lg', function () { var _$this = $(this); setTimeout(function () { // In IE9 and bellow touch does not support // Go to slide if browser does not support css transitions if ((_this.thumbClickable && !_this.core.lgBusy) || !_this.core.doCss()) { _this.core.index = _$this.index(); _this.core.slide(_this.core.index, false, true, false); } }, 50); }); _this.core.$el.on('onBeforeSlide.lg.tm', function () { _this.animateThumb(_this.core.index); }); $(window).on('resize.lg.thumb orientationchange.lg.thumb', function () { setTimeout(function () { _this.animateThumb(_this.core.index); _this.thumbOuterWidth = _this.$thumbOuter.width(); }, 200); }); }; Thumbnail.prototype.setTranslate = function (value) { // jQuery supports Automatic CSS prefixing since jQuery 1.8.0 this.core.$outer.find('.lg-thumb').css({ transform: 'translate3d(-' + (value) + 'px, 0px, 0px)' }); }; Thumbnail.prototype.animateThumb = function (index) { var $thumb = this.core.$outer.find('.lg-thumb'); if (this.core.s.animateThumb) { var position; switch (this.core.s.currentPagerPosition) { case 'left': position = 0; break; case 'middle': position = (this.thumbOuterWidth / 2) - (this.core.s.thumbWidth / 2); break; case 'right': position = this.thumbOuterWidth - this.core.s.thumbWidth; } this.left = ((this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1) - position; if (this.left > (this.thumbTotalWidth - this.thumbOuterWidth)) { this.left = this.thumbTotalWidth - this.thumbOuterWidth; } if (this.left < 0) { this.left = 0; } if (this.core.lGalleryOn) { if (!$thumb.hasClass('on')) { this.core.$outer.find('.lg-thumb').css('transition-duration', this.core.s.speed + 'ms'); } if (!this.core.doCss()) { $thumb.animate({ left: -this.left + 'px' }, this.core.s.speed); } } else { if (!this.core.doCss()) { $thumb.css('left', -this.left + 'px'); } } this.setTranslate(this.left); } }; // Enable thumbnail dragging and swiping Thumbnail.prototype.enableThumbDrag = function () { var _this = this; var startCoords = 0; var endCoords = 0; var isDraging = false; var isMoved = false; var tempLeft = 0; _this.$thumbOuter.addClass('lg-grab'); _this.core.$outer.find('.lg-thumb').on('mousedown.lg.thumb', function (e) { if (_this.thumbTotalWidth > _this.thumbOuterWidth) { // execute only on .lg-object e.preventDefault(); startCoords = e.pageX; isDraging = true; // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 _this.core.$outer.scrollLeft += 1; _this.core.$outer.scrollLeft -= 1; // * _this.thumbClickable = false; _this.$thumbOuter.removeClass('lg-grab').addClass('lg-grabbing'); } }); $(window).on('mousemove.lg.thumb', function (e) { if (isDraging) { tempLeft = _this.left; isMoved = true; endCoords = e.pageX; _this.$thumbOuter.addClass('lg-dragging'); tempLeft = tempLeft - (endCoords - startCoords); if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) { tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth; } if (tempLeft < 0) { tempLeft = 0; } // move current slide _this.setTranslate(tempLeft); } }); $(window).on('mouseup.lg.thumb', function () { if (isMoved) { isMoved = false; _this.$thumbOuter.removeClass('lg-dragging'); _this.left = tempLeft; if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) { _this.thumbClickable = true; } } else { _this.thumbClickable = true; } if (isDraging) { isDraging = false; _this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab'); } }); }; Thumbnail.prototype.enableThumbSwipe = function () { var _this = this; var startCoords = 0; var endCoords = 0; var isMoved = false; var tempLeft = 0; _this.core.$outer.find('.lg-thumb').on('touchstart.lg', function (e) { if (_this.thumbTotalWidth > _this.thumbOuterWidth) { e.preventDefault(); startCoords = e.originalEvent.targetTouches[0].pageX; _this.thumbClickable = false; } }); _this.core.$outer.find('.lg-thumb').on('touchmove.lg', function (e) { if (_this.thumbTotalWidth > _this.thumbOuterWidth) { e.preventDefault(); endCoords = e.originalEvent.targetTouches[0].pageX; isMoved = true; _this.$thumbOuter.addClass('lg-dragging'); tempLeft = _this.left; tempLeft = tempLeft - (endCoords - startCoords); if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) { tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth; } if (tempLeft < 0) { tempLeft = 0; } // move current slide _this.setTranslate(tempLeft); } }); _this.core.$outer.find('.lg-thumb').on('touchend.lg', function () { if (_this.thumbTotalWidth > _this.thumbOuterWidth) { if (isMoved) { isMoved = false; _this.$thumbOuter.removeClass('lg-dragging'); if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) { _this.thumbClickable = true; } _this.left = tempLeft; } else { _this.thumbClickable = true; } } else { _this.thumbClickable = true; } }); }; Thumbnail.prototype.toogle = function () { var _this = this; if (_this.core.s.toogleThumb) { _this.core.$outer.addClass('lg-can-toggle'); _this.$thumbOuter.append(''); _this.core.$outer.find('.lg-toogle-thumb').on('click.lg', function () { _this.core.$outer.toggleClass('lg-thumb-open'); }); } }; Thumbnail.prototype.thumbkeyPress = function () { var _this = this; $(window).on('keydown.lg.thumb', function (e) { if (e.keyCode === 38) { e.preventDefault(); _this.core.$outer.addClass('lg-thumb-open'); } else if (e.keyCode === 40) { e.preventDefault(); _this.core.$outer.removeClass('lg-thumb-open'); } }); }; Thumbnail.prototype.destroy = function () { if (this.core.s.thumbnail && this.core.$items.length > 1) { $(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb'); this.$thumbOuter.remove(); this.core.$outer.removeClass('lg-has-thumb'); } }; $.fn.lightGallery.modules.Thumbnail = Thumbnail; })(); })); /*! lg-video - v1.3.0 - 2020-05-03 * http://sachinchoolur.github.io/lightGallery * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module unless amdModuleId is set define(['jquery'], function (a0) { return (factory(a0)); }); } else if (typeof module === 'object' && module.exports) { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. module.exports = factory(require('jquery')); } else { factory(root["jQuery"]); } }(this, function ($) { (function () { 'use strict'; var defaults = { videoMaxWidth: '855px', autoplayFirstVideo: true, youtubePlayerParams: false, vimeoPlayerParams: false, dailymotionPlayerParams: false, vkPlayerParams: false, videojs: false, videojsOptions: {} }; var Video = function (element) { this.core = $(element).data('lightGallery'); this.$el = $(element); this.core.s = $.extend({}, defaults, this.core.s); this.videoLoaded = false; this.init(); return this; }; Video.prototype.init = function () { var _this = this; // Event triggered when video url found without poster _this.core.$el.on('hasVideo.lg.tm', onHasVideo.bind(this)); // Set max width for video _this.core.$el.on('onAferAppendSlide.lg.tm', onAferAppendSlide.bind(this)); if (_this.core.doCss() && (_this.core.$items.length > 1) && (_this.core.s.enableSwipe || _this.core.s.enableDrag)) { _this.core.$el.on('onSlideClick.lg.tm', function () { var $el = _this.core.$slide.eq(_this.core.index); _this.loadVideoOnclick($el); }); } else { // For IE 9 and bellow _this.core.$slide.on('click.lg', function () { _this.loadVideoOnclick($(this)); }); } _this.core.$el.on('onBeforeSlide.lg.tm', onBeforeSlide.bind(this)); _this.core.$el.on('onAfterSlide.lg.tm', function (event, prevIndex) { _this.core.$slide.eq(prevIndex).removeClass('lg-video-playing'); }); if (_this.core.s.autoplayFirstVideo) { _this.core.$el.on('onAferAppendSlide.lg.tm', function (e, index) { if (!_this.core.lGalleryOn) { var $el = _this.core.$slide.eq(index); setTimeout(function () { _this.loadVideoOnclick($el); }, 100); } }); } }; Video.prototype.loadVideo = function (src, addClass, noPoster, index, html) { var _this = this; var video = ''; var autoplay = 1; var a = ''; var isVideo = this.core.isVideo(src, index) || {}; var videoTitle; if (_this.core.s.dynamic) { videoTitle = _this.core.s.dynamicEl[_this.core.index].title; } else { videoTitle = _this.core.$items.eq(_this.core.index).attr('title') || _this.core.$items.eq(_this.core.index).find('img').first().attr('alt'); } videoTitle = videoTitle ? 'title="' + videoTitle + '"' : ''; // Enable autoplay based on setting for first video if poster doesn't exist if (noPoster) { if (this.videoLoaded) { autoplay = 0; } else { autoplay = this.core.s.autoplayFirstVideo ? 1 : 0; } } if (isVideo.youtube) { a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1'; if (this.core.s.youtubePlayerParams) { a = a + '&' + $.param(this.core.s.youtubePlayerParams); } video = ''; } else if (isVideo.vimeo) { a = '?autoplay=' + autoplay + '&api=1'; if (this.core.s.vimeoPlayerParams) { a = a + '&' + $.param(this.core.s.vimeoPlayerParams); } video = ''; } else if (isVideo.dailymotion) { a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage'; if (this.core.s.dailymotionPlayerParams) { a = a + '&' + $.param(this.core.s.dailymotionPlayerParams); } video = ''; } else if (isVideo.html5) { var fL = html.substring(0, 1); if (fL === '.' || fL === '#') { html = $(html).html(); } video = html; } else if (isVideo.vk) { a = '&autoplay=' + autoplay; if (this.core.s.vkPlayerParams) { a = a + '&' + $.param(this.core.s.vkPlayerParams); } video = ''; } return video; }; Video.prototype.loadVideoOnclick = function ($el) { var _this = this; // check slide has poster if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) { // check already video element present if (!$el.hasClass('lg-has-video')) { $el.addClass('lg-video-playing lg-has-video'); var _src; var _html; var _loadVideo = function (_src, _html) { $el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html)); if (_html) { if (_this.core.s.videojs) { try { videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function () { this.play(); }); } catch (e) { console.error('Make sure you have included videojs'); } } else { _this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play(); } } }; if (_this.core.s.dynamic) { _src = _this.core.s.dynamicEl[_this.core.index].src; _html = _this.core.s.dynamicEl[_this.core.index].html; _loadVideo(_src, _html); } else { _src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src'); _html = _this.core.$items.eq(_this.core.index).attr('data-html'); _loadVideo(_src, _html); } var $tempImg = $el.find('.lg-object'); $el.find('.lg-video').append($tempImg); // @todo loading icon for html5 videos also // for showing the loading indicator while loading video if (!$el.find('.lg-video-object').hasClass('lg-html5')) { $el.removeClass('lg-complete'); $el.find('.lg-video-object').on('load.lg error.lg', function () { $el.addClass('lg-complete'); }); } } else { var youtubePlayer = $el.find('.lg-youtube').get(0); var vimeoPlayer = $el.find('.lg-vimeo').get(0); var dailymotionPlayer = $el.find('.lg-dailymotion').get(0); var html5Player = $el.find('.lg-html5').get(0); if (youtubePlayer) { youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); } else if (vimeoPlayer) { try { $f(vimeoPlayer).api('play'); } catch (e) { console.error('Make sure you have included froogaloop2 js'); } } else if (dailymotionPlayer) { dailymotionPlayer.contentWindow.postMessage('play', '*'); } else if (html5Player) { if (_this.core.s.videojs) { try { videojs(html5Player).play(); } catch (e) { console.error('Make sure you have included videojs'); } } else { html5Player.play(); } } $el.addClass('lg-video-playing'); } } }; Video.prototype.destroy = function () { this.videoLoaded = false; }; function onHasVideo(event, index, src, html) { /*jshint validthis:true */ var _this = this; _this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html)); if (html) { if (_this.core.s.videojs) { try { videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function () { if (!_this.videoLoaded && _this.core.s.autoplayFirstVideo) { this.play(); } }); } catch (e) { console.error('Make sure you have included videojs'); } } else { if (!_this.videoLoaded && _this.core.s.autoplayFirstVideo) { _this.core.$slide.eq(index).find('.lg-html5').get(0).play(); } } } } function onAferAppendSlide(event, index) { /*jshint validthis:true */ var $videoCont = this.core.$slide.eq(index).find('.lg-video-cont'); if (!$videoCont.hasClass('lg-has-iframe')) { $videoCont.css('max-width', this.core.s.videoMaxWidth); this.videoLoaded = true; } } function onBeforeSlide(event, prevIndex, index) { /*jshint validthis:true */ var _this = this; var $videoSlide = _this.core.$slide.eq(prevIndex); var youtubePlayer = $videoSlide.find('.lg-youtube').get(0); var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0); var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0); var vkPlayer = $videoSlide.find('.lg-vk').get(0); var html5Player = $videoSlide.find('.lg-html5').get(0); if (youtubePlayer) { youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); } else if (vimeoPlayer) { try { $f(vimeoPlayer).api('pause'); } catch (e) { console.error('Make sure you have included froogaloop2 js'); } } else if (dailymotionPlayer) { dailymotionPlayer.contentWindow.postMessage('pause', '*'); } else if (html5Player) { if (_this.core.s.videojs) { try { videojs(html5Player).pause(); } catch (e) { console.error('Make sure you have included videojs'); } } else { html5Player.pause(); } } if (vkPlayer) { $(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay')); } var _src; if (_this.core.s.dynamic) { _src = _this.core.s.dynamicEl[index].src; } else { _src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src'); } var _isVideo = _this.core.isVideo(_src, index) || {}; if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) { _this.core.$outer.addClass('lg-hide-download'); } } $.fn.lightGallery.modules.video = Video; })(); })); /*! lg-zoom - v1.2.1 - 2020-06-13 * http://sachinchoolur.github.io/lightGallery * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module unless amdModuleId is set define(['jquery'], function (a0) { return (factory(a0)); }); } else if (typeof module === 'object' && module.exports) { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. module.exports = factory(require('jquery')); } else { factory(root["jQuery"]); } }(this, function ($) { (function () { 'use strict'; var getUseLeft = function () { var useLeft = false; var isChrome = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); if (isChrome && parseInt(isChrome[2], 10) < 54) { useLeft = true; } return useLeft; }; var defaults = { scale: 1, zoom: true, actualSize: true, enableZoomAfter: 300, useLeftForZoom: getUseLeft() }; var Zoom = function (element) { this.core = $(element).data('lightGallery'); this.core.s = $.extend({}, defaults, this.core.s); if (this.core.s.zoom && this.core.doCss()) { this.init(); // Store the zoomable timeout value just to clear it while closing this.zoomabletimeout = false; // Set the initial value center this.pageX = $(window).width() / 2; this.pageY = ($(window).height() / 2) + $(window).scrollTop(); } return this; }; Zoom.prototype.init = function () { var _this = this; var zoomIcons = ''; if (_this.core.s.actualSize) { zoomIcons += ''; } if (_this.core.s.useLeftForZoom) { _this.core.$outer.addClass('lg-use-left-for-zoom'); } else { _this.core.$outer.addClass('lg-use-transition-for-zoom'); } this.core.$outer.find('.lg-toolbar').append(zoomIcons); // Add zoomable class _this.core.$el.on('onSlideItemLoad.lg.tm.zoom', function (event, index, delay) { // delay will be 0 except first time var _speed = _this.core.s.enableZoomAfter + delay; // set _speed value 0 if gallery opened from direct url and if it is first slide if ($('body').hasClass('lg-from-hash') && delay) { // will execute only once _speed = 0; } else { // Remove lg-from-hash to enable starting animation. $('body').removeClass('lg-from-hash'); } _this.zoomabletimeout = setTimeout(function () { _this.core.$slide.eq(index).addClass('lg-zoomable'); }, _speed + 30); }); var scale = 1; /** * @desc Image zoom * Translate the wrap and scale the image to get better user experience * * @param {String} scaleVal - Zoom decrement/increment value */ var zoom = function (scaleVal) { var $image = _this.core.$outer.find('.lg-current .lg-image'); var _x; var _y; // Find offset manually to avoid issue after zoom var offsetX = ($(window).width() - $image.prop('offsetWidth')) / 2; var offsetY = (($(window).height() - $image.prop('offsetHeight')) / 2) + $(window).scrollTop(); _x = _this.pageX - offsetX; _y = _this.pageY - offsetY; var x = (scaleVal - 1) * (_x); var y = (scaleVal - 1) * (_y); $image.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal); if (_this.core.s.useLeftForZoom) { $image.parent().css({ left: -x + 'px', top: -y + 'px' }).attr('data-x', x).attr('data-y', y); } else { $image.parent().css('transform', 'translate3d(-' + x + 'px, -' + y + 'px, 0)').attr('data-x', x).attr('data-y', y); } }; var callScale = function () { if (scale > 1) { _this.core.$outer.addClass('lg-zoomed'); } else { _this.resetZoom(); } if (scale < 1) { scale = 1; } zoom(scale); }; var actualSize = function (event, $image, index, fromIcon) { var w = $image.prop('offsetWidth'); var nw; if (_this.core.s.dynamic) { nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w; } else { nw = _this.core.$items.eq(index).attr('data-width') || $image[0].naturalWidth || w; } var _scale; if (_this.core.$outer.hasClass('lg-zoomed')) { scale = 1; } else { if (nw > w) { _scale = nw / w; scale = _scale || 2; } } if (fromIcon) { _this.pageX = $(window).width() / 2; _this.pageY = ($(window).height() / 2) + $(window).scrollTop(); } else { _this.pageX = event.pageX || event.originalEvent.targetTouches[0].pageX; _this.pageY = event.pageY || event.originalEvent.targetTouches[0].pageY; } callScale(); setTimeout(function () { _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab'); }, 10); }; var tapped = false; // event triggered after appending slide content _this.core.$el.on('onAferAppendSlide.lg.tm.zoom', function (event, index) { // Get the current element var $image = _this.core.$slide.eq(index).find('.lg-image'); $image.on('dblclick', function (event) { actualSize(event, $image, index); }); $image.on('touchstart', function (event) { if (!tapped) { tapped = setTimeout(function () { tapped = null; }, 300); } else { clearTimeout(tapped); tapped = null; actualSize(event, $image, index); } event.preventDefault(); }); }); // Update zoom on resize and orientationchange $(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom', function () { _this.pageX = $(window).width() / 2; _this.pageY = ($(window).height() / 2) + $(window).scrollTop(); zoom(scale); }); $('#lg-zoom-out').on('click.lg', function () { if (_this.core.$outer.find('.lg-current .lg-image').length) { scale -= _this.core.s.scale; callScale(); } }); $('#lg-zoom-in').on('click.lg', function () { if (_this.core.$outer.find('.lg-current .lg-image').length) { scale += _this.core.s.scale; callScale(); } }); $('#lg-actual-size').on('click.lg', function (event) { actualSize(event, _this.core.$slide.eq(_this.core.index).find('.lg-image'), _this.core.index, true); }); // Reset zoom on slide change _this.core.$el.on('onBeforeSlide.lg.tm', function () { scale = 1; _this.resetZoom(); }); // Drag option after zoom _this.zoomDrag(); _this.zoomSwipe(); }; // Reset zoom effect Zoom.prototype.resetZoom = function () { this.core.$outer.removeClass('lg-zoomed'); this.core.$slide.find('.lg-img-wrap').removeAttr('style data-x data-y'); this.core.$slide.find('.lg-image').removeAttr('style data-scale'); // Reset pagx pagy values to center this.pageX = $(window).width() / 2; this.pageY = ($(window).height() / 2) + $(window).scrollTop(); }; Zoom.prototype.zoomSwipe = function () { var _this = this; var startCoords = {}; var endCoords = {}; var isMoved = false; // Allow x direction drag var allowX = false; // Allow Y direction drag var allowY = false; _this.core.$slide.on('touchstart.lg', function (e) { if (_this.core.$outer.hasClass('lg-zoomed')) { var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object'); allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height(); allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width(); if ((allowX || allowY)) { e.preventDefault(); startCoords = { x: e.originalEvent.targetTouches[0].pageX, y: e.originalEvent.targetTouches[0].pageY }; } } }); _this.core.$slide.on('touchmove.lg', function (e) { if (_this.core.$outer.hasClass('lg-zoomed')) { var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap'); var distanceX; var distanceY; e.preventDefault(); isMoved = true; endCoords = { x: e.originalEvent.targetTouches[0].pageX, y: e.originalEvent.targetTouches[0].pageY }; // reset opacity and transition duration _this.core.$outer.addClass('lg-zoom-dragging'); if (allowY) { distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y); } else { distanceY = -Math.abs(_$el.attr('data-y')); } if (allowX) { distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x); } else { distanceX = -Math.abs(_$el.attr('data-x')); } if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) { if (_this.core.s.useLeftForZoom) { _$el.css({ left: distanceX + 'px', top: distanceY + 'px' }); } else { _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'); } } } }); _this.core.$slide.on('touchend.lg', function () { if (_this.core.$outer.hasClass('lg-zoomed')) { if (isMoved) { isMoved = false; _this.core.$outer.removeClass('lg-zoom-dragging'); _this.touchendZoom(startCoords, endCoords, allowX, allowY); } } }); }; Zoom.prototype.zoomDrag = function () { var _this = this; var startCoords = {}; var endCoords = {}; var isDraging = false; var isMoved = false; // Allow x direction drag var allowX = false; // Allow Y direction drag var allowY = false; _this.core.$slide.on('mousedown.lg.zoom', function (e) { // execute only on .lg-object var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object'); allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height(); allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width(); if (_this.core.$outer.hasClass('lg-zoomed')) { if ($(e.target).hasClass('lg-object') && (allowX || allowY)) { e.preventDefault(); startCoords = { x: e.pageX, y: e.pageY }; isDraging = true; // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 _this.core.$outer.scrollLeft += 1; _this.core.$outer.scrollLeft -= 1; _this.core.$outer.removeClass('lg-grab').addClass('lg-grabbing'); } } }); $(window).on('mousemove.lg.zoom', function (e) { if (isDraging) { var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap'); var distanceX; var distanceY; isMoved = true; endCoords = { x: e.pageX, y: e.pageY }; // reset opacity and transition duration _this.core.$outer.addClass('lg-zoom-dragging'); if (allowY) { distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y); } else { distanceY = -Math.abs(_$el.attr('data-y')); } if (allowX) { distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x); } else { distanceX = -Math.abs(_$el.attr('data-x')); } if (_this.core.s.useLeftForZoom) { _$el.css({ left: distanceX + 'px', top: distanceY + 'px' }); } else { _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'); } } }); $(window).on('mouseup.lg.zoom', function (e) { if (isDraging) { isDraging = false; _this.core.$outer.removeClass('lg-zoom-dragging'); // Fix for chrome mouse move on click if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) { endCoords = { x: e.pageX, y: e.pageY }; _this.touchendZoom(startCoords, endCoords, allowX, allowY); } isMoved = false; } _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab'); }); }; Zoom.prototype.touchendZoom = function (startCoords, endCoords, allowX, allowY) { var _this = this; var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap'); var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object'); var distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x); var distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y); var minY = (_this.core.$outer.find('.lg').height() - $image.prop('offsetHeight')) / 2; var maxY = Math.abs(($image.prop('offsetHeight') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').height() + minY); var minX = (_this.core.$outer.find('.lg').width() - $image.prop('offsetWidth')) / 2; var maxX = Math.abs(($image.prop('offsetWidth') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').width() + minX); if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) { if (allowY) { if (distanceY <= -maxY) { distanceY = -maxY; } else if (distanceY >= -minY) { distanceY = -minY; } } if (allowX) { if (distanceX <= -maxX) { distanceX = -maxX; } else if (distanceX >= -minX) { distanceX = -minX; } } if (allowY) { _$el.attr('data-y', Math.abs(distanceY)); } else { distanceY = -Math.abs(_$el.attr('data-y')); } if (allowX) { _$el.attr('data-x', Math.abs(distanceX)); } else { distanceX = -Math.abs(_$el.attr('data-x')); } if (_this.core.s.useLeftForZoom) { _$el.css({ left: distanceX + 'px', top: distanceY + 'px' }); } else { _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'); } } }; Zoom.prototype.destroy = function () { var _this = this; // Unbind all events added by lightGallery zoom plugin _this.core.$el.off('.lg.zoom'); $(window).off('.lg.zoom'); _this.core.$slide.off('.lg.zoom'); _this.core.$el.off('.lg.tm.zoom'); _this.resetZoom(); clearTimeout(_this.zoomabletimeout); _this.zoomabletimeout = false; }; $.fn.lightGallery.modules.zoom = Zoom; })(); })); /*! lg-hash - v1.0.4 - 2017-12-20 * http://sachinchoolur.github.io/lightGallery * Copyright (c) 2017 Sachin N; Licensed GPLv3 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module unless amdModuleId is set define(['jquery'], function (a0) { return (factory(a0)); }); } else if (typeof exports === 'object') { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. module.exports = factory(require('jquery')); } else { factory(jQuery); } }(this, function ($) { (function () { 'use strict'; var defaults = { hash: true }; var Hash = function (element) { this.core = $(element).data('lightGallery'); this.core.s = $.extend({}, defaults, this.core.s); if (this.core.s.hash) { this.oldHash = window.location.hash; this.init(); } return this; }; Hash.prototype.init = function () { var _this = this; var _hash; // Change hash value on after each slide transition _this.core.$el.on('onAfterSlide.lg.tm', function (event, prevIndex, index) { if (history.replaceState) { history.replaceState(null, null, window.location.pathname + window.location.search + '#lg=' + _this.core.s.galleryId + '&slide=' + index); } else { window.location.hash = 'lg=' + _this.core.s.galleryId + '&slide=' + index; } }); // Listen hash change and change the slide according to slide value $(window).on('hashchange.lg.hash', function () { _hash = window.location.hash; var _idx = parseInt(_hash.split('&slide=')[1], 10); // it galleryId doesn't exist in the url close the gallery if ((_hash.indexOf('lg=' + _this.core.s.galleryId) > -1)) { _this.core.slide(_idx, false, false); } else if (_this.core.lGalleryOn) { _this.core.destroy(); } }); }; Hash.prototype.destroy = function () { if (!this.core.s.hash) { return; } // Reset to old hash value if (this.oldHash && this.oldHash.indexOf('lg=' + this.core.s.galleryId) < 0) { if (history.replaceState) { history.replaceState(null, null, this.oldHash); } else { window.location.hash = this.oldHash; } } else { if (history.replaceState) { history.replaceState(null, document.title, window.location.pathname + window.location.search); } else { window.location.hash = ''; } } this.core.$el.off('.lg.hash'); }; $.fn.lightGallery.modules.hash = Hash; })(); })); /*! lg-share - v1.2.1 - 2020-06-13 * http://sachinchoolur.github.io/lightGallery * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module unless amdModuleId is set define(['jquery'], function (a0) { return (factory(a0)); }); } else if (typeof module === 'object' && module.exports) { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. module.exports = factory(require('jquery')); } else { factory(root["jQuery"]); } }(this, function ($) { (function () { 'use strict'; var defaults = { share: true, facebook: true, facebookDropdownText: 'Facebook', twitter: true, twitterDropdownText: 'Twitter', googlePlus: true, googlePlusDropdownText: 'GooglePlus', pinterest: true, pinterestDropdownText: 'Pinterest' }; var Share = function (element) { this.core = $(element).data('lightGallery'); this.core.s = $.extend({}, defaults, this.core.s); if (this.core.s.share) { this.init(); } return this; }; Share.prototype.init = function () { var _this = this; var shareHtml = ''; this.core.$outer.find('.lg-toolbar').append(shareHtml); this.core.$outer.find('.lg').append('
'); $('#lg-share').on('click.lg', function () { _this.core.$outer.toggleClass('lg-dropdown-active'); var ariaExpanded = $('#lg-share').attr('aria-expanded'); $('#lg-share').attr('aria-expanded', ariaExpanded === 'true' ? false : true); }); $('#lg-dropdown-overlay').on('click.lg', function () { _this.core.$outer.removeClass('lg-dropdown-active'); $('#lg-share').attr('aria-expanded', false); }); _this.core.$el.on('onAfterSlide.lg.tm', function (event, prevIndex, index) { setTimeout(function () { $('#lg-share-facebook').attr('href', 'https://www.facebook.com/sharer/sharer.php?u=' + (encodeURIComponent(_this.getSahreProps(index, 'facebookShareUrl') || window.location.href))); $('#lg-share-twitter').attr('href', 'https://twitter.com/intent/tweet?text=' + _this.getSahreProps(index, 'tweetText') + '&url=' + (encodeURIComponent(_this.getSahreProps(index, 'twitterShareUrl') || window.location.href))); $('#lg-share-googleplus').attr('href', 'https://plus.google.com/share?url=' + (encodeURIComponent(_this.getSahreProps(index, 'googleplusShareUrl') || window.location.href))); $('#lg-share-pinterest').attr('href', 'http://www.pinterest.com/pin/create/button/?url=' + (encodeURIComponent(_this.getSahreProps(index, 'pinterestShareUrl') || window.location.href)) + '&media=' + encodeURIComponent(_this.getSahreProps(index, 'src')) + '&description=' + _this.getSahreProps(index, 'pinterestText')); }, 100); }); }; Share.prototype.getSahreProps = function (index, prop) { var shareProp = ''; if (this.core.s.dynamic) { shareProp = this.core.s.dynamicEl[index][prop]; } else { var _href = this.core.$items.eq(index).attr('href'); var _prop = this.core.$items.eq(index).data(prop); shareProp = prop === 'src' ? _href || _prop : _prop; } return shareProp; }; Share.prototype.destroy = function () { }; $.fn.lightGallery.modules.share = Share; })(); })); /* * This combined file was created by the DataTables downloader builder: * https://datatables.net/download * * To rebuild or modify this file with the latest versions of the included * software please visit: * https://datatables.net/download/#dt/dt-1.11.4 * * Included libraries: * DataTables 1.11.4 */ /*! Copyright 2008-2021 SpryMedia Ltd. This source file is free software, available under the following license: MIT license - http://datatables.net/license This source file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. For details please refer to: http://www.datatables.net DataTables 1.11.4 ©2008-2021 SpryMedia Ltd - datatables.net/license */ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(l,z,A){l instanceof String&&(l=String(l));for(var q=l.length,E=0;E").css({position:"fixed",top:0,left:-1*l(z).scrollLeft(),height:1, width:1,overflow:"hidden"}).append(l("
").css({position:"absolute",top:1,left:1,width:100,overflow:"scroll"}).append(l("
").css({width:"100%",height:10}))).appendTo("body"),d=c.children(),e=d.children();b.barWidth=d[0].offsetWidth-d[0].clientWidth;b.bScrollOversize=100===e[0].offsetWidth&&100!==d[0].clientWidth;b.bScrollbarLeft=1!==Math.round(e.offset().left);b.bBounding=c[0].getBoundingClientRect().width?!0:!1;c.remove()}l.extend(a.oBrowser,u.__browser);a.oScroll.iBarWidth=u.__browser.barWidth} function Cb(a,b,c,d,e,h){var f=!1;if(c!==q){var g=c;f=!0}for(;d!==e;)a.hasOwnProperty(d)&&(g=f?b(g,a[d],d,a):a[d],f=!0,d+=h);return g}function Ya(a,b){var c=u.defaults.column,d=a.aoColumns.length;c=l.extend({},u.models.oColumn,c,{nTh:b?b:A.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=l.extend({},u.models.oSearch,c[d]);Ga(a,d,l(b).data())}function Ga(a,b,c){b=a.aoColumns[b]; var d=a.oClasses,e=l(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=e.attr("width")||null;var h=(e.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);h&&(b.sWidthOrig=h[1])}c!==q&&null!==c&&(Ab(c),P(u.defaults.column,c,!0),c.mDataProp===q||c.mData||(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),c.sClass&&e.addClass(c.sClass),l.extend(b,c),X(b,c,"sWidth","sWidthOrig"),c.iDataSort!==q&&(b.aDataSort=[c.iDataSort]),X(b,c,"aDataSort"));var f=b.mData,g=na(f), k=b.mRender?na(b.mRender):null;c=function(m){return"string"===typeof m&&-1!==m.indexOf("@")};b._bAttrSrc=l.isPlainObject(f)&&(c(f.sort)||c(f.type)||c(f.filter));b._setter=null;b.fnGetData=function(m,n,p){var t=g(m,n,q,p);return k&&n?k(t,n,m,p):t};b.fnSetData=function(m,n,p){return ha(f)(m,n,p)};"number"!==typeof f&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==l.inArray("asc",b.asSorting);c=-1!==l.inArray("desc",b.asSorting);b.bSortable&&(a||c)?a&&!c? (b.sSortingClass=d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=d.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI):(b.sSortingClass=d.sSortableNone,b.sSortingClassJUI="")}function ta(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;Za(a);for(var c=0,d=b.length;cm[n])d(g.length+m[n],k);else if("string"===typeof m[n]){var p=0;for(f=g.length;pb&&a[e]--; -1!=d&&c===q&&a.splice(d,1)}function wa(a,b,c,d){var e=a.aoData[b],h,f=function(k,m){for(;k.childNodes.length;)k.removeChild(k.firstChild);k.innerHTML=T(a,b,m,"display")};if("dom"!==c&&(c&&"auto"!==c||"dom"!==e.src)){var g=e.anCells;if(g)if(d!==q)f(g[d],d);else for(c=0,h=g.length;c").appendTo(d));var k=0;for(b=g.length;k=a.fnRecordsDisplay()?0:d,a.iInitDisplayStart=-1);c=F(a,"aoPreDrawCallback","preDraw",[a]);if(-1!==l.inArray(!1,c))V(a,!1);else{c=[];var e=0;d=a.asStripeClasses;var h=d.length,f=a.oLanguage,g="ssp"==Q(a),k=a.aiDisplay,m=a._iDisplayStart,n=a.fnDisplayEnd();a.bDrawing=!0;if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,V(a,!1);else if(!g)a.iDraw++;else if(!a.bDestroying&&!b){Gb(a);return}if(0!==k.length)for(b=g?a.aoData.length:n,f=g?0:m;f",{"class":h?d[0]:""}).append(l("",{valign:"top",colSpan:oa(a),"class":a.oClasses.sRowEmpty}).html(e))[0];F(a,"aoHeaderCallback","header",[l(a.nTHead).children("tr")[0],db(a),m,n,k]);F(a,"aoFooterCallback", "footer",[l(a.nTFoot).children("tr")[0],db(a),m,n,k]);d=l(a.nTBody);d.children().detach();d.append(l(c));F(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1}}function ka(a,b){var c=a.oFeatures,d=c.bFilter;c.bSort&&Hb(a);d?za(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;ja(a);a._drawHold=!1}function Ib(a){var b=a.oClasses,c=l(a.nTable);c=l("
").insertBefore(c);var d=a.oFeatures,e=l("
",{id:a.sTableId+"_wrapper", "class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var h=a.sDom.split(""),f,g,k,m,n,p,t=0;t")[0];m=h[t+1];if("'"==m||'"'==m){n="";for(p=2;h[t+p]!=m;)n+=h[t+p],p++;"H"==n?n=b.sJUIHeader:"F"==n&&(n=b.sJUIFooter);-1!=n.indexOf(".")?(m=n.split("."),k.id=m[0].substr(1,m[0].length-1),k.className=m[1]):"#"==n.charAt(0)?k.id=n.substr(1,n.length-1):k.className=n;t+=p}e.append(k); e=l(k)}else if(">"==g)e=e.parent();else if("l"==g&&d.bPaginate&&d.bLengthChange)f=Jb(a);else if("f"==g&&d.bFilter)f=Kb(a);else if("r"==g&&d.bProcessing)f=Lb(a);else if("t"==g)f=Mb(a);else if("i"==g&&d.bInfo)f=Nb(a);else if("p"==g&&d.bPaginate)f=Ob(a);else if(0!==u.ext.feature.length)for(k=u.ext.feature,p=0,m=k.length;p',g=d.sSearch;g=g.match(/_INPUT_/)?g.replace("_INPUT_",f):g+f;b=l("
",{id:h.f?null:c+"_filter","class":b.sFilter}).append(l("
").addClass(b.sLength);a.aanFeatures.l||(k[0].id=c+"_length");k.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",e[0].outerHTML));l("select",k).val(a._iDisplayLength).on("change.DT",function(m){kb(a,l(this).val());ja(a)});l(a.nTable).on("length.dt.DT",function(m,n,p){a===n&&l("select",k).val(p)});return k[0]}function Ob(a){var b=a.sPaginationType,c=u.ext.pager[b],d="function"===typeof c,e=function(f){ja(f)};b=l("
").addClass(a.oClasses.sPaging+b)[0]; var h=a.aanFeatures;d||c.fnInit(a,b,e);h.p||(b.id=a.sTableId+"_paginate",a.aoDrawCallback.push({fn:function(f){if(d){var g=f._iDisplayStart,k=f._iDisplayLength,m=f.fnRecordsDisplay(),n=-1===k;g=n?0:Math.ceil(g/k);k=n?1:Math.ceil(m/k);m=c(g,k);var p;n=0;for(p=h.p.length;nh&& (d=0)):"first"==b?d=0:"previous"==b?(d=0<=e?d-e:0,0>d&&(d=0)):"next"==b?d+e",{id:a.aanFeatures.r?null:a.sTableId+"_processing","class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}function V(a,b){a.oFeatures.bProcessing&&l(a.aanFeatures.r).css("display",b?"block":"none"); F(a,null,"processing",[a,b])}function Mb(a){var b=l(a.nTable),c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var d=c.sX,e=c.sY,h=a.oClasses,f=b.children("caption"),g=f.length?f[0]._captionSide:null,k=l(b[0].cloneNode(!1)),m=l(b[0].cloneNode(!1)),n=b.children("tfoot");n.length||(n=null);k=l("
",{"class":h.sScrollWrapper}).append(l("
",{"class":h.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:d?d?K(d):null:"100%"}).append(l("
",{"class":h.sScrollHeadInner}).css({"box-sizing":"content-box", width:c.sXInner||"100%"}).append(k.removeAttr("id").css("margin-left",0).append("top"===g?f:null).append(b.children("thead"))))).append(l("
",{"class":h.sScrollBody}).css({position:"relative",overflow:"auto",width:d?K(d):null}).append(b));n&&k.append(l("
",{"class":h.sScrollFoot}).css({overflow:"hidden",border:0,width:d?d?K(d):null:"100%"}).append(l("
",{"class":h.sScrollFootInner}).append(m.removeAttr("id").css("margin-left",0).append("bottom"===g?f:null).append(b.children("tfoot"))))); b=k.children();var p=b[0];h=b[1];var t=n?b[2]:null;if(d)l(h).on("scroll.DT",function(v){v=this.scrollLeft;p.scrollLeft=v;n&&(t.scrollLeft=v)});l(h).css("max-height",e);c.bCollapse||l(h).css("height",e);a.nScrollHead=p;a.nScrollBody=h;a.nScrollFoot=t;a.aoDrawCallback.push({fn:Ha,sName:"scrolling"});return k[0]}function Ha(a){var b=a.oScroll,c=b.sX,d=b.sXInner,e=b.sY;b=b.iBarWidth;var h=l(a.nScrollHead),f=h[0].style,g=h.children("div"),k=g[0].style,m=g.children("table");g=a.nScrollBody;var n=l(g),p= g.style,t=l(a.nScrollFoot).children("div"),v=t.children("table"),x=l(a.nTHead),w=l(a.nTable),r=w[0],C=r.style,G=a.nTFoot?l(a.nTFoot):null,aa=a.oBrowser,L=aa.bScrollOversize;U(a.aoColumns,"nTh");var O=[],I=[],H=[],ea=[],Y,Ca=function(D){D=D.style;D.paddingTop="0";D.paddingBottom="0";D.borderTopWidth="0";D.borderBottomWidth="0";D.height=0};var fa=g.scrollHeight>g.clientHeight;if(a.scrollBarVis!==fa&&a.scrollBarVis!==q)a.scrollBarVis=fa,ta(a);else{a.scrollBarVis=fa;w.children("thead, tfoot").remove(); if(G){var ba=G.clone().prependTo(w);var la=G.find("tr");ba=ba.find("tr")}var mb=x.clone().prependTo(w);x=x.find("tr");fa=mb.find("tr");mb.find("th, td").removeAttr("tabindex");c||(p.width="100%",h[0].style.width="100%");l.each(Na(a,mb),function(D,W){Y=ua(a,D);W.style.width=a.aoColumns[Y].sWidth});G&&ca(function(D){D.style.width=""},ba);h=w.outerWidth();""===c?(C.width="100%",L&&(w.find("tbody").height()>g.offsetHeight||"scroll"==n.css("overflow-y"))&&(C.width=K(w.outerWidth()-b)),h=w.outerWidth()): ""!==d&&(C.width=K(d),h=w.outerWidth());ca(Ca,fa);ca(function(D){var W=z.getComputedStyle?z.getComputedStyle(D).width:K(l(D).width());H.push(D.innerHTML);O.push(W)},fa);ca(function(D,W){D.style.width=O[W]},x);l(fa).height(0);G&&(ca(Ca,ba),ca(function(D){ea.push(D.innerHTML);I.push(K(l(D).css("width")))},ba),ca(function(D,W){D.style.width=I[W]},la),l(ba).height(0));ca(function(D,W){D.innerHTML='
'+H[W]+"
";D.childNodes[0].style.height="0";D.childNodes[0].style.overflow= "hidden";D.style.width=O[W]},fa);G&&ca(function(D,W){D.innerHTML='
'+ea[W]+"
";D.childNodes[0].style.height="0";D.childNodes[0].style.overflow="hidden";D.style.width=I[W]},ba);Math.round(w.outerWidth())g.offsetHeight||"scroll"==n.css("overflow-y")?h+b:h,L&&(g.scrollHeight>g.offsetHeight||"scroll"==n.css("overflow-y"))&&(C.width=K(la-b)),""!==c&&""===d||da(a,1,"Possible column misalignment",6)):la="100%";p.width=K(la);f.width=K(la); G&&(a.nScrollFoot.style.width=K(la));!e&&L&&(p.height=K(r.offsetHeight+b));c=w.outerWidth();m[0].style.width=K(c);k.width=K(c);d=w.height()>g.clientHeight||"scroll"==n.css("overflow-y");e="padding"+(aa.bScrollbarLeft?"Left":"Right");k[e]=d?b+"px":"0px";G&&(v[0].style.width=K(c),t[0].style.width=K(c),t[0].style[e]=d?b+"px":"0px");w.children("colgroup").insertBefore(w.children("thead"));n.trigger("scroll");!a.bSorted&&!a.bFiltered||a._drawHold||(g.scrollTop=0)}}function ca(a,b,c){for(var d=0,e=0,h= b.length,f,g;e").appendTo(g.find("tbody"));g.find("thead, tfoot").remove();g.append(l(a.nTHead).clone()).append(l(a.nTFoot).clone());g.find("tfoot th, tfoot td").css("width","");m=Na(a,g.find("thead")[0]);for(v=0;v").css({width:w.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(a.aoData.length)for(v=0;v").css(h||e?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(g).appendTo(p);h&&f?g.width(f):h?(g.css("width","auto"),g.removeAttr("width"),g.width()").css("width",K(a)).appendTo(b||A.body);b=a[0].offsetWidth;a.remove();return b}function $b(a,b){var c= ac(a,b);if(0>c)return null;var d=a.aoData[c];return d.nTr?d.anCells[b]:l("").html(T(a,c,b,"display"))[0]}function ac(a,b){for(var c,d=-1,e=-1,h=0,f=a.aoData.length;hd&&(d=c.length,e=h);return e}function K(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function pa(a){var b=[],c=a.aoColumns;var d=a.aaSortingFixed;var e=l.isPlainObject(d);var h=[];var f=function(n){n.length&& !Array.isArray(n[0])?h.push(n):l.merge(h,n)};Array.isArray(d)&&f(d);e&&d.pre&&f(d.pre);f(a.aaSorting);e&&d.post&&f(d.post);for(a=0;aG?1:0;if(0!==C)return"asc"===r.dir?C:-C}C=c[n];G=c[p];return CG?1:0}):f.sort(function(n,p){var t,v=g.length,x=e[n]._aSortData,w=e[p]._aSortData;for(t=0;tG?1:0})}a.bSorted=!0}function cc(a){var b=a.aoColumns,c=pa(a);a=a.oLanguage.oAria;for(var d=0,e=b.length;d/g,"");var k=h.nTh;k.removeAttribute("aria-sort");h.bSortable&&(0e?e+1:3))}e= 0;for(h=d.length;ee?e+1:3))}a.aLastSort=d}function bc(a,b){var c=a.aoColumns[b],d=u.ext.order[c.sSortDataType],e;d&&(e=d.call(a.oInstance,a,b,va(a,b)));for(var h,f=u.ext.type.order[c.sType+"-pre"],g=0,k=a.aoData.length;g=e.length?[0,m[1]]:m)}));b.search!==q&&l.extend(a.oPreviousSearch,Wb(b.search));if(b.columns){f=0;for(d=b.columns.length;f=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function gb(a,b){a=a.renderer;var c=u.ext.renderer[b];return l.isPlainObject(a)&&a[b]?c[a[b]]||c._:"string"===typeof a?c[a]||c._:c._}function Q(a){return a.oFeatures.bServerSide? "ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function Da(a,b){var c=ec.numbers_length,d=Math.floor(c/2);b<=c?a=ra(0,b):a<=d?(a=ra(0,c-2),a.push("ellipsis"),a.push(b-1)):(a>=b-1-d?a=ra(b-(c-2),b):(a=ra(a-d+2,a+d-1),a.push("ellipsis"),a.push(b-1)),a.splice(0,0,"ellipsis"),a.splice(0,0,0));a.DT_el="span";return a}function Xa(a){l.each({num:function(b){return Ua(b,a)},"num-fmt":function(b){return Ua(b,a,rb)},"html-num":function(b){return Ua(b,a,Va)},"html-num-fmt":function(b){return Ua(b,a,Va,rb)}},function(b, c){M.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(M.type.search[b+a]=M.type.search.html)})}function fc(a){return function(){var b=[Ta(this[u.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return u.ext.internal[a].apply(this,b)}}var u=function(a,b){if(this instanceof u)return l(a).DataTable(b);b=a;this.$=function(f,g){return this.api(!0).$(f,g)};this._=function(f,g){return this.api(!0).rows(f,g).data()};this.api=function(f){return f?new B(Ta(this[M.iApiIndex])):new B(this)};this.fnAddData= function(f,g){var k=this.api(!0);f=Array.isArray(f)&&(Array.isArray(f[0])||l.isPlainObject(f[0]))?k.rows.add(f):k.row.add(f);(g===q||g)&&k.draw();return f.flatten().toArray()};this.fnAdjustColumnSizing=function(f){var g=this.api(!0).columns.adjust(),k=g.settings()[0],m=k.oScroll;f===q||f?g.draw(!1):(""!==m.sX||""!==m.sY)&&Ha(k)};this.fnClearTable=function(f){var g=this.api(!0).clear();(f===q||f)&&g.draw()};this.fnClose=function(f){this.api(!0).row(f).child.hide()};this.fnDeleteRow=function(f,g,k){var m= this.api(!0);f=m.rows(f);var n=f.settings()[0],p=n.aoData[f[0][0]];f.remove();g&&g.call(this,n,p);(k===q||k)&&m.draw();return p};this.fnDestroy=function(f){this.api(!0).destroy(f)};this.fnDraw=function(f){this.api(!0).draw(f)};this.fnFilter=function(f,g,k,m,n,p){n=this.api(!0);null===g||g===q?n.search(f,k,m,p):n.column(g).search(f,k,m,p);n.draw()};this.fnGetData=function(f,g){var k=this.api(!0);if(f!==q){var m=f.nodeName?f.nodeName.toLowerCase():"";return g!==q||"td"==m||"th"==m?k.cell(f,g).data(): k.row(f).data()||null}return k.data().toArray()};this.fnGetNodes=function(f){var g=this.api(!0);return f!==q?g.row(f).node():g.rows().nodes().flatten().toArray()};this.fnGetPosition=function(f){var g=this.api(!0),k=f.nodeName.toUpperCase();return"TR"==k?g.row(f).index():"TD"==k||"TH"==k?(f=g.cell(f).index(),[f.row,f.columnVisible,f.column]):null};this.fnIsOpen=function(f){return this.api(!0).row(f).child.isShown()};this.fnOpen=function(f,g,k){return this.api(!0).row(f).child(g,k).show().child()[0]}; this.fnPageChange=function(f,g){f=this.api(!0).page(f);(g===q||g)&&f.draw(!1)};this.fnSetColumnVis=function(f,g,k){f=this.api(!0).column(f).visible(g);(k===q||k)&&f.columns.adjust().draw()};this.fnSettings=function(){return Ta(this[M.iApiIndex])};this.fnSort=function(f){this.api(!0).order(f).draw()};this.fnSortListener=function(f,g,k){this.api(!0).order.listener(f,g,k)};this.fnUpdate=function(f,g,k,m,n){var p=this.api(!0);k===q||null===k?p.row(g).data(f):p.cell(g,k).data(f);(n===q||n)&&p.columns.adjust(); (m===q||m)&&p.draw();return 0};this.fnVersionCheck=M.fnVersionCheck;var c=this,d=b===q,e=this.length;d&&(b={});this.oApi=this.internal=M.internal;for(var h in u.ext.internal)h&&(this[h]=fc(h));this.each(function(){var f={},g=1").appendTo(t));r.nTHead=H[0];var ea=t.children("tbody");0===ea.length&&(ea=l("").insertAfter(H));r.nTBody=ea[0];H=t.children("tfoot");0===H.length&&0").appendTo(t));0===H.length||0===H.children().length?t.addClass(C.sNoFooter):0/g,uc=/^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/,vc=/(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\|\$|\^|\-)/g,rb=/['\u00A0,$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi,Z=function(a){return a&&!0!==a&&"-"!==a?!1:!0},hc= function(a){var b=parseInt(a,10);return!isNaN(b)&&isFinite(a)?b:null},ic=function(a,b){sb[b]||(sb[b]=new RegExp(jb(b),"g"));return"string"===typeof a&&"."!==b?a.replace(/\./g,"").replace(sb[b],"."):a},tb=function(a,b,c){var d="string"===typeof a;if(Z(a))return!0;b&&d&&(a=ic(a,b));c&&d&&(a=a.replace(rb,""));return!isNaN(parseFloat(a))&&isFinite(a)},jc=function(a,b,c){return Z(a)?!0:Z(a)||"string"===typeof a?tb(a.replace(Va,""),b,c)?!0:null:null},U=function(a,b,c){var d=[],e=0,h=a.length;if(c!==q)for(;e< h;e++)a[e]&&a[e][b]&&d.push(a[e][b][c]);else for(;ea.length)){var b=a.slice().sort();for(var c=b[0],d=1,e=b.length;d< e;d++){if(b[d]===c){b=!1;break a}c=b[d]}}b=!0}if(b)return a.slice();b=[];e=a.length;var h,f=0;d=0;a:for(;d")[0],sc=Qa.textContent!==q,tc=/<.*?>/g,hb=u.util.throttle,nc=[],N=Array.prototype,wc=function(a){var b,c=u.settings,d=l.map(c,function(h,f){return h.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&"table"===a.nodeName.toLowerCase()){var e= l.inArray(a,d);return-1!==e?[c[e]]:null}if(a&&"function"===typeof a.settings)return a.settings().toArray();"string"===typeof a?b=l(a):a instanceof l&&(b=a)}else return[];if(b)return b.map(function(h){e=l.inArray(this,d);return-1!==e?c[e]:null}).toArray()};var B=function(a,b){if(!(this instanceof B))return new B(a,b);var c=[],d=function(f){(f=wc(f))&&c.push.apply(c,f)};if(Array.isArray(a))for(var e=0,h=a.length;ea?new B(b[a],this[a]):null},filter:function(a){var b=[];if(N.filter)b=N.filter.call(this,a,this);else for(var c=0,d=this.length;c").addClass(g),l("td",k).addClass(g).html(f)[0].colSpan=oa(a),e.push(k[0]))};h(c,d);b._details&&b._details.detach();b._details=l(e);b._detailsShow&&b._details.insertAfter(b.nTr)},xb=function(a,b){var c=a.context;c.length&&(a=c[0].aoData[b!==q?b:a[0]])&&a._details&&(a._details.remove(),a._detailsShow=q,a._details= q,l(a.nTr).removeClass("dt-hasChild"),qa(c[0]))},qc=function(a,b){var c=a.context;if(c.length&&a.length){var d=c[0].aoData[a[0]];d._details&&((d._detailsShow=b)?(d._details.insertAfter(d.nTr),l(d.nTr).addClass("dt-hasChild")):(d._details.detach(),l(d.nTr).removeClass("dt-hasChild")),F(c[0],null,"childRow",[b,a.row(a[0])]),zc(c[0]),qa(c[0]))}},zc=function(a){var b=new B(a),c=a.aoData;b.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");0g){var n=l.map(d,function(p,t){return p.bVisible?t:null});return[n[n.length+g]]}return[ua(a,g)];case "name":return l.map(e,function(p,t){return p===m[1]?t:null});default:return[]}if(f.nodeName&&f._DT_CellIndex)return[f._DT_CellIndex.column];g=l(h).filter(f).map(function(){return l.inArray(this,h)}).toArray();if(g.length||!f.nodeName)return g;g=l(f).closest("*[data-dt-column]");return g.length?[g.data("dt-column")]:[]},a,c)};y("columns()",function(a,b){a===q?a="":l.isPlainObject(a)&&(b=a, a="");b=vb(b);var c=this.iterator("table",function(d){return Bc(d,a,b)},1);c.selector.cols=a;c.selector.opts=b;return c});J("columns().header()","column().header()",function(a,b){return this.iterator("column",function(c,d){return c.aoColumns[d].nTh},1)});J("columns().footer()","column().footer()",function(a,b){return this.iterator("column",function(c,d){return c.aoColumns[d].nTf},1)});J("columns().data()","column().data()",function(){return this.iterator("column-rows",rc,1)});J("columns().dataSrc()", "column().dataSrc()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].mData},1)});J("columns().cache()","column().cache()",function(a){return this.iterator("column-rows",function(b,c,d,e,h){return Ea(b.aoData,h,"search"===a?"_aFilterData":"_aSortData",c)},1)});J("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(a,b,c,d,e){return Ea(a.aoData,e,"anCells",b)},1)});J("columns().visible()","column().visible()",function(a,b){var c= this,d=this.iterator("column",function(e,h){if(a===q)return e.aoColumns[h].bVisible;var f=e.aoColumns,g=f[h],k=e.aoData,m;if(a!==q&&g.bVisible!==a){if(a){var n=l.inArray(!0,U(f,"bVisible"),h+1);f=0;for(m=k.length;fd;return!0};u.isDataTable=u.fnIsDataTable=function(a){var b=l(a).get(0),c=!1;if(a instanceof u.Api)return!0;l.each(u.settings,function(d,e){d=e.nScrollHead?l("table",e.nScrollHead)[0]:null;var h=e.nScrollFoot?l("table",e.nScrollFoot)[0]:null;if(e.nTable===b||d===b||h===b)c=!0});return c};u.tables=u.fnTables=function(a){var b= !1;l.isPlainObject(a)&&(b=a.api,a=a.visible);var c=l.map(u.settings,function(d){if(!a||a&&l(d.nTable).is(":visible"))return d.nTable});return b?new B(c):c};u.camelToHungarian=P;y("$()",function(a,b){b=this.rows(b).nodes();b=l(b);return l([].concat(b.filter(a).toArray(),b.find(a).toArray()))});l.each(["on","one","off"],function(a,b){y(b+"()",function(){var c=Array.prototype.slice.call(arguments);c[0]=l.map(c[0].split(/\s/),function(e){return e.match(/\.dt\b/)?e:e+".dt"}).join(" ");var d=l(this.tables().nodes()); d[b].apply(d,c);return this})});y("clear()",function(){return this.iterator("table",function(a){Ka(a)})});y("settings()",function(){return new B(this.context,this.context)});y("init()",function(){var a=this.context;return a.length?a[0].oInit:null});y("data()",function(){return this.iterator("table",function(a){return U(a.aoData,"_aData")}).flatten()});y("destroy()",function(a){a=a||!1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,d=b.oClasses,e=b.nTable,h=b.nTBody,f=b.nTHead, g=b.nTFoot,k=l(e);h=l(h);var m=l(b.nTableWrapper),n=l.map(b.aoData,function(t){return t.nTr}),p;b.bDestroying=!0;F(b,"aoDestroyCallback","destroy",[b]);a||(new B(b)).columns().visible(!0);m.off(".DT").find(":not(tbody *)").off(".DT");l(z).off(".DT-"+b.sInstance);e!=f.parentNode&&(k.children("thead").detach(),k.append(f));g&&e!=g.parentNode&&(k.children("tfoot").detach(),k.append(g));b.aaSorting=[];b.aaSortingFixed=[];Sa(b);l(n).removeClass(b.asStripeClasses.join(" "));l("th, td",f).removeClass(d.sSortable+ " "+d.sSortableAsc+" "+d.sSortableDesc+" "+d.sSortableNone);h.children().detach();h.append(n);f=a?"remove":"detach";k[f]();m[f]();!a&&c&&(c.insertBefore(e,b.nTableReinsertBefore),k.css("width",b.sDestroyWidth).removeClass(d.sTable),(p=b.asDestroyStripes.length)&&h.children().each(function(t){l(this).addClass(b.asDestroyStripes[t%p])}));c=l.inArray(b,u.settings);-1!==c&&u.settings.splice(c,1)})});l.each(["column","row","cell"],function(a,b){y(b+"s().every()",function(c){var d=this.selector.opts,e= this;return this.iterator(b,function(h,f,g,k,m){c.call(e[b](f,"cell"===b?g:d,"cell"===b?d:q),f,g,k,m)})})});y("i18n()",function(a,b,c){var d=this.context[0];a=na(a)(d.oLanguage);a===q&&(a=b);c!==q&&l.isPlainObject(a)&&(a=a[c]!==q?a[c]:a._);return a.replace("%d",c)});u.version="1.11.4";u.settings=[];u.models={};u.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0,"return":!1};u.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"", src:null,idx:-1};u.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};u.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10, 25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null, fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+a.sInstance+"_"+location.pathname))}catch(b){return{}}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}}, fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)", sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:l.extend({},u.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null,rowId:"DT_RowId"};E(u.defaults);u.defaults.column={aDataSort:null, iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};E(u.defaults.column);u.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null, iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[], aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,jqXHR:null,json:q,oAjaxData:q,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0, bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==Q(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==Q(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=this._iDisplayLength,b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,h= e.bPaginate;return e.bServerSide?!1===h||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!h||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null};u.ext=M={buttons:{},classes:{},builder:"dt/dt-1.11.4",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:u.fnVersionCheck, iApiIndex:0,oJUIClasses:{},sVersion:u.version};l.extend(M,{afnFiltering:M.search,aTypes:M.type.detect,ofnSearch:M.type.search,oSort:M.type.order,afnSortData:M.order,aoFeatures:M.feature,oApi:M.internal,oStdClasses:M.classes,oPagination:M.pager});l.extend(u.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter", sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_desc_disabled",sSortableDesc:"sorting_asc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody", sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""});var ec=u.ext.pager;l.extend(ec,{simple:function(a,b){return["previous","next"]},full:function(a,b){return["first","previous","next","last"]},numbers:function(a,b){return[Da(a,b)]},simple_numbers:function(a,b){return["previous",Da(a,b),"next"]}, full_numbers:function(a,b){return["first","previous",Da(a,b),"next","last"]},first_last_numbers:function(a,b){return["first",Da(a,b),"last"]},_numbers:Da,numbers_length:7});l.extend(!0,u.ext.renderer,{pageButton:{_:function(a,b,c,d,e,h){var f=a.oClasses,g=a.oLanguage.oPaginate,k=a.oLanguage.oAria.paginate||{},m,n,p=0,t=function(x,w){var r,C=f.sPageButtonDisabled,G=function(I){Ra(a,I.data.action,!0)};var aa=0;for(r=w.length;aa").appendTo(x); t(O,L)}else{m=null;n=L;O=a.iTabIndex;switch(L){case "ellipsis":x.append('');break;case "first":m=g.sFirst;0===e&&(O=-1,n+=" "+C);break;case "previous":m=g.sPrevious;0===e&&(O=-1,n+=" "+C);break;case "next":m=g.sNext;if(0===h||e===h-1)O=-1,n+=" "+C;break;case "last":m=g.sLast;if(0===h||e===h-1)O=-1,n+=" "+C;break;default:m=a.fnFormatNumber(L+1),n=e===L?f.sPageButtonActive:""}null!==m&&(O=l("",{"class":f.sPageButton+" "+n,"aria-controls":a.sTableId,"aria-label":k[L], "data-dt-idx":p,tabindex:O,id:0===c&&"string"===typeof L?a.sTableId+"_"+L:null}).html(m).appendTo(x),ob(O,{action:L},G),p++)}}};try{var v=l(b).find(A.activeElement).data("dt-idx")}catch(x){}t(l(b).empty(),d);v!==q&&l(b).find("[data-dt-idx="+v+"]").trigger("focus")}}});l.extend(u.ext.type.detect,[function(a,b){b=b.oLanguage.sDecimal;return tb(a,b)?"num"+b:null},function(a,b){if(a&&!(a instanceof Date)&&!uc.test(a))return null;b=Date.parse(a);return null!==b&&!isNaN(b)||Z(a)?"date":null},function(a, b){b=b.oLanguage.sDecimal;return tb(a,b,!0)?"num-fmt"+b:null},function(a,b){b=b.oLanguage.sDecimal;return jc(a,b)?"html-num"+b:null},function(a,b){b=b.oLanguage.sDecimal;return jc(a,b,!0)?"html-num-fmt"+b:null},function(a,b){return Z(a)||"string"===typeof a&&-1!==a.indexOf("<")?"html":null}]);l.extend(u.ext.type.search,{html:function(a){return Z(a)?a:"string"===typeof a?a.replace(gc," ").replace(Va,""):""},string:function(a){return Z(a)?a:"string"===typeof a?a.replace(gc," "):a}});var Ua=function(a, b,c,d){if(0!==a&&(!a||"-"===a))return-Infinity;b&&(a=ic(a,b));a.replace&&(c&&(a=a.replace(c,"")),d&&(a=a.replace(d,"")));return 1*a};l.extend(M.type.order,{"date-pre":function(a){a=Date.parse(a);return isNaN(a)?-Infinity:a},"html-pre":function(a){return Z(a)?"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return Z(a)?"":"string"===typeof a?a.toLowerCase():a.toString?a.toString():""},"string-asc":function(a,b){return ab?1:0},"string-desc":function(a,b){return a< b?1:a>b?-1:0}});Xa("");l.extend(!0,u.ext.renderer,{header:{_:function(a,b,c,d){l(a.nTable).on("order.dt.DT",function(e,h,f,g){a===h&&(e=c.idx,b.removeClass(d.sSortAsc+" "+d.sSortDesc).addClass("asc"==g[e]?d.sSortAsc:"desc"==g[e]?d.sSortDesc:c.sSortingClass))})},jqueryui:function(a,b,c,d){l("
").addClass(d.sSortJUIWrapper).append(b.contents()).append(l("").addClass(d.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);l(a.nTable).on("order.dt.DT",function(e,h,f,g){a===h&&(e=c.idx,b.removeClass(d.sSortAsc+ " "+d.sSortDesc).addClass("asc"==g[e]?d.sSortAsc:"desc"==g[e]?d.sSortDesc:c.sSortingClass),b.find("span."+d.sSortIcon).removeClass(d.sSortJUIAsc+" "+d.sSortJUIDesc+" "+d.sSortJUI+" "+d.sSortJUIAscAllowed+" "+d.sSortJUIDescAllowed).addClass("asc"==g[e]?d.sSortJUIAsc:"desc"==g[e]?d.sSortJUIDesc:c.sSortingClassJUI))})}}});var yb=function(a){Array.isArray(a)&&(a=a.join(","));return"string"===typeof a?a.replace(/&/g,"&").replace(//g,">").replace(/"/g,"""):a};u.render= {number:function(a,b,c,d,e){return{display:function(h){if("number"!==typeof h&&"string"!==typeof h)return h;var f=0>h?"-":"",g=parseFloat(h);if(isNaN(g))return yb(h);g=g.toFixed(c);h=Math.abs(g);g=parseInt(h,10);h=c?b+(h-g).toFixed(c).substring(2):"";0===g&&0===parseFloat(h)&&(f="");return f+(d||"")+g.toString().replace(/\B(?=(\d{3})+(?!\d))/g,a)+h+(e||"")}}},text:function(){return{display:yb,filter:yb}}};l.extend(u.ext.internal,{_fnExternApiFunc:fc,_fnBuildAjax:Oa,_fnAjaxUpdate:Gb,_fnAjaxParameters:Pb, _fnAjaxUpdateDraw:Qb,_fnAjaxDataSrc:Aa,_fnAddColumn:Ya,_fnColumnOptions:Ga,_fnAdjustColumnSizing:ta,_fnVisibleToColumnIndex:ua,_fnColumnIndexToVisible:va,_fnVisbleColumns:oa,_fnGetColumns:Ia,_fnColumnTypes:$a,_fnApplyColumnDefs:Db,_fnHungarianMap:E,_fnCamelToHungarian:P,_fnLanguageCompat:ma,_fnBrowserDetect:Bb,_fnAddData:ia,_fnAddTr:Ja,_fnNodeToDataIndex:function(a,b){return b._DT_RowIndex!==q?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,c){return l.inArray(c,a.aoData[b].anCells)},_fnGetCellData:T, _fnSetCellData:Eb,_fnSplitObjNotation:cb,_fnGetObjectDataFn:na,_fnSetObjectDataFn:ha,_fnGetDataMaster:db,_fnClearTable:Ka,_fnDeleteIndex:La,_fnInvalidate:wa,_fnGetRowElements:bb,_fnCreateTr:ab,_fnBuildHead:Fb,_fnDrawHead:ya,_fnDraw:ja,_fnReDraw:ka,_fnAddOptionsHtml:Ib,_fnDetectHeader:xa,_fnGetUniqueThs:Na,_fnFeatureHtmlFilter:Kb,_fnFilterComplete:za,_fnFilterCustom:Tb,_fnFilterColumn:Sb,_fnFilter:Rb,_fnFilterCreateSearch:ib,_fnEscapeRegex:jb,_fnFilterData:Ub,_fnFeatureHtmlInfo:Nb,_fnUpdateInfo:Xb, _fnInfoMacros:Yb,_fnInitialise:Ba,_fnInitComplete:Pa,_fnLengthChange:kb,_fnFeatureHtmlLength:Jb,_fnFeatureHtmlPaginate:Ob,_fnPageChange:Ra,_fnFeatureHtmlProcessing:Lb,_fnProcessingDisplay:V,_fnFeatureHtmlTable:Mb,_fnScrollDraw:Ha,_fnApplyToChildren:ca,_fnCalculateColumnWidths:Za,_fnThrottle:hb,_fnConvertToWidth:Zb,_fnGetWidestNode:$b,_fnGetMaxLenString:ac,_fnStringToCss:K,_fnSortFlatten:pa,_fnSort:Hb,_fnSortAria:cc,_fnSortListener:nb,_fnSortAttachListener:fb,_fnSortingClasses:Sa,_fnSortData:bc,_fnSaveState:qa, _fnLoadState:dc,_fnImplementState:pb,_fnSettingsFromNode:Ta,_fnLog:da,_fnMap:X,_fnBindAction:ob,_fnCallbackReg:R,_fnCallbackFire:F,_fnLengthOverflow:lb,_fnRenderer:gb,_fnDataSource:Q,_fnRowAttributes:eb,_fnExtend:qb,_fnCalculateEnd:function(){}});l.fn.dataTable=u;u.$=l;l.fn.dataTableSettings=u.settings;l.fn.dataTableExt=u.ext;l.fn.DataTable=function(a){return l(this).dataTable(a).api()};l.each(u,function(a,b){l.fn.DataTable[a]=b});return u}); /*! DataTables styling integration ©2018 SpryMedia Ltd - datatables.net/license */ (function(c){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return c(a,window,document)}):"object"===typeof exports?module.exports=function(a,b){a||(a=window);b&&b.fn.dataTable||(b=require("datatables.net")(a,b).$);return c(b,a,a.document)}:c(jQuery,window,document)})(function(c,a,b,d){return c.fn.dataTable}); var propath = "/c/moraferre/img/p/"; var imgpath="/c/moraferre"; var prosuf = "-r600.jpg"; var fampath = "/c/moraferre/img/c/"; var famsuf = "-r600.jpg"; var propagination = 1; var procurrent = 0; var contadortotal = 0; var contadorposicion = 0; var iszoom = 0; var unidadesventa=["Unidad","Caja","Paquete3","Paquete4","Paquete5","Paquete6"]; var unidadesventashort=["Ud.","Caja","Paq3","Paq4","Paq5","Paq6"]; var SUCURSAL1=0; var SUCURSAL2=-1; var MINIMOVENTA=0; var MINIMOVENTADESBLOQUEO="kk"; var SALTOMENUCONUNO="1"; var OCULTARUNICAUNIDADVENTA="1"; var KFEA_TIPO="M_MODELO"; var KFEA_TIPO2="M_FAMILIA"; var KFEA_COLOR="M_IM_COLORS"; var appclient="moraferre"; var STOCKAGENTE="0"; var INICIOREFERENCIA="1"; var COBRARCARTERA="0"; var STOCKDANGER="1"; var STOCKWARNING="11"; /*dmentalsoft*/ //const { array } = require("prop-types"); const soundEffect = new Audio(); var online = 1; var swreg; //service worker var currentswversion = 0; var kcontra = ""; window.onerror = function myErrorHandler(errorMsg, url, lineNumber) { alert("Error occured: " + errorMsg); //or any message return false; }; function imgonerror() { $("img").on("error", function () { $(this).attr("src", "broken.gif"); }); } function isNumeric(str) { if (typeof str != "string") return false // we only process strings! return !isNaN(str) && // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)... !isNaN(parseFloat(str)) // ...and ensure strings of whitespace fail } function final_on() { imgonerror(); } function trimChar(string, charToRemove) { while (string.charAt(0) == charToRemove) { string = string.substring(1); } while (string.charAt(string.length - 1) == charToRemove) { string = string.substring(0, string.length - 1); } return string; } function uuidv4() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) { var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8; return v.toString(16); }); } function uuidv4_date() { thisdt = new Date(); kdt = thisdt.getFullYear().toString().substring(2, 4) + "" + (thisdt.getMonth() + 1 < 10 ? "0" : "") + (thisdt.getMonth() + 1) + "" + (thisdt.getDate() < 10 ? "0" : "") + thisdt.getDate() + "" + (thisdt.getHours() < 10 ? "0" : "") + thisdt.getHours() + "-" + (thisdt.getMinutes() < 10 ? "0" : "") + thisdt.getMinutes() + "" + (thisdt.getSeconds() < 10 ? "0" : "") + thisdt.getSeconds(); return (kdt + "-4xxx-yxxx-xxxxxxxxxxxx").replace(/[xy]/g, function (c) { var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8; return v.toString(16); }); } var drawpedidostimer = null; function isEmpty(val) { return val === undefined || val == null || val.length <= 0 ? true : false; } // For todays date; Date.prototype.today = function () { return ( (this.getDate() < 10 ? "0" : "") + this.getDate() + "/" + (this.getMonth() + 1 < 10 ? "0" : "") + (this.getMonth() + 1) + "/" + this.getFullYear() ); }; // For the time now Date.prototype.timeNow = function () { return ( (this.getHours() < 10 ? "0" : "") + this.getHours() + ":" + (this.getMinutes() < 10 ? "0" : "") + this.getMinutes() + ":" + (this.getSeconds() < 10 ? "0" : "") + this.getSeconds() ); }; // For todays date; Date.prototype.compressdt = function () { return ( this.getFullYear() + "" + (this.getMonth() + 1 < 10 ? "0" : "") + (this.getMonth() + 1) + "" + (this.getDate() < 10 ? "0" : "") + this.getDate() + "" + (this.getHours() < 10 ? "0" : "") + this.getHours() + "" + (this.getMinutes() < 10 ? "0" : "") + this.getMinutes() + "" + (this.getSeconds() < 10 ? "0" : "") + this.getSeconds() ); }; $(".buscador").hover( function () { $("#navbarlogo").hide(); }, function () { setTimeout(function () { $("#navbarlogo").show(); }, 500); } ); //alert(($( ".kcol" ).width()-545)/2); //$(".imgprocol").css("margin-left","96px"); var aproduct = null; var afam = null; var alb = null; var albformat=null; var adr = null; var pref = null; var cli = null; var cartera = null; var sts = null; var tventas = null; var ashowproducts = null; var relacionadosh = 0; var relacionadosch = 0; var relacionadoscw = 0; var cnf = null; var kanchopro = 0; var cuantoscorazones = 0; var localpedido = {}; var localcli = -1; var localag = -1; var cliag = null; var cliagstk = null; var timeoutloadlotes = null; var botoncobrarcartera=null; function loadImagePro(kthis, idpro) { if (kthis.attr("src") != kthis.attr("data-src")) { kthis.attr("src", kthis.attr("data-src")); xxx(); } } function moveproduct(k) { if (iszoom) { return; } if ($("#pro").is(":hidden")) { } else { //$("#blanco").show(); tmpprocurrent = procurrent + k; if (tmpprocurrent <= 0 || tmpprocurrent > contadortotal) { return; } procurrent = procurrent + k; if (procurrent * propagination <= ashowproducts_full.length) { fin = procurrent * propagination; init = fin - propagination; drawproductsarray(init, fin); } } } function formatearalbaranes(){ if (isEmpty(albformat)){ albformat=[]; } if (!isEmpty(alb) && alb!='vacio' ){ alb.forEach(function (k, v) { kkey=k['f'].substring(3, 4) + "" + String(k['al']).padStart(5,'0'); if ((albformat[kkey])==null){ albformat[kkey]=[]; albformat[kkey]['p']=1; albformat[kkey]['f']=k["f"]; albformat[kkey]['e']=k["e"]; albformat[kkey]['al']=k["al"]; } else{ albformat[kkey]['p'] +=1; } }); } } function xxx() { //console.log("xxx"); if (window.innerHeight > window.innerWidth) { //alert("Please use Landscape!"); Ordenar_Relacionados_Vertical(); } else { Ordenar_Relacionados_Horizontal(); } //$("#blanco").hide(); } var kaltoactual = "100%"; function Ordenar_Relacionados_Vertical() { /* anchocol = $(".kcol").width(); kanchopro = anchocol; ancho = $(".imgprocol").width() + $(".txtprocol").outerWidth() + parseInt($(".txtprocol").css('marginLeft')); $(".imgprocol").css('margin-left', parseInt((anchocol - ancho) / 2)) */ alto = $(".menufooter").offset().top - $("#separatorfixed").outerHeight() - 2; alto = parseInt(alto); alto = parseInt(alto * 0.4); kaltoactual = alto + "px"; $(".imgplist").css("max-height", alto); $(".relacionados").css("height", 0); relacionadosh = parseInt( $(".menufooter").offset().top - ($("#pro").offset().top + $("#pro").outerHeight()) ); $(".relacionados").css("height", relacionadosh); if (relacionadosh < 120) { filas = 1; } else { filas = 2; } relacionadosch = parseInt((relacionadosh - 2 * filas) / filas); relacionadoscw = parseInt(($("#pro").width() - 8 * 2) / 3); //$(".soyrelacionado").css('height', relacionadosch); $(".soyrelacionado").css("width", relacionadoscw); //console.log("gato" + parseInt($(".logistica").offset().top + $(".logistica").height()) - parseInt($(".menufooter").offset().top)); $(".soyrelacionado").css("width", relacionadoscw); } function drawconsumos() { $(".consumoproducto").each(function (index) { //console.log(index + ": " + $(this).attr("data-id")); //console.log($(this).html()) if (!isEmpty(con)) { consumo = con[$(this).attr("data-id")]; if (consumo == null) { } else { if (con[$(this).attr("data-id")][-1] == null) { } else { $(this) .children() .html(formatprice(con[$(this).attr("data-id")][-1], 0)); $(this).show(); } } } }); drawcantidadpedida(); } function drawcantidadpedida() { $(".pedidoproducto").each(function (index) { ////console.log(index + ": " + $(this).attr("data-id")); consumo = aproduct[$(this).attr("data-id")]; if (consumo == null) { $(this).hide(); } else { cantidad = dimecantidad($(this).attr("data-id")); if (cantidad == 0) { $(this).hide(); } else { $(this).html(formatprice(cantidad, 0)); $(this).show(); } } }); } var fechajson = ""; var fechajsonag = ""; function tableclientesagente(){ htmlres = ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; $.each(cliag, function (index, valor) { nom = trimChar(valor["nom"], " "); if (trimChar(valor["com"], " ") != nom && !isEmpty(valor["com"])) { nom += "
" + trimChar(valor["com"], " ") + "
"; } htmlres += ""; htmlres += "'; (""); }); htmlres += ""; htmlres += "
IDNOMBRECIUDADPAIS
" + index + "" + nom + "" + valor["city"] + "" + valor["country"] + "
"; return htmlres; } function mostrarclientesagente() { $("#MaxModalTitle").html("Clientes"); $("#MaxModal").attr("data-tipo", "clientesagente"); $("#MaxModal").modal("show"); $("#blanco").hide(); htmlres=""; if (typeof Customtableclientesagente === "function") { htmlres+=Customtableclientesagente(); } else { htmlres+=tableclientesagente(); } setTimeout(function () { transaction = midb.transaction("kli"); klis = transaction.objectStore("kli"); // (2) request = klis.openCursor(); request.onsuccess = function () { let cursor = request.result; if (cursor) { //console.log(cursor.key); $(".unkli" + cursor.key).addClass("isoffline"); cursor.continue(); } else { //console.log("No hay más libros"); } }; $("#tablecliag").DataTable({ paging: false, ordering: true, info: false, }); }, 500); $(".maxmodalbody").html(htmlres); } function utf8_to_b64(str) { return window.btoa(unescape(encodeURIComponent(str))); } function b64_to_utf8(str) { return decodeURIComponent(escape(window.atob(str))); } function loadDataClientEnd(data, isoffline) { $("#nologin").hide(); var items = []; fechajson = data["date"]; $(".fechajson").html(fechajson); aproduct = data["p"]; afam = data["f"]; apo = data["po"]; rel = data["r"]; con = data["cons_ano"]; alb = data["alb"]; adr = data["ad"]; pref = data["pref"]; cli = data["cli"]; cartera = data["cartera"]; sts = data["sts"]; tventas = data["tv"]; cnf = data["cnf"]; pst = data["pst"]; psc = data["psc"]; famfilter(); purgadatos(); $.each(aproduct, function (k, v) { if (!isEmpty(psc) && psc[k] != null) { aproduct[k]["p"] = psc[k]; } else if (!isEmpty(pst) && pst[k] != null) { aproduct[k]["p"] = pst[k]; } }); formatearalbaranes(); drawfams(-1); MapeoAcciones(); MapeoAcciones(); $("#login").hide(); $("#pro").hide(); $("#main").show(); $("#cat").show(); $(".namefamilia").hide(); $(".paginascount").hide(); $("#clisinf").html("" + cli["idmon"] + " " + cli["nom"]); if (typeof CustomPostLoadData === "function") { CustomPostLoadData(); } if (isoffline) { $("body").addClass("offline"); $("body").removeClass("online"); } else { $("body").addClass("online"); $("body").removeClass("offline"); } transaction = midb.transaction("kpd"); kpds = transaction.objectStore("kpd"); request = kpds.get(localcli); request.onerror = function () { console.error("Error", request.error); $("#blanco").hide(); loadcorazones(); }; request.onsuccess = function () { gatorrrr = request.result; if (!isEmpty(gatorrrr)) { data = gatorrrr["json"]; localpedido = JSON.parse(data); } $("#blanco").hide(); loadcorazones(); }; drawpedidostimer = setTimeout(drawpedidos, 1000); } var acliagoff = []; var cuantosklioffline = 0; var cuantoskliofflineok = 0; var cuantoskliofflineerror = 0; function DescargarClientesOffline() { acliagoff = []; cuantosklioffline = 0; cuantoskliofflineok = 0; cuantoskliofflineerror = 0; $.each(cliag, function (index, valor) { acliagoff.push(index); cuantosklioffline++; }); DescargarClientesOfflineContinua(); } function DescargarClientesOfflineContinua() { if (!cimgprogresscontinue) { return; } $(".ckliok").html(cuantoskliofflineok); $(".cklierror").html(cuantoskliofflineerror); $(".cklitotal").html(cuantosklioffline); $(".cklip").html(cuantoskliofflineok + cuantoskliofflineerror); tmpxx = cuantoskliofflineok + cuantoskliofflineerror; porcent = Math.round((tmpxx * 100) / cuantosklioffline); $("#kliprogress").attr("aria-valuenow", porcent); $("#kliprogress").attr("style", "width: " + porcent + "%"); $("#kliprogress").html(porcent + "%"); if (acliagoff.length > 0) { LoadDataForOffline(acliagoff.pop(), "json"); } } function BorrarClientesOffline() { transaction = midb.transaction("kli", "readwrite"); klis = transaction.objectStore("kli"); // (2) klis.clear(); } function LoadDataForOffline(kcli, cual) { tmph = localag + "|" + kcli + "|" + currentswversion + "|" + kcontra; tmph = utf8_to_b64(tmph); $.ajax({ dataType: "json", url: cual + "/" + kcli, headers: { "X-Myapp-Nonce": tmph, }, }) .done(function (data) { if (data["OK"] > 0) { //localStorage.setItem("kli" + kcli, JSON.stringify(data)); transaction = midb.transaction("kli", "readwrite"); klis = transaction.objectStore("kli"); // (2) kliinsert = { id: kcli, json: data }; request = klis.put(kliinsert); // (3) request.onsuccess = function () { // (4) cuantoskliofflineok++; DescargarClientesOfflineContinua(); }; request.onerror = function () { console.log("Error", request.error); console.log(kcli + "KO 7"); cuantoskliofflineerror++; DescargarClientesOfflineContinua(); }; } else { console.log(kcli + "KO 1"); cuantoskliofflineerror++; DescargarClientesOfflineContinua(); } }) .fail(function (jqXHR, textStatus, xhr) { console.log(kcli + "KO 2"); cuantoskliofflineerror++; DescargarClientesOfflineContinua(); }); } function LoadData(kcli, cual) { $("#MaxModal").modal("hide"); $("#blanco").show(); $(".ncart").hide(); if (kcli.startsWith("ag")) { tmph = kcli.substring(2, 1000) + "|" + "-1" + "|" + currentswversion + "|" + kcontra; tmph = utf8_to_b64(tmph); $.ajax({ dataType: "json", url: cual + "/" + kcli, headers: { "X-Myapp-Nonce": tmph, }, }) .done(function (data) { if (data["OK"] > 0) { transaction = midb.transaction("kli", "readwrite"); klis = transaction.objectStore("kli"); // (2) kliinsert = { id: kcli, json: data }; request = klis.put(kliinsert); // (3) cliag = data["c"]; fechajson = data["date"]; localag = kcli.substring(2, 1000); if (STOCKAGENTE == "1" && localag > 0) { cliagstk = data["s"]; } mostrarclientesagente(); $(".soloagente").show(); $("#nologin").hide(); } else { $("#login").show(); $("#blanco").hide(); $("#nologin").show(); } }) .fail(function (data, rescode) { transaction = midb.transaction("kli"); klis = transaction.objectStore("kli"); request = klis.get(kcli); request.onerror = function () { console.error("Error", request.error); $("#login").show(); $("#blanco").hide(); $("#nologin").show(); }; request.onsuccess = function () { gatorrrr = request.result; if (!isEmpty(gatorrrr)) { data = gatorrrr["json"]; cliag = data["c"]; fechajson = data["date"]; localag = kcli.substring(2, 1000); if (STOCKAGENTE == "1" && localag > 0) { cliagstk = data["s"]; } $(".soloagente").show(); mostrarclientesagente(); $("#nologin").hide(); } else { $("#login").show(); $("#blanco").hide(); $("#nologin").show(); } // continúa trabajando con la base de datos usando el objeto db }; }); /* $.getJSON(cual + "/" + kcli, function (data) { =data['c']; fechajson=data['date']; localag=kcli.substring(2, 1000); mostrarclientesagente(); }).fail(function() { $("#login").show(); $("#blanco").hide(); $('#nologin').show(); }); */ } else { tmph = localag + "|" + kcli + "|" + currentswversion + "|" + kcontra; tmph = utf8_to_b64(tmph); $.ajax({ dataType: "json", url: cual + "/" + kcli, headers: { "X-Myapp-Nonce": tmph, }, }) .done(function (data) { if (data["OK"] > 0) { transaction = midb.transaction("kli", "readwrite"); klis = transaction.objectStore("kli"); // (2) kliinsert = { id: kcli, json: data }; request = klis.put(kliinsert); // (3) localcli = kcli; loadDataClientEnd(data, 0); } else { $("#login").show(); $("#blanco").hide(); $("#nologin").show(); } }) .fail(function (jqXHR, textStatus, xhr) { transaction = midb.transaction("kli"); klis = transaction.objectStore("kli"); request = klis.get(kcli); request.onerror = function () { console.error("Error", request.error); $("#login").show(); $("#blanco").hide(); $("#nologin").show(); }; request.onsuccess = function () { gatorrrr = request.result; if (!isEmpty(gatorrrr)) { data = gatorrrr["json"]; localcli = kcli; loadDataClientEnd(data, 1); } else { $("#login").show(); $("#blanco").hide(); $("#nologin").show(); } // continúa trabajando con la base de datos usando el objeto db }; }); } if(COBRARCARTERA=='1' && localag > 0){ $('#botoncobros').show(); } else{ $('#botoncobros').hide(); } } /* function listenForWaitingServiceWorker(reg, callback) { function awaitStateChange() { reg.installing.addEventListener('statechange', function() { if (this.state === 'installed') callback(reg); }); } if (!reg) return; if (reg.waiting) return callback(reg); if (reg.installing) awaitStateChange(); reg.addEventListener('updatefound', awaitStateChange); } // reload once when the new Service Worker starts activating var refreshing; navigator.serviceWorker.addEventListener('controllerchange', function() { if (refreshing) return; refreshing = true; window.location.reload(); } ); function promptUserToRefresh(reg) { // this is just an example // don't use window.confirm in real life; it's terrible if (window.confirm("New version available! OK to refresh?")) { reg.waiting.postMessage('skipWaiting'); } } listenForWaitingServiceWorker(reg, promptUserToRefresh); */ function updatesw() { swreg.unregister().then((unregResult) => { if (navigator.app) { navigator.app.exitApp(); } window.location.reload(); }); } function drawcontador() { $(".paginascount").html(contadorposicion + 1 + "/" + contadortotal); } function Ordenar_Relacionados_Horizontal() { if ($(".logistica").length) { /* anchocol = $(".kcol").width(); kanchopro = anchocol; ancho = $(".imgprocol").width() + $(".txtprocol").outerWidth() + parseInt($(".txtprocol").css('marginLeft')); $(".imgprocol").css('margin-left', parseInt((anchocol - ancho) / 2)) */ $(".relacionados").css("height", 0); relacionadosh = parseInt( $(".menufooter").offset().top - $("#pro").offset().top ); $(".relacionados").css("height", relacionadosh); relacionadosw = parseInt($(".relacionados").width() - 20); if (relacionadosw < 560) { filas = 3; } else { filas = 3; } //relacionadosch=parseInt((relacionadosh-2*filas)/filas); relacionadoscw = parseInt(($(".relacionados").width() - 20) / filas); //$(".soyrelacionado").css('height', relacionadosch); $(".soyrelacionado").css("width", relacionadoscw); dif = parseInt($(".logistica").offset().top + $(".logistica").height()) - parseInt($(".menufooter").offset().top); kaltoactual = "100%"; if (dif > 0) { //console.log("Resto imagen"); maxhimg = parseInt($(".imgplist").height()) - (dif + 10); $(".imgplist").css("max-width", maxhimg); } } } $(window).resize(function () { anchocol = $(".kcol").width(); if (kanchopro != anchocol) { kanchopro = anchocol; xxx(); } }); var EsTactil = 0; var midb; $(document).ready(function () { supportsTouchx = "ontouchstart" in window || navigator.msMaxTouchPoints; if (!isEmpty(supportsTouchx) || supportsTouchx == true) { EsTactil = 1; } $("body").addClass("tactil" + EsTactil); imgonerror(); /* if ('serviceWorker' in navigator) { navigator.serviceWorker .register('/n/sw.js') .then(() => { console.log('Service Worker Registered'); }); } */ var midbopenrequest = indexedDB.open("db" + appclient, 4); // crea/actualiza la base de datos sin chequeo de versiones midbopenrequest.onupgradeneeded = function () { midb = midbopenrequest.result; if (!midb.objectStoreNames.contains("kli")) { // si no hay un almacén de libros ("books"), midb.createObjectStore("kli", { keyPath: "id" }); // crearlo } if (!midb.objectStoreNames.contains("kpd")) { // si no hay un almacén de libros ("books"), midb.createObjectStore("kpd", { keyPath: "id" }); // crearlo } if (!midb.objectStoreNames.contains("khe")) { // si no hay un almacén de libros ("books"), midb.createObjectStore("khe", { keyPath: "id" }); // crearlo } if (!midb.objectStoreNames.contains("kpds")) { // si no hay un almacén de libros ("books"), var objectStore = midb.createObjectStore("kpds", { keyPath: "id", autoIncrement: true, }); // crearlo objectStore.createIndex("idcli", "idcli", { unique: false }); } }; midbopenrequest.onerror = function () { console.error("Error", midbopenrequest.error); }; midbopenrequest.onsuccess = function () { midb = midbopenrequest.result; // continúa trabajando con la base de datos usando el objeto db }; // make the whole serviceworker process into a promise so later on we can // listen to it and in case new content is available a toast will be shown window.isUpdateAvailable = new Promise(function (resolve, reject) { // lazy way of disabling service workers while developing if ( "serviceWorker" in navigator && ["localhost", "127"].indexOf(location.hostname) === -1 ) { // register service worker file navigator.serviceWorker .register("sw.php") .then((reg) => { swreg = reg; reg.onupdatefound = () => { const installingWorker = reg.installing; installingWorker.onstatechange = () => { console.log("Instalando Worker"); switch (installingWorker.state) { case "installed": if (navigator.serviceWorker.controller) { console.log("UPDATE"); alert( "Hay una actulizacion Reinicie el programa por favor" ); resolve(true); } else { console.log("NOUPDATE"); // no update available resolve(false); } break; } }; }; console.log("Registration succeeded. Scope is " + reg.scope); $.getJSON("swversion", function (data) { currentswversion = data["swversion"]; $(".swversionn").html(data["swversion"]); if ($("#hwversion").html() != data["swversion"]) { $(".updateversion").show(); } }); }) .catch((err) => console.error("[SW ERROR]", err)); } }); setInterval(function () { $.getJSON("swversion", function (data) { currentswversion = data["swversion"]; $(".swversionn").html(data["swversion"]); if ($("#hwversion").html() != data["swversion"]) { $(".updateversion").show(); } }).fail(function (event, jqxhr, exception) { if (event.status == 404) { window.location.reload(); } }); }, 3000); // Update: // this also can be incorporated right into e.g. your run() function in angular, // to avoid using the global namespace for such a thing. // because the registering of a service worker doesn't need to be executed on the first load of the page. /* window.addEventListener("beforeinstallprompt", function(e) { // log the platforms provided as options in an install prompt console.log(e.platforms); // e.g., ["web", "android", "windows"] e.userChoice.then(function(choiceResult) { console.log(choiceResult.outcome); // either "accepted" or "dismissed" }, handleError); }); */ /* window.addEventListener('beforeinstallprompt', (e) => { alert("gato"); // Prevent Chrome 67 and earlier from automatically showing the prompt e.preventDefault(); // Stash the event so it can be triggered later. deferredPrompt = e; // Update UI to notify the user they can add to home screen $("#installapp").show(); $("#installapp").click(function () { $("#installapp").hide(); // Show the prompt deferredPrompt.prompt(); // Wait for the user to respond to the prompt deferredPrompt.userChoice.then((choiceResult) => { if (choiceResult.outcome === 'accepted') { console.log('User accepted the A2HS prompt'); } else { console.log('User dismissed the A2HS prompt'); } deferredPrompt = null; }); }); }); */ document.onkeydown = checkKey; $("#pro").on("swipeleft", function () { moveproduct(1); }); $("#pro").on("swiperight", function () { moveproduct(-1); }); $(document).bind("touchmove", function (e) { e.preventDefault(); }); document.addEventListener("touchmove", function (event) { event.preventDefault(); }); // later on when you actually want to play a sound at any point without user interaction soundEffect.src = "./sound/click.ogg"; var win = $(window); $("#buscador").submit(function (event) { //console.log("busco"); buscador($("#search").val()); event.preventDefault(); }); /* // Each time the user scrolls win.scroll(function () { alert("xxx"); // End of the document reached? //$(".debug").html($(document).height() + ' ' + win.height() + ' ' + win.scrollTop() + ' ' + screen.availHeight); if (($(document).height() - win.height()) - 40 < win.scrollTop()) { if ($('#pro').is(':hidden')) { alert("fin"); } else { $('.rowpro').html(""); if (procurrent * propagination < ashowproducts.length) { procurrent = procurrent + 1; fin = procurrent * propagination; init = fin - propagination; drawproductsarray(init, fin); } } } }); */ MapeoAcciones(); }); function MapeoAcciones() { $(".action").off("click"); $(".action").click(function () { ActionClick($(this)); }); $("img").off("error"); $("img").on("error", function () { $(this).attr("src", "/img/offline.jpg"); }); } function draweconomia(direccion) { economia = ""; m0 = 0; m1 = 0; y0 = 0; y1 = 0; m0_0 = 0; m1_0 = 0; y0_0 = 0; y1_0 = 0; m0_2 = 0; m1_2 = 0; y0_2 = 0; y1_2 = 0; classeco = ""; if (direccion >= 0) { classeco = " ecodirect"; } sts.forEach(function (k, v) { if ((direccion >= 0 && parseInt(k["e"]) == direccion) || direccion == -1) { if (k["t"] == "M0") { m0 += parseInt(k["b"]); if (parseInt(k["s"]) == 0) { m0_0 += parseInt(k["b"]); } else { m0_2 += parseInt(k["b"]); } } if (k["t"] == "M1") { m1 += parseInt(k["b"]); if (parseInt(k["s"]) == 0) { m1_0 += parseInt(k["b"]); } else { m1_2 += parseInt(k["b"]); } } if (k["t"] == "Y0") { y0 += parseInt(k["b"]); if (parseInt(k["s"]) == 0) { y0_0 += parseInt(k["b"]); } else { y0_2 += parseInt(k["b"]); } } if (k["t"] == "Y1") { y1 += parseInt(k["b"]); if (parseInt(k["s"]) == 0) { y1_0 += parseInt(k["b"]); } else { y1_2 += parseInt(k["b"]); } } } }); m = parseInt((100 * m0) / m1) - 100; y = parseInt((100 * y0) / y1) - 100; m_0 = parseInt((100 * m0_0) / m1_0) - 100; y_0 = parseInt((100 * y0_0) / y1_0) - 100; m_2 = parseInt((100 * m0_2) / m1_2) - 100; y_2 = parseInt((100 * y0_2) / y1_2) - 100; if (isNaN(m)) m = 100; if (isNaN(y)) y = 100; if (isNaN(m_0)) m_0 = 100; if (isNaN(y_0)) y_0 = 100; if (isNaN(m_2)) m_2 = 100; if (isNaN(y_0)) y_0 = 100; if (m > 0) { m = "+" + m + "%"; } else { m = "" + m + "%"; } if (y > 0) { y = "+" + y + "%"; } else { y = "" + y + "%"; } if (m_0 > 0) { m_0 = "+" + m_0 + "%"; } else { m_0 = "" + m_0 + "%"; } if (y_0 > 0) { y_0 = "+" + y_0 + "%"; } else { y_0 = "" + y_0 + "%"; } if (m_2 > 0) { m_2 = "+" + m_2 + "%"; } else { m_2 = "" + m_2 + "%"; } if (y_2 > 0) { y_2 = "+" + y_2 + "%"; } else { y_2 = "" + y_2 + "%"; } economia += ""; economia += ""; //economia += ""; //economia += ""; economia += ""; economia += "
SucursalAño Natural ActualAño Natural AnteriorAño en curso ActualAño en curso Anterior
Empresa2" + formatprice(m0_2, 0) + "" + formatprice(m1_2, 0) + "" + m_2 + "" + formatprice(y0_2, 0) + "" + formatprice(y1_2, 0) + "" + y_2 + "
Empresa0" + formatprice(m0_0, 0) + "" + formatprice(m1_0, 0) + "" + m_0 + "" + formatprice(y0_0, 0) + "" + formatprice(y1_0, 0) + "" + y_0 + "
GENERAL" + formatprice(m0, 0) + "" + formatprice(m1, 0) + "" + m + "" + formatprice(y0, 0) + "" + formatprice(y1, 0) + "" + y + "
"; return economia; } function pad(num, size) { num = num.toString(); while (num.length < size) num = "0" + num; return num; } function findcantidadtventas(idp) { tventas[2].forEach(function (k, v) { idprotmp = productbyref(k["a"]); if (idprotmp != -1) { if (idprotmp == idp) { return k["t"]; } } }); tventas[0].forEach(function (k, v) { idprotmp = productbyref(k["a"]); if (idprotmp != -1) { if (idprotmp == idp) { return k["t"]; } } }); return; } //variables para la descarga de imganes var cuantasloaded = 0; var cuantas = 0; var cuantaserror = 0; var cuantastotal = 0; var cimgprogresscontinue = 0; function loadimgcache(donde) { if (cimgprogresscontinue == 0) { return; } dondefin = donde + 20; cuantosp = Object.keys(aproduct).length; if (donde == 0) { $("span.cimgtotal").html(cuantosp); cuantastotal = cuantosp; } nocontinuo = 0; if (dondefin > cuantosp) { nocontinuo = 1; dondefin = cuantosp; } for (i = donde; i < dondefin; i++) { cuantas += 1; var tmp = new Image(); tmp.onload = function () { cuantasloaded += 1; updatecimgprogress(); if (cuantasloaded + cuantaserror == cuantas) { if (nocontinuo == 0) { setTimeout(function () { loadimgcache(donde + 20); }, 100); } } //console.log(cuantas + " -> " + cuantasloaded); }; tmp.onerror = function () { cuantaserror += 1; updatecimgprogress(); if (cuantasloaded + cuantaserror == cuantas) { if (nocontinuo == 0) { setTimeout(function () { loadimgcache(donde + 20); }, 100); } } }; tmp.src = getpimg(aproduct[Object.keys(aproduct)[i]]["im"]); //console.log(cuantas + " -> " + cuantasloaded); $("span.cimg").html(cuantas); } } function updatecimgprogress() { tmpxx = cuantasloaded + cuantaserror; porcent = Math.round((tmpxx * 100) / cuantastotal); $("span.cimgok").html(cuantasloaded); $("span.cimgerror").html(cuantaserror); $("#imgprogress").attr("aria-valuenow", porcent); $("#imgprogress").attr("style", "width: " + porcent + "%"); $("#imgprogress").html(porcent + "%"); } function ActionClick(object) { att = object.attr("data-action"); $("#MenuModal").modal("hide"); if (att == "familia") { window.scrollTo(0, 0); kfam = object.attr("data-id"); $("#cat").hide(); $("#pro").hide(); $("#prolist").show(); $("#OptionModal").modal("hide"); drawproductsfam(kfam); //drawproductsfamlist(kfam); } else if (att == "productgoto") { kfam = object.attr("data-famid"); kproduct = object.attr("data-productid"); gotoproduct(kfam, kproduct, kproduct); } else if (att == "login") { window.scrollTo(0, 0); kcontra = $("#kpass").val(); LoadData($("#kusuario").val(), "json"); /* $("#login").hide(); $("#pro").hide(); $("#main").show(); $("#cat").show(); $('.namefamilia').hide(); $('.paginascount').hide(); */ } else if (att == "familiatit") { kfam = object.attr("data-id"); drawfams(kfam); } else if (att == "inicio") { drawfams(-1); $("#login").hide(); $("#pro").hide(); $("#main").show(); $("#cat").show(); $(".namefamilia").hide(); $(".paginascount").hide(); } else if (att == "logout") { window.scrollTo(0, 0); $("#login").show(); $("#pro").hide(); $("#main").hide(); $("#cat").hide(); localag = "-1"; cliag = null; cliagstk = null; localcli = null; $(".soloagente").hide(); } else if (att == "test") { alert( $(document).height() + " -> " + $(window).height() + " -> " + $(window).scrollTop() ); } else if (att == "plus") { moveproduct(1); } else if (att == "minus") { moveproduct(-1); } else if (att == "menu") { $("#MenuModal").modal("show"); } else if (att == "familias") { drawfams(-1); } else if (att == "buscar") { $("#BuscaModal").modal("show"); } else if (att == "reload") { //window.scrollTo(0, 0); //$("#blanco").show(); //LoadData($("#kusuario").val(), "jsonr"); $("#MaxModalTitle").html("Reload Imgs"); $("#MaxModal").attr("data-tipo", "reloadimgs"); $("#MaxModal").modal("show"); htmlres = ""; cuantas = 0; cuantasloaded = 0; cuantaserror = 0; htmlres = ""; htmlres += '
0%
'; htmlres += "
"; htmlres += '0  '; htmlres += '0  '; htmlres += '0  '; htmlres += '0'; htmlres += "
"; htmlres += ""; if (localag > 0) { htmlres += "

"; htmlres += '
0%
'; htmlres += "
"; htmlres += '0  '; htmlres += '0  '; htmlres += '0  '; htmlres += '0'; htmlres += "
"; htmlres += ""; htmlres += "

"; htmlres += ""; } $(".maxmodalbody").html(htmlres); cuantasloaded = 0; cuantas = 0; cuantaserror = 0; cuantastotal = 0; cimgprogresscontinue = 1; $("#MaxModal").on("hidden.bs.modal", function (e) { $("#MaxModal").off("hidden.bs.modal"); cimgprogresscontinue = 0; }); /* setTimeout(function () { loadimgcache(0); }, 200); */ } else if (att == "tools") { $("#MaxModalTitle").html("Herramientas"); $("#MaxModal").attr("data-tipo", "herramientas"); $("#MaxModal").modal("show"); htmlres = "Espacio Ocupado:" + localStorageSpace(); htmlres += "
Chequer Espacio:
"; htmlres += "

"; htmlres += window.localStorage.remainingSpace; htmlres += "
"; htmlres += "document.body.client:" + document.body.clientWidth + "x" + document.body.clientHeight + "
"; htmlres += "screen:" + screen.width + "x" + screen.height + "
"; htmlres += "screen.avail:" + screen.availWidth + "x" + screen.availHeight + "
"; htmlres += "window.inner:" + window.innerWidth + "x" + window.innerHeight + "
"; htmlres += "window.outer:" + window.outerWidth + "x" + window.outerHeight + "
"; htmlres += "
"; supportsTouch = "ontouchstart" in window || navigator.msMaxTouchPoints; htmlres += "Touch:" + supportsTouch + "
"; htmlres += "Touch Init:" + EsTactil + "
"; /* document.body.clientHeight // Inner height of the HTML document body, including padding // but not the horizontal scrollbar height, border, or margin screen.height // Device screen height (i.e. all physically visible stuff) screen.availHeight // Device screen height minus the operating system taskbar (if present) window.innerHeight // The current document's viewport height, minus taskbars, etc. window.outerHeight */ $(".maxmodalbody").html(htmlres); } else if (att == "buscador") { kbusco = $("#kbusco").val(); buscador(kbusco); } else if (att == "heart") { $("#MaxModalTitle").html("Favoritos"); $("#MaxModal").attr("data-tipo", "favoritos"); $("#MaxModal").modal("show"); itemsheart = []; $.each(aproduct, function (key, val) { //console.log(key); //console.log(val); heart = val["cz"]; if (heart == 1) { itemsheart.push(key); } }); tittemp = ''; tittemp += " Favoritos [" + itemsheart.length + "]"; tittemp += ''; $("#MaxModalTitle").html(tittemp); htmlres = ""; $.each(itemsheart, function (key, val) { //console.log(key + " <<>> " + val); htmlres += DrawProductList2(val); }); htmlres += ""; htmlres = gettablehead("tableheart") + htmlres; $(".maxmodalbody").html(htmlres); if (STOCKAGENTE == "1" && localag > 0) { $.each(itemsheart, function (key, val) { //console.log(key + " <<>> " + val); loadlotes(val); }); } } else if (att == "cartera") { $("#MaxModalTitle").html("Cartera Cliente"); $("#MaxModal").attr("data-tipo", "Cartera"); $("#MaxModal").modal("show"); hayheader = 0; htmlres = ""; moneda = "€"; importe = 0; htmlres += '
'; htmlrestemp="No hay Cartera"; if(COBRARCARTERA=='1' && localag > 0){ htmlrestemp+= "

"; } $(".maxmodalbody").html(htmlrestemp); if (!isEmpty(cartera) && cartera != "vacio") { cartera.forEach(function (k, v) { if (k["SUCURSAL"] == SUCURSAL1 || SUCURSAL1== -1 ) { if (hayheader == 0) { htmlres += headercartera(0); hayheader = 1; } importe += parseFloat(k["IMPORTE"]); htmlres += "" + pad(k["ENVIO"], 2) + "*" + k["FECHA"] + "" + k["VENCIMIENTO"] + "" + k["FACTURA"] + "" + formatprice(k["IMPORTE"], 2) + ""; htmlres += ""; if (k["REC"] == 1) { htmlres += ''; } htmlres += ""; if (k["FACTURA"] != "") { htmlres += ''; } if(COBRARCARTERA=='1' && localag > 0){ htmlres+= ""; } htmlres += ""; if (!isEmpty(k["NOTAS"])) { htmlres += ""; htmlres += "" + k["NOTAS"] + ""; htmlres += ""; } else { htmlres += ""; htmlres += ""; htmlres += ""; } } }); if (hayheader == 1) { htmlres += footercartera(importe, moneda, 0); htmlres += "
"; } hayheader = 0; importe = 0; moneda = "€"; cartera.forEach(function (k, v) { if (k["SUCURSAL"] == SUCURSAL2 && SUCURSAL1!= -1) { if (hayheader == 0) { htmlres += headercartera(2); hayheader = 1; } importe += parseFloat(k["IMPORTE"]); htmlres += "" + pad(k["ENVIO"], 2) + "*" + k["FECHA"] + "" + k["VENCIMIENTO"] + "" + k["FACTURA"] + "" + formatprice(k["P_DTO_ESP"], 2) + "" + formatprice(k["P_DTO_PP"], 2) + "" + formatprice(k["IMPORTE"], 2) + ""; htmlres += ""; if (k["REC"] == 1) { htmlres += ''; } htmlres += ""; if (k["FACTURA"] != "") { htmlres += ''; } htmlres += ""; if (!isEmpty(k["NOTAS"])) { htmlres += ""; htmlres += "" + k["NOTAS"] + ""; htmlres += ""; } else { htmlres += ""; htmlres += ""; htmlres += ""; } } }); if (hayheader == 1) { htmlres += footercartera(importe, moneda, 2); } if(COBRARCARTERA=='1' && localag > 0){ htmlres+= "

"; } htmlres += "
"; htmlres += "
"; htmlres += GetDirecciones(); $(".maxmodalbody").html(htmlres); MapeoAcciones(); } } else if (att == "albaranes") { $("#MaxModalTitle").html("Albaranes Cliente"); $("#MaxModal").attr("data-tipo", "Albaranes"); $("#MaxModal").modal("show"); $(".maxmodalbody").html("Cargando Albaranes ...."); htmlres=""; albformat.forEach(function (k, v) { htmlres = ""+k['al']+""+k['f']+""+k['p']+""+k['e']+"*" + htmlres; }); htmlres="" + htmlres; htmlres +="
NumeroFechaLineasDireccion
"; htmlres += "
"; htmlres += GetDirecciones(); $(".maxmodalbody").html(htmlres); MapeoAcciones(); } else if (att == "infocliente") { $("#MaxModalTitle").html("Informacion Cliente"); $("#MaxModal").modal("show"); tarifas = ""; /* Forma de pago: 1 PAGARE a 30 c Dto. Comercial: 0 d Dto. Comercial 2: 0 e Dto. Especial: 17.35 f Dto. Pronto Pago: 5 g */ tarifas += ""; /*la tarifa solo la vera el comercial*/ /*tarifas += "";*/ tarifas += ""; tarifas += ""; tarifas += ""; tarifas += ""; tarifas += ""; tarifas += ""; tarifas += "
Tarifa:" + cli['gro'] + "
Agente:" + cli["idag"] + "
Forma de pago:" + cli["more"]["c"] + "
DTO LINEA 1:" + formatprice(cli["more"]["d"], 2) + " %
DTO LINEA 2:" + formatprice(cli["more"]["e"], 2) + " %
Dto. Especial:" + formatprice(cli["more"]["f"], 2) + " %
Dto. Pronto Pago:" + formatprice(cli["more"]["g"], 2) + " %
"; facturacion = ""; /* Forma de pago: 1 PAGARE a 30 c Dto. Comercial: 0 d Dto. Comercial 2: 0 e Dto. Especial: 17.35 f Dto. Pronto Pago: 5 g */ facturacion += ""; facturacion += ""; facturacion += ""; facturacion += ""; facturacion += ""; facturacion += ""; facturacion += ""; facturacion += ""; facturacion += ""; facturacion += ""; facturacion += "
Razon Social:" + cli["nom"] + "
Nombre Comercial:" + cli["com"] + "
CIF:" + cli["cif"] + "
Direccion:" + "-" + "
Poblacion:" + cli["city"] + "
Provincia:" + "-" + "
Pais:" + "-" + "
Telefono:" + "-" + "
EMail:" + cli["mail"] + "
"; direcciones = ""; direcciones += ""; adr.forEach(function (k, v) { direcciones += ""; direcciones += ""; direcciones += ""; direcciones += ""; direcciones += ""; direcciones += ""; direcciones += ""; direcciones += ""; direcciones += ""; //direcciones += "" + k["ali"].substring(1) + "* : " + k["ad"] + ", " + k["cp"] + ", " + k["city"] + ", " + k["pais"] + "
"; }); direcciones += "
Direccion " + k["ali"].substring(1) + "
Nombre:" + k["company"] + "
Direccion:" + k["ad"] + "
CP.:" + k["cp"] + "
Ciudad:" + k["city"] + "
Pais:" + k["pais"] + "
Telefono 1:" + k["phone"] + "
Telefono 2:" + k["phone_mobile"] + "
"; economia = ""; economia += draweconomia(-1); adr.forEach(function (k, v) { economia += "
"; economia += "
DIRECCION " + k["ali"].substring(1) + " (" + k["ad"] + " " + k["cp"] + " " + k["city"] + ")
"; economia += draweconomia(parseInt(k["ali"].substring(1))); }); tv = ""; tv += ""; tventas[0].forEach(function (k, v) { //if(productbyref(k["a"])!=-1){ tv += ""; //} }); tv += "
" + k["a"] + "" + productbyref(k["a"]) + "" + k["t"] + "" + k["p"] + "
"; tv = "
"; tv += ""; tventas[2].forEach(function (k, v) { //if(productbyref(k["a"])!=-1){ tv += ""; //} }); tv += "
" + k["a"] + "" + productbyref(k["a"]) + "" + k["t"] + "" + k["p"] + "
"; tventasa = []; tventas[0].forEach(function (k, v) { idprotmp = productbyref(k["a"]); if (idprotmp != -1) { tventasa.push(idprotmp); } }); tv_2 = ""; $.each(tventasa, function (key, val) { //console.log(key + " <<>> " + val); tv_2 += DrawProductList2(val); }); tv_2 += ""; tv_2 = gettablehead("tabletv") + tv_2; htmlres = `
` + economia + `
` + facturacion + `
` + direcciones + `
`; $(".maxmodalbody").html(htmlres); //$('div.plist[data-id="' + idp + '"]').find('div.listUnidades').html(formatprice(ori, 0)) /*$("table.tabletv tr").each(function () { idp=$(this).attr("data-id"); if(idp!==undefined) { $(this).find('.refaddon').html(findcantidadtventas(idp)); } }); */ tventas[2].forEach(function (k, v) { idprotmp = productbyref(k["a"]); if (idprotmp != -1) { $('table.tabletv tr[data-id="' + idprotmp + '"]') .find(".refaddon") .html("[" + formatprice(k["t"], 0) + "]"); } }); tventas[0].forEach(function (k, v) { idprotmp = productbyref(k["a"]); if (idprotmp != -1) { $('table.tabletv tr[data-id="' + idprotmp + '"]') .find(".refaddon") .html("[" + formatprice(k["t"], 0) + "]"); } }); } else if (att == "cart") { $("#MaxModalTitle").html("Pedido"); $("#MaxModal").attr("data-tipo", "pedido"); $("#MaxModal").modal("show"); itemsheart = []; itemsheart = ordenarproductos(getlistapedidos()); tittemp = ''; tittemp += " Pedido [" + itemsheart.length + "]"; $("#MaxModalTitle").html(tittemp); htmlres = ""; totaldinero = 0; volumentotal = 0; $.each(itemsheart, function (key, val) { //console.log(key + " <<>> " + val); htmlres += DrawProductList2(val); totaldinero += getTotalLinea(val); volumentotal += (getVolume(val) * dimecantidad(val)) / getFloatProductValue(val, "u5"); }); htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; if (STOCKAGENTE == "1" && localag > 0) { htmlres += ""; } htmlres += "TOTAL"; htmlres += "" + formatprice(totaldinero, 2) + ""; //htmlres += ""; htmlres += ""; /* htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += "Volumen"; htmlres += "" + formatprice(volumentotal, 2) + ""; //htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += "" + formatprice(volumentotal * 100 / 20, 1) + " %"; //htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += "" + formatprice(volumentotal * 100 / 40, 1) + " %"; //htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += "" + formatprice(volumentotal * 100 / 80, 1) + " %"; //htmlres += ""; htmlres += ""; */ htmlres += ""; htmlres += '
' + totaldinero + "
"; htmlres = gettablehead("tablepedido") + htmlres; htmlres += '"; htmlres += '
Notas
'; htmlres += '
'; htmlres += 'Nota
Pedido
'; htmlres += '"; htmlres += "
"; htmlres += '
'; htmlres += 'Nota
Interna
'; htmlres += '"; htmlres += "
"; htmlres += '
Direcciones
'; htmlres += '
'; adr.forEach(function (k, v) { htmlres += '
'; htmlres += ''; htmlres += '"; htmlres += "
"; }); htmlres += "
"; htmlres += '
'; htmlres += ""; htmlres += ""; $(".maxmodalbody").html(htmlres); if (STOCKAGENTE == "1" && localag > 0) { $.each(itemsheart, function (key, val) { //console.log(key + " <<>> " + val); loadlotes(val); }); } $("#direccionespedidos div input[type=radio][name=dire]").change( function () { validatepedido(); } ); $("input[name=pedidominimopass]").change(function () { validatepedido(); }); //$(".action").off("click"); $("#EnvioPedido").click(function () { if (validatepedido() > 0) { return; } console.log("Envio Pedido"); kdir = -1; notaped = "-1xx"; notapedint = "-1xx"; if ($("#direccionespedidos div input:checked")) { kdir = $("#direccionespedidos div input:checked").val(); } if (kdir == -1) { return; } notaped = $("#notaped").val(); notapedint = $("#notapedint").val(); //alert(notapedint); //alert(kdir); if (isEmpty(localpedido["c"])) { localpedido["c"] = {}; } newDate = new Date(); curdatetime = newDate.compressdt(); localpedido["c"].np = notaped; localpedido["c"].npi = notapedint; localpedido["c"].d = kdir; localpedido["c"].dt = curdatetime; localpedido["c"].ag = localag; localpedido["c"].cl = localcli; localpedido["c"].clid = cli["id"]; localpedido["c"].cln = cli["nom"]; if (isEmpty(localpedido["c"].ui)) { localpedido["c"].ui = uuidv4_date(); } localpedido["c"].custom = {}; $(".customcampfact").each(function (index) { localpedido["c"].custom[$(this).attr("name")] = $(this).val(); }); SaveLocalStorage(); $("#blanco").show(); purgapedidosa0(); var jqxhr = $.post("newpedido.php", { data: JSON.stringify(localpedido) }) .done(function (data) { if (data == localpedido["c"].ui) { DisplayPedidoOK(); } else { DisplayPedidoKO("ERROR: " + data); } }) .fail(function (xhr, status, error) { DisplayPedidoKO("error: " + xhr.status + "\r\n No se ha podido enviar el pedido, compruebe su conexion a internet"); }) .always(function (data) {}); }); if (typeof CustomFormPedido === "function") { CustomFormPedido(); } else { $("#EnvioPedido").show(); } validatepedido(); } else if (att == "cambiarcliente") { mostrarclientesagente(); } else if (att == "cobrarcartera"){ if(object.data('ejercicio')!="0"){ botoncobrarcartera=object; } else{ botoncobrarcartera=null; } $("#modalcobros").modal("show"); $("#fccantidad").val(object.data('importe')); $("#fcejercicio").val(object.data('ejercicio')); $("#fcsucursal").val(object.data('sucursal')); $("#fccartera").val(object.data('cartera')); $("#fccomentarios").val(''); $("#procesarcobrofin").show(); $("#cobroresult").html(''); } else if (att == "procesarcobrofin"){ $("#cobroresult").html(''); person=$("#fccantidad").val().replace(",", "."); if(isNumeric(person)){ $("#procesarcobrofin").hide(); $.ajax({ dataType: "json", url: 'cobros.php?a='+ localag + "&c=" + localcli + "&ej=" + $("#fcejercicio").val() + "&s=" + $("#fcsucursal").val() + "&ctr=" + $("#fccartera").val()+ "&cnt=" + person + "&tc=" + $("#fctipocobro").val()+ "&com=" + utf8_to_b64($("#fccomentarios").val()) , headers: { "X-Myapp-Nonce": tmph, }, }) .done(function (data) { if (data["OK"] > 0) { $("#cobroresult").html('') if(!isEmpty(botoncobrarcartera)){ botoncobrarcartera.hide(); } botoncobrarcartera=null; }else if (!isEmpty(data["KO"])) { $("#cobroresult").html('') botoncobrarcartera=null; } else { $("#cobroresult").html('') botoncobrarcartera=null; } }) .fail(function (jqXHR, textStatus, xhr) { $("#cobroresult").html('') botoncobrarcartera=null; }); }else{ $("#cobroresult").html('') } } else if (att == "cobrarcartera2"){ let text; let person = prompt("Introduzca la cantidad:", object.data('importe')); if (person == null || person == "") { if(isNumeric(person)){ $.ajax({ dataType: "json", url: 'cobros.php?a='+ localag + "&c=" + localcli + "&ej=" + object.data("ejercicio") + "&s=" + object.data("sucursal") + "&ctr=" + object.data("cartera")+ "&cnt=" + person , headers: { "X-Myapp-Nonce": tmph, }, }) .done(function (data) { if (data["OK"] > 0) { alert("Cobro Enviado") }else if (!isEmpty(data["KO"])) { alert("ERROR:\n" + data['KO']); } else { alert("No se ha procesado el Cobro") } }) .fail(function (jqXHR, textStatus, xhr) { alert("No se ha procesado el Cobro 1") }); }else{ alert("cantidad introducida no valida"); } } else { person=person.replace(",", "."); if(isNumeric(person)){ $.ajax({ dataType: "json", url: 'cobros.php?a='+ localag + "&c=" + localcli + "&ej=" + object.data("ejercicio") + "&s=" + object.data("sucursal") + "&ctr=" + object.data("cartera")+ "&cnt=" + person , headers: { "X-Myapp-Nonce": tmph, }, }) .done(function (data) { if (data["OK"] > 0) { alert("Cobro Enviado") }else if (!isEmpty(data["KO"])) { alert("ERROR:\n" + data['KO']); } else { alert("No se ha procesado el Cobro") } }) .fail(function (jqXHR, textStatus, xhr) { alert("No se ha procesado el Cobro 1") }); }else{ alert("cantidad introducida no valida"); } } } else if (att == "cobros"){ $("#MaxModalTitle").html("Cobros Agente"); $("#MaxModal").attr("data-tipo", "Cobros"); $("#MaxModal").modal("show"); htmlres=""; htmlres="
"; htmlres+='De: '; htmlres+=" a "; htmlres+=''; htmlres+=' '; htmlres+="
"; htmlres+="
"; htmlres+="
"; htmlres+="
"; htmlres+=""; htmlres+="
"; $(".maxmodalbody").html(htmlres); MapeoAcciones(); } else if (att == "cobrosaction"){ fini=($('#cobrosfechaini').val()); ffin=($('#cobrosfechafin').val()); if(fini==''|| ffin=='' ) { $('#cobrosresult').html('FECHAS INCORRECTAS'); } else{ $('#cobrosresult').html('............'); tmph = localag + "|" + 0 + "|" + currentswversion + "|" + kcontra; tmph = utf8_to_b64(tmph); $.ajax({ dataType: "json", url: "/lib/cobrado.php?fi=" + fini + "&ff="+ ffin, headers: { "X-Myapp-Nonce": tmph, }, }) .done(function (data) { if (data["OK"] > 0) { htmlres=""; htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; $.each(data['sts'], function (key, val) { console.log(key); console.log(val); htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; }); htmlres+='
"; htmlres+='FECHA'; htmlres+=""; htmlres+='IMPORTE'; htmlres+=""; htmlres+= 'TIPO'; htmlres+=""; htmlres+= 'CLIENTE'; htmlres+=""; htmlres+= 'TITULO'; htmlres+="
"; htmlres+=val['FECHACOBRO']; htmlres+=""; htmlres+=val['CANTIDAD']; htmlres+=""; htmlres+= val['TIPOCOBRO']; htmlres+=""; htmlres+= val['SUBNOMBRE']; htmlres+=""; htmlres+= val['TITULOCLIENTE']; htmlres+="
' htmlres+='

' htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; $.each(data['sum'], function (key, val) { htmlres+=""; htmlres+=""; htmlres+=""; htmlres+=""; }); htmlres+='
"; htmlres+= 'TIPO'; htmlres+=""; htmlres+='IMPORTE'; htmlres+="
"; htmlres+= val['TIPOCOBRO']; htmlres+=""; htmlres+=val['CANTIDAD']; htmlres+="
' $('#cobrosresult').html(htmlres); request.onsuccess = function () { }; request.onerror = function () { console.log("Error", request.error); console.log("KO 7"); $('#cobrosresult').html("ERROR 7"); }; } else { console.log("KO 1"); $('#cobrosresult').html("ERROR 1"); } }) .fail(function (jqXHR, textStatus, xhr) { console.log("KO 2"); $('#cobrosresult').html("ERROR 2"); }); } } else { alert("nose"); alert(att); } } function validatepedido() { if (parseFloat($("#pricepedido").text()) < parseFloat(cnf["mv"])) { if ($("#pedidominimopass").val() != cnf["mvd"]) { $("#errorpedido").html( "No se llega al pedido minimo de " + parseFloat(cnf["mv"]) + "€
Si desea realizar el pedido introduza la clave de desbloqueo" ); $("#errorpedido").show(); $("#pedidominimodiv").show(); $("#EnvioPedido").hide(); return 1; } } else { $("#pedidominimodiv").hide(); } if (!$("#direccionespedidos div input:checked").length > 0) { $("#errorpedido").html("No hay direccion de envio selecionada"); $("#errorpedido").show(); $("#EnvioPedido").hide(); return 1; } if (typeof CustomPedidoValidate === "function") { ret = CustomPedidoValidate(); if (ret != "") { $("#errorpedido").html(ret); $("#errorpedido").show(); $("#EnvioPedido").hide(); return 1; } } $("#errorpedido").html(""); $("#errorpedido").hide(); $("#EnvioPedido").show(); return 0; } function DisplayPedidoOK() { transaction = midb.transaction("kpd", "readwrite"); kpds = transaction.objectStore("kpd"); // (2) request = kpds.delete(localcli); // (3) request.onsuccess = function () { transaction = midb.transaction("kpds", "readwrite"); kpdss = transaction.objectStore("kpds"); // (2) kpdsinsert = { idcli: localcli, json: JSON.stringify(localpedido) }; request = kpdss.put(kpdsinsert); // (3) request.onsuccess = function () { localizador = localpedido["c"].ui; localpedido = {}; drawpedidos(); $("#MaxModal").modal("hide"); $("#pro").hide(); $("#cat").show(); $("#MediumModalTitle").html("Envio Pedido Correcto"); $("#MediumModal").modal("show"); htmlres = "Su envio con el localizador " + localizador + " se ha realizado correctmente"; $(".mediummodalbody").html(htmlres); $("#blanco").hide(); }; request.onerror = function () { console.log("eeeee"); }; }; request.onerror = function () { console.log("eeeeeee2"); }; } function DisplayPedidoKO(kerror) { alert(kerror); $("#blanco").hide(); } function getTotalLinea(idp) { ret = 0; cant = dimecantidad(idp); if (cant == 0) { return 0; } return cant * getPrice(idp); } function getVolume(idp) { vo = 0; if (!isEmpty(aproduct[idp])) { if (!isEmpty(aproduct[idp]["vo"])) { vo = aproduct[idp]["vo"]; vo = parseFloat(aproduct[idp]["vo"].replace(",", ".")); } } return vo; } function getIntProductValue(idp, kvalue) { val = getProductValue(idp, kvalue); if (isEmpty(val)) { val = 0; } else { val = parseInt(val); } return val; } function getFloatProductValue(idp, kvalue) { val = getProductValue(idp, kvalue); if (isEmpty(val)) { val = 0; } else { val = parseFloat(val); } return val; } function getProductValue(idp, kvalue) { val = null; if (!isEmpty(aproduct[idp])) { if (!isEmpty(aproduct[idp][kvalue])) { val = aproduct[idp][kvalue]; } } return val; } function gettablehead(kclase) { htmlreshead = ""; /* htmlreshead += ""; htmlreshead += ""; htmlreshead += ""; htmlreshead += ""; htmlreshead += ""; htmlreshead += ""; htmlreshead += ""; htmlreshead += ""; htmlreshead += ""; htmlreshead += ""; */ return htmlreshead; } function productbyref(ref) { ret = -1; $.each(aproduct, function (key, val) { if (val["reference"].toUpperCase() == ref.toUpperCase()) { ret = val["id"]; } }); return ret; } function buscador(str) { itemsct = []; itemscto = []; str = str.trim(); tofind = []; if (str.substr(0, 1) == "|") { tofind.push(str); } else { splstr = str.split(" "); $.each(splstr, function (key, val) { val2 = val.trim(); if (val2.length > 1) { tofind.push(val2); } }); } $.each(aproduct, function (key, val) { itemsct.push(key); }); $.each(tofind, function (key, str2) { itemsct2 = []; $.each(itemsct, function (key, valx) { val = aproduct[valx]; encontrado = 0; ct = val["n"].toUpperCase(); if (!isEmpty(val["reference"])) { ct += val["reference"].toUpperCase(); } if (!isEmpty(val["tags"])) { ct += val["tags"].toUpperCase(); } console.log(ct); str2 = str2.toUpperCase(); if (!isEmpty(ct) && ct.indexOf(str2) !== -1) { if (val["ac"] == "1") { itemsct2.push(valx); } } }); itemsct = []; itemsct = itemsct2; }); itemsheart2=ordenarproductos(itemsct); htmlres = ""; $.each(itemsheart2, function (key, val) { console.log(key + " <<>> " + val); htmlres += DrawProductList3(val); }); htmlres += "
Ref.TituloUds.PrecioTotal
"; htmlres = gettablehead("tablebuscador") + htmlres; $(".buscamodalbody").html(htmlres); } function ordenarproductos(atoorder){ atoordertmp=Array.from(atoorder); aordertmp=[]; korden=[]; $.each(atoordertmp, function (key, val) { aordertmp.push(parseInt(aproduct[val]['ot'])); }); indexo1 = Array.from(aordertmp); indexo1.sort((a, b) => a - b); $.each(indexo1, function (key, val) { $.each(aordertmp, function (key2, val2) { if(val2==val){ val2='XXX'; atoordertmp[key2]='XXX'; korden.push(key2); return false } }); }); retorden=[]; $.each(korden, function (key, val) { retorden.push(atoorder[val]); }); return retorden; } function buscador_old(str) { itemsct = []; $.each(aproduct, function (key, val) { encontrado = 0; ct = val["n"].toUpperCase(); str = str.toUpperCase(); if (!isEmpty(ct) && ct.indexOf(str) !== -1) { if (aproduct[key]["ac"] == "1") { itemsct.push(key); } encontrado = 1; } if (encontrado == 0) { ct = val["reference"].toUpperCase(); if (!isEmpty(ct) && ct.indexOf(str) !== -1) { if (aproduct[key]["ac"] == "1") { itemsct.push(key); } encontrado = 1; } } if (encontrado == 0 && !isEmpty(val["tags"])) { ct = val["tags"].toUpperCase(); console.log(ct); if (!isEmpty(ct) && ct.indexOf(str) !== -1) { if (aproduct[key]["ac"] == "1") { itemsct.push(key); } } } }); itemsheart = []; itemsheart = itemsct; htmlres = ""; $.each(itemsheart, function (key, val) { //console.log(key + " <<>> " + val); htmlres += DrawProductList3(val); }); htmlres += ""; htmlres = gettablehead("tablebuscador") + htmlres; $(".buscamodalbody").html(htmlres); } function purgapedidosa0() { itemsborrar0 = []; $.each(localpedido["ped"], function (key, val) { if (val["qt"] == 0) { itemsborrar0.push(key); } }); $.each(itemsborrar0, function (key, val) { delete localpedido["ped"][val]; }); } function getlistapedidos() { itemsct = []; $.each(aproduct, function (key, val) { ct = dimecantidad(val["id"]); if (!isEmpty(ct) && parseInt(ct) > 0) { itemsct.push(key); } }); return itemsct; } function getnumpedidos() { return getlistapedidos().length; } function gettotalpedidosk(){ itemsheart = []; itemsheart = ordenarproductos(getlistapedidos()); totaldinero = 0; volumentotal = 0; $.each(itemsheart, function (key, val) { totaldinero += getTotalLinea(val); }); return formatprice(totaldinero/1000, 2); } function drawpedidos() { ctxx = getnumpedidos(); if (ctxx > 0) { k=gettotalpedidosk(); $(".ncart").html(ctxx + "
" + k); $(".ncart").show(); } else { $(".ncart").hide(); } } function findParentProduct(id) { parentproducts = []; fams = []; val = aproduct[id]; //console.log(val); if (val["sh"] == "1") { parentproducts.push(id); //console.log("Esta en Show"); } else { //console.log("No Esta en Show"); $.each(rel, function (index, valor) { //console.log("RR" + index); $.each(valor, function (index2, valor2) { //console.log(" -> " + valor); if (valor2 == id) { if ( typeof aproduct[index] === 'undefined') { console.log ("ERROR rel mal " + index); } else if (aproduct[index]["sh"] == "1") { //console.log("Encuentro parent " + index); parentproducts.push(index); } } }); }); } if (parentproducts.length == 0) { //console.log("No encuentro producto parent"); } tmpfams2 = []; $.each(parentproducts, function (index, valor) { tmpval = findFamProduct(valor); $.each(tmpval, function (indexx, valorx) { //console.log(typeof tmpfams[valorx[0]]); if (typeof tmpfams2[valorx[0]] !== "undefined") { // your code here //console.log("mal" + valorx[0]); } else { //console.log("anado" + valorx[0]); tmpfams2[valorx[0]] = valorx; } }); //tmpfams2.push(findFamProduct(valor)); }); tmpfams3 = []; $.each(tmpfams2, function (index, valor) { if (typeof valor !== "undefined") { tmpfams3.push(valor); } }); //console.log("voy1"); //console.log(parentproducts); //console.log(tmpfams3); return tmpfams3; } function findFamProduct(id) { tmpfams = []; $.each(apo, function (index, valor) { $.each(valor, function (index2, valor2) { //console.log(valor2); if (valor2 == id) { tmpfams.push([index, afam[index]["n"], id]); } }); }); //console.log("Familias de " + id); //console.log(tmpfams); return tmpfams; } function DrawProductList(id) { val = aproduct[id]; htmlres = ""; htmlres += "
"; htmlres += ' '; htmlres += '
'; htmlres += '
'; htmlres += " ref:" + val["reference"] + ""; htmlres += "
"; htmlres += '
'; htmlres += " " + val["n"] + ""; htmlres += "
"; htmlres += '
'; htmlres += " " + getFormatPrice(val["id"], 2) + "€"; htmlres += "
"; htmlres += "
"; htmlres += '
'; htmlres += ' '; htmlres += "
"; htmlres += '
'; htmlres += '
'; htmlres += '
'; htmlres += '
'; htmlres += '
' + dimecantidad(id) + "
"; htmlres += '
' + formatprice(dimecantidad(id) * val["p"], 2) + " €" + "
"; tmpparent = findParentProduct(id); htmlres += '
'; if (tmpparent.length == 0) { htmlres += ' '; } else { $.each(tmpparent, function (key, val) { if (typeof val !== "undefined") { htmlres += ' "; } }); } htmlres += drawtags(id); htmlres += "
"; htmlres += "
"; htmlres += "
"; htmlres += "
"; return htmlres; } function DrawProductList2(id) { val = aproduct[id]; htmlres = ""; htmlres += ""; htmlres += ' '; htmlres += ' '; htmlres += " "; htmlres += ' '; htmlres += ' '; htmlres += " " + val["reference"] + ''; htmlres += " "; htmlres += ' '; htmlres += " " + val["n"] + ""; htmlres += " "; htmlres += ' ' + formatprice(dimecantidad(id), 0) + ""; if (STOCKAGENTE == "1" && localag > 0) { htmlres += ' ' + 'x' + ""; } htmlres += ' '; htmlres += " " + getFormatPrice(val["id"], 2); htmlres += " "; htmlres += ' ' + formatprice(dimecantidad(id) * val["p"], 2) + ""; htmlres += ' '; htmlres += '
'; htmlres += '
'; htmlres += '
'; htmlres += "
"; htmlres += " "; htmlres += ""; return htmlres; } function DrawProductList3(id) { val = aproduct[id]; htmlres = ""; htmlres += ""; htmlres += ' '; htmlres += ' '; htmlres += " "; htmlres += ' '; htmlres += ' '; htmlres += " " + val["n"] + ""; htmlres += " "; htmlres += ' '; htmlres += '
' + formatprice(dimecantidad(id), 0) + "
"; htmlres += '
'; htmlres += '
'; htmlres += '
'; htmlres += "
"; htmlres += " "; htmlres += ""; htmlres += ""; htmlres += ' '; htmlres += " " + val["reference"]; htmlres += " "; htmlres += ' '; htmlres += " " + getFormatPrice(val["id"], 2); htmlres += " "; htmlres += ' ' + formatprice(dimecantidad(id) * val["p"], 2) + ""; htmlres += ""; htmlres += ""; htmlres += ' '; tmpparent = findParentProduct(id); htmlres += '
'; if (tmpparent.length == 0) { htmlres += ' '; } else { $.each(tmpparent, function (key, val) { if (typeof val !== "undefined") { htmlres += ' "; } }); } htmlres += drawtags(val["tags"]); htmlres += "
"; htmlres += " "; htmlres += ""; return htmlres; } function featureformat(kfea) { retfea=""; try { retfea=trimChar(kfea.trim(), "|").replaceAll("||", " | "); } catch (e) { retfea="ERROR:" + kfea; } return retfea; } function drawfams(famid) { $(".namefamilia").hide(); //$('.paginascount').hide(); resfin = ""; afamorder = []; var count = 0; var countt = ""; varcountf = ""; $.each(afam, function (key, val) { if (val["p2"] == famid) { afamorder[val["p"]] = key; } }); resfin = "
"; //$.each(afamorder, function (index, valor) { for (var index in afamorder) { count++; countt = "F"; countf = afamorder[index]; res = ""; res += '
'; res += '
'; //res += '
'; //res += ' ' + afam[afamorder[index]]['n'] + ''; //res += '
' res += ' ' +
      afam[afamorder[index]]['; res += '
'; res += '
' + afam[afamorder[index]]["n"] + "
"; res += "
"; /* res += '
'; res += '
'; res += '

' + afam[afamorder[index]]['n'] + '

'; res += '
'; res += '
'; */ res += "
"; res += "
"; resfin += res; } resfin += "
"; resfin += "
"; res = ""; resfin += "
"; ashowproducts = []; $.each(apo[famid], function (key, val) { if (aproduct[val] != null) { if (aproduct[val]["sh"] == "1") { count++; countf = famid; countt = "P"; countp = val; //console.log(aproduct[val]); FEA_TIPO = ""; FEA_TIPO2 = ""; FEA_COLOR = ""; if (aproduct[val]["fea"] != null) { if (KFEA_TIPO != "" && aproduct[val]["fea"][KFEA_TIPO] != null) { FEA_TIPO = featureformat(aproduct[val]["fea"][KFEA_TIPO]); } if (KFEA_TIPO2 != "" && aproduct[val]["fea"][KFEA_TIPO2] != null) { FEA_TIPO2 = featureformat(aproduct[val]["fea"][KFEA_TIPO2]); } if (KFEA_TIPO2 != "" && aproduct[val]["fea"][KFEA_COLOR] != null) { FEA_COLOR = aproduct[val]["fea"][KFEA_COLOR]; } } res = ""; res += '
'; res += '
'; res += ' ' +
          FEA_TIPO +
          ''; res += '
'; if (FEA_COLOR != "") { res += " " + drawcolors(FEA_COLOR); } res += "
"; if(INICIOREFERENCIA=='1'){ res += '
'; res += '
' + aproduct[val]["reference"] + "
"; res += "
"; } res += '
'; res += '
' + FEA_TIPO2 + "
"; res += "
"; res += '
'; res += '
' + FEA_TIPO + "
"; res += "
"; /* res += '
'; res += '
'; res += '

' + afam[afamorder[index]]['n'] + '

'; res += '
'; res += '
'; */ res += "
"; res += "
"; resfin += res; } else { //console.log(key + "->" + aproduct[val]["ac"]); } } // }); resfin += "
"; if (count == 1 && cnf["sm1"] == 1) { if (countt == "F") { drawfams(countf); } else if (countt == "P") { gotoproduct(countf, countp, countp); } } else { titulo = getfamiliassub(famid); //$('.rowfams').html(resfin); $(".rowfams").html(""); $("#OptionModalBody").html(resfin); $("#OptionModalTitle").html(titulo); $("#OptionModal").modal("show"); MapeoAcciones(); } //drawfams2(); } function gettitulofam(famid) { if (famid == -1) { return "INICIO"; } else { return afam[famid]["n"]; } } function getfamiliassub(famid) { res = ""; while (famid != -1) { res = " | " + gettitulofam(famid) + "" + res; famid = afam[famid]["p2"]; } res = "" + gettitulofam(famid) + "" + res; return res; } function drawfams2() { alert("gato2"); resfin = ""; afamorder = []; $.each(afam, function (key, val) { afamorder[val["p"]] = key; }); //$.each(afamorder, function (index, valor) { resfin += '"; $("#OptionModalBody").html(resfin); $("#OptionModalTitle").html("Familias"); $("#OptionModal").modal("show"); MapeoAcciones(); } function listsumapro(id, mult) { event.stopPropagation(); val = aproduct[id]; unidadminimaventa = 9999; unidadminimaventaindex = -99; for (i = 1; i <= 6; i++) { if ( parseInt(val["u" + i]) > 0 && parseInt(val["u" + i]) < unidadminimaventa ) { unidadminimaventa = parseInt(val["u" + i]); unidadminimaventaindex = i; } } cantidad = unidadminimaventa * mult; SumaProducto(id, cantidad); listrenderkcantidadvalue(id); } function listrenderkcantidadvalue(idp) { ori = dimecantidad(idp); $('div.plist[data-id="' + idp + '"]') .find("div.listUnidades") .html(formatprice(ori, 0)); $('tr[data-id="' + idp + '"]') .find("td.tdlistUnidades") .html(formatprice(ori, 0)); $('tr[data-id="' + idp + '"] td.tdlistped') .find("div.tdlistUnidades") .html(formatprice(ori, 0)); totalprice = formatprice(dimecantidad(idp) * aproduct[idp]["p"], 2); $('div.plist[data-id="' + idp + '"]') .find("div.listtotalprice") .html(totalprice + " €"); $('tr[data-id="' + idp + '"]') .find("td.tdlisttotalprice") .html(totalprice); } function gotoproduct(dfamilia, dproducto, dsubproducto) { $("#MaxModal").modal("hide"); $("#BuscaModal").modal("hide"); $("#OptionModal").modal("hide"); val = aproduct[dproducto]; drawproductsfam(dfamilia, 0, dproducto, dsubproducto); } function gotoproductobyid(idp) { $("#MediumModal").modal("hide"); atmp = findParentProduct(idp); if (atmp.length == 1) { gotoproduct(atmp[0][0], atmp[0][2], idp); } else if (atmp.length == 0) { htmlres = ""; $("#OModalTitle").html("ERROR"); $("#OptionModal").modal("show"); htmlres = "

Este producto no tiene punto de inicio

"; $(".optionmodalbody").html(htmlres); } else { htmlres = ""; $("#OptionModalTitle").html("Opciones"); $("#OptionModal").modal("show"); $.each(atmp, function (key, val) { if (typeof val !== "undefined") { htmlres += '
"; } }); $(".optionmodalbody").html(htmlres); } } function drawproductsfam(famid, pos, idp, subproducto) { $("#cat").hide(); $("#pro").show(); procurrent = 1; $(".rowpro").html(""); //$('.namefamilia').show(); $(".paginascount").show(); $(".namefamiliatext").html(afam[famid]["n"]); $(".namefamiliaid").html(famid); count = 0; if (isEmpty(pos)) { pos = 0; } if (isEmpty(idp)) { idp = -1; } ashowproducts_full = []; $.each(apo[famid], function (key, val) { if (aproduct[val] != null) { if (aproduct[val]["sh"] == "1") { //console.log(aproduct[val]); if (idp != -1 && pos == 0) { if (aproduct[val]["id"] == idp) { pos = count; procurrent = pos + 1; } } count++; ashowproducts_full.push(val); } else { //console.log(key + "->" + aproduct[val]["ac"]); } } // }); drawproductsarray(pos, pos + propagination); if (typeof subproducto !== "undefined") { //console.log("subproducto" + subproducto + " - " + idp); //console.log($('.imgrelacionado[data-id="' + subproducto + '"]')); $('.imgrelacionado[data-id="' + subproducto + '"]').trigger("click"); } } function drawproductsfamlist(famid) { $("#cat").hide(); $("#pro").hide(); $("#prolist").show(); procurrent = 1; $(".rowpro").html(""); //$('.namefamilia').show(); $(".paginascount").show(); $(".namefamiliatext").html(afam[famid]["n"]); $(".namefamiliaid").html(famid); count = 0; $(".rowprolist").html(""); res = ""; ashowproducts = []; $.each(apo[famid], function (key, val) { if (aproduct[val] != null) { if (aproduct[val]["sh"] == "1") { //console.log(aproduct[val]); res = ""; res += '
'; res += '
'; res += drawproductolist(aproduct[val]); res += "
"; res += "
"; $(".rowprolist").append(res); count++; } else { //console.log(key + "->" + aproduct[val]["ac"]); } } // }); setTimeout(function () { $(".asyncload").each(function (index) { //console.log( index + ": " + $( this ).attr("dms-src") ); $(this).attr("src", $(this).attr("dms-src")); }); //$(".pplus").popover(); $(".pplus").bind("taphold", function () { res = ""; val = aproduct[$(this).attr("dms-idp")]; res += '
'; res += '
' + unidadesventa[0] + "
" + val["u1"] + 'ud.
'; res += '
' + unidadesventa[1] + "
" + val["u2"] + 'ud.
'; res += '
' + unidadesventa[2] + "
" + val["u3"] + 'ud.
'; res += '
' + unidadesventa[3] + "
" + val["u4"] + 'ud.
'; res += '
' + unidadesventa[4] + "
" + val["u5"] + 'ud.
'; res += "
"; $(this).popover({ title: "Unidades Venta", content: res, placement: "auto", html: true, trigger: "manual", toggle: "popover", }); $(this).popover("show"); }); }, 100); //$('.rowpro').html(res); } function drawproductsarray(init, fin) { if (fin > ashowproducts_full.length) { fin = ashowproducts_full.length; } contadortotal = ashowproducts_full.length; contadorposicion = init; drawcontador(); for (var i = init; i < fin; i++) { renderproductlist( ashowproducts_full[i], ashowproducts_full[i + 1], ashowproducts_full[i - 1] ); } } function openlogistica(id) { val = aproduct[id]; htmlres = ""; if (STOCKAGENTE == "1" && localag > 0) { if (!isEmpty(cliagstk[val["reference"]])) { htmlres += ""; spro = cliagstk[val["reference"]]; $.each(spro, function (key2, val2) { if (key2 != "t") { htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; } }); htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += "
"; htmlres += val2["l"] + " | " + val2["n"]; htmlres += ""; htmlres += val2["s"]; htmlres += ""; htmlres += ""; htmlres += "
"; htmlres += ""; htmlres += ""; htmlres += ""; htmlres += " xxx "; htmlres += "
"; } else { htmlres += "No hay Stock"; } } htmlres += ""; htmlres += ""; htmlres += ""; if (val["fea"] != null) { fea = Object.entries(val["fea"]); fea.forEach(function (k, v) { fname = k[0]; if (!fname.startsWith("M_IM_")) { if (fname.startsWith("M_")) { fname = fname.substring(2); } htmlres += ""; htmlres += ""; htmlres += ""; htmlres += ""; } }); } htmlres += "
" + "Un." + "" + "Cant." + "
" + fname + "" + featureformat(k[1]) + "
"; //$('.modal-body-logistica').html($('.logistica').html()); //$('.modal-body-spincantidad').html($('.spincantidad').html()); $(".modal-body-logistica").html($(".logistica").html() + htmlres); $("#myModal").modal("show"); $(".modal-body-logistica .kunidad").click(function (event) { $(".kunidad").removeClass("selected"); at = $(this).attr("data-x"); //$(this).addClass("selected"); $('.kunidad[data-x="' + at + '"]').addClass("selected"); }); $("#notasp" + id).bind("input propertychange", function () { savenotasproducto($(this).attr("data-id"), this.value); }); loadlotes(id); $(".sagc").bind("input propertychange", function () { changelote(id); }); } function changelote(idp) { if (STOCKAGENTE == "1" && localag > 0) { console.log("change stock"); total = 0; txxto = ""; $(".sagc").each(function (index) { if (parseInt($(this).val()) > 0) { txxto += $(this).attr("data-lote") + "," + $(this).val() + ";"; } }); savelotesproducto(idp, txxto); loadlotes(idp); } } function savelotesproducto(idp, lotes) { if (STOCKAGENTE == "1" && localag > 0) { if (isEmpty(localpedido["ped"])) { localpedido["ped"] = {}; } if (isEmpty(localpedido["ped"][idp])) { localpedido["ped"][idp] = {}; } localpedido["ped"][idp].lt = lotes; SaveLocalStorage(); } } function loadlotes(idp) { if (STOCKAGENTE == "1" && localag > 0) { totallotes = 0; totalpedido = 0; if (!isEmpty(localpedido) && !isEmpty(localpedido["ped"]) && !isEmpty(localpedido["ped"][idp])) { if (!isEmpty(localpedido["ped"][idp].qt)) { totalpedido = parseInt(localpedido["ped"][idp].qt); } if (!isEmpty(localpedido["ped"][idp].lt)) { lotes = localpedido["ped"][idp].lt; var valores = lotes.split(";"); valores.forEach(function (k, v) { dos = k.split(","); if (dos.length == 2) { $('.sagc[data-lote="' + dos[0] + '"]').val(dos[1]); totallotes += parseInt(dos[1]); } }); } } total = totalpedido - totallotes; $(".lotecount[data-id='" + idp + "']").html(total); if (total != 0) { $(".lotecount[data-id='" + idp + "']").show(); } else { $(".lotecount[data-id='" + idp + "']").hide(); } } } function savenotasproducto(idp, nota) { if (isEmpty(localpedido["ped"])) { localpedido["ped"] = {}; } if (isEmpty(localpedido["ped"][idp])) { localpedido["ped"][idp] = {}; } localpedido["ped"][idp].n = nota; SaveLocalStorage(); } function SaveLocalStorage() { purgapedidosa0(); //localStorage.setItem("qt" + localcli, JSON.stringify(localpedido)); transaction = midb.transaction("kpd", "readwrite"); kpds = transaction.objectStore("kpd"); // (2) kpdinsert = { id: localcli, json: JSON.stringify(localpedido) }; request = kpds.put(kpdinsert); // (3) request.onsuccess = function () { //animocorazonfooter(); }; request.onerror = function () { //animocorazonfooter(); }; } function getnotasproducto(idp) { nota = ""; if (!isEmpty(localpedido["ped"])) { if (!isEmpty(localpedido["ped"][idp])) { if (!isEmpty(localpedido["ped"][idp].n)) { nota = localpedido["ped"][idp].n; } } } return nota; } function getnotaPedido() { nota = ""; if (!isEmpty(localpedido["c"])) { if (!isEmpty(localpedido["c"].np)) { nota = localpedido["c"].np; } } return nota; } function savenotaPedido(){ if (isEmpty(localpedido["c"])) { localpedido["c"] = {}; } localpedido["c"].np=$("#notaped").val(); } function getnotaPedidoI() { nota = ""; if (!isEmpty(localpedido["c"])) { if (!isEmpty(localpedido["c"].npi)) { nota = localpedido["c"].npi; } } return nota; } function savenotaPedidoI(){ if (isEmpty(localpedido["c"])) { localpedido["c"] = {}; } localpedido["c"].npi=$("#notapedint").val(); } function purgadatos() { familiashuerfanas(); productossinfamilia(); } function famfilter() { tarifa = cli["gro"]; tarifa = parseInt(tarifa) - 10; tmpa = []; $.each(afam, function (key, val) { ft = val["ft"]; if (ft.length > 0 && ft.substring(0, 1) == "-") { ft = "," + ft.substring(1) + ","; if (ft.search("," + tarifa + ",") >= 0) { tmpa.push(key); } } }); if (tmpa.length > 0) { $.each(tmpa, function (key, val) { deletefamilia(val); }); } } function deletefamilia(id) { delete afam["" + id + ""]; delete apo["" + id + ""]; } function familiashuerfanas() { tmpa = []; tmpa2 = []; tmpa.push("-1"); $.each(afam, function (key, val) { tmpa.push(key); }); console.log(tmpa); $.each(afam, function (key, val) { if (!tmpa.includes(val["p2"])) { tmpa2.push(key); } }); console.log(tmpa2); if (tmpa2.length > 0) { $.each(tmpa2, function (key, val) { deletefamilia(val); }); familiashuerfanas(); } } function productossinfamilia() { tmpa = []; $.each(aproduct, function (key, val) { tmpa.push(key); }); $.each(apo, function (key, val) { //tmpa.push(key); console.log("fam" + key); $.each(val, function (key2, val2) { //tmpa.push(key); //console.log("p" + key2 + " " + val2); var index = tmpa.indexOf(val2); if (index !== -1) { tmpa.splice(index, 1); } }); }); console.log("Sin Familia"); console.log(tmpa); console.log("END Familia"); $.each(tmpa, function (key, val) { delete aproduct[val]; }); console.log("end purga"); } function displayconsumos(obj) { art = obj.attr("data-id"); htmlres = ""; htmlres += ""; alb.forEach(function (k, v) { if (k["a"] == art) { htmlres += ""; } }); htmlres += "
FechaDir.Cant.Alb.
" + k["f"] + "" + k["e"] + "*" + k["c"] + "" + k["al"] + "
"; htmlres += "
"; htmlres += "
"; htmlres += GetDirecciones(); $("#MediumModalTitle").html("Consumos [" + art + "]"); $("#MediumModal").modal("show"); $(".mediummodalbody").html(htmlres); } function GetDirecciones() { htmlres = ""; adr.forEach(function (k, v) { htmlres += "" + k["ali"].substring(1) + "* : " + k["ad"] + ", " + k["cp"] + ", " + k["city"] + ", " + k["pais"] + "
"; }); return htmlres; } function displayalbaran(idalbaran) { htmlres = ""; //htmlres += ""; alb.forEach(function (k, v) { if (k["al"] == idalbaran) { namep = "nose"; if (!isEmpty(pref[k["a"]])) { idp = pref[k["a"]]; if (!isEmpty(aproduct[idp])) { namep = aproduct[idp]["n"]; imgsrc = getpimg(aproduct[idp]["im"]); } } if (namep != "nose") { cantidadp = dimecantidad(idp); cantidadp = cantidadp == 0 ? "" : cantidadp; htmlres += ""; } } }); htmlres += "
Cod.prodCant.
" + k["a"] + "" + namep + "" + k["c"] + "" + cantidadp + "
"; ct = getnumpedidos(); if (ct == 0) { htmlres += '"; } $("#MediumModalTitle").html("Albaran [" + idalbaran + "]"); $("#MediumModal").modal("show"); $(".mediummodalbody").html(htmlres); } function drawproductlistmosaic(val) { res = ""; res += "gato"; return res; } function drawproductolist(val) { res = ""; res += '
'; res += ' '; res += "
"; res += '
'; res += '
'; res += ' ' + val["reference"] + ""; res += '
' + getFormatPrice(val["id"], 2) + " €"; res += "
"; kcant = dimecantidad(val["id"]); kcantclass = ""; if (kcant == 0) { kcantclass = "hidezero"; } res += '
'; res += '
' + val["u1"] + "
"; res += '
' + formatprice(kcant, 0) + "
"; res += '
'; res += ' '; res += "
"; res += '
'; res += ' '; res += "
"; res += "
"; res += "
"; return res; } function drawtags(valor) { res = ""; if (isEmpty(valor)) { return res; } var valores = valor.split("||"); valores.forEach(function (k, v) { tag = k .replace("|", "") .replace("|", "") .replace("|", "") .replace("|", "") .replace("|", ""); res += '"; }); return res; } function drawcolors(valor) { res = "
"; if (isEmpty(valor)) { res += "
"; return res; } var valores = valor.split("||"); valores.forEach(function (k, v) { tag = k .replace("|", "") .replace("|", "") .replace("|", "") .replace("|", "") .replace("|", ""); res += ""; }); res += "
"; return res; } function drawproducto(val) { res = ""; res += '
'; res += '
'; res += " " + $(".namefamiliatext").text(); res += "
"; res += '
'; res += drawtags(val["tags"]); res += "
"; res += "
"; res += '
'; res += '
'; //res += ' '; res += ' '; res += '
49
'; //res += '
+ Colors
'; res += "
"; res += '
'; res += '
' + getFormatPrice(val["id"], 2) + " €
"; res += ' '; res += ' '; res += ' '; res += " "; res += '
'; res += " Ref:" + val["reference"] + ""; res += "   " + drawtags(val["tags"]) + ""; res += "
"; /* res += '
'; res += '
' + val['n'] + '
'; res += '
'; */ res += "
"; //res += ' '; if (val["nw"] == 1 /*&& val['fid'] != 10*/) { res += '
'; } if (val["lq"] == 1) { res += '
'; } else if (val["lq"] == 2) { res += '
'; } else if (val["lq"] == 3) { res += '
'; } else if (val["lq"] == 4) { res += '
'; } else if (val["lq"] == 5) { res += '
'; } else if (val["lq"] == 6) { res += '
'; } res += "
"; res += "
"; res += '
'; res += '
'; res += '
'; res += '
'; res += " " + val["reference"] + ""; res += "
"; res += '
' + val["n"] + "
"; res += "
"; res += "
"; res += '
'; unidadminimaventa = 9999; unidadminimaventaindex = -99; counttiposunidades = 0; for (i = 1; i <= 6; i++) { counttiposunidades += val["u" + i] > 0 ? 1 : 0; if ( parseInt(val["u" + i]) > 0 && parseInt(val["u" + i]) < unidadminimaventa ) { unidadminimaventa = parseInt(val["u" + i]); unidadminimaventaindex = i; } } if (counttiposunidades == 1 && cnf["ouv"] == 1) { res += ' "; res += '
'; res += "
"; res += '
'; return res; } function getclassstock(idproduct){ var retstopclas=""; var stoc=parseInt(aproduct[idproduct]['sto']); if(stoc
48
46
'; $.each(rel[id], function (key, val) { //console.log("rel:" + val); rp = aproduct[val]; if (rp != null) { rimg = rp["im"]; rimgurl = getpimg(rimg); if (val == id) { //no dibujo el mismo porque ya lo he dibujado antes //res += '
48
46
'; } else { res += '
47
45
'; } } }); res += '
'; res += "
"; res += "
"; if (!isEmpty(next)) { res += ''; } if (!isEmpty(prev)) { res += ''; } //$('.rowpro').append(res); $(".rowpro").html(res); setTimeout(function () { //console.log($("#relacionados").innerHeight() + " -> " + $("#relacionados").height() + " -> " + $("#relacionados").outerHeight() + " -> " + ($("#relacionados")).prop('scrollHeight')); if ( $("#relacionados").innerHeight() < $("#relacionados").prop("scrollHeight") ) { $(".flecharelacionados").show(); } }, 400); drawconsumos(); $(".imgrelacionado").click(function () { //console.log($(this)); renderonlyproductlist($(this).attr("data-id")); }); $("#relacionados").scroll(function () { $(".flecharelacionados").hide(); }); $(".imgplist").click(function (event) { showgallery($(this)); }); $(".kunidad").click(function (event) { $(".kunidad").removeClass("selected"); at = $(this).attr("data-x"); //$(this).addClass("selected"); $('.kunidad[data-x="' + at + '"]').addClass("selected"); }); $(".corazon").click(function (event) { idp = $(this).attr("data-id"); cz = aproduct[idp]["cz"]; if (isEmpty(cz) || cz == 0) { aproduct[idp]["cz"] = 1; $(".corazonvacio").hide(100); $(".corazonlleno").show(200); } else { aproduct[idp]["cz"] = 0; $(".corazonlleno").hide(100); $(".corazonvacio").show(200); } savecorazones(); }); renderkcantidadvalue(id); /* $(".imgplist").one("load", function () { ////console.log("uno") }).each(function () { if (this.complete) { $(this).load(); // For jQuery < 3.0 // $(this).trigger('load'); // For jQuery >= 3.0 //console.log("dos"); } }); */ cz = val["cz"]; if (!isEmpty(cz) && cz == 1) { $(".corazonvacio").hide(); $(".corazonlleno").show(); } MapeoAcciones(); clearTimeout(loadlotes); timeoutloadlotes = setTimeout(function () { loadlotes(id); }, 50); } function borrarcorazonestodos() { $.each(aproduct, function (key, val) { heart = val["cz"]; if (heart == 1) { val["cz"] = 0; } }); cuantoscorazones = 0; animocorazonfooter(); transaction = midb.transaction("khe", "readwrite"); khes = transaction.objectStore("khe"); request = khes.delete(localcli); request.onerror = function () {}; request.onsuccess = function () {}; $("#MaxModal").modal("hide"); } function borrarcorazon(idp) { aproduct[idp]["cz"] = 0; savecorazones(); } function listborrar(kitem) { //kitem.parent().parent().html() esto es el tr hay que eliminarlo //kitem.data("id") id producto para eliminar //kitem.parent().parent().parent().parent().hasClass('tableheart') si es un borrado de corazon if (kitem.parent().parent().parent().parent().hasClass("tableheart")) { idp = kitem.data("id"); borrarcorazon(idp); kitem.parent().parent().remove(); } console.log(kitem); } function loadcorazones() { cuantoscorazones = 0; transaction = midb.transaction("khe"); khes = transaction.objectStore("khe"); request = khes.get(localcli); request.onerror = function () { console.error("Error", request.error); }; request.onsuccess = function () { gatorrrr = request.result; if (!isEmpty(gatorrrr)) { data = gatorrrr["json"]; itemsheart = JSON.parse(data); $.each(aproduct, function (key, val) { if (itemsheart.includes(key)) { val["cz"] = 1; cuantoscorazones++; } }); if (cuantoscorazones > 0) { animocorazonfooter(); } } else { } // continúa trabajando con la base de datos usando el objeto db }; } function savecorazones() { itemsheart = []; $.each(aproduct, function (key, val) { heart = val["cz"]; if (heart == 1) { itemsheart.push(key); } }); cuantoscorazones = itemsheart.length; transaction = midb.transaction("khe", "readwrite"); khes = transaction.objectStore("khe"); // (2) kheinsert = { id: localcli, json: JSON.stringify(itemsheart) }; request = khes.put(kheinsert); // (3) request.onsuccess = function () { animocorazonfooter(); }; request.onerror = function () { animocorazonfooter(); }; } function animocorazonfooter() { $(".corazonllenofooter").show(); setTimeout(function () { $(".corazonllenofooter").hide(); }, 3000); $(".ncorazones").html(cuantoscorazones); if (cuantoscorazones > 0) { $(".ncorazones").show(); } else { $(".ncorazones").hide(); } } function renderonlyproductlist(id) { //console.log(id); val = aproduct[id]; console.log(val); res = ""; res += drawproducto(val); $(".imgprocol").html(res); drawconsumos(); $(".imgrelacionado").each(function () { if ($(this).attr("data-id") == id) { $(this).parent().addClass("current"); } else { $(this).parent().removeClass("current"); } }); $(".imgplist").click(function (event) { showgallery($(this)); }); $(".kunidad").click(function (event) { $(".kunidad").removeClass("selected"); $(this).addClass("selected"); }); $(".corazon").click(function (event) { idp = $(this).attr("data-id"); cz = aproduct[idp]["cz"]; if (isEmpty(cz) || cz == 0) { aproduct[idp]["cz"] = 1; $(".corazonvacio").hide(100); $(".corazonlleno").show(200); } else { aproduct[idp]["cz"] = 0; $(".corazonlleno").hide(100); $(".corazonvacio").show(200); } savecorazones(); }); cz = val["cz"]; if (!isEmpty(cz) && cz == 1) { $(".corazonvacio").hide(); $(".corazonlleno").show(); } renderkcantidadvalue(id); MapeoAcciones(); } function getpimg(id) { //return "./img/noimage.gif"; if (isEmpty(id)) { return "./img/offline.jpg"; } else { if (online == 0) { return "http://127.0.0.1:7777/p/" + id + prosuf; } else { fin = ""; idx = id + ""; var i = 0; for (i = 0; i < idx.length; i++) { fin += idx.substring(i, i + 1) + "/"; } fin += id + prosuf; fin = propath + fin; return fin; } } } function getimg(id) { //return "./img/noimage.gif"; if (isEmpty(id)) { return "./img/noimage.gif"; } else { if (online == 0) { return "http://127.0.0.1:7777/s/" + id; } else { fin = ""; fin = imgpath + fin + id; return fin; } } } function getcimg(id) { if (isEmpty(id)) { return "./img/noimage.gif"; } else { if (online == 0) { return "http://127.0.0.1:7777/c/" + id + famsuf; } else { fin = ""; fin += id + famsuf; fin = fampath + fin; return fin; } } } function gototag(ktag) { ktag = "|" + ktag + "|"; $("#BuscaModal").modal("show"); $("#kbusco").val(ktag); buscador(ktag); } function PlaySound() { //var sound = document.getElementById("audio"); //sound.play() soundEffect.play(); } function getPrice(id) { retprecio = aproduct[id]["p"]; return parseFloat(retprecio); } function getFormatPrice(id, decimales) { retprecio = aproduct[id]["p"]; return formatprice(retprecio, decimales); } function numberWithCommas(x) { var parts = x.toString().split(","); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, "."); return parts.join("."); } function formatprice(price, decimales) { if (price == undefined) { return "-"; } price = parseFloat(price.toString().replace(",", ".")).toFixed(decimales); ResultStr = price.toString(); if (ResultStr != null) { var SplitChars = "."; if (ResultStr.indexOf(SplitChars) >= 0) { var DtlStr = ResultStr.split(SplitChars); decimaless = ""; if (decimales > 0) { decimaless = ',' + DtlStr[1] + ""; } return numberWithCommas(DtlStr[0]) + decimaless; //return 'gato'; } else { return numberWithCommas(price); } } } function dimecantidad(idp) { ori = 0; if (!isEmpty(localpedido["ped"])) { if (!isEmpty(localpedido["ped"][idp])) { if (!isEmpty(localpedido["ped"][idp].qt)) { ori = localpedido["ped"][idp].qt; } } } if (isEmpty(ori)) { ori = 0; } return ori; } function masproducto(idp, mult, eslista = 0) { if (eslista == 1) { cuantos = parseInt($("#prolist .kunidadlist" + idp).html()) * parseInt(mult); } else { cuantos = parseInt($("#pro .kunidad.selected").attr("data-c")) * parseInt(mult); } //alert(cuantos); SumaProducto(idp, cuantos); renderkcantidadvalue(idp); } function recuperarpedidodesdealbaran(ida){ alb.forEach(function (k, v) { if (k["al"] == ida) { idp = pref[k["a"]]; SumaProducto(idp,k["c"]); } $('.modal').modal("hide"); $('#idbuttonpedido').click() }); } function SumaProducto(idp, suma) { ori = dimecantidad(idp); suma=parseInt(suma); tmpqt = ori + suma; if (tmpqt < 0) { tmpqt = 0; } if (tmpqt != ori) { if (isEmpty(localpedido["ped"])) { localpedido["ped"] = {}; } if (isEmpty(localpedido["ped"][idp])) { localpedido["ped"][idp] = {}; } localpedido["ped"][idp].qt = tmpqt; localpedido["ped"][idp].pri = aproduct[idp]["p"]; loadlotes(idp); SaveLocalStorage(); PlaySound(); } clearTimeout(drawpedidostimer); drawpedidostimer = setTimeout(drawpedidos, 1000); if ($("#dineropedidototal").is(":visible")) { itemsheart = []; itemsheart = ordenarproductos(getlistapedidos()); totaldinero = 0; volumentotal = 0; $.each(itemsheart, function (key, val) { totaldinero += getTotalLinea(val); volumentotal += (getVolume(val) * dimecantidad(val)) / getFloatProductValue(val, "u5"); }); $("#dineropedidototal").html(formatprice(totaldinero, 2)); $("#pricepedido").html(totaldinero); validatepedido(); } } function renderkcantidadvalue(idp) { ori = dimecantidad(idp); if (ori == 0) { $(".spincantidadlist" + idp).addClass("hidezero"); } else { $(".spincantidadlist" + idp).removeClass("hidezero"); } $(".kcantidadlist" + idp).html(formatprice(ori, 0)); $(".kcantidadvalue").html(formatprice(ori, 0)); unidadminimaventa = 9999; unidadminimaventaindex = -99; for (i = 1; i <= 6; i++) { if ( parseInt(val["u" + i]) > 0 && parseInt(val["u" + i]) < unidadminimaventa ) { unidadminimaventa = parseInt(val["u" + i]); unidadminimaventaindex = i; } } unidades = aproduct[idp]["u" + unidadminimaventaindex]; kunidades = ori / unidades; $(".unidades").html( formatprice(kunidades, 0) + " " + unidadesventashort[unidadminimaventaindex - 1] ); drawcantidadpedida(); } function checkKey(e) { e = e || window.event; if (e.keyCode == "38") { // up arrow } else if (e.keyCode == "40") { // down arrow } else if (e.keyCode == "37") { moveproduct(-1); } else if (e.keyCode == "39") { moveproduct(1); } } function showgallery(obj) { iszoom = 1; //$('#bodyzoom2').html(htmlres); //$('#imgzoom2').attr("src", $(this).attr('data-img')); //$('#transition2').show(); /* jsonxx = [{ "src": '../static/img/1.jpg', 'thumb': '../static/img/thumb-1.jpg', 'subHtml': '

Fading Light

Classic view from Rigwood Jetty on Coniston Water an old archive shot similar to an old post but a little later on.

' }, { 'src': '../static/img/2.jpg', 'thumb': '../static/img/thumb-2.jpg', 'subHtml': "

Bowness Bay

A beautiful Sunrise this morning taken En-route to Keswick not one as planned but I'm extremely happy I was passing the right place at the right time....

" }, { 'src': '../static/img/3.jpg', 'thumb': '../static/img/thumb-3.jpg', 'subHtml': "

Coniston Calmness

Beautiful morning

" }]; */ jsonxx = []; val = aproduct[obj.attr("data-pid")]; val["img"].forEach(function (k, v) { jsonxx.push({ src: getpimg(k), thumb: getpimg(k) }); }); //$('#zoomimg2').lightGallery(); obj.lightGallery({ dynamic: true, share: false, download: false, thumbnail: true, autoplayControls: false, dynamicEl: jsonxx, }); obj.on("onCloseAfter.lg", function (event, index, fromTouch, fromThumb) { iszoom = 0; }); event.stopPropagation(); /*event.preventDefault(); event.stopImmediatePropagation(); return false; */ } function headercartera(curcartera) { var htmlres = ""; htmlres += ''; if (curcartera == 0) { htmlres += ''; } else if (curcartera == 2) { htmlres += ''; } /*htmlres += '';*/ htmlres += ''; htmlres += ''; return htmlres; } function footercartera(valor, moneda, curcartera) { var htmlres = ""; htmlres += ''; /*htmlres += ''; htmlres += ''; htmlres += '';*/ if (curcartera == 0) { htmlres += '"; } else if (curcartera == 2) { htmlres += '"; } //htmlres += ''; htmlres += ""; htmlres += ""; htmlres += ""; /* if (curcartera == 0 && moneda == '€') { htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; } else if (curcartera == 0 && moneda == '£') { htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; } if (curcartera == 2 && moneda == '€') { htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; } else if (curcartera == 2 && moneda == '£') { htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; htmlres += ''; } */ htmlres += ""; htmlres += "
' + lan(73) + '' + lan(82) + '' + lan(103) + '' + lan(74) + 'Dto. EspDto. Pp' + lan(76) + '' + lan(75) + 'Fecha Recogida
' + "Fecha" + "" + "Vencimiento" + "" + "Factura" + '' + "Importe" + '
' + "Total Empresa0" + "' + "Total Empresa2" + "" + formatprice(parseFloat(valor), 2) + " " + moneda + ""; htmlres += "
' + 'BBVA, S.A.' + '' + 'IBAN: ES75 0182 5465 9102 0153 9033' + '' + 'SWIFT CODE: BBVAESMMXXX' + '
' + 'CAIXABANK, S.A.' + '' + 'IBAN: ES28 2100 2834 9002 0009 9017' + '' + 'SWIFT CODE: CAIXESBBXXX' + '
' + 'CAIXABANK, S.A.' + '' + 'IBAN: ES88 2100 8604 0772 0030 7287' + '' + 'SWIFT CODE: CAIXESBBXXX' + '
' + 'BBVA, S.A.' + '' + 'IBAN: ES27 0182 5465 9802 0153 7808' + '' + 'SWIFT CODE: BBVAESMMXXX' + '
' + 'CAIXABANK, S.A.' + '' + 'IBAN: ES35 2100 2834 9702 0009 9130' + '' + 'SWIFT CODE: CAIXESBBXXX' + '
' + 'CAIXABANK, S.A.' + '' + 'IBAN: ES54 2100 8604 0272 0030 7174' + '' + 'SWIFT CODE: CAIXESBBXXX' + '
"; return htmlres; } function localStorageSpace() { var allStrings = ""; for (var key in window.localStorage) { if (window.localStorage.hasOwnProperty(key)) { allStrings += window.localStorage[key]; } } return allStrings ? formatprice(3 + (allStrings.length * 16) / (8 * 1024), 2) + " KB" : "Empty (0 KB)"; } function testLocalStorage() { var timeStart = Date.now(); var timeEnd, countKey, countValue, amountLeft, itemLength; var occupied = (leftCount = 3); //Shurav's comment on initial overhead //create localStorage entries until localStorage is totally filled and browser issues a warning. var i = 0; while (!error) { try { //length of the 'value' was picked to be a compromise between speed and accuracy, // the longer the 'value' the quicker script and result less accurate. This one is around 2Kb localStorage.setItem( "testKey" + i, "11111111112222222222333333333344444444445555555555666661111111111222222222233333333334444444444555555555566666" ); } catch (e) { var error = e; } i++; } //if the warning was issued - localStorage is full. if (error) { //iterate through all keys and values to count their length for (var i = 0; i < localStorage.length; i++) { countKey = localStorage.key(i); countValue = localStorage.getItem(localStorage.key(i)); itemLength = countKey.length + countValue.length; //if the key is one of our 'test' keys count it separately if (countKey.indexOf("testKey") !== -1) { leftCount = leftCount + itemLength; } //count all keys and their values occupied = occupied + itemLength; } //all keys + values lenght recalculated to Mb occupied = ((occupied * 16) / (8 * 1024) / 1024).toFixed(2); //if there are any other keys then our 'testKeys' it will show how much localStorage is left amountLeft = occupied - ((leftCount * 16) / (8 * 1024) / 1024).toFixed(2); //iterate through all localStorage keys and remove 'testKeys' Object.keys(localStorage).forEach(function (key) { if (key.indexOf("testKey") !== -1) { localStorage.removeItem(key); } }); } //calculate execution time var timeEnd = Date.now(); var time = timeEnd - timeStart; //create message var message = "Finished in: " + time + "ms \n total localStorage: " + occupied + "Mb \n localStorage left: " + amountLeft + "Mb"; //put the message on the screen document.getElementById("testLocalStorage").innerText = message; //this works with Chrome,Safari, Opera, IE //document.getElementById('scene').textContent = message; //Required for Firefox to show messages } //custom file