Function: eww-toggle-checkbox
eww-toggle-checkbox is an interactive and byte-compiled function
defined in eww.el.gz.
Signature
(eww-toggle-checkbox &optional EVENT)
Documentation
Toggle the value of the checkbox under point.
EVENT, if non-nil, is the mouse event that preceded this command.
Interactively, EVENT is the value of last-nonmenu-event.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/net/eww.el.gz
(defun eww-toggle-checkbox (&optional event)
"Toggle the value of the checkbox under point.
EVENT, if non-nil, is the mouse event that preceded this command.
Interactively, EVENT is the value of `last-nonmenu-event'."
(interactive (list last-nonmenu-event) eww-mode)
(when (and event (setq event (event-start event)))
(goto-char (posn-point event)))
(let* ((input (get-text-property (point) 'eww-form))
(type (plist-get input :type)))
(if (equal type "checkbox")
(goto-char
(1+
(if (plist-get input :checked)
(progn
(plist-put input :checked nil)
(eww-update-field eww-form-checkbox-symbol))
(plist-put input :checked t)
(eww-update-field eww-form-checkbox-selected-symbol))))
;; Radio button. Switch all other buttons off.
(let ((name (plist-get input :name)))
(save-excursion
(dolist (elem (eww-inputs (plist-get input :eww-form)))
(when (equal (plist-get (cdr elem) :name) name)
(goto-char (car elem))
(if (not (eq (cdr elem) input))
(progn
(plist-put (cdr elem) :checked nil)
(eww-update-field eww-form-checkbox-symbol))
(plist-put (cdr elem) :checked t)
(eww-update-field eww-form-checkbox-selected-symbol)))))
(forward-char 1)))))