Skip to content

Commit

Permalink
Merge branch 'dev' into adrienModif
Browse files Browse the repository at this point in the history
  • Loading branch information
DridriLaBastos authored Jul 19, 2022
2 parents 7214f34 + 1024914 commit 7d41067
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,19 @@ child.push( async function () {

child.push( async function () {
const __global__ = getGlobal();
if ( __global__ ) {

if ( is( __global__ ) ) {
__global__.edt = {
cookieName: 'univgrade',
toggle: document.getElementById( 'edt-element' ),
form: document.getElementById( 'edt-form' ),
img: document.getElementById( 'edt-img' ),
imgContainer: document.getElementById( 'edt-img-cont' ),
grade: document.getElementById( 'edt-grade' ),
week: document.getElementById( 'edt-week' ),
year: document.getElementById( 'edt-year' ),
comeback: document.getElementById( 'edt-comeback' ),
setCookie: document.getElementById( 'set-default-cookie' ),
toggle: byId( 'edt-element' ),
form: byId( 'edt-form' ),
img: byId( 'edt-img' ),
imgContainer: byId( 'edt-img-cont' ),
grade: byId( 'edt-grade' ),
week: byId( 'edt-week' ),
year: byId( 'edt-year' ),
comeback: byId( 'edt-comeback' ),
setCookie: byId( 'set-default-cookie' ),
today: {},
current: {},
grades: [{
Expand Down Expand Up @@ -207,19 +208,19 @@ child.push( async function () {
function updateImage() {
const { edt } = __global__;
const { imgContainer } = edt;
const img = document.getElementById( 'edt-img' );
if ( img ) {
const img = byId( 'edt-img' );
if ( is( img ) ) {
edt.img = img;
img.src = updateLink();
} else if ( imgContainer ) {
} else if ( is( imgContainer ) ) {
const img = new Image();
img.id = 'edt-img';
img.src = updateLink();
imgContainer.appendChild( img );
}
}

if ( 'form' in __global__.edt && __global__.edt.form ) {
if ( 'form' in __global__.edt && is( __global__.edt.form ) ) {
const { edt } = __global__;
const { has, get } = Cookies;
const { cookieName, setCookie, today } = edt;
Expand Down Expand Up @@ -302,7 +303,7 @@ child.push( async function () {
toggleClass( imgContainer, 'modal-active' );
}
imgContainer.addEventListener( 'click', toggleModalActive );
document.getElementById( 'modal-close' ).addEventListener( 'click', toggleModalActive );
byId( 'modal-close' ).addEventListener( 'click', toggleModalActive );

function backward() {
const { edt } = __global__;
Expand Down Expand Up @@ -405,3 +406,4 @@ child.push( async function () {
} );

child.run();

0 comments on commit 7d41067

Please sign in to comment.