<div dir="auto">Ok. I think I've deciphered that. Will give it a try. <div dir="auto"><br></div><div dir="auto">Michael </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 27 Dec 2022, 3:54 pm Michael Balzer, <<a href="mailto:dexter@expeedo.de">dexter@expeedo.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
Michael,<br>
<br>
I remember I changed the slider enable/disable control scheme from
reading the checkbox state to using the data attribute / option for
a reason, but I cannot remember exactly which now. I think it was to
get consistent dynamic controllability.<br>
<br>
My initial commit was ec1a874dadce01e8bd588c20115d890acd9149c2,
which used the checkbox state. A few days later in
91ed78a3d7ac5392eadd65be026a1a0fc77a611e I changed this to using the
`checked` option, but missed adding `data-checked` to
`PageContext::input_slider()` accordingly.<br>
<br>
Sliders using the enable/disable feature at that time only appeared
in plugins/pages doing dynamic initialization, so this didn't become
visible. Plugins normally create sliders by data attributes or init
options, not by explicit markup.<br>
<br>
TL;DR: I think the fix would probably better be to add the missing
`data-checked` to the markup created by
`PageContext::input_slider()`.<br>
<br>
Regards,<br>
Michael<br>
<br>
<br>
<div>Am 27.12.22 um 04:40 schrieb Michael
Geddes:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Right, so that didn't work if the check-box was
disabled (like in wifi)- but this does seem to work!<br>
<div><br>
</div>
<div> var $sld = $(this).closest('.slider'), $cbi =
$sld.find('.slider-enable'), data = $.extend({ checked:
($cbi.prop("type") === "hidden" || $cbi.prop("checked")) },
$sld.data());<br>
</div>
<div><br>
</div>
<div>//.ichael</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, 27 Dec 2022 at 11:04,
Michael Geddes <<a href="mailto:frog@bunyip.wheelycreek.net" target="_blank" rel="noreferrer">frog@bunyip.wheelycreek.net</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>Hi all,<br>
</div>
<div>I've noticed that if you create a 'slider' widget with
a checkbox that if it's unchecked when it first loads,
then the slider is enabled. If you check/uncheck then the
slider is disabled. Or at least that's what I seen in
google chrome.</div>
<div><br>
</div>
<div>I'm really not familiar with NodeJS, but this _seems_
to fix the problem:</div>
<div><br>
</div>
<div>Does this fix make sense? If so - I'll do a p/r for
it.</div>
<div><br>
</div>
<div>//.ichael </div>
<div><br>
</div>
<div><br>
</div>
* Slider widget plugin<br>
*/<br>
<br>
$.fn.slider = function(options) {<br>
return this.each(function() {<br>
- <font color="#ff0000">var $sld =
$(this).closest('.slider'), data = $.extend({ checked:
true }, $sld.data());</font><br>
+ <font color="#38761d"> var $sld =
$(this).closest('.slider'), $cbi =
$sld.find('.slider-enable'), data = $.extend({ checked:
$cbi.prop("checked") }, $sld.data());</font><br>
var opts = (typeof options == "object") ? options :
data;<br>
// init?<br>
if ($sld.children().length == 0) {<br>
var id = $sld.attr('id');<br>
$sld.html('\<br>
</div>
</blockquote>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
OvmsDev mailing list
<a href="mailto:OvmsDev@lists.openvehicles.com" target="_blank" rel="noreferrer">OvmsDev@lists.openvehicles.com</a>
<a href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" target="_blank" rel="noreferrer">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br>
<pre cols="72">--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26</pre>
</div>
_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.openvehicles.com" target="_blank" rel="noreferrer">OvmsDev@lists.openvehicles.com</a><br>
<a href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" rel="noreferrer noreferrer" target="_blank">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a><br>
</blockquote></div>