1

I'm trying to use fullcalendar.io and mootools libraries in same web site. However I have this error:

TypeError: t is undefined xxx_core.main.min_1.js:9:22019

The file xxx_core.main.min_1.js have this code:

/*!
FullCalendar Core Package v4.1.0
Docs & License: https://fullcalendar.io/
(c) 2019 Adam Shaw
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):(e=e||self,t(e.FullCalendar={}))}(this,function(e){"use strict";function t(e,t,n){var r=document.createElement(e);if(t)for(var i in t)"style"===i?g(r,t[i]):mi[i]?r[i]=t[i]:r.setAttribute(i,t[i]);return"string"==typeof n?r.innerHTML=n:null!=n&&a(r,n),r}function n(e){e=e.trim();var t=document.createElement(o(e));return t.innerHTML=e,t.firstChild}function r(e){return Array.prototype.slice.call(i(e))}function i(e){e=e.trim();var t=document.createElement(o(e));return t.innerHTML=e,t.childNodes}function o(e){return Ei[e.substr(0,3)]||"div"}function a(e,t){for(var n=l(t),r=0;r<n.length;r++)e.appendChild(n[r])}function s(e,t){for(var n=l(t),r=e.firstChild||null,i=0;i<n.length;i++)e.insertBefore(n[i],r)}function u(e,t){for(var n=l(t),r=e.nextSibling||null,i=0;i<n.length;i++)e.parentNode.insertBefore(n[i],r)}function l(e){return"string"==typeof e?r(e):e instanceof Node?[e]:Array.prototype.slice.call(e)}function c(e){e.parentNode&&e.parentNode.removeChild(e)}function d(e,t){return bi.call(e,t)}function f(e,t){return Si.call(e,t)}function p(e,t){for(var n=e instanceof HTMLElement?[e]:e,r=[],i=0;i<n.length;i++)for(var o=n[i].querySelectorAll(t),a=0;a<o.length;a++)r.push(o[a]);return r}function h(e,t){for(var n=e instanceof HTMLElement?[e]:e,r=[],i=0;i<n.length;i++)for(var o=n[i].children,a=0;a<o.length;a++){var s=o[a];t&&!f(s,t)||r.push(s)}return r}function v(e,t,n){n?e.classList.add(t):e.classList.remove(t)}function g(e,t){for(var n in t)y(e,n,t[n])}function y(e,t,n){null==n?e.style[t]="":"number"==typeof n&&Di.test(t)?e.style[t]=n+"px":e.style[t]=n}function m(e,t){return e.left>=t.left&&e.left<t.right&&e.top>=t.top&&e.top<t.bottom}function E(e,t){var n={left:Math.max(e.left,t.left),right:Math.min(e.right,t.right),top:Math.max(e.top,t.top),bottom:Math.min(e.bottom,t.bottom)};return n.left<n.right&&n.top<n.bottom&&n}function S(e,t,n){return{left:e.left+t,right:e.right+t,top:e.top+n,bottom:e.bottom+n}}function b(e,t){return{left:Math.min(Math.max(e.left,t.left),t.right),top:Math.min(Math.max(e.top,t.top),t.bottom)}}function D(e){return{left:(e.left+e.right)/2,top:(e.top+e.bottom)/2}}function T(e,t){return{left:e.left-t.left,top:e.top-t.top}}function w(){return null===Ti&&(Ti=R()),Ti}function R(){var e=t("div",{style:{position:"absolute",top:-1e3,left:0,border:0,padding:0,overflow:"scroll",direction:"rtl"}},"<div></div>");document.body.appendChild(e);var n=e.firstChild,r=n.getBoundingClientRect().left>e.getBoundingClientRect().left;return c(e),r}function I(e){return e=Math.max(0,e),e=Math.round(e)}function C(e,t){void 0===t&&(t=!1);var n=window.getComputedStyle(e),r=parseInt(n.borderLeftWidth,10)||0,i=parseInt(n.borderRightWidth,10)||0,o=parseInt(n.borderTopWidth,10)||0,a=parseInt(n.borderBottomWidth,10)||0,s=I(e.offsetWidth-e.clientWidth-r-i),u=I(e.offsetHeight-e.clientHeight-o-a),l={borderLeft:r,borderRight:i,borderTop:o,borderBottom:a,scrollbarBottom:u,scrollbarLeft:0,scrollbarRight:0};return w()&&"rtl"===n.direction?l.scrollbarLeft=s:l.scrollbarRight=s,t&&(l.paddingLeft=parseInt(n.paddingLeft,10)||0,l.paddingRight=parseInt(n.paddingRight,10)||0,l.paddingTop=parseInt(n.paddingTop,10)||0,l.paddingBottom=parseInt(n.paddingBottom,10)||0),l}function M(e,t){void 0===t&&(t=!1);var n=k(e),r=C(e,t),i={left:n.left+r.borderLeft+r.scrollbarLeft,right:n.right-r.borderRight-r.scrollbarRight,top:n.top+r.borderTop,bottom:n.bottom-r.borderBottom-r.scrollbarBottom};return t&&(i.left+=r.paddingLeft,i.right-=r.paddingRight,i.top+=r.paddingTop,i.bottom-=r.paddingBottom),i}function k(e){var t=e.getBoundingClientRect();return{left:t.left+window.pageXOffset,top:t.top+window.pageYOffset,right:t.right+window.pageXOffset,bottom:t.bottom+window.pageYOffset}}function O(){return{left:window.pageXOffset,right:window.pageXOffset+document.documentElement.clientWidth,top:window.pageYOffset,bottom:window.pageYOffset+document.documentElement.clientHeight}}function _(e){var t=window.getComputedStyle(e);return e.getBoundingClientRect().height+parseInt(t.marginTop,10)+parseInt(t.marginBottom,10)}function P(e){for(var t=[];e instanceof HTMLElement;){var n=window.getComputedStyle(e);if("fixed"===n.position)break;/(auto|scroll)/.test(n.overflow+n.overflowY+n.overflowX)&&t.push(e),e=e.parentNode}return t}function H(e){return P(e).map(function(e){return M(e)}).concat(O()).reduce(function(e,t){return E(e,t)||t})}function x(e){e.preventDefault()}function N(e,t,n,r){function i(e){var t=d(e.target,n);t&&r.call(t,e,t)}return e.addEventListener(t,i),function(){e.removeEventListener(t,i)}}function z(e,t,n,r){var i;return N(e,"mouseover",t,function(e,t){if(t!==i){i=t,n(e,t);var o=function(e){i=null,r(e,t),t.removeEventListener("mouseleave",o)};t.addEventListener("mouseleave",o)}})}function U(e,t){var n=function(r){t(r),wi.forEach(function(t){e.removeEventListener(t,n)})};wi.forEach(function(t){e.addEventListener(t,n)})}function L(e,t){var n=ie(e);return n[2]+=7*t,oe(n)}function A(e,t){var n=ie(e);return n[2]+=t,oe(n)}function V(e,t){var n=ie(e);return n[6]+=t,oe(n)}function B(e,t){return F(e,t)/7}function F(e,t){return(t.valueOf()-e.valueOf())/864e5}function W(e,t){return(t.valueOf()-e.valueOf())/36e5}function Z(e,t){return(t.valueOf()-e.valueOf())/6e4}function j(e,t){return(t.valueOf()-e.valueOf())/1e3}function Y(e,t){var n=X(e),r=X(t);return{years:0,months:0,days:Math.round(F(n,r)),milliseconds:t.valueOf()-r.valueOf()-(e.valueOf()-n.valueOf())}}function q(e,t){var n=G(e,t);return null!==n&&n%7==0?n/7:null}function G(e,t){return se(e)===se(t)?Math.round(F(e,t)):null}function X(e){return oe([e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()])}function J(e){return oe([e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours()])}function K(e){return oe([e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes()])}function Q(e){return oe([e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds()])}function $(e,t,n){var r=e.getUTCFullYear(),i=ee(e,r,t,n);if(i<1)return ee(e,r-1,t,n);var o=ee(e,r+1,t,n);return o>=1?Math.min(i,o):i}function ee(e,t,n,r){var i=oe([t,0,1+te(t,n,r)]),o=X(e),a=Math.round(F(i,o));return Math.floor(a/7)+1}function te(e,t,n){var r=7+t-n;return-(7+oe([e,0,r]).getUTCDay()-t)%7+r-1}function ne(e){return[e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()]}function re(e){return new Date(e[0],e[1]||0,null==e[2]?1:e[2],e[3]||0,e[4]||0,e[5]||0)}function ie(e){return[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()]}function oe(e){return 1===e.length&&(e=e.concat([0])),new Date(Date.UTC.apply(Date,e))}function ae(e){return!isNaN(e.valueOf())}function se(e){return 1e3*e.getUTCHours()*60*60+1e3*e.getUTCMinutes()*60+1e3*e.getUTCSeconds()+e.getUTCMilliseconds()}function ue(e,t){var n;return"string"==typeof e?le(e):"object"==typeof e&&e?ce(e):"number"==typeof e?ce((n={},n[t||"milliseconds"]=e,n)):null}function le(e){var t=Ci.exec(e);if(t){var n=t[1]?-1:1;return{years:0,months:0,days:n*(t[2]?parseInt(t[2],10):0),milliseconds:n*(60*(t[3]?parseInt(t[3],10):0)*60*1e3+60*(t[4]?parseInt(t[4],10):0)*1e3+1e3*(t[5]?parseInt(t[5],10):0)+(t[6]?parseInt(t[6],10):0))}}return null}function ce(e){return{years:e.years||e.year||0,months:e.months||e.month||0,days:(e.days||e.day||0)+7*de(e),milliseconds:60*(e.hours||e.hour||0)*60*1e3+60*(e.minutes||e.minute||0)*1e3+1e3*(e.seconds||e.second||0)+(e.milliseconds||e.millisecond||e.ms||0)}}function de(e){return e.weeks||e.week||0}function fe(e,t){return e.years===t.years&&e.months===t.months&&e.days===t.days&&e.milliseconds===t.milliseconds}function pe(e){return 0===e.years&&0===e.months&&1===e.days&&0===e.milliseconds}function he(e,t){return{years:e.years+t.years,months:e.months+t.months,days:e.days+t.days,milliseconds:e.milliseconds+t.milliseconds}}function ve(e,t){return{years:e.years-t.years,months:e.months-t.months,days:e.days-t.days,milliseconds:e.milliseconds-t.milliseconds}}function ge(e,t){return{years:e.years*t,months:e.months*t,days:e.days*t,milliseconds:e.milliseconds*t}}function ye(e){return Ee(e)/365}function me(e){return Ee(e)/30}function Ee(e){return De(e)/864e5}function Se(e){return De(e)/6e4}function be(e){return De(e)/1e3}function De(e){return 31536e6*e.years+2592e6*e.months+864e5*e.days+e.milliseconds}function Te(e,t){for(var n=null,r=0;r<Ii.length;r++){var i=Ii[r];if(t[i]){var o=e[i]/t[i];if(!Ze(o)||null!==n&&n!==o)return null;n=o}else if(e[i])return null}return n}function we(e,t){var n=e.milliseconds;if(n){if(n%1e3!=0)return{unit:"millisecond",value:n};if(n%6e4!=0)return{unit:"second",value:n/1e3};if(n%36e5!=0)return{unit:"minute",value:n/6e4};if(n)return{unit:"hour",value:n/36e5}}return e.days?t||e.days%7!=0?{unit:"day",value:e.days}:{unit:"week",value:e.days/7}:e.months?{unit:"month",value:e.months}:e.years?{unit:"year",value:e.years}:{unit:"millisecond",value:0}}function Re(e,t){t.left&&g(e,{borderLeftWidth:1,marginLeft:t.left-1}),t.right&&g(e,{borderRightWidth:1,marginRight:t.right-1})}function Ie(e){g(e,{marginLeft:"",marginRight:"",borderLeftWidth:"",borderRightWidth:""})}function Ce(){document.body.classList.add("fc-not-allowed")}function Me(){document.body.classList.remove("fc-not-allowed")}function ke(e,t,n){var r=Math.floor(t/e.length),i=Math.floor(t-r*(e.length-1)),o=[],a=[],s=[],u=0;Oe(e),e.forEach(function(t,n){var l=n===e.length-1?i:r,c=_(t);c<l?(o.push(t),a.push(c),s.push(t.offsetHeight)):u+=c}),n&&(t-=u,r=Math.floor(t/o.length),i=Math.floor(t-r*(o.length-1))),o.forEach(function(e,t){var n=t===o.length-1?i:r,u=a[t],l=s[t],c=n-(u-l);u<n&&(e.style.height=c+"px")})}function Oe(e){e.forEach(function(e){e.style.height=""})}function _e(e){var t=0;return e.forEach(function(e){var n=e.firstChild;if(n instanceof HTMLElement){var r=n.offsetWidth;r>t&&(t=r)}}),t++,e.forEach(function(e){e.style.width=t+"px"}),t}function Pe(e,t){var n={position:"relative",left:-1};g(e,n),g(t,n);var r=e.offsetHeight-t.offsetHeight,i={position:"",left:""};return g(e,i),g(t,i),r}function He(e){e.classList.add("fc-unselectable"),e.addEventListener("selectstart",x)}function xe(e){e.classList.remove("fc-unselectable"),e.removeEventListener("selectstart",x)}function Ne(e){e.addEventListener("contextmenu",x)}function ze(e){e.removeEventListener("contextmenu",x)}function Ue(e){var t,n,r=[],i=[];for("string"==typeof e?i=e.split(/\s*,\s*/):"function"==typeof e?i=[e]:Array.isArray(e)&&(i=e),t=0;t<i.length;t++)n=i[t],"string"==typeof n?r.push("-"===n.charAt(0)?{field:n.substring(1),order:-1}:{field:n,order:1}):"function"==typeof n&&r.push({func:n});return r}function Le(e,t,n){var r,i;for(r=0;r<n.length;r++)if(i=Ae(e,t,n[r]))return i;return 0}function Ae(e,t,n){return n.func?n.func(e,t):Ve(e[n.field],t[n.field])*(n.order||1)}function Ve(e,t){return e||t?null==t?-1:null==e?1:"string"==typeof e||"string"==typeof t?String(e).localeCompare(String(t)):e-t:0}function Be(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fe(e,t){var n=String(e);return"000".substr(0,t-n.length)+n}function We(e,t){return e-t}function Ze(e){return e%1==0}function je(e,t,n){if("function"==typeof e&&(e=[e]),e){var r=void 0,i=void 0;for(r=0;r<e.length;r++)i=e[r].apply(t,n)||i;return i}}function Ye(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0;n<e.length;n++)if(void 0!==e[n])return e[n]}function qe(e,t){var n,r,i,o,a,s=function(){var u=(new Date).valueOf()-o;u<t?n=setTimeout(s,t-u):(n=null,a=e.apply(i,r),i=r=null)};return function(){return i=this,r=arguments,o=(new Date).valueOf(),n||(n=setTimeout(s,t)),a}}function Ge(e,t,n,r){void 0===n&&(n={});var i={};for(var o in t){var a=t[o];void 0!==e[o]?a===Function?i[o]="function"==typeof e[o]?e[o]:null:i[o]=a?a(e[o]):e[o]:void 0!==n[o]?i[o]=n[o]:a===String?i[o]="":a&&a!==Number&&a!==Boolean&&a!==Function?i[o]=a(null):i[o]=null}if(r)for(var o in e)void 0===t[o]&&(r[o]=e[o]);return i}

