css:wrap_avillepreux

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
css:wrap_avillepreux [2026/01/27 18:22] avillepreuxcss:wrap_avillepreux [2026/04/08 15:15] (Version actuelle) avillepreux
Ligne 58: Ligne 58:
  
 </CSS> </CSS>
 +
 <JS> <JS>
-/* 
-var string_to_color = function(str) { 
  
-  var hash = 0; 
-  for (var i = 0; i < str.length; i++) { 
-    hash = str.charCodeAt(i) + ((hash << 5) - hash); 
-  } 
-  var colour = '#'; 
-  for (var i = 0; i < 3; i++) { 
-    var value = (hash >> (i * 8)) & 0xFF; 
-    colour += ('00' + value.toString(16)).substr(-2); 
-  } 
-  return colour; 
-}*/ 
 var string_to_color = function(str, h, s, l) { var string_to_color = function(str, h, s, l) {
   var hash = 0;   var hash = 0;
Ligne 85: Ligne 73:
 function init_username_wrap(wrap_element, username) function init_username_wrap(wrap_element, username)
 { {
- var img_url = 'https://intranet.cyanide-studio.com/_media/user/' + username + '.jpg';+ /* 
 +  var url_img_check = 'https://intranet.cyanide-studio.com/_media/user/' + username + '.jpg';*/ 
 +        var url_img_check = 'https://web.cyanide-studio.com/trombi/photo/?username=' + username + '&check';
  
  try   try 
  {  {
-          jQuery.get(img_url).done(function() { + /*console.log("Init username...", username, wrap_element.html());*/ 
-  + 
-               console.log("Init username", username);+          jQuery.get(url_img_check).done(function() { 
 +           
 +                    wrap_element.addClass("plugin_wrap"); 
 +                    wrap_element.addClass("wrap_username"); 
 +                    wrap_element.addClass("wrap_"+username); 
 +                     
 +                    document.querySelectorAll(".wrap_"+username).forEach(function(e) {  
 +                    e.classList.add("plugin_wrap");  
 +                    e.classList.add("wrap_username");  
 +                    }); 
 + 
 +                console.log("Init username OK", username, wrap_element.html(), wrap_element.attr("class").split(/\s+/)); 
 + 
 +                    var color = string_to_color(username, -20, 50, 50); 
 + 
 +                    jQuery('head').append('<style> ' + 
 + 
 +                        '    .wrap_'+username+':before { border: 2px solid var(--color); }' + 
 +                        ' div.wrap_'+username+':after  { content: "'+username+'" }' + 
 +                        ' div.wrap_'+username+'        { --color: '+color+'; border: 2px solid var(--color); }' + 
 +                        ' span.wrap_'+username+'       { --color: '+color+'}'
  
-              var color = string_to_color(username, -20, 50, 50);+                        + ' </style>');
  
-              jQuery('head').append('<style> ' ++                    jQuery('head').append('<style> ' +
  
-                    .wrap_'+username+':before { background-image: url(/_media/user/'+username+'.jpg); border: 2px solid var(--color); }' + +                               .wrap_'+username+':before { background-image: url(/_media/user/'+username+'.jpg); }'
-                  ' div.wrap_'+username+':after  { content: "'+username+'" }' + +
-                  ' div.wrap_'+username+'        { --color: '+color+'; border: 2px solid var(--color); }' + +
-                  ' span.wrap_'+username+'       { --color: '+color+'; }'+
  
-                  + ' </style>');+                            + ' </style>');
  
-              wrap_element.addClass("wrap_username"); +          }).fail(function () { 
-               wrap_element.addClass("wrap_"+username);+           
 +                /*console.log("Init username FAIL"username, wrap_element.html());*/
  
-          }).fail(function () { /*console.log("Invalid username", username);*/ });+          });
           }           }
           catch (e)           catch (e)
           {           {
 +              console.log("Init username EXCEPTION", username, wrap_element.html());
           }           }
 } }
  • css/wrap_avillepreux.1769534548.txt.gz
  • Dernière modification : 2026/01/27 18:22
  • de avillepreux