WIDGET VignetteBandeau (info/binaire)

Bonjour à tous

Je vous propose un widget « Bandeau » inspiré du design de @ [Djal94] (https://www.jeedom.com/forum/memberlist.php?mode=viewprofile&u=5979)

Merci à lui pour son autorisation

C’est un widget pour info binaire

vignettebandeau

Options :

  • name : texte du bandeau, sinon Display_name
  • coloron : Couleur ON sous la forme #xxxxx, sinon VERT
  • coloroff : Couleur OFF sous la forme #xxxxx, sinon ROUGE
  • imgon : Image ON avec répertoire (Obligatoire)
  • imgoff : Image ON avec répertoire (Obligatoire)
<div style="padding:0px; width:90px; height:90px" class="cmd #history# container-fluid tooltips cmd-widget" data-type="info" data-version="#version#" data-eqLogic_id="#eqLogic_id#" data-subtype="binary" data-cmd_id="#id#" data-cmd_uid="#uid#">
	<div class="ruban#uid#" style="#hideCmdName#"><span class="rubantext#uid#"></span></div>
	<div class="contour#uid#">
  		<div class="fenetre#uid#">
         	<img class="image#uid#" style="transform:translate(-50%,-50%);" />
          	<span class="timeCmd#uid#"></span>
  		</div>     
	</div>

  
	<style>
	img.image#uid# {
		position: absolute;
        margin-top: 2px;
    	margin-left: 2px;
		top: 40%;
  		left: 50%;
       	width: 80%;
       	z-index: 2;
	} 
	.contour#uid# {
		border-left: solid 1px black;
  		border-right: solid 1px black;
  		border-top: solid 2px #BEBEBE;
  		border-bottom: solid 1px black;
		width: 100% ;
		height: 100%;
		text-align: center;
  		color: white;
  		text-transform: uppercase;
 		display: flex;
    	background-color: #BEBEBE;
  		border-radius: 0px 0px 5px 5px;
  		opacity: 0.9;
  		box-shadow: 3px 3px 3px 3px rgba(0,0,0,0.5);   
	}

	.fenetre#uid# {
     	margin: auto;
     	margin-top: 3px;
     	margin-right: 2px;
     	margin-bottom: 2px;
     	margin-left: 5px;
     	width: 95%;
     	height: 95%;
    	border-radius: 2px;
  		background-color: #BEBEBE;
  		opacity: 0.9;
 		box-shadow: 5px 5px 20px #000000 inset,-2px -2px 2px #000,2px 2px 2px #fff;
	}
    .fenetre#uid# span {
		position: absolute;
        font-size: 10px;
  		font-weight: bold;
  		color: #FFF;
		text-align: center;
      	color: black;
		bottom: 2px;
        left: 0px;
       	width: 100%;
       	z-index: 2;
      }
	div.ruban#uid# {
  		position: absolute;
  		left: -5px; 
      	top: -5px;
  		z-index: 2;
  		overflow: hidden;
  		width: 75px; 
      	height: 75px;
  		text-align: right;
	}
	.ruban#uid# span {
  		font-size: 12px;
  		font-weight: bold;
  		color: #FFF;
  		text-transform: uppercase;
  		text-align: center;
  		line-height: 20px;
  		transform: rotate(-45deg);
  		-webkit-transform: rotate(-45deg);
  		width: 100px;
  		display: block;
  		/*background-color: #79A70A;*/
  		background: linear-gradient(#2989d8 0%, #1e5799 100%);
  		position: absolute;
  		top: 19px; 
      	left: -21px;
	}
	.ruban#uid# span::before {
  		content: "";
  		position: absolute; left: 0px; top: 100%;
  		z-index: -1;
  		border-left: 3px solid #1e5799;
  		border-right: 3px solid transparent;
  		border-bottom: 3px solid transparent;
  		border-top: 3px solid #1e5799;
	}
	.ruban#uid# span::after {
  		content: "";
  		position: absolute; right: 0px; top: 100%;
  		z-index: -1;
  		border-left: 3px solid transparent;
  		border-right: 3px solid #1e5799;
  		border-bottom: 3px solid transparent;
  		border-top: 3px solid #1e5799;
	}
	</style>

	<script> 
		jeedom.cmd.update['#id#'] = function(_options){ 
			// Récupération de la valeur
			var value = _options.display_value;
 			// Récupération des options
            /*
            name : texte du bandeau, sinon Display_name
         	coloron : Couleur ON sous la forme #xxxxx, sinon VERT
            coloroff : Couleur OFF sous la forme #xxxxx, sinon ROUGE
            imgon : Image ON avec répertoire
            imgoff : Image ON avec répertoire
 			*/         
          	var valueName = ('#name#' !='#'+'name#') ? "#name#":"";
          	if (valueName != "" ) { 
              	$(".rubantext#uid#").text(valueName); 
            } else {
              	$(".rubantext#uid#").text('#name_display#');   
            }  
            var valueCouleurOn = ('#coloron#' !='#'+'coloron#') ? "#coloron#":"#61FC94";
            var valueCouleurOff = ('#coloroff#' !='#'+'coloroff#') ? "#coloroff#":"#FC6361";
            var valueImgOn = ('#imgon#' !='#'+'imgon#') ? "#imgon#":""; 
            var valueImgOff = ('#imgoff#' !='#'+'imgoff#') ? "#imgoff#":"";        
          
            // TEST PRESENCE IMAGE ON/OFF
          	if ( valueImgOn == "" || valueImgOff == "" ) { $(".rubantext#uid#").empty().text("ERROR IMG"); }
          
            // TEST 0 ou 1 de la valeur
          	if ( value == 0) {
	        	var srcIMAGE = valueImgOff;
	        } else {
	          	var srcIMAGE = valueImgOn;
	        }
            $('.image#uid#').attr('src', srcIMAGE);
          
          	// FENETRE COULEUR
          	if ( value == 0) { var couleurFenetre = valueCouleurOff; } else { var couleurFenetre = valueCouleurOn; }
          	$('.fenetre#uid#').css("background-color", couleurFenetre);
          
            // FENETRE INFO
         	$('.fenetre#uid#').css('height', '75%');
            jeedom.cmd.displayDuration(_options.valueDate, $('.timeCmd#uid#'));

          
			$('.cmd[data-cmd_id=#id#]').attr('title','srcState du '+_options.valueDate+', collectée le '+_options.collectDate);
		}
		jeedom.cmd.update['#id#']({display_value:'#state#',valueDate:'#valueDate#',collectDate:'#collectDate#',alertLevel:'#alertLevel#'});          
	</script>
