diff --git a/lacommunaute/static/vendor/htmx-1.8.4/htmx.min.js b/lacommunaute/static/vendor/htmx-1.8.4/htmx.min.js deleted file mode 100644 index 556de48b4..000000000 --- a/lacommunaute/static/vendor/htmx-1.8.4/htmx.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else{e.htmx=e.htmx||t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var W={onLoad:t,process:mt,on:X,off:F,trigger:Q,ajax:or,find:R,findAll:O,closest:N,values:function(e,t){var r=jt(e,t||"post");return r.values},remove:q,addClass:L,removeClass:T,toggleClass:H,takeClass:A,defineExtension:dr,removeExtension:vr,logAll:C,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,inlineScriptNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",disableSelector:"[hx-disable], [data-hx-disable]",useTemplateFragments:false,scrollBehavior:"smooth",defaultFocusScroll:false},parseInterval:v,_:e,createEventSource:function(e){return new EventSource(e,{withCredentials:true})},createWebSocket:function(e){return new WebSocket(e,[])},version:"1.8.4"};var r={addTriggerHandler:ft,bodyContains:te,canAccessLocalStorage:E,filterValues:zt,hasAttribute:o,getAttributeValue:G,getClosestMatch:h,getExpressionVars:rr,getHeaders:_t,getInputValues:jt,getInternalData:Z,getSwapSpecification:Gt,getTriggerSpecs:Xe,getTarget:oe,makeFragment:g,mergeObjects:re,makeSettleInfo:Zt,oobSwap:_,selectAndSwap:Oe,settleImmediately:At,shouldCancel:Ve,triggerEvent:Q,triggerErrorEvent:Y,withExtensions:wt};var n=["get","post","put","delete","patch"];var i=n.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function v(e){if(e==undefined){return undefined}if(e.slice(-2)=="ms"){return parseFloat(e.slice(0,-2))||undefined}if(e.slice(-1)=="s"){return parseFloat(e.slice(0,-1))*1e3||undefined}if(e.slice(-1)=="m"){return parseFloat(e.slice(0,-1))*1e3*60||undefined}return parseFloat(e)||undefined}function f(e,t){return e.getAttribute&&e.getAttribute(t)}function o(e,t){return e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function G(e,t){return f(e,t)||f(e,"data-"+t)}function u(e){return e.parentElement}function J(){return document}function h(e,t){while(e&&!t(e)){e=u(e)}return e?e:null}function a(e,t,r){var n=G(t,r);var i=G(t,"hx-disinherit");if(e!==t&&i&&(i==="*"||i.split(" ").indexOf(r)>=0)){return"unset"}else{return n}}function $(t,r){var n=null;h(t,function(e){return n=a(t,e,r)});if(n!=="unset"){return n}}function d(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}function s(e){var t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var r=t.exec(e);if(r){return r[1].toLowerCase()}else{return""}}function l(e,t){var r=new DOMParser;var n=r.parseFromString(e,"text/html");var i=n.body;while(t>0){t--;i=i.firstChild}if(i==null){i=J().createDocumentFragment()}return i}function g(e){if(W.config.useTemplateFragments){var t=l("",0);return t.querySelector("template").content}else{var r=s(e);switch(r){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return l(""+e+"
",1);case"col":return l(""+e+"
",2);case"tr":return l(""+e+"
",2);case"td":case"th":return l(""+e+"
",3);case"script":return l("
"+e+"
",1);default:return l(e,0)}}}function ee(e){if(e){e()}}function p(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function m(e){return p(e,"Function")}function x(e){return p(e,"Object")}function Z(e){var t="htmx-internal-data";var r=e[t];if(!r){r=e[t]={}}return r}function y(e){var t=[];if(e){for(var r=0;r=0}function te(e){if(e.getRootNode&&e.getRootNode()instanceof ShadowRoot){return J().body.contains(e.getRootNode().host)}else{return J().body.contains(e)}}function w(e){return e.trim().split(/\s+/)}function re(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}function S(e){try{return JSON.parse(e)}catch(e){St(e);return null}}function E(){var e="htmx:localStorageTest";try{localStorage.setItem(e,e);localStorage.removeItem(e);return true}catch(e){return false}}function e(e){return Qt(J().body,function(){return eval(e)})}function t(t){var e=W.on("htmx:load",function(e){t(e.detail.elt)});return e}function C(){W.logger=function(e,t,r){if(console){console.log(t,e,r)}}}function R(e,t){if(t){return e.querySelector(t)}else{return R(J(),e)}}function O(e,t){if(t){return e.querySelectorAll(t)}else{return O(J(),e)}}function q(e,t){e=D(e);if(t){setTimeout(function(){q(e)},t)}else{e.parentElement.removeChild(e)}}function L(e,t,r){e=D(e);if(r){setTimeout(function(){L(e,t)},r)}else{e.classList&&e.classList.add(t)}}function T(e,t,r){e=D(e);if(r){setTimeout(function(){T(e,t)},r)}else{if(e.classList){e.classList.remove(t);if(e.classList.length===0){e.removeAttribute("class")}}}}function H(e,t){e=D(e);e.classList.toggle(t)}function A(e,t){e=D(e);K(e.parentElement.children,function(e){T(e,t)});L(e,t)}function N(e,t){e=D(e);if(e.closest){return e.closest(t)}else{do{if(e==null||d(e,t)){return e}}while(e=e&&u(e))}}function I(e,t){if(t.indexOf("closest ")===0){return[N(e,t.substr(8))]}else if(t.indexOf("find ")===0){return[R(e,t.substr(5))]}else if(t.indexOf("next ")===0){return[k(e,t.substr(5))]}else if(t.indexOf("previous ")===0){return[M(e,t.substr(9))]}else if(t==="document"){return[document]}else if(t==="window"){return[window]}else{return J().querySelectorAll(t)}}var k=function(e,t){var r=J().querySelectorAll(t);for(var n=0;n=0;n--){var i=r[n];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING){return i}}};function ne(e,t){if(t){return I(e,t)[0]}else{return I(J().body,e)[0]}}function D(e){if(p(e,"String")){return R(e)}else{return e}}function P(e,t,r){if(m(t)){return{target:J().body,event:e,listener:t}}else{return{target:D(e),event:t,listener:r}}}function X(t,r,n){pr(function(){var e=P(t,r,n);e.target.addEventListener(e.event,e.listener)});var e=m(r);return e?r:n}function F(t,r,n){pr(function(){var e=P(t,r,n);e.target.removeEventListener(e.event,e.listener)});return m(r)?r:n}var ie=J().createElement("output");function j(e,t){var r=$(e,t);if(r){if(r==="this"){return[ae(e,t)]}else{var n=I(e,r);if(n.length===0){St('The selector "'+r+'" on '+t+" returned no matches!");return[ie]}else{return n}}}}function ae(e,t){return h(e,function(e){return G(e,t)!=null})}function oe(e){var t=$(e,"hx-target");if(t){if(t==="this"){return ae(e,"hx-target")}else{return ne(e,t)}}else{var r=Z(e);if(r.boosted){return J().body}else{return e}}}function B(e){var t=W.config.attributesToSettle;for(var r=0;r0){o=e.substr(0,e.indexOf(":"));t=e.substr(e.indexOf(":")+1,e.length)}else{o=e}var r=J().querySelectorAll(t);if(r){K(r,function(e){var t;var r=i.cloneNode(true);t=J().createDocumentFragment();t.appendChild(r);if(!V(o,e)){t=r}var n={shouldSwap:true,target:e,fragment:t};if(!Q(e,"htmx:oobBeforeSwap",n))return;e=n.target;if(n["shouldSwap"]){Ce(o,e,e,t,a)}K(a.elts,function(e){Q(e,"htmx:oobAfterSwap",n)})});i.parentNode.removeChild(i)}else{i.parentNode.removeChild(i);Y(J().body,"htmx:oobErrorNoTarget",{content:i})}return e}function z(e,t,r){var n=$(e,"hx-select-oob");if(n){var i=n.split(",");for(let e=0;e0){var t=n.querySelector(e.tagName+"[id='"+e.id+"']");if(t&&t!==n){var r=e.cloneNode();U(e,t);i.tasks.push(function(){U(e,r)})}}})}function ue(e){return function(){T(e,W.config.addedClass);mt(e);ht(e);fe(e);Q(e,"htmx:load")}}function fe(e){var t="[autofocus]";var r=d(e,t)?e:e.querySelector(t);if(r!=null){r.focus()}}function ce(e,t,r,n){le(e,r,n);while(r.childNodes.length>0){var i=r.firstChild;L(i,W.config.addedClass);e.insertBefore(i,t);if(i.nodeType!==Node.TEXT_NODE&&i.nodeType!==Node.COMMENT_NODE){n.tasks.push(ue(i))}}}function he(e,t){var r=0;while(r-1){var t=e.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");var r=t.match(/]*>|>)([\s\S]*?)<\/title>/im);if(r){return r[2]}}}function Oe(e,t,r,n,i){i.title=Re(n);var a=g(n);if(a){z(r,a,i);a=Ee(r,a);se(a);return Ce(e,r,t,a,i)}}function qe(e,t,r){var n=e.getResponseHeader(t);if(n.indexOf("{")===0){var i=S(n);for(var a in i){if(i.hasOwnProperty(a)){var o=i[a];if(!x(o)){o={value:o}}Q(r,a,o)}}}else{Q(r,n,[])}}var Le=/\s/;var Te=/[\s,]/;var He=/[_$a-zA-Z]/;var Ae=/[_$a-zA-Z0-9]/;var Ne=['"',"'","/"];var Ie=/[^\s]/;function ke(e){var t=[];var r=0;while(r0){var o=t[0];if(o==="]"){n--;if(n===0){if(a===null){i=i+"true"}t.shift();i+=")})";try{var s=Qt(e,function(){return Function(i)()},function(){return true});s.source=i;return s}catch(e){Y(J().body,"htmx:syntax:error",{error:e,source:i});return null}}}else if(o==="["){n++}if(Me(o,a,r)){i+="(("+r+"."+o+") ? ("+r+"."+o+") : (window."+o+"))"}else{i=i+o}a=t.shift()}}}function c(e,t){var r="";while(e.length>0&&!e[0].match(t)){r+=e.shift()}return r}var Pe="input, textarea, select";function Xe(e){var t=G(e,"hx-trigger");var r=[];if(t){var n=ke(t);do{c(n,Ie);var f=n.length;var i=c(n,/[,\[\s]/);if(i!==""){if(i==="every"){var a={trigger:"every"};c(n,Ie);a.pollInterval=v(c(n,/[,\[\s]/));c(n,Ie);var o=De(e,n,"event");if(o){a.eventFilter=o}r.push(a)}else if(i.indexOf("sse:")===0){r.push({trigger:"sse",sseEvent:i.substr(4)})}else{var s={trigger:i};var o=De(e,n,"event");if(o){s.eventFilter=o}while(n.length>0&&n[0]!==","){c(n,Ie);var l=n.shift();if(l==="changed"){s.changed=true}else if(l==="once"){s.once=true}else if(l==="consume"){s.consume=true}else if(l==="delay"&&n[0]===":"){n.shift();s.delay=v(c(n,Te))}else if(l==="from"&&n[0]===":"){n.shift();var u=c(n,Te);if(u==="closest"||u==="find"||u==="next"||u==="previous"){n.shift();u+=" "+c(n,Te)}s.from=u}else if(l==="target"&&n[0]===":"){n.shift();s.target=c(n,Te)}else if(l==="throttle"&&n[0]===":"){n.shift();s.throttle=v(c(n,Te))}else if(l==="queue"&&n[0]===":"){n.shift();s.queue=c(n,Te)}else if((l==="root"||l==="threshold")&&n[0]===":"){n.shift();s[l]=c(n,Te)}else{Y(e,"htmx:syntax:error",{token:n.shift()})}}r.push(s)}}if(n.length===f){Y(e,"htmx:syntax:error",{token:n.shift()})}c(n,Ie)}while(n[0]===","&&n.shift())}if(r.length>0){return r}else if(d(e,"form")){return[{trigger:"submit"}]}else if(d(e,'input[type="button"]')){return[{trigger:"click"}]}else if(d(e,Pe)){return[{trigger:"change"}]}else{return[{trigger:"click"}]}}function Fe(e){Z(e).cancelled=true}function je(e,t,r){var n=Z(e);n.timeout=setTimeout(function(){if(te(e)&&n.cancelled!==true){if(!ze(r,yt("hx:poll:trigger",{triggerSpec:r,target:e}))){t(e)}je(e,t,r)}},r.pollInterval)}function Be(e){return location.hostname===e.hostname&&f(e,"href")&&f(e,"href").indexOf("#")!==0}function Ue(t,r,e){if(t.tagName==="A"&&Be(t)&&(t.target===""||t.target==="_self")||t.tagName==="FORM"){r.boosted=true;var n,i;if(t.tagName==="A"){n="get";i=f(t,"href")}else{var a=f(t,"method");n=a?a.toLowerCase():"get";if(n==="get"){}i=f(t,"action")}e.forEach(function(e){We(t,function(e){lr(n,i,t,e)},r,e,true)})}}function Ve(e,t){if(e.type==="submit"||e.type==="click"){if(t.tagName==="FORM"){return true}if(d(t,'input[type="submit"], button')&&N(t,"form")!==null){return true}if(t.tagName==="A"&&t.href&&(t.getAttribute("href")==="#"||t.getAttribute("href").indexOf("#")!==0)){return true}}return false}function _e(e,t){return Z(e).boosted&&e.tagName==="A"&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function ze(e,t){var r=e.eventFilter;if(r){try{return r(t)!==true}catch(e){Y(J().body,"htmx:eventFilter:error",{error:e,source:r.source});return true}}return false}function We(a,o,e,s,l){var t;if(s.from){t=I(a,s.from)}else{t=[a]}K(t,function(n){var i=function(e){if(!te(a)){n.removeEventListener(s.trigger,i);return}if(_e(a,e)){return}if(l||Ve(e,a)){e.preventDefault()}if(ze(s,e)){return}var t=Z(e);t.triggerSpec=s;if(t.handledFor==null){t.handledFor=[]}var r=Z(a);if(t.handledFor.indexOf(a)<0){t.handledFor.push(a);if(s.consume){e.stopPropagation()}if(s.target&&e.target){if(!d(e.target,s.target)){return}}if(s.once){if(r.triggeredOnce){return}else{r.triggeredOnce=true}}if(s.changed){if(r.lastValue===a.value){return}else{r.lastValue=a.value}}if(r.delayed){clearTimeout(r.delayed)}if(r.throttle){return}if(s.throttle){if(!r.throttle){o(a,e);r.throttle=setTimeout(function(){r.throttle=null},s.throttle)}}else if(s.delay){r.delayed=setTimeout(function(){o(a,e)},s.delay)}else{o(a,e)}}};if(e.listenerInfos==null){e.listenerInfos=[]}e.listenerInfos.push({trigger:s.trigger,listener:i,on:n});n.addEventListener(s.trigger,i)})}var Ge=false;var Je=null;function $e(){if(!Je){Je=function(){Ge=true};window.addEventListener("scroll",Je);setInterval(function(){if(Ge){Ge=false;K(J().querySelectorAll("[hx-trigger='revealed'],[data-hx-trigger='revealed']"),function(e){Ze(e)})}},200)}}function Ze(t){if(!o(t,"data-hx-revealed")&&b(t)){t.setAttribute("data-hx-revealed","true");var e=Z(t);if(e.initHash){Q(t,"revealed")}else{t.addEventListener("htmx:afterProcessNode",function(e){Q(t,"revealed")},{once:true})}}}function Ke(e,t,r){var n=w(r);for(var i=0;i=0){var t=tt(n);setTimeout(function(){Ye(s,r,n+1)},t)}};t.onopen=function(e){n=0};Z(s).webSocket=t;t.addEventListener("message",function(e){if(Qe(s)){return}var t=e.data;wt(s,function(e){t=e.transformResponse(t,null,s)});var r=Zt(s);var n=g(t);var i=y(n.children);for(var a=0;a0){Q(u,"htmx:validation:halted",i);return}t.send(JSON.stringify(l));if(Ve(e,u)){e.preventDefault()}})}else{Y(u,"htmx:noWebSocketSourceError")}}function tt(e){var t=W.config.wsReconnectDelay;if(typeof t==="function"){return t(e)}if(t==="full-jitter"){var r=Math.min(e,6);var n=1e3*Math.pow(2,r);return n*Math.random()}St('htmx.config.wsReconnectDelay must either be a function or the string "full-jitter"')}function rt(e,t,r){var n=w(r);for(var i=0;iW.config.historyCacheSize){i.shift()}while(i.length>0){try{localStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(e){Y(J().body,"htmx:historyCacheError",{cause:e,cache:i});i.shift()}}}function Ot(e){if(!E()){return null}var t=S(localStorage.getItem("htmx-history-cache"))||[];for(var r=0;r=200&&this.status<400){Q(J().body,"htmx:historyCacheMissLoad",o);var e=g(this.response);e=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;var t=Ct();var r=Zt(t);var n=Re(this.response);if(n){var i=R("title");if(i){i.innerHTML=n}else{window.document.title=n}}Se(t,e,r);At(r.tasks);Et=a;Q(J().body,"htmx:historyRestore",{path:a,cacheMiss:true,serverResponse:this.response})}else{Y(J().body,"htmx:historyCacheMissLoadError",o)}};e.send()}function It(e){Lt();e=e||location.pathname+location.search;var t=Ot(e);if(t){var r=g(t.content);var n=Ct();var i=Zt(n);Se(n,r,i);At(i.tasks);document.title=t.title;window.scrollTo(0,t.scroll);Et=e;Q(J().body,"htmx:historyRestore",{path:e,item:t})}else{if(W.config.refreshOnHistoryMiss){window.location.reload(true)}else{Nt(e)}}}function kt(e){var t=j(e,"hx-indicator");if(t==null){t=[e]}K(t,function(e){var t=Z(e);t.requestCount=(t.requestCount||0)+1;e.classList["add"].call(e.classList,W.config.requestClass)});return t}function Mt(e){K(e,function(e){var t=Z(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.classList["remove"].call(e.classList,W.config.requestClass)}})}function Dt(e,t){for(var r=0;r=0}function Gt(e,t){var r=t?t:$(e,"hx-swap");var n={swapStyle:Z(e).boosted?"innerHTML":W.config.defaultSwapStyle,swapDelay:W.config.defaultSwapDelay,settleDelay:W.config.defaultSettleDelay};if(Z(e).boosted&&!Wt(e)){n["show"]="top"}if(r){var i=w(r);if(i.length>0){n["swapStyle"]=i[0];for(var a=1;a0?l.join(":"):null;n["scroll"]=f;n["scrollTarget"]=u}if(o.indexOf("show:")===0){var c=o.substr(5);var l=c.split(":");var h=l.pop();var u=l.length>0?l.join(":"):null;n["show"]=h;n["showTarget"]=u}if(o.indexOf("focus-scroll:")===0){var d=o.substr("focus-scroll:".length);n["focusScroll"]=d=="true"}}}}return n}function Jt(e){return $(e,"hx-encoding")==="multipart/form-data"||d(e,"form")&&f(e,"enctype")==="multipart/form-data"}function $t(t,r,n){var i=null;wt(r,function(e){if(i==null){i=e.encodeParameters(t,n,r)}});if(i!=null){return i}else{if(Jt(r)){return Vt(n)}else{return Ut(n)}}}function Zt(e){return{tasks:[],elts:[e]}}function Kt(e,t){var r=e[0];var n=e[e.length-1];if(t.scroll){var i=null;if(t.scrollTarget){i=ne(r,t.scrollTarget)}if(t.scroll==="top"&&(r||i)){i=i||r;i.scrollTop=0}if(t.scroll==="bottom"&&(n||i)){i=i||n;i.scrollTop=i.scrollHeight}}if(t.show){var i=null;if(t.showTarget){var a=t.showTarget;if(t.showTarget==="window"){a="body"}i=ne(r,a)}if(t.show==="top"&&(r||i)){i=i||r;i.scrollIntoView({block:"start",behavior:W.config.scrollBehavior})}if(t.show==="bottom"&&(n||i)){i=i||n;i.scrollIntoView({block:"end",behavior:W.config.scrollBehavior})}}}function Yt(e,t,r,n){if(n==null){n={}}if(e==null){return n}var i=G(e,t);if(i){var a=i.trim();var o=r;if(a==="unset"){return null}if(a.indexOf("javascript:")===0){a=a.substr(11);o=true}else if(a.indexOf("js:")===0){a=a.substr(3);o=true}if(a.indexOf("{")!==0){a="{"+a+"}"}var s;if(o){s=Qt(e,function(){return Function("return ("+a+")")()},{})}else{s=S(a)}for(var l in s){if(s.hasOwnProperty(l)){if(n[l]==null){n[l]=s[l]}}}}return Yt(u(e),t,r,n)}function Qt(e,t,r){if(W.config.allowEval){return t()}else{Y(e,"htmx:evalDisallowedError");return r}}function er(e,t){return Yt(e,"hx-vars",true,t)}function tr(e,t){return Yt(e,"hx-vals",false,t)}function rr(e){return re(er(e),tr(e))}function nr(t,r,n){if(n!==null){try{t.setRequestHeader(r,n)}catch(e){t.setRequestHeader(r,encodeURIComponent(n));t.setRequestHeader(r+"-URI-AutoEncoded","true")}}}function ir(t){if(t.responseURL&&typeof URL!=="undefined"){try{var e=new URL(t.responseURL);return e.pathname+e.search}catch(e){Y(J().body,"htmx:badResponseUrl",{url:t.responseURL})}}}function ar(e,t){return e.getAllResponseHeaders().match(t)}function or(e,t,r){e=e.toLowerCase();if(r){if(r instanceof Element||p(r,"String")){return lr(e,t,null,null,{targetOverride:D(r),returnPromise:true})}else{return lr(e,t,D(r.source),r.event,{handler:r.handler,headers:r.headers,values:r.values,targetOverride:D(r.target),swapOverride:r.swap,returnPromise:true})}}else{return lr(e,t,null,null,{returnPromise:true})}}function sr(e){var t=[];while(e){t.push(e);e=e.parentElement}return t}function lr(e,t,n,r,i,f){var c=null;var h=null;i=i!=null?i:{};if(i.returnPromise&&typeof Promise!=="undefined"){var d=new Promise(function(e,t){c=e;h=t})}if(n==null){n=J().body}var v=i.handler||fr;if(!te(n)){return}var g=i.targetOverride||oe(n);if(g==null||g==ie){Y(n,"htmx:targetError",{target:G(n,"hx-target")});return}if(!f){var p=function(){return lr(e,t,n,r,i,true)};var m={target:g,elt:n,path:t,verb:e,triggeringEvent:r,etc:i,issueRequest:p};if(Q(n,"htmx:confirm",m)===false){return}}var x=n;var a=Z(n);var y=$(n,"hx-sync");var b=null;var w=false;if(y){var S=y.split(":");var E=S[0].trim();if(E==="this"){x=ae(n,"hx-sync")}else{x=ne(n,E)}y=(S[1]||"drop").trim();a=Z(x);if(y==="drop"&&a.xhr&&a.abortable!==true){return}else if(y==="abort"){if(a.xhr){return}else{w=true}}else if(y==="replace"){Q(x,"htmx:abort")}else if(y.indexOf("queue")===0){var C=y.split(" ");b=(C[1]||"last").trim()}}if(a.xhr){if(a.abortable){Q(x,"htmx:abort")}else{if(b==null){if(r){var R=Z(r);if(R&&R.triggerSpec&&R.triggerSpec.queue){b=R.triggerSpec.queue}}if(b==null){b="last"}}if(a.queuedRequests==null){a.queuedRequests=[]}if(b==="first"&&a.queuedRequests.length===0){a.queuedRequests.push(function(){lr(e,t,n,r,i)})}else if(b==="all"){a.queuedRequests.push(function(){lr(e,t,n,r,i)})}else if(b==="last"){a.queuedRequests=[];a.queuedRequests.push(function(){lr(e,t,n,r,i)})}return}}var o=new XMLHttpRequest;a.xhr=o;a.abortable=w;var s=function(){a.xhr=null;a.abortable=false;if(a.queuedRequests!=null&&a.queuedRequests.length>0){var e=a.queuedRequests.shift();e()}};var O=$(n,"hx-prompt");if(O){var q=prompt(O);if(q===null||!Q(n,"htmx:prompt",{prompt:q,target:g})){ee(c);s();return d}}var L=$(n,"hx-confirm");if(L){if(!confirm(L)){ee(c);s();return d}}var T=_t(n,g,q);if(i.headers){T=re(T,i.headers)}var H=jt(n,e);var A=H.errors;var N=H.values;if(i.values){N=re(N,i.values)}var I=rr(n);var k=re(N,I);var M=zt(k,n);if(e!=="get"&&!Jt(n)){T["Content-Type"]="application/x-www-form-urlencoded"}if(t==null||t===""){t=J().location.href}var D=Yt(n,"hx-request");var P=Z(n).boosted;var l={boosted:P,parameters:M,unfilteredParameters:k,headers:T,target:g,verb:e,errors:A,withCredentials:i.credentials||D.credentials||W.config.withCredentials,timeout:i.timeout||D.timeout||W.config.timeout,path:t,triggeringEvent:r};if(!Q(n,"htmx:configRequest",l)){ee(c);s();return d}t=l.path;e=l.verb;T=l.headers;M=l.parameters;A=l.errors;if(A&&A.length>0){Q(n,"htmx:validation:halted",l);ee(c);s();return d}var X=t.split("#");var F=X[0];var j=X[1];var B=null;if(e==="get"){B=F;var U=Object.keys(M).length!==0;if(U){if(B.indexOf("?")<0){B+="?"}else{B+="&"}B+=Ut(M);if(j){B+="#"+j}}o.open("GET",B,true)}else{o.open(e.toUpperCase(),t,true)}o.overrideMimeType("text/html");o.withCredentials=l.withCredentials;o.timeout=l.timeout;if(D.noHeaders){}else{for(var V in T){if(T.hasOwnProperty(V)){var _=T[V];nr(o,V,_)}}}var u={xhr:o,target:g,requestConfig:l,etc:i,boosted:P,pathInfo:{requestPath:t,finalRequestPath:B||t,anchor:j}};o.onload=function(){try{var e=sr(n);u.pathInfo.responsePath=ir(o);v(n,u);Mt(z);Q(n,"htmx:afterRequest",u);Q(n,"htmx:afterOnLoad",u);if(!te(n)){var t=null;while(e.length>0&&t==null){var r=e.shift();if(te(r)){t=r}}if(t){Q(t,"htmx:afterRequest",u);Q(t,"htmx:afterOnLoad",u)}}ee(c);s()}catch(e){Y(n,"htmx:onLoadError",re({error:e},u));throw e}};o.onerror=function(){Mt(z);Y(n,"htmx:afterRequest",u);Y(n,"htmx:sendError",u);ee(h);s()};o.onabort=function(){Mt(z);Y(n,"htmx:afterRequest",u);Y(n,"htmx:sendAbort",u);ee(h);s()};o.ontimeout=function(){Mt(z);Y(n,"htmx:afterRequest",u);Y(n,"htmx:timeout",u);ee(h);s()};if(!Q(n,"htmx:beforeRequest",u)){ee(c);s();return d}var z=kt(n);K(["loadstart","loadend","progress","abort"],function(t){K([o,o.upload],function(e){e.addEventListener(t,function(e){Q(n,"htmx:xhr:"+t,{lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total})})})});Q(n,"htmx:beforeSend",u);o.send(e==="get"?null:$t(o,n,M));return d}function ur(e,t){var r=t.xhr;var n=null;var i=null;if(ar(r,/HX-Push:/i)){n=r.getResponseHeader("HX-Push");i="push"}else if(ar(r,/HX-Push-Url:/i)){n=r.getResponseHeader("HX-Push-Url");i="push"}else if(ar(r,/HX-Replace-Url:/i)){n=r.getResponseHeader("HX-Replace-Url");i="replace"}if(n){if(n==="false"){return{}}else{return{type:i,path:n}}}var a=t.pathInfo.finalRequestPath;var o=t.pathInfo.responsePath;var s=$(e,"hx-push-url");var f=$(e,"hx-replace-url");var c=Z(e).boosted;var l=null;var u=null;if(s){l="push";u=s}else if(f){l="replace";u=f}else if(c){l="push";u=o||a}if(u){if(u==="false"){return{}}if(u==="true"){u=o||a}if(t.pathInfo.anchor&&u.indexOf("#")===-1){u=u+"#"+t.pathInfo.anchor}return{type:l,path:u}}else{return{}}}function fr(s,l){var u=l.xhr;var f=l.target;var n=l.etc;if(!Q(s,"htmx:beforeOnLoad",l))return;if(ar(u,/HX-Trigger:/i)){qe(u,"HX-Trigger",s)}if(ar(u,/HX-Location:/i)){Lt();var e=u.getResponseHeader("HX-Location");var c;if(e.indexOf("{")===0){c=S(e);e=c["path"];delete c["path"]}or("GET",e,c).then(function(){Tt(e)});return}if(ar(u,/HX-Redirect:/i)){location.href=u.getResponseHeader("HX-Redirect");return}if(ar(u,/HX-Refresh:/i)){if("true"===u.getResponseHeader("HX-Refresh")){location.reload();return}}if(ar(u,/HX-Retarget:/i)){l.target=J().querySelector(u.getResponseHeader("HX-Retarget"))}var h=ur(s,l);var i=u.status>=200&&u.status<400&&u.status!==204;var d=u.response;var t=u.status>=400;var r=re({shouldSwap:i,serverResponse:d,isError:t},l);if(!Q(f,"htmx:beforeSwap",r))return;f=r.target;d=r.serverResponse;t=r.isError;l.failed=t;l.successful=!t;if(r.shouldSwap){if(u.status===286){Fe(s)}wt(s,function(e){d=e.transformResponse(d,u,s)});if(h.type){Lt()}var a=n.swapOverride;if(ar(u,/HX-Reswap:/i)){a=u.getResponseHeader("HX-Reswap")}var c=Gt(s,a);f.classList.add(W.config.swappingClass);var o=function(){try{var e=document.activeElement;var t={};try{t={elt:e,start:e?e.selectionStart:null,end:e?e.selectionEnd:null}}catch(e){}var n=Zt(f);Oe(c.swapStyle,f,s,d,n);if(t.elt&&!te(t.elt)&&t.elt.id){var r=document.getElementById(t.elt.id);var i={preventScroll:c.focusScroll!==undefined?!c.focusScroll:!W.config.defaultFocusScroll};if(r){if(t.start&&r.setSelectionRange){r.setSelectionRange(t.start,t.end)}r.focus(i)}}f.classList.remove(W.config.swappingClass);K(n.elts,function(e){if(e.classList){e.classList.add(W.config.settlingClass)}Q(e,"htmx:afterSwap",l)});if(ar(u,/HX-Trigger-After-Swap:/i)){var a=s;if(!te(s)){a=J().body}qe(u,"HX-Trigger-After-Swap",a)}var o=function(){K(n.tasks,function(e){e.call()});K(n.elts,function(e){if(e.classList){e.classList.remove(W.config.settlingClass)}Q(e,"htmx:afterSettle",l)});if(h.type){if(h.type==="push"){Tt(h.path);Q(J().body,"htmx:pushedIntoHistory",{path:h.path})}else{Ht(h.path);Q(J().body,"htmx:replacedInHistory",{path:h.path})}}if(l.pathInfo.anchor){var e=R("#"+l.pathInfo.anchor);if(e){e.scrollIntoView({block:"start",behavior:"auto"})}}if(n.title){var t=R("title");if(t){t.innerHTML=n.title}else{window.document.title=n.title}}Kt(n.elts,c);if(ar(u,/HX-Trigger-After-Settle:/i)){var r=s;if(!te(s)){r=J().body}qe(u,"HX-Trigger-After-Settle",r)}};if(c.settleDelay>0){setTimeout(o,c.settleDelay)}else{o()}}catch(e){Y(s,"htmx:swapError",l);throw e}};if(c.swapDelay>0){setTimeout(o,c.swapDelay)}else{o()}}if(t){Y(s,"htmx:responseError",re({error:"Response Status Error Code "+u.status+" from "+l.pathInfo.requestPath},l))}}var cr={};function hr(){return{init:function(e){return null},onEvent:function(e,t){return true},transformResponse:function(e,t,r){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,r,n){return false},encodeParameters:function(e,t,r){return null}}}function dr(e,t){if(t.init){t.init(r)}cr[e]=re(hr(),t)}function vr(e){delete cr[e]}function gr(e,r,n){if(e==undefined){return r}if(r==undefined){r=[]}if(n==undefined){n=[]}var t=G(e,"hx-ext");if(t){K(t.split(","),function(e){e=e.replace(/ /g,"");if(e.slice(0,7)=="ignore:"){n.push(e.slice(7));return}if(n.indexOf(e)<0){var t=cr[e];if(t&&r.indexOf(t)<0){r.push(t)}}})}return gr(u(e),r,n)}function pr(e){if(J().readyState!=="loading"){e()}else{J().addEventListener("DOMContentLoaded",e)}}function mr(){if(W.config.includeIndicatorStyles!==false){J().head.insertAdjacentHTML("beforeend","")}}function xr(){var e=J().querySelector('meta[name="htmx-config"]');if(e){return S(e.content)}else{return null}}function yr(){var e=xr();if(e){W.config=re(W.config,e)}}pr(function(){yr();mr();var e=J().body;mt(e);var t=J().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(e){var t=e.target;var r=Z(t);if(r&&r.xhr){r.xhr.abort()}});window.onpopstate=function(e){if(e.state&&e.state.htmx){It();K(t,function(e){Q(e,"htmx:restored",{document:J(),triggerEvent:Q})})}};setTimeout(function(){Q(e,"htmx:load",{})},0)});return W}()}); \ No newline at end of file diff --git a/lacommunaute/static/vendor/htmx-1.9.2/htmx.min.js b/lacommunaute/static/vendor/htmx-1.9.2/htmx.min.js new file mode 100644 index 000000000..f889d0ea5 --- /dev/null +++ b/lacommunaute/static/vendor/htmx-1.9.2/htmx.min.js @@ -0,0 +1 @@ +(function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else if(typeof module==="object"&&module.exports){module.exports=t()}else{e.htmx=e.htmx||t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var z={onLoad:t,process:Tt,on:le,off:ue,trigger:ie,ajax:dr,find:b,findAll:f,closest:d,values:function(e,t){var r=Jt(e,t||"post");return r.values},remove:B,addClass:j,removeClass:n,toggleClass:U,takeClass:V,defineExtension:yr,removeExtension:br,logAll:F,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,inlineScriptNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",useTemplateFragments:false,scrollBehavior:"smooth",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false},parseInterval:v,_:e,createEventSource:function(e){return new EventSource(e,{withCredentials:true})},createWebSocket:function(e){var t=new WebSocket(e,[]);t.binaryType=z.config.wsBinaryType;return t},version:"1.9.2"};var C={addTriggerHandler:xt,bodyContains:ee,canAccessLocalStorage:D,filterValues:er,hasAttribute:q,getAttributeValue:G,getClosestMatch:c,getExpressionVars:fr,getHeaders:Qt,getInputValues:Jt,getInternalData:Y,getSwapSpecification:rr,getTriggerSpecs:ze,getTarget:de,makeFragment:l,mergeObjects:te,makeSettleInfo:S,oobSwap:me,selectAndSwap:Me,settleImmediately:Bt,shouldCancel:Ke,triggerEvent:ie,triggerErrorEvent:ne,withExtensions:w};var R=["get","post","put","delete","patch"];var O=R.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function v(e){if(e==undefined){return undefined}if(e.slice(-2)=="ms"){return parseFloat(e.slice(0,-2))||undefined}if(e.slice(-1)=="s"){return parseFloat(e.slice(0,-1))*1e3||undefined}if(e.slice(-1)=="m"){return parseFloat(e.slice(0,-1))*1e3*60||undefined}return parseFloat(e)||undefined}function $(e,t){return e.getAttribute&&e.getAttribute(t)}function q(e,t){return e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function G(e,t){return $(e,t)||$(e,"data-"+t)}function u(e){return e.parentElement}function J(){return document}function c(e,t){while(e&&!t(e)){e=u(e)}return e?e:null}function T(e,t,r){var n=G(t,r);var i=G(t,"hx-disinherit");if(e!==t&&i&&(i==="*"||i.split(" ").indexOf(r)>=0)){return"unset"}else{return n}}function Z(t,r){var n=null;c(t,function(e){return n=T(t,e,r)});if(n!=="unset"){return n}}function h(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}function H(e){var t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var r=t.exec(e);if(r){return r[1].toLowerCase()}else{return""}}function i(e,t){var r=new DOMParser;var n=r.parseFromString(e,"text/html");var i=n.body;while(t>0){t--;i=i.firstChild}if(i==null){i=J().createDocumentFragment()}return i}function L(e){return e.match(/",0);return r.querySelector("template").content}else{var n=H(e);switch(n){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return i(""+e+"
",1);case"col":return i(""+e+"
",2);case"tr":return i(""+e+"
",2);case"td":case"th":return i(""+e+"
",3);case"script":return i("
"+e+"
",1);default:return i(e,0)}}}function K(e){if(e){e()}}function A(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function N(e){return A(e,"Function")}function I(e){return A(e,"Object")}function Y(e){var t="htmx-internal-data";var r=e[t];if(!r){r=e[t]={}}return r}function k(e){var t=[];if(e){for(var r=0;r=0}function ee(e){if(e.getRootNode&&e.getRootNode()instanceof ShadowRoot){return J().body.contains(e.getRootNode().host)}else{return J().body.contains(e)}}function M(e){return e.trim().split(/\s+/)}function te(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}function y(e){try{return JSON.parse(e)}catch(e){x(e);return null}}function D(){var e="htmx:localStorageTest";try{localStorage.setItem(e,e);localStorage.removeItem(e);return true}catch(e){return false}}function X(t){try{var e=new URL(t);if(e){t=e.pathname+e.search}if(!t.match("^/$")){t=t.replace(/\/+$/,"")}return t}catch(e){return t}}function e(e){return sr(J().body,function(){return eval(e)})}function t(t){var e=z.on("htmx:load",function(e){t(e.detail.elt)});return e}function F(){z.logger=function(e,t,r){if(console){console.log(t,e,r)}}}function b(e,t){if(t){return e.querySelector(t)}else{return b(J(),e)}}function f(e,t){if(t){return e.querySelectorAll(t)}else{return f(J(),e)}}function B(e,t){e=s(e);if(t){setTimeout(function(){B(e);e=null},t)}else{e.parentElement.removeChild(e)}}function j(e,t,r){e=s(e);if(r){setTimeout(function(){j(e,t);e=null},r)}else{e.classList&&e.classList.add(t)}}function n(e,t,r){e=s(e);if(r){setTimeout(function(){n(e,t);e=null},r)}else{if(e.classList){e.classList.remove(t);if(e.classList.length===0){e.removeAttribute("class")}}}}function U(e,t){e=s(e);e.classList.toggle(t)}function V(e,t){e=s(e);Q(e.parentElement.children,function(e){n(e,t)});j(e,t)}function d(e,t){e=s(e);if(e.closest){return e.closest(t)}else{do{if(e==null||h(e,t)){return e}}while(e=e&&u(e));return null}}function r(e){var t=e.trim();if(t.startsWith("<")&&t.endsWith("/>")){return t.substring(1,t.length-2)}else{return t}}function _(e,t){if(t.indexOf("closest ")===0){return[d(e,r(t.substr(8)))]}else if(t.indexOf("find ")===0){return[b(e,r(t.substr(5)))]}else if(t.indexOf("next ")===0){return[W(e,r(t.substr(5)))]}else if(t.indexOf("previous ")===0){return[oe(e,r(t.substr(9)))]}else if(t==="document"){return[document]}else if(t==="window"){return[window]}else{return J().querySelectorAll(r(t))}}var W=function(e,t){var r=J().querySelectorAll(t);for(var n=0;n=0;n--){var i=r[n];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING){return i}}};function re(e,t){if(t){return _(e,t)[0]}else{return _(J().body,e)[0]}}function s(e){if(A(e,"String")){return b(e)}else{return e}}function se(e,t,r){if(N(t)){return{target:J().body,event:e,listener:t}}else{return{target:s(e),event:t,listener:r}}}function le(t,r,n){Sr(function(){var e=se(t,r,n);e.target.addEventListener(e.event,e.listener)});var e=N(r);return e?r:n}function ue(t,r,n){Sr(function(){var e=se(t,r,n);e.target.removeEventListener(e.event,e.listener)});return N(r)?r:n}var fe=J().createElement("output");function ce(e,t){var r=Z(e,t);if(r){if(r==="this"){return[he(e,t)]}else{var n=_(e,r);if(n.length===0){x('The selector "'+r+'" on '+t+" returned no matches!");return[fe]}else{return n}}}}function he(e,t){return c(e,function(e){return G(e,t)!=null})}function de(e){var t=Z(e,"hx-target");if(t){if(t==="this"){return he(e,"hx-target")}else{return re(e,t)}}else{var r=Y(e);if(r.boosted){return J().body}else{return e}}}function ve(e){var t=z.config.attributesToSettle;for(var r=0;r0){o=e.substr(0,e.indexOf(":"));t=e.substr(e.indexOf(":")+1,e.length)}else{o=e}var r=J().querySelectorAll(t);if(r){Q(r,function(e){var t;var r=i.cloneNode(true);t=J().createDocumentFragment();t.appendChild(r);if(!pe(o,e)){t=r}var n={shouldSwap:true,target:e,fragment:t};if(!ie(e,"htmx:oobBeforeSwap",n))return;e=n.target;if(n["shouldSwap"]){ke(o,e,e,t,a)}Q(a.elts,function(e){ie(e,"htmx:oobAfterSwap",n)})});i.parentNode.removeChild(i)}else{i.parentNode.removeChild(i);ne(J().body,"htmx:oobErrorNoTarget",{content:i})}return e}function xe(e,t,r){var n=Z(e,"hx-select-oob");if(n){var i=n.split(",");for(let e=0;e0){var t=e.id.replace("'","\\'");var r=e.tagName.replace(":","\\:");var n=a.querySelector(r+"[id='"+t+"']");if(n&&n!==a){var i=e.cloneNode();ge(e,n);o.tasks.push(function(){ge(e,i)})}}})}function we(e){return function(){n(e,z.config.addedClass);Tt(e);bt(e);Se(e);ie(e,"htmx:load")}}function Se(e){var t="[autofocus]";var r=h(e,t)?e:e.querySelector(t);if(r!=null){r.focus()}}function a(e,t,r,n){be(e,r,n);while(r.childNodes.length>0){var i=r.firstChild;j(i,z.config.addedClass);e.insertBefore(i,t);if(i.nodeType!==Node.TEXT_NODE&&i.nodeType!==Node.COMMENT_NODE){n.tasks.push(we(i))}}}function Ee(e,t){var r=0;while(r-1){var t=e.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");var r=t.match(/]*>|>)([\s\S]*?)<\/title>/im);if(r){return r[2]}}}function Me(e,t,r,n,i){i.title=Pe(n);var a=l(n);if(a){xe(r,a,i);a=Ie(r,a);ye(a);return ke(e,r,t,a,i)}}function De(e,t,r){var n=e.getResponseHeader(t);if(n.indexOf("{")===0){var i=y(n);for(var a in i){if(i.hasOwnProperty(a)){var o=i[a];if(!I(o)){o={value:o}}ie(r,a,o)}}}else{ie(r,n,[])}}var Xe=/\s/;var g=/[\s,]/;var Fe=/[_$a-zA-Z]/;var Be=/[_$a-zA-Z0-9]/;var je=['"',"'","/"];var p=/[^\s]/;function Ue(e){var t=[];var r=0;while(r0){var o=t[0];if(o==="]"){n--;if(n===0){if(a===null){i=i+"true"}t.shift();i+=")})";try{var s=sr(e,function(){return Function(i)()},function(){return true});s.source=i;return s}catch(e){ne(J().body,"htmx:syntax:error",{error:e,source:i});return null}}}else if(o==="["){n++}if(Ve(o,a,r)){i+="(("+r+"."+o+") ? ("+r+"."+o+") : (window."+o+"))"}else{i=i+o}a=t.shift()}}}function m(e,t){var r="";while(e.length>0&&!e[0].match(t)){r+=e.shift()}return r}var We="input, textarea, select";function ze(e){var t=G(e,"hx-trigger");var r=[];if(t){var n=Ue(t);do{m(n,p);var i=n.length;var a=m(n,/[,\[\s]/);if(a!==""){if(a==="every"){var o={trigger:"every"};m(n,p);o.pollInterval=v(m(n,/[,\[\s]/));m(n,p);var s=_e(e,n,"event");if(s){o.eventFilter=s}r.push(o)}else if(a.indexOf("sse:")===0){r.push({trigger:"sse",sseEvent:a.substr(4)})}else{var l={trigger:a};var s=_e(e,n,"event");if(s){l.eventFilter=s}while(n.length>0&&n[0]!==","){m(n,p);var u=n.shift();if(u==="changed"){l.changed=true}else if(u==="once"){l.once=true}else if(u==="consume"){l.consume=true}else if(u==="delay"&&n[0]===":"){n.shift();l.delay=v(m(n,g))}else if(u==="from"&&n[0]===":"){n.shift();var f=m(n,g);if(f==="closest"||f==="find"||f==="next"||f==="previous"){n.shift();f+=" "+m(n,g)}l.from=f}else if(u==="target"&&n[0]===":"){n.shift();l.target=m(n,g)}else if(u==="throttle"&&n[0]===":"){n.shift();l.throttle=v(m(n,g))}else if(u==="queue"&&n[0]===":"){n.shift();l.queue=m(n,g)}else if((u==="root"||u==="threshold")&&n[0]===":"){n.shift();l[u]=m(n,g)}else{ne(e,"htmx:syntax:error",{token:n.shift()})}}r.push(l)}}if(n.length===i){ne(e,"htmx:syntax:error",{token:n.shift()})}m(n,p)}while(n[0]===","&&n.shift())}if(r.length>0){return r}else if(h(e,"form")){return[{trigger:"submit"}]}else if(h(e,'input[type="button"]')){return[{trigger:"click"}]}else if(h(e,We)){return[{trigger:"change"}]}else{return[{trigger:"click"}]}}function $e(e){Y(e).cancelled=true}function Ge(e,t,r){var n=Y(e);n.timeout=setTimeout(function(){if(ee(e)&&n.cancelled!==true){if(!Qe(r,Lt("hx:poll:trigger",{triggerSpec:r,target:e}))){t(e)}Ge(e,t,r)}},r.pollInterval)}function Je(e){return location.hostname===e.hostname&&$(e,"href")&&$(e,"href").indexOf("#")!==0}function Ze(t,r,e){if(t.tagName==="A"&&Je(t)&&(t.target===""||t.target==="_self")||t.tagName==="FORM"){r.boosted=true;var n,i;if(t.tagName==="A"){n="get";i=t.href}else{var a=$(t,"method");n=a?a.toLowerCase():"get";if(n==="get"){}i=$(t,"action")}e.forEach(function(e){et(t,function(e,t){ae(n,i,e,t)},r,e,true)})}}function Ke(e,t){if(e.type==="submit"||e.type==="click"){if(t.tagName==="FORM"){return true}if(h(t,'input[type="submit"], button')&&d(t,"form")!==null){return true}if(t.tagName==="A"&&t.href&&(t.getAttribute("href")==="#"||t.getAttribute("href").indexOf("#")!==0)){return true}}return false}function Ye(e,t){return Y(e).boosted&&e.tagName==="A"&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function Qe(e,t){var r=e.eventFilter;if(r){try{return r(t)!==true}catch(e){ne(J().body,"htmx:eventFilter:error",{error:e,source:r.source});return true}}return false}function et(i,a,e,o,s){var l=Y(i);var t;if(o.from){t=_(i,o.from)}else{t=[i]}if(o.changed){l.lastValue=i.value}Q(t,function(r){var n=function(e){if(!ee(i)){r.removeEventListener(o.trigger,n);return}if(Ye(i,e)){return}if(s||Ke(e,i)){e.preventDefault()}if(Qe(o,e)){return}var t=Y(e);t.triggerSpec=o;if(t.handledFor==null){t.handledFor=[]}if(t.handledFor.indexOf(i)<0){t.handledFor.push(i);if(o.consume){e.stopPropagation()}if(o.target&&e.target){if(!h(e.target,o.target)){return}}if(o.once){if(l.triggeredOnce){return}else{l.triggeredOnce=true}}if(o.changed){if(l.lastValue===i.value){return}else{l.lastValue=i.value}}if(l.delayed){clearTimeout(l.delayed)}if(l.throttle){return}if(o.throttle){if(!l.throttle){a(i,e);l.throttle=setTimeout(function(){l.throttle=null},o.throttle)}}else if(o.delay){l.delayed=setTimeout(function(){a(i,e)},o.delay)}else{ie(i,"htmx:trigger");a(i,e)}}};if(e.listenerInfos==null){e.listenerInfos=[]}e.listenerInfos.push({trigger:o.trigger,listener:n,on:r});r.addEventListener(o.trigger,n)})}var tt=false;var rt=null;function nt(){if(!rt){rt=function(){tt=true};window.addEventListener("scroll",rt);setInterval(function(){if(tt){tt=false;Q(J().querySelectorAll("[hx-trigger='revealed'],[data-hx-trigger='revealed']"),function(e){it(e)})}},200)}}function it(t){if(!q(t,"data-hx-revealed")&&P(t)){t.setAttribute("data-hx-revealed","true");var e=Y(t);if(e.initHash){ie(t,"revealed")}else{t.addEventListener("htmx:afterProcessNode",function(e){ie(t,"revealed")},{once:true})}}}function at(e,t,r){var n=M(r);for(var i=0;i=0){var t=ut(n);setTimeout(function(){ot(s,r,n+1)},t)}};t.onopen=function(e){n=0};Y(s).webSocket=t;t.addEventListener("message",function(e){if(st(s)){return}var t=e.data;w(s,function(e){t=e.transformResponse(t,null,s)});var r=S(s);var n=l(t);var i=k(n.children);for(var a=0;a0){ie(u,"htmx:validation:halted",i);return}t.send(JSON.stringify(l));if(Ke(e,u)){e.preventDefault()}})}else{ne(u,"htmx:noWebSocketSourceError")}}function ut(e){var t=z.config.wsReconnectDelay;if(typeof t==="function"){return t(e)}if(t==="full-jitter"){var r=Math.min(e,6);var n=1e3*Math.pow(2,r);return n*Math.random()}x('htmx.config.wsReconnectDelay must either be a function or the string "full-jitter"')}function ft(e,t,r){var n=M(r);for(var i=0;i0){var o=n.shift();var s=o.match(/^\s*([a-zA-Z:\-]+:)(.*)/);if(a===0&&s){o.split(":");i=s[1].slice(0,-1);r[i]=s[2]}else{r[i]+=o}a+=Ct(o)}for(var l in r){Rt(e,l,r[l])}}}function qt(t){if(t.closest&&t.closest(z.config.disableSelector)){return}var r=Y(t);if(r.initHash!==Ce(t)){r.initHash=Ce(t);Re(t);Ot(t);ie(t,"htmx:beforeProcessNode");if(t.value){r.lastValue=t.value}var e=ze(t);var n=mt(t,r,e);if(!n){if(Z(t,"hx-boost")==="true"){Ze(t,r,e)}else if(q(t,"hx-trigger")){e.forEach(function(e){xt(t,e,r,function(){})})}}if(t.tagName==="FORM"){Et(t)}var i=G(t,"hx-sse");if(i){ft(t,r,i)}var a=G(t,"hx-ws");if(a){at(t,r,a)}ie(t,"htmx:afterProcessNode")}}function Tt(e){e=s(e);qt(e);Q(St(e),function(e){qt(e)})}function Ht(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Lt(e,t){var r;if(window.CustomEvent&&typeof window.CustomEvent==="function"){r=new CustomEvent(e,{bubbles:true,cancelable:true,detail:t})}else{r=J().createEvent("CustomEvent");r.initCustomEvent(e,true,true,t)}return r}function ne(e,t,r){ie(e,t,te({error:t},r))}function At(e){return e==="htmx:afterProcessNode"}function w(e,t){Q(wr(e),function(e){try{t(e)}catch(e){x(e)}})}function x(e){if(console.error){console.error(e)}else if(console.log){console.log("ERROR: ",e)}}function ie(e,t,r){e=s(e);if(r==null){r={}}r["elt"]=e;var n=Lt(t,r);if(z.logger&&!At(t)){z.logger(e,t,r)}if(r.error){x(r.error);ie(e,"htmx:error",{errorInfo:r})}var i=e.dispatchEvent(n);var a=Ht(t);if(i&&a!==t){var o=Lt(a,n.detail);i=i&&e.dispatchEvent(o)}w(e,function(e){i=i&&e.onEvent(t,n)!==false});return i}var Nt=location.pathname+location.search;function It(){var e=J().querySelector("[hx-history-elt],[data-hx-history-elt]");return e||J().body}function kt(e,t,r,n){if(!D()){return}e=X(e);var i=y(localStorage.getItem("htmx-history-cache"))||[];for(var a=0;az.config.historyCacheSize){i.shift()}while(i.length>0){try{localStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(e){ne(J().body,"htmx:historyCacheError",{cause:e,cache:i});i.shift()}}}function Pt(e){if(!D()){return null}e=X(e);var t=y(localStorage.getItem("htmx-history-cache"))||[];for(var r=0;r=200&&this.status<400){ie(J().body,"htmx:historyCacheMissLoad",o);var e=l(this.response);e=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;var t=It();var r=S(t);var n=Pe(this.response);if(n){var i=b("title");if(i){i.innerHTML=n}else{window.document.title=n}}Ne(t,e,r);Bt(r.tasks);Nt=a;ie(J().body,"htmx:historyRestore",{path:a,cacheMiss:true,serverResponse:this.response})}else{ne(J().body,"htmx:historyCacheMissLoadError",o)}};e.send()}function Ut(e){Dt();e=e||location.pathname+location.search;var t=Pt(e);if(t){var r=l(t.content);var n=It();var i=S(n);Ne(n,r,i);Bt(i.tasks);document.title=t.title;window.scrollTo(0,t.scroll);Nt=e;ie(J().body,"htmx:historyRestore",{path:e,item:t})}else{if(z.config.refreshOnHistoryMiss){window.location.reload(true)}else{jt(e)}}}function Vt(e){var t=ce(e,"hx-indicator");if(t==null){t=[e]}Q(t,function(e){var t=Y(e);t.requestCount=(t.requestCount||0)+1;e.classList["add"].call(e.classList,z.config.requestClass)});return t}function _t(e){Q(e,function(e){var t=Y(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.classList["remove"].call(e.classList,z.config.requestClass)}})}function Wt(e,t){for(var r=0;r=0}function rr(e,t){var r=t?t:Z(e,"hx-swap");var n={swapStyle:Y(e).boosted?"innerHTML":z.config.defaultSwapStyle,swapDelay:z.config.defaultSwapDelay,settleDelay:z.config.defaultSettleDelay};if(Y(e).boosted&&!tr(e)){n["show"]="top"}if(r){var i=M(r);if(i.length>0){n["swapStyle"]=i[0];for(var a=1;a0?l.join(":"):null;n["scroll"]=u;n["scrollTarget"]=f}if(o.indexOf("show:")===0){var c=o.substr(5);var l=c.split(":");var h=l.pop();var f=l.length>0?l.join(":"):null;n["show"]=h;n["showTarget"]=f}if(o.indexOf("focus-scroll:")===0){var d=o.substr("focus-scroll:".length);n["focusScroll"]=d=="true"}}}}return n}function nr(e){return Z(e,"hx-encoding")==="multipart/form-data"||h(e,"form")&&$(e,"enctype")==="multipart/form-data"}function ir(t,r,n){var i=null;w(r,function(e){if(i==null){i=e.encodeParameters(t,n,r)}});if(i!=null){return i}else{if(nr(r)){return Yt(n)}else{return Kt(n)}}}function S(e){return{tasks:[],elts:[e]}}function ar(e,t){var r=e[0];var n=e[e.length-1];if(t.scroll){var i=null;if(t.scrollTarget){i=re(r,t.scrollTarget)}if(t.scroll==="top"&&(r||i)){i=i||r;i.scrollTop=0}if(t.scroll==="bottom"&&(n||i)){i=i||n;i.scrollTop=i.scrollHeight}}if(t.show){var i=null;if(t.showTarget){var a=t.showTarget;if(t.showTarget==="window"){a="body"}i=re(r,a)}if(t.show==="top"&&(r||i)){i=i||r;i.scrollIntoView({block:"start",behavior:z.config.scrollBehavior})}if(t.show==="bottom"&&(n||i)){i=i||n;i.scrollIntoView({block:"end",behavior:z.config.scrollBehavior})}}}function or(e,t,r,n){if(n==null){n={}}if(e==null){return n}var i=G(e,t);if(i){var a=i.trim();var o=r;if(a==="unset"){return null}if(a.indexOf("javascript:")===0){a=a.substr(11);o=true}else if(a.indexOf("js:")===0){a=a.substr(3);o=true}if(a.indexOf("{")!==0){a="{"+a+"}"}var s;if(o){s=sr(e,function(){return Function("return ("+a+")")()},{})}else{s=y(a)}for(var l in s){if(s.hasOwnProperty(l)){if(n[l]==null){n[l]=s[l]}}}}return or(u(e),t,r,n)}function sr(e,t,r){if(z.config.allowEval){return t()}else{ne(e,"htmx:evalDisallowedError");return r}}function lr(e,t){return or(e,"hx-vars",true,t)}function ur(e,t){return or(e,"hx-vals",false,t)}function fr(e){return te(lr(e),ur(e))}function cr(t,r,n){if(n!==null){try{t.setRequestHeader(r,n)}catch(e){t.setRequestHeader(r,encodeURIComponent(n));t.setRequestHeader(r+"-URI-AutoEncoded","true")}}}function hr(t){if(t.responseURL&&typeof URL!=="undefined"){try{var e=new URL(t.responseURL);return e.pathname+e.search}catch(e){ne(J().body,"htmx:badResponseUrl",{url:t.responseURL})}}}function E(e,t){return e.getAllResponseHeaders().match(t)}function dr(e,t,r){e=e.toLowerCase();if(r){if(r instanceof Element||A(r,"String")){return ae(e,t,null,null,{targetOverride:s(r),returnPromise:true})}else{return ae(e,t,s(r.source),r.event,{handler:r.handler,headers:r.headers,values:r.values,targetOverride:s(r.target),swapOverride:r.swap,returnPromise:true})}}else{return ae(e,t,null,null,{returnPromise:true})}}function vr(e){var t=[];while(e){t.push(e);e=e.parentElement}return t}function ae(e,t,n,r,i,M){var a=null;var o=null;i=i!=null?i:{};if(i.returnPromise&&typeof Promise!=="undefined"){var s=new Promise(function(e,t){a=e;o=t})}if(n==null){n=J().body}var D=i.handler||pr;if(!ee(n)){return}var l=i.targetOverride||de(n);if(l==null||l==fe){ne(n,"htmx:targetError",{target:G(n,"hx-target")});return}if(!M){var X=function(){return ae(e,t,n,r,i,true)};var F={target:l,elt:n,path:t,verb:e,triggeringEvent:r,etc:i,issueRequest:X};if(ie(n,"htmx:confirm",F)===false){return}}var u=n;var f=Y(n);var c=Z(n,"hx-sync");var h=null;var d=false;if(c){var v=c.split(":");var g=v[0].trim();if(g==="this"){u=he(n,"hx-sync")}else{u=re(n,g)}c=(v[1]||"drop").trim();f=Y(u);if(c==="drop"&&f.xhr&&f.abortable!==true){return}else if(c==="abort"){if(f.xhr){return}else{d=true}}else if(c==="replace"){ie(u,"htmx:abort")}else if(c.indexOf("queue")===0){var B=c.split(" ");h=(B[1]||"last").trim()}}if(f.xhr){if(f.abortable){ie(u,"htmx:abort")}else{if(h==null){if(r){var p=Y(r);if(p&&p.triggerSpec&&p.triggerSpec.queue){h=p.triggerSpec.queue}}if(h==null){h="last"}}if(f.queuedRequests==null){f.queuedRequests=[]}if(h==="first"&&f.queuedRequests.length===0){f.queuedRequests.push(function(){ae(e,t,n,r,i)})}else if(h==="all"){f.queuedRequests.push(function(){ae(e,t,n,r,i)})}else if(h==="last"){f.queuedRequests=[];f.queuedRequests.push(function(){ae(e,t,n,r,i)})}return}}var m=new XMLHttpRequest;f.xhr=m;f.abortable=d;var x=function(){f.xhr=null;f.abortable=false;if(f.queuedRequests!=null&&f.queuedRequests.length>0){var e=f.queuedRequests.shift();e()}};var y=Z(n,"hx-prompt");if(y){var b=prompt(y);if(b===null||!ie(n,"htmx:prompt",{prompt:b,target:l})){K(a);x();return s}}var w=Z(n,"hx-confirm");if(w){if(!confirm(w)){K(a);x();return s}}var S=Qt(n,l,b);if(i.headers){S=te(S,i.headers)}var E=Jt(n,e);var C=E.errors;var R=E.values;if(i.values){R=te(R,i.values)}var j=fr(n);var O=te(R,j);var q=er(O,n);if(e!=="get"&&!nr(n)){S["Content-Type"]="application/x-www-form-urlencoded"}if(z.config.getCacheBusterParam&&e==="get"){q["org.htmx.cache-buster"]=$(l,"id")||"true"}if(t==null||t===""){t=J().location.href}var T=or(n,"hx-request");var H=Y(n).boosted;var L={boosted:H,parameters:q,unfilteredParameters:O,headers:S,target:l,verb:e,errors:C,withCredentials:i.credentials||T.credentials||z.config.withCredentials,timeout:i.timeout||T.timeout||z.config.timeout,path:t,triggeringEvent:r};if(!ie(n,"htmx:configRequest",L)){K(a);x();return s}t=L.path;e=L.verb;S=L.headers;q=L.parameters;C=L.errors;if(C&&C.length>0){ie(n,"htmx:validation:halted",L);K(a);x();return s}var U=t.split("#");var V=U[0];var A=U[1];var N=null;if(e==="get"){N=V;var _=Object.keys(q).length!==0;if(_){if(N.indexOf("?")<0){N+="?"}else{N+="&"}N+=Kt(q);if(A){N+="#"+A}}m.open("GET",N,true)}else{m.open(e.toUpperCase(),t,true)}m.overrideMimeType("text/html");m.withCredentials=L.withCredentials;m.timeout=L.timeout;if(T.noHeaders){}else{for(var I in S){if(S.hasOwnProperty(I)){var W=S[I];cr(m,I,W)}}}var k={xhr:m,target:l,requestConfig:L,etc:i,boosted:H,pathInfo:{requestPath:t,finalRequestPath:N||t,anchor:A}};m.onload=function(){try{var e=vr(n);k.pathInfo.responsePath=hr(m);D(n,k);_t(P);ie(n,"htmx:afterRequest",k);ie(n,"htmx:afterOnLoad",k);if(!ee(n)){var t=null;while(e.length>0&&t==null){var r=e.shift();if(ee(r)){t=r}}if(t){ie(t,"htmx:afterRequest",k);ie(t,"htmx:afterOnLoad",k)}}K(a);x()}catch(e){ne(n,"htmx:onLoadError",te({error:e},k));throw e}};m.onerror=function(){_t(P);ne(n,"htmx:afterRequest",k);ne(n,"htmx:sendError",k);K(o);x()};m.onabort=function(){_t(P);ne(n,"htmx:afterRequest",k);ne(n,"htmx:sendAbort",k);K(o);x()};m.ontimeout=function(){_t(P);ne(n,"htmx:afterRequest",k);ne(n,"htmx:timeout",k);K(o);x()};if(!ie(n,"htmx:beforeRequest",k)){K(a);x();return s}var P=Vt(n);Q(["loadstart","loadend","progress","abort"],function(t){Q([m,m.upload],function(e){e.addEventListener(t,function(e){ie(n,"htmx:xhr:"+t,{lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total})})})});ie(n,"htmx:beforeSend",k);m.send(e==="get"?null:ir(m,n,q));return s}function gr(e,t){var r=t.xhr;var n=null;var i=null;if(E(r,/HX-Push:/i)){n=r.getResponseHeader("HX-Push");i="push"}else if(E(r,/HX-Push-Url:/i)){n=r.getResponseHeader("HX-Push-Url");i="push"}else if(E(r,/HX-Replace-Url:/i)){n=r.getResponseHeader("HX-Replace-Url");i="replace"}if(n){if(n==="false"){return{}}else{return{type:i,path:n}}}var a=t.pathInfo.finalRequestPath;var o=t.pathInfo.responsePath;var s=Z(e,"hx-push-url");var l=Z(e,"hx-replace-url");var u=Y(e).boosted;var f=null;var c=null;if(s){f="push";c=s}else if(l){f="replace";c=l}else if(u){f="push";c=o||a}if(c){if(c==="false"){return{}}if(c==="true"){c=o||a}if(t.pathInfo.anchor&&c.indexOf("#")===-1){c=c+"#"+t.pathInfo.anchor}return{type:f,path:c}}else{return{}}}function pr(s,l){var u=l.xhr;var f=l.target;var e=l.etc;if(!ie(s,"htmx:beforeOnLoad",l))return;if(E(u,/HX-Trigger:/i)){De(u,"HX-Trigger",s)}if(E(u,/HX-Location:/i)){Dt();var t=u.getResponseHeader("HX-Location");var c;if(t.indexOf("{")===0){c=y(t);t=c["path"];delete c["path"]}dr("GET",t,c).then(function(){Xt(t)});return}if(E(u,/HX-Redirect:/i)){location.href=u.getResponseHeader("HX-Redirect");return}if(E(u,/HX-Refresh:/i)){if("true"===u.getResponseHeader("HX-Refresh")){location.reload();return}}if(E(u,/HX-Retarget:/i)){l.target=J().querySelector(u.getResponseHeader("HX-Retarget"))}var h=gr(s,l);var r=u.status>=200&&u.status<400&&u.status!==204;var d=u.response;var n=u.status>=400;var i=te({shouldSwap:r,serverResponse:d,isError:n},l);if(!ie(f,"htmx:beforeSwap",i))return;f=i.target;d=i.serverResponse;n=i.isError;l.target=f;l.failed=n;l.successful=!n;if(i.shouldSwap){if(u.status===286){$e(s)}w(s,function(e){d=e.transformResponse(d,u,s)});if(h.type){Dt()}var a=e.swapOverride;if(E(u,/HX-Reswap:/i)){a=u.getResponseHeader("HX-Reswap")}var c=rr(s,a);f.classList.add(z.config.swappingClass);var v=null;var g=null;var o=function(){try{var e=document.activeElement;var t={};try{t={elt:e,start:e?e.selectionStart:null,end:e?e.selectionEnd:null}}catch(e){}var n=S(f);Me(c.swapStyle,f,s,d,n);if(t.elt&&!ee(t.elt)&&t.elt.id){var r=document.getElementById(t.elt.id);var i={preventScroll:c.focusScroll!==undefined?!c.focusScroll:!z.config.defaultFocusScroll};if(r){if(t.start&&r.setSelectionRange){try{r.setSelectionRange(t.start,t.end)}catch(e){}}r.focus(i)}}f.classList.remove(z.config.swappingClass);Q(n.elts,function(e){if(e.classList){e.classList.add(z.config.settlingClass)}ie(e,"htmx:afterSwap",l)});if(E(u,/HX-Trigger-After-Swap:/i)){var a=s;if(!ee(s)){a=J().body}De(u,"HX-Trigger-After-Swap",a)}var o=function(){Q(n.tasks,function(e){e.call()});Q(n.elts,function(e){if(e.classList){e.classList.remove(z.config.settlingClass)}ie(e,"htmx:afterSettle",l)});if(h.type){if(h.type==="push"){Xt(h.path);ie(J().body,"htmx:pushedIntoHistory",{path:h.path})}else{Ft(h.path);ie(J().body,"htmx:replacedInHistory",{path:h.path})}}if(l.pathInfo.anchor){var e=b("#"+l.pathInfo.anchor);if(e){e.scrollIntoView({block:"start",behavior:"auto"})}}if(n.title){var t=b("title");if(t){t.innerHTML=n.title}else{window.document.title=n.title}}ar(n.elts,c);if(E(u,/HX-Trigger-After-Settle:/i)){var r=s;if(!ee(s)){r=J().body}De(u,"HX-Trigger-After-Settle",r)}K(v)};if(c.settleDelay>0){setTimeout(o,c.settleDelay)}else{o()}}catch(e){ne(s,"htmx:swapError",l);K(g);throw e}};var p=z.config.globalViewTransitions;if(c.hasOwnProperty("transition")){p=c.transition}if(p&&ie(s,"htmx:beforeTransition",l)&&typeof Promise!=="undefined"&&document.startViewTransition){var m=new Promise(function(e,t){v=e;g=t});var x=o;o=function(){document.startViewTransition(function(){x();return m})}}if(c.swapDelay>0){setTimeout(o,c.swapDelay)}else{o()}}if(n){ne(s,"htmx:responseError",te({error:"Response Status Error Code "+u.status+" from "+l.pathInfo.requestPath},l))}}var mr={};function xr(){return{init:function(e){return null},onEvent:function(e,t){return true},transformResponse:function(e,t,r){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,r,n){return false},encodeParameters:function(e,t,r){return null}}}function yr(e,t){if(t.init){t.init(C)}mr[e]=te(xr(),t)}function br(e){delete mr[e]}function wr(e,r,n){if(e==undefined){return r}if(r==undefined){r=[]}if(n==undefined){n=[]}var t=G(e,"hx-ext");if(t){Q(t.split(","),function(e){e=e.replace(/ /g,"");if(e.slice(0,7)=="ignore:"){n.push(e.slice(7));return}if(n.indexOf(e)<0){var t=mr[e];if(t&&r.indexOf(t)<0){r.push(t)}}})}return wr(u(e),r,n)}function Sr(e){if(J().readyState!=="loading"){e()}else{J().addEventListener("DOMContentLoaded",e)}}function Er(){if(z.config.includeIndicatorStyles!==false){J().head.insertAdjacentHTML("beforeend","")}}function Cr(){var e=J().querySelector('meta[name="htmx-config"]');if(e){return y(e.content)}else{return null}}function Rr(){var e=Cr();if(e){z.config=te(z.config,e)}}Sr(function(){Rr();Er();var e=J().body;Tt(e);var t=J().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(e){var t=e.target;var r=Y(t);if(r&&r.xhr){r.xhr.abort()}});var r=window.onpopstate;window.onpopstate=function(e){if(e.state&&e.state.htmx){Ut();Q(t,function(e){ie(e,"htmx:restored",{document:J(),triggerEvent:ie})})}else{if(r){r(e)}}};setTimeout(function(){ie(e,"htmx:load",{});e=null},0)});return z}()}); \ No newline at end of file diff --git a/lacommunaute/static/vendor/tiva-calendar/js/calendar.js b/lacommunaute/static/vendor/tiva-calendar/js/calendar.js index 68f54f873..a20d2b71e 100644 --- a/lacommunaute/static/vendor/tiva-calendar/js/calendar.js +++ b/lacommunaute/static/vendor/tiva-calendar/js/calendar.js @@ -27,864 +27,863 @@ var wordDay; var date_start; function getShortText(text, num) { - if (text) { + if (text) { // Get num of word - var textArray = text.split(" "); - if (textArray.length > num) { - return textArray.slice(0, num).join(" ") + " ..."; - } - return text; - } - return ""; + var textArray = text.split(" "); + if (textArray.length > num) { + return textArray.slice(0, num).join(" ") + " ..."; + } + return text; + } + return ""; } function sortEventsByDate(a, b) { - if (a.date < b.date) { - return -1; - } else if (a.date > b.date) { - return 1; - } else { - return 0; - } + if (a.date < b.date) { + return -1; + } else if (a.date > b.date) { + return 1; + } else { + return 0; + } } function sortEventsByUpcoming(a, b) { - var today_date = new Date(todaysYear, todaysMonth - 1, todaysDate); - if (Math.abs(a.date - today_date.getTime()) < Math.abs(b.date - today_date.getTime())) { - return -1; - } else if (Math.abs(a.date - today_date.getTime()) > Math.abs(b.date - today_date.getTime())) { - return 1; - } else { - return 0; - } + var today_date = new Date(todaysYear, todaysMonth - 1, todaysDate); + if (Math.abs(a.date - today_date.getTime()) < Math.abs(b.date - today_date.getTime())) { + return -1; + } else if (Math.abs(a.date - today_date.getTime()) > Math.abs(b.date - today_date.getTime())) { + return 1; + } else { + return 0; + } } function getEventsByTime(type) { - var events = []; - var today_date = new Date(todaysYear, todaysMonth - 1, todaysDate); - for (var i = 0; i < tiva_events.length; i++) { - if (type == 'upcoming') { - if (tiva_events[i].date >= today_date.getTime()) { - events.push(tiva_events[i]); - } - } else { - if (tiva_events[i].date < today_date.getTime()) { - events.push(tiva_events[i]); - } - } - } - return events; + var events = []; + var today_date = new Date(todaysYear, todaysMonth - 1, todaysDate); + for (var i = 0; i < tiva_events.length; i++) { + if (type == 'upcoming') { + if (tiva_events[i].date >= today_date.getTime()) { + events.push(tiva_events[i]); + } + } else { + if (tiva_events[i].date < today_date.getTime()) { + events.push(tiva_events[i]); + } + } + } + return events; } // Change month or year on calendar function changedate(btn, layout) { - if (btn == "prevyr") { - eval("yearNum_" + layout + "--;"); - } else if (btn == "nextyr") { - eval("yearNum_" + layout + "++;"); - } else if (btn == "prevmo") { - eval("monthNum_" + layout + "--;"); - } else if (btn == "nextmo") { - eval("monthNum_" + layout + "++;"); - } else if (btn == "current") { - eval("monthNum_" + layout + " = todaysMonth;"); - eval("yearNum_" + layout + " = todaysYear;"); - } - - if (monthNum_full == 0) { - monthNum_full = 12; - yearNum_full--; - } else if (monthNum_full == 13) { - monthNum_full = 1; - yearNum_full++ - } - - if (monthNum_compact == 0) { - monthNum_compact = 12; - yearNum_compact--; - } else if (monthNum_compact == 13) { - monthNum_compact = 1; - yearNum_compact++ - } + if (btn == "prevyr") { + eval("yearNum_" + layout + "--;"); + } else if (btn == "nextyr") { + eval("yearNum_" + layout + "++;"); + } else if (btn == "prevmo") { + eval("monthNum_" + layout + "--;"); + } else if (btn == "nextmo") { + eval("monthNum_" + layout + "++;"); + } else if (btn == "current") { + eval("monthNum_" + layout + " = todaysMonth;"); + eval("yearNum_" + layout + " = todaysYear;"); + } + + if (monthNum_full == 0) { + monthNum_full = 12; + yearNum_full--; + } else if (monthNum_full == 13) { + monthNum_full = 1; + yearNum_full++ + } + + if (monthNum_compact == 0) { + monthNum_compact = 12; + yearNum_compact--; + } else if (monthNum_compact == 13) { + monthNum_compact = 1; + yearNum_compact++ + } // Get first day and number days of month - eval("firstDate = new Date(yearNum_" + layout + ", monthNum_" + layout + " - 1, 1);"); - if (date_start == 'sunday') { - firstDay = firstDate.getDay() + 1; - } else { - firstDay = firstDate.getDay(); - } - eval("lastDate = new Date(yearNum_" + layout + ", monthNum_" + layout + ", 0);"); - numbDays = lastDate.getDate(); + eval("firstDate = new Date(yearNum_" + layout + ", monthNum_" + layout + " - 1, 1);"); + if (date_start == 'sunday') { + firstDay = firstDate.getDay() + 1; + } else { + firstDay = firstDate.getDay(); + } + eval("lastDate = new Date(yearNum_" + layout + ", monthNum_" + layout + ", 0);"); + numbDays = lastDate.getDate(); // Create calendar - eval("createCalendar(layout, firstDay, numbDays, monthNum_" + layout + ", yearNum_" + layout + ");"); + eval("createCalendar(layout, firstDay, numbDays, monthNum_" + layout + ", yearNum_" + layout + ");"); - return; + return; } // Create calendar function createCalendar(layout, firstDay, numbDays, monthNum, yearNum) { - calendarString = ''; - daycounter = 0; - - calendarString += ''; - calendarString += ''; - calendarString += ''; - if (layout == 'full') { - calendarString += ''; - for (var m = 0; m < wordDay.length; m++) { - calendarString += ''; - for (var x = 1; x <= 7; x++) { - daycounter = (thisDate - firstDay) + 1; - thisDate++; - if ((daycounter > numbDays) || (daycounter < 1)) { - calendarString += ''; + calendarString += '
« ' + prev_month + '<\/span><\/span><\/td>'; - calendarString += '<\/i>' + wordMonth[monthNum - 1] + '  ' + yearNum + '<\/span><\/td>'; - calendarString += '' + next_month + '<\/span> »<\/span><\/td>'; - } else { - calendarString += '«<\/span><\/td>'; - calendarString += '' + wordMonth[monthNum - 1] + '  ' + yearNum + '<\/span><\/td>'; - calendarString += '»<\/span><\/td>'; - } - calendarString += '<\/tr>'; - - calendarString += '
' + wordDay[m].substring(0, 3) + '<\/th>'; - } - calendarString += '<\/tr>'; - - thisDate == 1; - - for (var i = 1; i <= 6; i++) { - var k = (i - 1) * 7 + 1; - if (k < (firstDay + numbDays)) { - calendarString += '
 <\/td>'; - } else { + calendarString = ''; + daycounter = 0; + + calendarString += ''; + calendarString += ''; + calendarString += ''; + if (layout == 'full') { + calendarString += ''; + for (var m = 0; m < wordDay.length; m++) { + calendarString += ''; + for (var x = 1; x <= 7; x++) { + daycounter = (thisDate - firstDay) + 1; + thisDate++; + if ((daycounter > numbDays) || (daycounter < 1)) { + calendarString += ''; - calendarString += '
« ' + prev_month + '<\/span><\/span><\/td>'; + calendarString += '<\/i>' + wordMonth[monthNum - 1] + '  ' + yearNum + '<\/span><\/td>'; + calendarString += '' + next_month + '<\/span> »<\/span><\/td>'; + } else { + calendarString += '«<\/span><\/td>'; + calendarString += '' + wordMonth[monthNum - 1] + '  ' + yearNum + '<\/span><\/td>'; + calendarString += '»<\/span><\/td>'; + } + calendarString += '<\/tr>'; + + calendarString += '
' + wordDay[m].substring(0, 3) + '<\/th>'; + } + calendarString += '<\/tr>'; + + thisDate == 1; + + for (var i = 1; i <= 6; i++) { + var k = (i - 1) * 7 + 1; + if (k < (firstDay + numbDays)) { + calendarString += '
 <\/td>'; + } else { // Saturday or Sunday - if (date_start == 'sunday') { - if ((x == 1) || (x == 7)) { - daycounter_s = '' + daycounter + ''; - } else { - daycounter_s = daycounter; - } - } else { - if ((x == 6) || (x == 7)) { - daycounter_s = '' + daycounter + ''; - } else { - daycounter_s = daycounter; - } - } - - if ((todaysDate == daycounter) && (todaysMonth == monthNum)) { - calendarString += ''; - } else { - calendarString += ''; - } - if (checkEvents(daycounter, monthNum, yearNum)) { - if (layout == 'full') { - calendarString += '
'; - } else { - calendarString += '
'; - } - calendarString += daycounter_s; + if (date_start == 'sunday') { + if ((x == 1) || (x == 7)) { + daycounter_s = '' + daycounter + ''; + } else { + daycounter_s = daycounter; + } + } else { + if ((x == 6) || (x == 7)) { + daycounter_s = '' + daycounter + ''; + } else { + daycounter_s = daycounter; + } + } + + if ((todaysDate == daycounter) && (todaysMonth == monthNum)) { + calendarString += '
'; + } else { + calendarString += ''; + } + if (checkEvents(daycounter, monthNum, yearNum)) { + if (layout == 'full') { + calendarString += '
'; + } else { + calendarString += '
'; + } + calendarString += daycounter_s; // Get events of day - if (layout == 'full') { - var events = getEvents(daycounter, monthNum, yearNum); - for (var t = 0; t < events.length; t++) { - if (typeof events[t] != "undefined") { - var color = events[t].color ? events[t].color : 1; - var event_class = "one-day"; - if (events[t].first_day && !events[t].last_day) { - event_class = "first-day"; - } else if (events[t].last_day && !events[t].first_day) { - event_class = "last-day"; - } else if (!events[t].first_day && !events[t].last_day) { - event_class = "middle-day"; - } - - calendarString += '
' + getShortText(events[t].name, 2) + '<\/div>'; - } else { - var event_fake; - if (typeof events[t + 1] != "undefined") { - if (typeof tiva_events[events[t + 1].id - 1] != "undefined") { - event_fake = getShortText(tiva_events[events[t + 1].id - 1].name, 2); - } else { - event_fake = "no-name"; - } - } else { - event_fake = "no-name"; - } - calendarString += '
' + event_fake + '
'; - } - } - } else { - calendarString += ''; - } + if (layout == 'full') { + var events = getEvents(daycounter, monthNum, yearNum); + for (var t = 0; t < events.length; t++) { + if (typeof events[t] != "undefined") { + var color = events[t].color ? events[t].color : 1; + var event_class = "one-day"; + if (events[t].first_day && !events[t].last_day) { + event_class = "first-day"; + } else if (events[t].last_day && !events[t].first_day) { + event_class = "last-day"; + } else if (!events[t].first_day && !events[t].last_day) { + event_class = "middle-day"; + } + + calendarString += '
' + getShortText(events[t].name, 2) + '<\/div>'; + } else { + var event_fake; + if (typeof events[t + 1] != "undefined") { + if (typeof tiva_events[events[t + 1].id - 1] != "undefined") { + event_fake = getShortText(tiva_events[events[t + 1].id - 1].name, 2); + } else { + event_fake = "no-name"; + } + } else { + event_fake = "no-name"; + } + calendarString += '
' + event_fake + '
'; + } + } + } else { + calendarString += ''; + } // Tooltip - calendarString += '
<\/div>'; - calendarString += '<\/div>'; - } else { - calendarString += daycounter_s; - } - calendarString += '<\/td>'; - } - } - calendarString += '<\/tr>'; - } - } - calendarString += '
'; - - if (layout == 'full') { - jQuery('.tiva-calendar-full').html(calendarString); - } else { - jQuery('.tiva-calendar-compact').html(calendarString); - } - thisDate = 1; + calendarString += '
<\/div>'; + calendarString += '<\/div>'; + } else { + calendarString += daycounter_s; + } + calendarString += '<\/td>'; + } + } + calendarString += '<\/tr>'; + } + } + calendarString += '
'; + + if (layout == 'full') { + jQuery('.tiva-calendar-full').html(calendarString); + } else { + jQuery('.tiva-calendar-compact').html(calendarString); + } + thisDate = 1; } // Check day has events or not function checkEvents(day, month, year) { - numevents = 0; - var date_check = new Date(year, Number(month) - 1, day); - for (var i = 0; i < tiva_events.length; i++) { - var start_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, tiva_events[i].day); - var end_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, Number(tiva_events[i].day) + Number(tiva_events[i].duration) - 1); - if ((start_date.getTime() <= date_check.getTime()) && (date_check.getTime() <= end_date.getTime())) { - numevents++; - } - } - - if (numevents == 0) { - return false; - } else { - return true; - } + numevents = 0; + var date_check = new Date(year, Number(month) - 1, day); + for (var i = 0; i < tiva_events.length; i++) { + var start_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, tiva_events[i].day); + var end_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, Number(tiva_events[i].day) + Number(tiva_events[i].duration) - 1); + if ((start_date.getTime() <= date_check.getTime()) && (date_check.getTime() <= end_date.getTime())) { + numevents++; + } + } + + if (numevents == 0) { + return false; + } else { + return true; + } } function getOrderNumber(id, day, month, year) { - var date_check = new Date(year, Number(month) - 1, day); - var events = []; - for (var i = 0; i < tiva_events.length; i++) { - var start_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, tiva_events[i].day); - var end_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, Number(tiva_events[i].day) + Number(tiva_events[i].duration) - 1); - if ((start_date.getTime() <= date_check.getTime()) && (date_check.getTime() <= end_date.getTime())) { - var first_day = (start_date.getTime() == date_check.getTime()) ? true : false; - var event = { id: tiva_events[i].id, name: tiva_events[i].name, day: tiva_events[i].day, month: tiva_events[i].month, year: tiva_events[i].year, first_day: first_day }; - events.push(event); - } - } - - if (events.length) { - if (events[0].id == id) { - var num = order_num; - order_num = 0; - return num; - } else { - order_num++; - for (var j = 0; j < events.length; j++) { - if (events[j].id == id) { - return getOrderNumber(events[j - 1].id, events[j - 1].day, events[j - 1].month, events[j - 1].year); - } - } - - } - } - - return 0; + var date_check = new Date(year, Number(month) - 1, day); + var events = []; + for (var i = 0; i < tiva_events.length; i++) { + var start_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, tiva_events[i].day); + var end_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, Number(tiva_events[i].day) + Number(tiva_events[i].duration) - 1); + if ((start_date.getTime() <= date_check.getTime()) && (date_check.getTime() <= end_date.getTime())) { + var first_day = (start_date.getTime() == date_check.getTime()) ? true : false; + var event = { id: tiva_events[i].id, name: tiva_events[i].name, day: tiva_events[i].day, month: tiva_events[i].month, year: tiva_events[i].year, first_day: first_day }; + events.push(event); + } + } + + if (events.length) { + if (events[0].id == id) { + var num = order_num; + order_num = 0; + return num; + } else { + order_num++; + for (var j = 0; j < events.length; j++) { + if (events[j].id == id) { + return getOrderNumber(events[j - 1].id, events[j - 1].day, events[j - 1].month, events[j - 1].year); + } + } + + } + } + + return 0; } // Get events of day function getEvents(day, month, year) { - var n = 0; - var date_check = new Date(year, Number(month) - 1, day); - var events = []; - for (var i = 0; i < tiva_events.length; i++) { - var start_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, tiva_events[i].day); - var end_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, Number(tiva_events[i].day) + Number(tiva_events[i].duration) - 1); - if ((start_date.getTime() <= date_check.getTime()) && (date_check.getTime() <= end_date.getTime())) { - var first_day = (start_date.getTime() == date_check.getTime()) ? true : false; - var last_day = (end_date.getTime() == date_check.getTime()) ? true : false; - var event = { id: tiva_events[i].id, name: tiva_events[i].name, first_day: first_day, last_day: last_day, color: tiva_events[i].color }; - - if (!first_day) { - n = getOrderNumber(tiva_events[i].id, tiva_events[i].day, tiva_events[i].month, tiva_events[i].year); - } - - events[n] = event; - n++; - } - } - - return events; + var n = 0; + var date_check = new Date(year, Number(month) - 1, day); + var events = []; + for (var i = 0; i < tiva_events.length; i++) { + var start_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, tiva_events[i].day); + var end_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, Number(tiva_events[i].day) + Number(tiva_events[i].duration) - 1); + if ((start_date.getTime() <= date_check.getTime()) && (date_check.getTime() <= end_date.getTime())) { + var first_day = (start_date.getTime() == date_check.getTime()) ? true : false; + var last_day = (end_date.getTime() == date_check.getTime()) ? true : false; + var event = { id: tiva_events[i].id, name: tiva_events[i].name, first_day: first_day, last_day: last_day, color: tiva_events[i].color }; + + if (!first_day) { + n = getOrderNumber(tiva_events[i].id, tiva_events[i].day, tiva_events[i].month, tiva_events[i].year); + } + + events[n] = event; + n++; + } + } + + return events; } // Show tooltip when mouse over function showTooltip(id, layout, day, month, year, el) { - if (layout == 'full') { - if (tiva_events[id].image) { - var event_image = '' + tiva_events[id].name + ''; - } else { - var event_image = ''; - } - if (tiva_events[id].time) { - var event_time = '
' + tiva_events[id].time + '
'; - } else { - var event_time = ''; - } + if (layout == 'full') { + if (tiva_events[id].image) { + var event_image = '' + tiva_events[id].name + ''; + } else { + var event_image = ''; + } + if (tiva_events[id].time) { + var event_time = '
' + tiva_events[id].time + '
'; + } else { + var event_time = ''; + } // Change position of tooltip - var index = jQuery(el).parent().find('.calendar-event-name').index(el); - var count = jQuery(el).parent().find('.calendar-event-name').length; - var bottom = 32 + ((count - index - 1) * 25); - jQuery(el).parent().find('.tiva-event-tooltip').css('bottom', bottom + 'px'); - - jQuery(el).parent().find('.tiva-event-tooltip').html('
' - + event_time - + '
' + tiva_events[id].name + '
' - + '
' + event_image + '
' - + '
' + getShortText(tiva_events[id].description, 10) + '
' - + '
' - ); - jQuery(el).parent().find('.tiva-event-tooltip').css('opacity', '1'); - jQuery(el).parent().find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); - jQuery(el).parent().find('.tiva-event-tooltip').css('transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); - } else { - jQuery(el).find('.tiva-event-tooltip').html(''); - var events = getEvents(day, month, year); - for (var i = 0; i < events.length; i++) { - if (typeof events[i] != "undefined") { - if (tiva_events[events[i].id].image) { - var event_image = '' + tiva_events[events[i].id].name + ''; - } else { - var event_image = ''; - } - if (tiva_events[events[i].id].time) { - var event_time = '
' + tiva_events[events[i].id].time + '
'; - } else { - var event_time = ''; - } - - jQuery(el).find('.tiva-event-tooltip').append('
' - + event_time - + '
' + tiva_events[events[i].id].name + '
' - + '
' + event_image + '
' - + '
' + getShortText(tiva_events[events[i].id].description, 10) + '
' - + '
' - ); - } - } - jQuery(el).find('.tiva-event-tooltip').css('opacity', '1'); - jQuery(el).find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); - jQuery(el).find('.tiva-event-tooltip').css('transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); - } + var index = jQuery(el).parent().find('.calendar-event-name').index(el); + var count = jQuery(el).parent().find('.calendar-event-name').length; + var bottom = 32 + ((count - index - 1) * 25); + jQuery(el).parent().find('.tiva-event-tooltip').css('bottom', bottom + 'px'); + + jQuery(el).parent().find('.tiva-event-tooltip').html('
' + + event_time + + '
' + tiva_events[id].name + '
' + + '
' + event_image + '
' + + '
' + getShortText(tiva_events[id].description, 10) + '
' + + '
' + ); + jQuery(el).parent().find('.tiva-event-tooltip').css('opacity', '1'); + jQuery(el).parent().find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); + jQuery(el).parent().find('.tiva-event-tooltip').css('transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); + } else { + jQuery(el).find('.tiva-event-tooltip').html(''); + var events = getEvents(day, month, year); + for (var i = 0; i < events.length; i++) { + if (typeof events[i] != "undefined") { + if (tiva_events[events[i].id].image) { + var event_image = '' + tiva_events[events[i].id].name + ''; + } else { + var event_image = ''; + } + if (tiva_events[events[i].id].time) { + var event_time = '
' + tiva_events[events[i].id].time + '
'; + } else { + var event_time = ''; + } + + jQuery(el).find('.tiva-event-tooltip').append('
' + + event_time + + '
' + tiva_events[events[i].id].name + '
' + + '
' + event_image + '
' + + '
' + getShortText(tiva_events[events[i].id].description, 10) + '
' + + '
' + ); + } + } + jQuery(el).find('.tiva-event-tooltip').css('opacity', '1'); + jQuery(el).find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); + jQuery(el).find('.tiva-event-tooltip').css('transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); + } } // Clear tooltip when mouse out function clearTooltip(layout, el) { - if (layout == 'full') { - jQuery(el).parent().find('.tiva-event-tooltip').css('opacity', '0'); - jQuery(el).parent().find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,-10px,0)'); - jQuery(el).parent().find('.tiva-event-tooltip').css('transform', 'translate3d(0,-10px,0)'); - } else { - jQuery(el).find('.tiva-event-tooltip').css('opacity', '0'); - jQuery(el).find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,-10px,0)'); - jQuery(el).find('.tiva-event-tooltip').css('transform', 'translate3d(0,-10px,0)'); - } + if (layout == 'full') { + jQuery(el).parent().find('.tiva-event-tooltip').css('opacity', '0'); + jQuery(el).parent().find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,-10px,0)'); + jQuery(el).parent().find('.tiva-event-tooltip').css('transform', 'translate3d(0,-10px,0)'); + } else { + jQuery(el).find('.tiva-event-tooltip').css('opacity', '0'); + jQuery(el).find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,-10px,0)'); + jQuery(el).find('.tiva-event-tooltip').css('transform', 'translate3d(0,-10px,0)'); + } } // Show event detail function showEventList(layout, max_events) { // Sort event via upcoming - var upcoming_events = getEventsByTime('upcoming'); - upcoming_events.sort(sortEventsByUpcoming); - var past_events = getEventsByTime('past'); - past_events.sort(sortEventsByUpcoming); - var tiva_list_events = upcoming_events.concat(past_events); - tiva_list_events = tiva_list_events.slice(0, max_events); - - if (layout == 'full') { - jQuery('.tiva-event-list-full').html(''); - for (var i = 0; i < tiva_list_events.length; i++) { + var upcoming_events = getEventsByTime('upcoming'); + upcoming_events.sort(sortEventsByUpcoming); + var past_events = getEventsByTime('past'); + past_events.sort(sortEventsByUpcoming); + var tiva_list_events = upcoming_events.concat(past_events); + tiva_list_events = tiva_list_events.slice(0, max_events); + + if (layout == 'full') { + jQuery('.tiva-event-list-full').html(''); + for (var i = 0; i < tiva_list_events.length; i++) { // Start date - var day = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, tiva_list_events[i].day); - if (date_start == 'sunday') { - var event_day = wordDay[day.getDay()]; - } else { - if (day.getDay() > 0) { - var event_day = wordDay[day.getDay() - 1]; - } else { - var event_day = wordDay[6]; - } - } - var event_date = wordMonth[Number(tiva_list_events[i].month) - 1] + ' ' + tiva_list_events[i].day + ', ' + tiva_list_events[i].year; + var day = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, tiva_list_events[i].day); + if (date_start == 'sunday') { + var event_day = wordDay[day.getDay()]; + } else { + if (day.getDay() > 0) { + var event_day = wordDay[day.getDay() - 1]; + } else { + var event_day = wordDay[6]; + } + } + var event_date = wordMonth[Number(tiva_list_events[i].month) - 1] + ' ' + tiva_list_events[i].day + ', ' + tiva_list_events[i].year; // End date - var event_end_time = ''; - if (tiva_list_events[i].duration > 1) { - var end_date = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, Number(tiva_list_events[i].day) + Number(tiva_list_events[i].duration) - 1); - - if (date_start == 'sunday') { - var event_end_day = wordDay[end_date.getDay()]; - } else { - if (end_date.getDay() > 0) { - var event_end_day = wordDay[end_date.getDay() - 1]; - } else { - var event_end_day = wordDay[6]; - } - } - var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); - event_end_time = ' - ' + event_end_day + ', ' + event_end_date; - } + var event_end_time = ''; + if (tiva_list_events[i].duration > 1) { + var end_date = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, Number(tiva_list_events[i].day) + Number(tiva_list_events[i].duration) - 1); + + if (date_start == 'sunday') { + var event_end_day = wordDay[end_date.getDay()]; + } else { + if (end_date.getDay() > 0) { + var event_end_day = wordDay[end_date.getDay() - 1]; + } else { + var event_end_day = wordDay[6]; + } + } + var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); + event_end_time = ' - ' + event_end_day + ', ' + event_end_date; + } // Event time - if (tiva_list_events[i].time) { - var event_time = '' + tiva_list_events[i].time; - } else { - var event_time = ''; - } + if (tiva_list_events[i].time) { + var event_time = '' + tiva_list_events[i].time; + } else { + var event_time = ''; + } // Event image - if (tiva_list_events[i].image) { - var event_image = '' + tiva_list_events[i].name + ''; - } else { - var event_image = ''; - } + if (tiva_list_events[i].image) { + var event_image = '' + tiva_list_events[i].name + ''; + } else { + var event_image = ''; + } // Event location - if (tiva_list_events[i].location) { - var event_location = '' + '' + tiva_list_events[i].location + ''; - } else { - var event_location = ''; - } - - jQuery('.tiva-event-list-full').append('
' - + '
' - + '' - + '
' - + '
' - + '' - + '
' + event_day + ', ' + event_date + event_end_time + '
' - + '
' + event_time + '
' - + '
' + event_location + '
' - + '
' + getShortText(tiva_list_events[i].description, 25) + '
' - + '
' - + '
' - + '
' - ); - } - } else { - jQuery('.tiva-event-list-compact').html(''); - for (var i = 0; i < tiva_list_events.length; i++) { + if (tiva_list_events[i].location) { + var event_location = '' + '' + tiva_list_events[i].location + ''; + } else { + var event_location = ''; + } + + jQuery('.tiva-event-list-full').append('
' + + '
' + + '' + + '
' + + '
' + + '' + + '
' + event_day + ', ' + event_date + event_end_time + '
' + + '
' + event_time + '
' + + '
' + event_location + '
' + + '
' + getShortText(tiva_list_events[i].description, 25) + '
' + + '
' + + '
' + + '
' + ); + } + } else { + jQuery('.tiva-event-list-compact').html(''); + for (var i = 0; i < tiva_list_events.length; i++) { // Start date - var day = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, tiva_list_events[i].day); - if (date_start == 'sunday') { - var event_day = wordDay[day.getDay()]; - } else { - if (day.getDay() > 0) { - var event_day = wordDay[day.getDay() - 1]; - } else { - var event_day = wordDay[6]; - } - } - var event_date = wordMonth[Number(tiva_list_events[i].month) - 1] + ' ' + tiva_list_events[i].day + ', ' + tiva_list_events[i].year; + var day = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, tiva_list_events[i].day); + if (date_start == 'sunday') { + var event_day = wordDay[day.getDay()]; + } else { + if (day.getDay() > 0) { + var event_day = wordDay[day.getDay() - 1]; + } else { + var event_day = wordDay[6]; + } + } + var event_date = wordMonth[Number(tiva_list_events[i].month) - 1] + ' ' + tiva_list_events[i].day + ', ' + tiva_list_events[i].year; // End date - var event_end_time = ''; - if (tiva_list_events[i].duration > 1) { - var end_date = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, Number(tiva_list_events[i].day) + Number(tiva_list_events[i].duration) - 1); - - if (date_start == 'sunday') { - var event_end_day = wordDay[end_date.getDay()]; - } else { - if (end_date.getDay() > 0) { - var event_end_day = wordDay[end_date.getDay() - 1]; - } else { - var event_end_day = wordDay[6]; - } - } - var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); - event_end_time = ' - ' + event_end_day + ', ' + event_end_date; - } + var event_end_time = ''; + if (tiva_list_events[i].duration > 1) { + var end_date = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, Number(tiva_list_events[i].day) + Number(tiva_list_events[i].duration) - 1); + + if (date_start == 'sunday') { + var event_end_day = wordDay[end_date.getDay()]; + } else { + if (end_date.getDay() > 0) { + var event_end_day = wordDay[end_date.getDay() - 1]; + } else { + var event_end_day = wordDay[6]; + } + } + var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); + event_end_time = ' - ' + event_end_day + ', ' + event_end_date; + } // Event time - if (tiva_list_events[i].time) { - var event_time = '' + tiva_list_events[i].time; - } else { - var event_time = ''; - } + if (tiva_list_events[i].time) { + var event_time = '' + tiva_list_events[i].time; + } else { + var event_time = ''; + } // Event image - if (tiva_list_events[i].image) { - var event_image = '' + tiva_list_events[i].name + ''; - } else { - var event_image = ''; - } + if (tiva_list_events[i].image) { + var event_image = '' + tiva_list_events[i].name + ''; + } else { + var event_image = ''; + } // Event location - if (tiva_list_events[i].location) { - var event_location = '' + '' + tiva_list_events[i].location + ''; - } else { - var event_location = ''; - } - - jQuery('.tiva-event-list-compact').append('
' - + '' - + '' - + '
' + event_day + ', ' + event_date + event_end_time + '
' - + '
' + event_time + '
' - + '
' + event_location + '
' - + '
' + getShortText(tiva_list_events[i].description, 15) + '
' - + '
' - + '
' - ); - } - } + if (tiva_list_events[i].location) { + var event_location = '' + '' + tiva_list_events[i].location + ''; + } else { + var event_location = ''; + } + + jQuery('.tiva-event-list-compact').append('
' + + '' + + '' + + '
' + event_day + ', ' + event_date + event_end_time + '
' + + '
' + event_time + '
' + + '
' + event_location + '
' + + '
' + getShortText(tiva_list_events[i].description, 15) + '
' + + '
' + + '
' + ); + } + } } // Show event detail function showEventDetail(id, layout, day, month, year) { - jQuery('.tiva-events-calendar.' + layout + ' .back-calendar').show(); - jQuery('.tiva-events-calendar.' + layout + ' .tiva-calendar').hide(); - jQuery('.tiva-events-calendar.' + layout + ' .tiva-event-list').hide(); - jQuery('.tiva-events-calendar.' + layout + ' .tiva-event-detail').fadeIn(1500); + jQuery('.tiva-events-calendar.' + layout + ' .back-calendar').show(); + jQuery('.tiva-events-calendar.' + layout + ' .tiva-calendar').hide(); + jQuery('.tiva-events-calendar.' + layout + ' .tiva-event-list').hide(); + jQuery('.tiva-events-calendar.' + layout + ' .tiva-event-detail').fadeIn(1500); - jQuery('.tiva-events-calendar.' + layout + ' .list-view').removeClass('active'); - jQuery('.tiva-events-calendar.' + layout + ' .calendar-view').removeClass('active'); + jQuery('.tiva-events-calendar.' + layout + ' .list-view').removeClass('active'); + jQuery('.tiva-events-calendar.' + layout + ' .calendar-view').removeClass('active'); - if (layout == 'full') { + if (layout == 'full') { // Start date - var day = new Date(tiva_events[id].year, Number(tiva_events[id].month) - 1, tiva_events[id].day); - if (date_start == 'sunday') { - var event_day = wordDay[day.getDay()]; - } else { - if (day.getDay() > 0) { - var event_day = wordDay[day.getDay() - 1]; - } else { - var event_day = wordDay[6]; - } - } - var event_date = wordMonth[Number(tiva_events[id].month) - 1] + ' ' + tiva_events[id].day + ', ' + tiva_events[id].year; + var day = new Date(tiva_events[id].year, Number(tiva_events[id].month) - 1, tiva_events[id].day); + if (date_start == 'sunday') { + var event_day = wordDay[day.getDay()]; + } else { + if (day.getDay() > 0) { + var event_day = wordDay[day.getDay() - 1]; + } else { + var event_day = wordDay[6]; + } + } + var event_date = wordMonth[Number(tiva_events[id].month) - 1] + ' ' + tiva_events[id].day + ', ' + tiva_events[id].year; // End date - var event_end_time = ''; - if (tiva_events[id].duration > 1) { - var end_date = new Date(tiva_events[id].year, Number(tiva_events[id].month) - 1, Number(tiva_events[id].day) + Number(tiva_events[id].duration) - 1); - - if (date_start == 'sunday') { - var event_end_day = wordDay[end_date.getDay()]; - } else { - if (end_date.getDay() > 0) { - var event_end_day = wordDay[end_date.getDay() - 1]; - } else { - var event_end_day = wordDay[6]; - } - } - var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); - event_end_time = ' - ' + event_end_day + ', ' + event_end_date; - } + var event_end_time = ''; + if (tiva_events[id].duration > 1) { + var end_date = new Date(tiva_events[id].year, Number(tiva_events[id].month) - 1, Number(tiva_events[id].day) + Number(tiva_events[id].duration) - 1); + + if (date_start == 'sunday') { + var event_end_day = wordDay[end_date.getDay()]; + } else { + if (end_date.getDay() > 0) { + var event_end_day = wordDay[end_date.getDay() - 1]; + } else { + var event_end_day = wordDay[6]; + } + } + var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); + event_end_time = ' - ' + event_end_day + ', ' + event_end_date; + } // Event time - if (tiva_events[id].time) { - var event_time = '' + tiva_events[id].time; - } else { - var event_time = ''; - } + if (tiva_events[id].time) { + var event_time = '' + tiva_events[id].time; + } else { + var event_time = ''; + } // Event image - if (tiva_events[id].image) { - var event_image = '' + tiva_events[id].name + ''; - } else { - var event_image = ''; - } + if (tiva_events[id].image) { + var event_image = '' + tiva_events[id].name + ''; + } else { + var event_image = ''; + } // Event location - if (tiva_events[id].location) { - var event_location = '' + '' + tiva_events[id].location + ''; - } else { - var event_location = ''; - } + if (tiva_events[id].location) { + var event_location = '' + '' + tiva_events[id].location + ''; + } else { + var event_location = ''; + } // Event description - if (tiva_events[id].description) { - var event_desc = '
' + tiva_events[id].description + '
'; - } else { - var event_desc = ''; - } - - jQuery('.tiva-event-detail-full').html('
' - + '
' + event_image + '
' - + '
' + tiva_events[id].name + '
' - + '
' + event_day + ', ' + event_date + event_end_time + '
' - + '
' + event_time + '
' - + '
' + event_location + '
' - + event_desc - + '
' - ); - } else { - jQuery('.tiva-event-detail-compact').html(''); - if (day && month && year) { - var events = getEvents(day, month, year); - } else { - var events = [{ id: id }]; - } - for (var i = 0; i < events.length; i++) { - if (typeof events[i] != "undefined") { + if (tiva_events[id].description) { + var event_desc = '
' + tiva_events[id].description + '
'; + } else { + var event_desc = ''; + } + + jQuery('.tiva-event-detail-full').html('
' + + '
' + event_image + '
' + + '
' + tiva_events[id].name + '
' + + '
' + event_day + ', ' + event_date + event_end_time + '
' + + '
' + event_time + '
' + + '
' + event_location + '
' + + event_desc + + '
' + ); + } else { + jQuery('.tiva-event-detail-compact').html(''); + if (day && month && year) { + var events = getEvents(day, month, year); + } else { + var events = [{ id: id }]; + } + for (var i = 0; i < events.length; i++) { + if (typeof events[i] != "undefined") { // Start date - var day = new Date(tiva_events[events[i].id].year, Number(tiva_events[events[i].id].month) - 1, tiva_events[events[i].id].day); - if (date_start == 'sunday') { - var event_day = wordDay[day.getDay()]; - } else { - if (day.getDay() > 0) { - var event_day = wordDay[day.getDay() - 1]; - } else { - var event_day = wordDay[6]; - } - } - var event_date = wordMonth[Number(tiva_events[events[i].id].month) - 1] + ' ' + tiva_events[events[i].id].day + ', ' + tiva_events[events[i].id].year; + var day = new Date(tiva_events[events[i].id].year, Number(tiva_events[events[i].id].month) - 1, tiva_events[events[i].id].day); + if (date_start == 'sunday') { + var event_day = wordDay[day.getDay()]; + } else { + if (day.getDay() > 0) { + var event_day = wordDay[day.getDay() - 1]; + } else { + var event_day = wordDay[6]; + } + } + var event_date = wordMonth[Number(tiva_events[events[i].id].month) - 1] + ' ' + tiva_events[events[i].id].day + ', ' + tiva_events[events[i].id].year; // End date - var event_end_time = ''; - if (tiva_events[events[i].id].duration > 1) { - var end_date = new Date(tiva_events[events[i].id].year, Number(tiva_events[events[i].id].month) - 1, Number(tiva_events[events[i].id].day) + Number(tiva_events[events[i].id].duration) - 1); - - if (date_start == 'sunday') { - var event_end_day = wordDay[end_date.getDay()]; - } else { - if (end_date.getDay() > 0) { - var event_end_day = wordDay[end_date.getDay() - 1]; - } else { - var event_end_day = wordDay[6]; - } - } - var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); - event_end_time = ' - ' + event_end_day + ', ' + event_end_date; - } + var event_end_time = ''; + if (tiva_events[events[i].id].duration > 1) { + var end_date = new Date(tiva_events[events[i].id].year, Number(tiva_events[events[i].id].month) - 1, Number(tiva_events[events[i].id].day) + Number(tiva_events[events[i].id].duration) - 1); + + if (date_start == 'sunday') { + var event_end_day = wordDay[end_date.getDay()]; + } else { + if (end_date.getDay() > 0) { + var event_end_day = wordDay[end_date.getDay() - 1]; + } else { + var event_end_day = wordDay[6]; + } + } + var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); + event_end_time = ' - ' + event_end_day + ', ' + event_end_date; + } // Event time - if (tiva_events[events[i].id].time) { - var event_time = '' + tiva_events[events[i].id].time; - } else { - var event_time = ''; - } + if (tiva_events[events[i].id].time) { + var event_time = '' + tiva_events[events[i].id].time; + } else { + var event_time = ''; + } // Event image - if (tiva_events[events[i].id].image) { - var event_image = '' + tiva_events[events[i].id].name + ''; - } else { - var event_image = ''; - } + if (tiva_events[events[i].id].image) { + var event_image = '' + tiva_events[events[i].id].name + ''; + } else { + var event_image = ''; + } // Event location - if (tiva_events[events[i].id].location) { - var event_location = '' + '' + tiva_events[events[i].id].location; + ''; - } else { - var event_location = ''; - } + if (tiva_events[events[i].id].location) { + var event_location = '' + '' + tiva_events[events[i].id].location; + ''; + } else { + var event_location = ''; + } // Event description - if (tiva_events[events[i].id].description) { - var event_desc = '
' + tiva_events[events[i].id].description + '
'; - } else { - var event_desc = ''; - } - - jQuery('.tiva-event-detail-compact').append('
' - + '
' + event_image + '
' - + '
' + tiva_events[events[i].id].name + '
' - + '
' + event_day + ', ' + event_date + event_end_time + '
' - + '
' + event_time + '
' - + '
' + event_location + '
' - + event_desc - + '
' - ); - } - } - } + if (tiva_events[events[i].id].description) { + var event_desc = '
' + tiva_events[events[i].id].description + '
'; + } else { + var event_desc = ''; + } + + jQuery('.tiva-event-detail-compact').append('
' + + '
' + event_image + '
' + + '
' + tiva_events[events[i].id].name + '
' + + '
' + event_day + ', ' + event_date + event_end_time + '
' + + '
' + event_time + '
' + + '
' + event_location + '
' + + event_desc + + '
' + ); + } + } + } } jQuery(document).ready(function () { // Init calendar full - if (jQuery('.tiva-events-calendar.full').length) { - jQuery('.tiva-events-calendar.full').html('
' - + '' + calendar_view + '' - + '' + list_view + '' - + '' + back + '' - + '
' - + '
' - + '
' - + '
' - + '
' - + '
' - + '
' - ); - } + if (jQuery('.tiva-events-calendar.full').length) { + jQuery('.tiva-events-calendar.full').html('
' + + '' + calendar_view + '' + + '' + list_view + '' + + '' + back + '' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + ); + } // Init calendar compact - if (jQuery('.tiva-events-calendar.compact').length) { - jQuery('.tiva-events-calendar.compact').html('
' - + '' + calendar_view + '' - + '' + list_view + '' - + '' + back + '' - + '
' - + '
' - + '
' - + '
' - + '
' - + '
' - + '
' - ); - } + if (jQuery('.tiva-events-calendar.compact').length) { + jQuery('.tiva-events-calendar.compact').html('
' + + '' + calendar_view + '' + + '' + list_view + '' + + '' + back + '' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + ); + } // Show - Hide view - jQuery('.tiva-events-calendar .back-calendar').hide(); - jQuery('.tiva-event-list').hide(); - jQuery('.tiva-event-detail').hide(); + jQuery('.tiva-events-calendar .back-calendar').hide(); + jQuery('.tiva-event-list').hide(); + jQuery('.tiva-event-detail').hide(); - jQuery('.tiva-events-calendar').each(function (index) { + jQuery('.tiva-events-calendar').each(function (index) { // Hide switch button - var switch_button = (typeof jQuery(this).attr('data-switch') != "undefined") ? jQuery(this).attr('data-switch') : 'show'; - if (switch_button == 'hide') { - jQuery(this).find('.calendar-view').hide(); - jQuery(this).find('.list-view').hide(); + var switch_button = (typeof jQuery(this).attr('data-switch') != "undefined") ? jQuery(this).attr('data-switch') : 'show'; + if (switch_button == 'hide') { + jQuery(this).find('.calendar-view').hide(); + jQuery(this).find('.list-view').hide(); // Change css of button back - jQuery(this).find('.events-calendar-bar').css('position', 'relative'); - jQuery(this).find('.back-calendar').css({ "position": "absolute", "margin-top": "15px", "right": "15px" }); - jQuery(this).find('.tiva-event-detail').css('padding-top', '60px'); - } - }); + jQuery(this).find('.events-calendar-bar').css('position', 'relative'); + jQuery(this).find('.back-calendar').css({ "position": "absolute", "margin-top": "15px", "right": "15px" }); + jQuery(this).find('.tiva-event-detail').css('padding-top', '60px'); + } + }); // Set wordDay - date_start = (typeof jQuery('.tiva-events-calendar').attr('data-start') != "undefined") ? jQuery('.tiva-events-calendar').attr('data-start') : 'sunday'; - if (date_start == 'sunday') { - wordDay = new Array(wordDay_sun, wordDay_mon, wordDay_tue, wordDay_wed, wordDay_thu, wordDay_fri, wordDay_sat); - } else { // Start with Monday - wordDay = new Array(wordDay_mon, wordDay_tue, wordDay_wed, wordDay_thu, wordDay_fri, wordDay_sat, wordDay_sun); - } + date_start = (typeof jQuery('.tiva-events-calendar').attr('data-start') != "undefined") ? jQuery('.tiva-events-calendar').attr('data-start') : 'sunday'; + if (date_start == 'sunday') { + wordDay = new Array(wordDay_sun, wordDay_mon, wordDay_tue, wordDay_wed, wordDay_thu, wordDay_fri, wordDay_sat); + } else { // Start with Monday + wordDay = new Array(wordDay_mon, wordDay_tue, wordDay_wed, wordDay_thu, wordDay_fri, wordDay_sat, wordDay_sun); + } // Get events from json file or ajax php - var source = (typeof jQuery('.tiva-events-calendar').attr('data-source') != "undefined") ? jQuery('.tiva-events-calendar').attr('data-source') : 'json'; - if (source == 'json') { // Get events from json file : events/events.json - console.log(events_json) - jQuery.getJSON(events_json, function (data) { - for (var i = 0; i < data.items.length; i++) { - var event_date = new Date(data.items[i].year, Number(data.items[i].month) - 1, data.items[i].day); - data.items[i].date = event_date.getTime(); - tiva_events.push(data.items[i]); - } + var source = (typeof jQuery('.tiva-events-calendar').attr('data-source') != "undefined") ? jQuery('.tiva-events-calendar').attr('data-source') : 'json'; + if (source == 'json') { // Get events from json file : events/events.json + jQuery.getJSON(events_json, function (data) { + for (var i = 0; i < data.items.length; i++) { + var event_date = new Date(data.items[i].year, Number(data.items[i].month) - 1, data.items[i].day); + data.items[i].date = event_date.getTime(); + tiva_events.push(data.items[i]); + } // Sort events by date - tiva_events.sort(sortEventsByDate); + tiva_events.sort(sortEventsByDate); - for (var j = 0; j < tiva_events.length; j++) { - tiva_events[j].id = j; - if (!tiva_events[j].duration) { - tiva_events[j].duration = 1; - } - } + for (var j = 0; j < tiva_events.length; j++) { + tiva_events[j].id = j; + if (!tiva_events[j].duration) { + tiva_events[j].duration = 1; + } + } // Create calendar - changedate('current', 'full'); - changedate('current', 'compact'); + changedate('current', 'full'); + changedate('current', 'compact'); - jQuery('.tiva-events-calendar').each(function (index) { + jQuery('.tiva-events-calendar').each(function (index) { // Initial view - var initial_view = (typeof jQuery(this).attr('data-view') != "undefined") ? jQuery(this).attr('data-view') : 'calendar'; - if (initial_view == 'list') { - jQuery(this).find('.list-view').click(); - } - }); - }); - } else { // Get events from php file via ajax - jQuery.ajax({ - url: events_php, - dataType: 'json', - data: '', - beforeSend: function () { - jQuery('.tiva-calendar').html('
'); - }, - success: function (data) { - for (var i = 0; i < data.length; i++) { - var event_date = new Date(data[i].year, Number(data[i].month) - 1, data[i].day); - data[i].date = event_date.getTime(); - tiva_events.push(data[i]); - } + var initial_view = (typeof jQuery(this).attr('data-view') != "undefined") ? jQuery(this).attr('data-view') : 'calendar'; + if (initial_view == 'list') { + jQuery(this).find('.list-view').click(); + } + }); + }); + } else { // Get events from php file via ajax + jQuery.ajax({ + url: events_php, + dataType: 'json', + data: '', + beforeSend: function () { + jQuery('.tiva-calendar').html('
'); + }, + success: function (data) { + for (var i = 0; i < data.length; i++) { + var event_date = new Date(data[i].year, Number(data[i].month) - 1, data[i].day); + data[i].date = event_date.getTime(); + tiva_events.push(data[i]); + } // Sort events by date - tiva_events.sort(sortEventsByDate); + tiva_events.sort(sortEventsByDate); - for (var j = 0; j < tiva_events.length; j++) { - tiva_events[j].id = j; - if (!tiva_events[j].duration) { - tiva_events[j].duration = 1; - } - } + for (var j = 0; j < tiva_events.length; j++) { + tiva_events[j].id = j; + if (!tiva_events[j].duration) { + tiva_events[j].duration = 1; + } + } // Create calendar - changedate('current', 'full'); - changedate('current', 'compact'); + changedate('current', 'full'); + changedate('current', 'compact'); - jQuery('.tiva-events-calendar').each(function (index) { + jQuery('.tiva-events-calendar').each(function (index) { // Initial view - var initial_view = (typeof jQuery(this).attr('data-view') != "undefined") ? jQuery(this).attr('data-view') : 'calendar'; - if (initial_view == 'list') { - jQuery(this).find('.list-view').click(); - } - }); - } - }); - } + var initial_view = (typeof jQuery(this).attr('data-view') != "undefined") ? jQuery(this).attr('data-view') : 'calendar'; + if (initial_view == 'list') { + jQuery(this).find('.list-view').click(); + } + }); + } + }); + } // Click - Calendar view btn - jQuery('.tiva-events-calendar .calendar-view').click(function () { - jQuery(this).parents('.tiva-events-calendar').find('.back-calendar').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-list').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-detail').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-calendar').fadeIn(1500); + jQuery('.tiva-events-calendar .calendar-view').click(function () { + jQuery(this).parents('.tiva-events-calendar').find('.back-calendar').hide(); + jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-list').hide(); + jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-detail').hide(); + jQuery(this).parents('.tiva-events-calendar').find('.tiva-calendar').fadeIn(1500); - jQuery(this).parents('.tiva-events-calendar').find('.list-view').removeClass('active'); - jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').addClass('active'); - }); + jQuery(this).parents('.tiva-events-calendar').find('.list-view').removeClass('active'); + jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').addClass('active'); + }); // Click - List view btn - jQuery('.tiva-events-calendar .list-view').click(function () { - jQuery(this).parents('.tiva-events-calendar').find('.back-calendar').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-calendar').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-detail').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-list').fadeIn(1500); - - jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').removeClass('active'); - jQuery(this).parents('.tiva-events-calendar').find('.list-view').addClass('active'); - - var layout = jQuery(this).parents('.tiva-events-calendar').attr('class') ? jQuery(this).parents('.tiva-events-calendar').attr('class') : 'full'; - var max_events = jQuery(this).parents('.tiva-events-calendar').attr('data-events') ? jQuery(this).parents('.tiva-events-calendar').attr('data-events') : 1000; - if (layout.indexOf('full') != -1) { - showEventList('full', max_events); - } else { - showEventList('compact', max_events); - } - }); + jQuery('.tiva-events-calendar .list-view').click(function () { + jQuery(this).parents('.tiva-events-calendar').find('.back-calendar').hide(); + jQuery(this).parents('.tiva-events-calendar').find('.tiva-calendar').hide(); + jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-detail').hide(); + jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-list').fadeIn(1500); + + jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').removeClass('active'); + jQuery(this).parents('.tiva-events-calendar').find('.list-view').addClass('active'); + + var layout = jQuery(this).parents('.tiva-events-calendar').attr('class') ? jQuery(this).parents('.tiva-events-calendar').attr('class') : 'full'; + var max_events = jQuery(this).parents('.tiva-events-calendar').attr('data-events') ? jQuery(this).parents('.tiva-events-calendar').attr('data-events') : 1000; + if (layout.indexOf('full') != -1) { + showEventList('full', max_events); + } else { + showEventList('compact', max_events); + } + }); // Click - Back calendar btn - jQuery('.tiva-events-calendar .back-calendar').click(function () { - jQuery(this).parents('.tiva-events-calendar').find('.back-calendar').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-detail').hide(); - - var initial_view = (typeof jQuery(this).parents('.tiva-events-calendar').attr('data-view') != "undefined") ? jQuery(this).parents('.tiva-events-calendar').attr('data-view') : 'calendar'; - if (initial_view == 'calendar') { - jQuery(this).parents('.tiva-events-calendar').find('.tiva-calendar').fadeIn(1500); - - jQuery(this).parents('.tiva-events-calendar').find('.list-view').removeClass('active'); - jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').addClass('active'); - } else { - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-list').fadeIn(1500); - - jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').removeClass('active'); - jQuery(this).parents('.tiva-events-calendar').find('.list-view').addClass('active'); - } - }); + jQuery('.tiva-events-calendar .back-calendar').click(function () { + jQuery(this).parents('.tiva-events-calendar').find('.back-calendar').hide(); + jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-detail').hide(); + + var initial_view = (typeof jQuery(this).parents('.tiva-events-calendar').attr('data-view') != "undefined") ? jQuery(this).parents('.tiva-events-calendar').attr('data-view') : 'calendar'; + if (initial_view == 'calendar') { + jQuery(this).parents('.tiva-events-calendar').find('.tiva-calendar').fadeIn(1500); + + jQuery(this).parents('.tiva-events-calendar').find('.list-view').removeClass('active'); + jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').addClass('active'); + } else { + jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-list').fadeIn(1500); + + jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').removeClass('active'); + jQuery(this).parents('.tiva-events-calendar').find('.list-view').addClass('active'); + } + }); }); diff --git a/lacommunaute/templates/event/event_calendar.html b/lacommunaute/templates/event/event_calendar.html index 021da39ac..ac7ab9cc7 100644 --- a/lacommunaute/templates/event/event_calendar.html +++ b/lacommunaute/templates/event/event_calendar.html @@ -33,7 +33,7 @@

Les évènements à venir

{% if user.is_authenticated %} + role="button" class="btn btn-primary"> {% trans "Post a new Public Event" %} {% else %} @@ -55,7 +55,7 @@

Les évènements à venir

{% endblock %} {% block extra_js %} - +