Skip to content

Commit

Permalink
Correction du ColorScheme
Browse files Browse the repository at this point in the history
- Suppression de Code JS inutile
- Correction de JS
- ajout de classes de ColorScheme pour les icones
  • Loading branch information
g-cqd committed Nov 19, 2020
1 parent 624fd81 commit 8998f71
Show file tree
Hide file tree
Showing 4 changed files with 845 additions and 1,297 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ app.set( 'view engine', 'ejs' );
function initHelmet( app, helmet ) {
app.use( helmet.contentSecurityPolicy( {
directives: {
defaultSrc: ['\'self\''],
defaultSrc: ['\'self\'', 'edt.univ-evry.fr'],
baseUri: ['\'self\''],
blockAllMixedContent: [],
fontSrc: ['\'self\'', 'https:', 'data:'],
Expand Down
6 changes: 6 additions & 0 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,12 @@ body:not(.color-scheme-dark) #site-header.color-scheme-dark .light-scheme-logo:n
transition: opacity var(--tr-short) var(--tr-func);
}

.color-scheme-dark .light-scheme-icon:not(:only-child) img,
.color-scheme-light .dark-scheme-icon:not(:only-child) img {
opacity: 0;
transition: opacity var(--tr-short) var(--tr-func);
}

/*--------------------------------------------------------------
# Theme Switcher
--------------------------------------------------------------*/
Expand Down
30 changes: 15 additions & 15 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ child.push( async function () {

child.push( async function () {
const __global__ = getGlobal();
if ( is( __global__ ) ) {
if ( __global__ ) {
__global__.edt = {
cookieName: 'univgrade',
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' ),
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' ),
today: {},
current: {},
grades: [{
Expand Down Expand Up @@ -207,19 +207,19 @@ child.push( async function () {
function updateImage() {
const { edt } = __global__;
const { imgContainer } = edt;
const img = byId( 'edt-img' );
if ( is( img ) ) {
const img = document.getElementById( 'edt-img' );
if ( img ) {
edt.img = img;
img.src = updateLink();
} else if ( is( imgContainer ) ) {
} else if ( imgContainer ) {
const img = new Image();
img.id = 'edt-img';
img.src = updateLink();
imgContainer.appendChild( img );
}
}

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

function backward() {
const { edt } = __global__;
Expand Down
Loading

0 comments on commit 8998f71

Please sign in to comment.