Bonjour,
J’ai une erreur dans un widget en V4 :
Uncaught ReferenceError: autoonoffNormalize is not defined
J’ai reussi à identifier la source, mais je ne sais pas comment résoudre
Merci de vos idées
voici le code du widget
<div class="cmd tooltips cmd-widget cursor autoonoff" data-type="action" data-subtype="other" data-cmd_id="#id#" data-cmd_uid="#uid#" data-version="#version#">
<div class="autoonoffDivConteneur" >
<span class="autoonoffName" style="#hideCmdName#">#valueName#<br/></span>
<span class="autoonoffAction"><br/><img class="autoonoffImg" style="width: 80px;" src=""/></span>
</div>
<script type="text/javascript">
jeedom.cmd.update['#id#'] = function(_options){
$.include(['plugins/widget/core/template/dashboard/cmd.action.other.CommutAutoOnOff_IMG/AutoOnOff.js', 'plugins/widget/core/template/dashboard/cmd.action.other.CommutAutoOnOff_IMG/AutoOnOff.css'], function() {
var widget = $('div.cmd[data-cmd_uid="#uid#"]');
if ('#reverse#'.trim() == '1') {
var sens = ['off','auto','on'];
} else {
var sens = ['on','off','auto'];
}
if ('#nospace#'.trim() == '1') { $('span.autoonoffAction br', widget).remove(); }
if ('#inline#'.trim() == '1') { autoonoffInline(widget); }
if (autoonoffNormalize(_options.display_value.toString()) == 'auto') {
$('.autoonoffImg', widget).attr('src','plugins/widget/core/template/dashboard/cmd.action.other.CommutAutoOnOff_IMG/AutoOnOffCommut_AUTO.png');
if (**autoonoffNormalize**('#name#') == 'auto' || **autoonoffNormalize**('#name#') == sens[0]) {
widget.hide();
} else {
widget.show();
}
} else if (**autoonoffNormalize**(_options.display_value.toString()) == 'on') {
$('.autoonoffImg', widget).attr('src','plugins/widget/core/template/dashboard/cmd.action.other.CommutAutoOnOff_IMG/AutoOnOffCommut_ON.png');
if (**autoonoffNormalize**('#name#') == 'on' || **autoonoffNormalize**('#name#') == sens[1]) {
widget.hide();
} else {
widget.show();
}
} else {
$('.autoonoffImg', widget).attr('src','plugins/widget/core/template/dashboard/cmd.action.other.CommutAutoOnOff_IMG/AutoOnOffCommut_OFF.png');
if (**autoonoffNormalize**('#name#') == 'off' || **autoonoffNormalize**('#name#') == sens[2]) {
widget.hide();
} else {
widget.show();
}
}
});
}
jeedom.cmd.update['#id#']({display_value:'#state#'});
$('.cmd[data-cmd_uid=#uid#] .autoonoffAction').off().on('click', function () {
jeedom.cmd.execute({id: '#id#'});
});
</script>
</div>