@@ -178,7 +178,7 @@ export async function addButtons() {
178178 console . info ( "[Better IUT RCC] Ajout des boutons..." ) ;
179179
180180 const userAvatar = document . querySelector ( '.topbar-right .topbar-btn-avatar img' ) ;
181- const userId = / . * \/ ( \d * ) \. j p g / g . exec ( userAvatar . src ) [ 1 ] ;
181+ const photoName = userAvatar . src . split ( '/' ) . pop ( ) ;
182182
183183 const headerInfo = document . querySelector ( '.header-info' ) ;
184184 const firstChild = headerInfo . querySelector ( '.left' ) ;
@@ -223,7 +223,7 @@ export async function addButtons() {
223223 ? '<i class="fa-solid fa-window-minimize"></i> Minimal'
224224 : '<i class="fa-solid fa-window-restore"></i> Maximal' ;
225225 if ( ! showMore ) document . getElementById ( "details" ) . open = false ;
226- await browser . storage . local . set ( { showMoreDetails : { [ userId ] : showMore } } ) ;
226+ await browser . storage . local . set ( { showMoreDetails : { [ photoName ] : showMore } } ) ;
227227 } ) ;
228228 cardHeader . append ( toggleMoreDetails ) ;
229229
@@ -248,11 +248,11 @@ export async function addButtons() {
248248 cardHeader . append ( version ) ;
249249
250250 const cache = await browser . storage . local . get ( 'showMoreDetails' ) ;
251- var showMore = cache . showMoreDetails ?. [ userId ] ;
251+ var showMore = cache . showMoreDetails ?. [ photoName ] ;
252252
253253 if ( showMore === undefined ) {
254254 showMore = true ;
255- await browser . storage . local . set ( { showMoreDetails : { [ userId ] : showMore } } ) ;
255+ await browser . storage . local . set ( { showMoreDetails : { [ photoName ] : showMore } } ) ;
256256 }
257257
258258 col1 . style . display = col2 . style . display = col3 . style . display = showMore ? 'block' : 'none' ;
@@ -400,13 +400,13 @@ export async function createBilanCard() {
400400 console . info ( "[Better IUT RCC] Création de la carte de bilan..." ) ;
401401
402402 const userAvatar = document . querySelector ( '.topbar-right .topbar-btn-avatar img' ) ;
403- const userId = / . * \/ ( \d * ) \. j p g / g . exec ( userAvatar . src ) [ 1 ] ;
403+ const photoName = userAvatar . src . split ( '/' ) . pop ( ) ;
404404 const cache = await browser . storage . local . get ( 'userBilanCache' ) ;
405405 let user = null ;
406406
407- if ( cache . userBilanCache !== undefined && cache . userBilanCache [ userId ] !== undefined ) {
407+ if ( cache . userBilanCache !== undefined && cache . userBilanCache [ photoName ] !== undefined ) {
408408 console . info ( "[Better IUT RCC] Récupération de l'utilisateur en cache..." ) ;
409- user = cache . userBilanCache [ userId ] ;
409+ user = cache . userBilanCache [ photoName ] ;
410410 console . info ( "[Better IUT RCC] > " + user ) ;
411411 } else {
412412 console . info ( "[Better IUT RCC] Récupération de l'utilisateur depuis l'intranet..." ) ;
@@ -421,7 +421,7 @@ export async function createBilanCard() {
421421
422422 await browser . storage . local . set ( {
423423 userBilanCache : {
424- [ userId ] : user ,
424+ [ photoName ] : user ,
425425 }
426426 } )
427427 }
0 commit comments