Here is my twig template:

{#  include  mootools libraries #}

{% extends "AppBundle:layout.html.twig" %}

{% block title "mon calendrier"%}
{% block body %}
{% include "default/ajoutBoostrap.html.twig" %}
<div class="container m-5">
    <div class="row">
        <div class="col-11">
            <div id="calendar-holder"></div>
        </div>
        <div class="col-1">
             <a href="{{path("planning_demande_autorisation_absence")}}" class="btn btn-primary">Retour</a>
        </div>
    </div>
</div>

 <script type="text/javascript">

    document.addEventListener('DOMContentLoaded', function () {
        var calendarEl = document.getElementById('calendar-holder');
        var id = [{{ agent.id | raw }}];
        var calendar = new FullCalendar.Calendar(calendarEl, {
            plugins: [ 'list' ],
            defaultView: 'dayGridMonth',
            eventDurationEditable: true,
            editable: true,
            locale: 'fr',
            eventSources: [
            {
                url: "{{ path('fc_load_events') }}",
                method: "POST",
                extraParams: {
                    filters: JSON.stringify(id)
                },
                failure: function() {
                    alert("Problème de synchronisation des données !");
                },
            },
            ],
           
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'dayGridMonth,timeGridWeek,timeGridDay',
            },
            footer:{
                left: 'prevYear,nextYear today',
                center: 'title',
                right: 'dayGridMonth,timeGridWeek,timeGridDay',
            },
            buttonText:{
                today:    "Aujourd'hui",
                month:    "Mois",
                week:     'Semaine',
                day:      'Jour',

            },
            eventDrop: function(info){
               if( ! confirm(" Etes vous sûr.e de vouloir déplacer cet évènement ?")){
                   info.revert();
               }
            },
            eventRisize: function(info){

            },
             plugins: [ 'interaction', 'dayGrid', 'timeGrid' ], // https://fullcalendar.io/docs/plugin-index
             timeZone: 'UTC',
             nowIndicator: true,
            });
            calendar.render();
        });