</div>
1 « J'aime »

Question bete il affiche que le bandeau c’est ça ? du coup il va prendre le dessus sur un widget type IconInfo ou IconAction ?

Non il affiche le bandeau, le cadre, le fond change de couleur et l’image suivant On/Off et la durée de l’état

d’accord ça viens en remplacement du Iconinfo/iconaction de Saviaf

En remplacement je sais pas, c’est un autre widget pour afficher une commande info-binaire comme il y en a plein.

J’aimais bien cet affichage en bandeau, comme je n’utilise pas ce design alors je me suis fait un widget et je le partage

Oui j’aime beaucoup les bandeaux aussi :slight_smile:

Bonjour @Nemeraud,

J’aime bien l’idée mais la question que je me pose, est ce compatible v4 ou que v3?

Merci d’avance pour ta réponse.

bonjour
si tu vois
style="#hideCmdName#"
c’est full v3

v4 c’est une class

  <div class="title #hide_name#">

Bonjour

C’est vieux et fait en V3 en effet, il faudrait l’adapter mais perso je ne l’utilise plus.

Bonsoir @ajja17orange et @Nemeraud,

Merci pour votre réponse à tous les deux, bon pas certain qu’avec mes 2 neurones je sois capable de faire une adaptation à la v4 mais je vais essayer

Il pourrait être sympa celui là dans pimp my jeedom

Hello,

Début d’adaptation réussi, merci @ajja17orange pour l’info :slight_smile: reste 2/3 truc à corriger comme la taille mais ça fonctionne.

Capture

2 « J'aime »