<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    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 class="moz-cite-prefix">Am 27.12.22 um 04:40 schrieb Michael
      Geddes:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAH0p7uJxnhq9cyG_o9S5=3g0rzv0mWi5k1ONH=jBJPPx1zP_Jw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <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"
            moz-do-not-send="true" class="moz-txt-link-freetext">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 class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26</pre>
  </body>
</html>