</script>

{#  include  fullcalendar libraries #}

    {% stylesheets  filter='cssrewrite'
        'fullcalendar/c_css/core.main.min.css'
        'fullcalendar/c_css/daygrid.main.min.css'
        'fullcalendar/c_css/timegrid.main.min.css'
        'css/beaute.css'
    %}
       <link rel="stylesheet" href="{{ asset_url }}" type="text/css">
    {% endstylesheets %}
    {% javascripts
        'fullcalendar/c_js/core.main.min.js'
        'fullcalendar/c_js/interaction.main.min.js'
        'fullcalendar/c_js/daygrid.main.min.js'
        'fullcalendar/c_js/timegrid.main.min.js'
    %}
       <script src="{{ asset_url }}" charset="UTF-8"> </script>
    {% endjavascripts %}


{% endblock %}

According to what I understood, there is a conflict of variables between the two libraries (mootools and fullcalendar.io).

But even after several searches on the web, I can not solve the problem.

Can someone please help me, please?

10
  • It's unclear how the code above is demonstrating any conflict with mootools. What have you done to come to that conclusion? Does removing mootools from your page make any difference?
    – ADyson
    Commented Jan 5, 2021 at 16:09
  • Thank you for your response. Yes, if I remove mootools import, the calendar page works correctly without any error and vice versa if I remove the calendar imports.
    – thiery
    Commented Jan 5, 2021 at 18:55
  • Thanks. This is an odd one. Some things to try: change the order that you include these tools - e.g. put fullCalendar first. Or upgrade to a newer version of one or both of them.
    – ADyson
    Commented Jan 6, 2021 at 6:45
  • I have upgrade fullcalendar by dowloading new files (main.min.css, main.min.js, locales-all.min.js ) from fullcalendar.io/docs/getting-started. Unfortunatly I've simulary error TypeError: a is undefined ec8f312_main.min_1.js:6:85965. Please @ADyson can you tel me how put fullCalendar first in this page ?
    – thiery
    Commented Jan 6, 2021 at 9:13
  • Move it's "include" block higher up than the mootools one. I don't know twig but I assume it loads them in order just like regular script blocks
    – ADyson
    Commented Jan 6, 2021 at 9:14

0