Commit 4570dd16 authored by Rüdiger Sonderfeld's avatar Rüdiger Sonderfeld Committed by Lars Magne Ingebrigtsen
Browse files

Allow customizing the checkboxes in eww

* net/shr.el (shr-tag-table): Fix comment typo.

* net/eww.el (eww-text-input-types): : New const.
(eww-process-text-input): Treat input types in
`eww-text-input-types' as text.

* net/shr.el (shr-tag-video): Display content for video if no
poster is available.
(shr-tag-audio): Add support for <audio> tag.

* net/eww.el (eww-use-external-browser-for-content-type): New
variable.
(eww-render): Handle `eww-use-external-browser-for-content-type'.
Use \\` to match beginning of string instead of ^.
(eww-browse-with-external-browser): Provide optional URL parameter.
(eww-render): Set `eww-current-title' back to "".

* net/shr.el (shr-prefer-media-type-alist): : New customizable
variable.
(shr--get-media-pref): New function.
(shr--extract-best-source): New function.
(shr-tag-video, shr-tag-audio):  Use `shr--extract-best-source' when
no :src tag was specified.

* net/eww.el (eww-form-checkbox-selected-symbol): New
customizable variable.
(eww-form-checkbox-symbol): New customizable variable.
(eww-form-checkbox): Use `eww-form-checkbox-selected-symbol' and
`eww-form-checkbox-symbol'.
(eww-toggle-checkbox): Use `eww-form-checkbox-selected-symbol' and
`eww-form-checkbox-symbol'.
parent ad9a773c
2013-12-01 Rüdiger Sonderfeld <ruediger@c-plusplus.de>
* net/eww.el (eww-form-checkbox-selected-symbol): New
customizable variable.
(eww-form-checkbox-symbol): New customizable variable.
(eww-form-checkbox): Use `eww-form-checkbox-selected-symbol' and
`eww-form-checkbox-symbol'.
(eww-toggle-checkbox): Use `eww-form-checkbox-selected-symbol' and
`eww-form-checkbox-symbol'.
* net/shr.el (shr-prefer-media-type-alist): : New customizable
variable.
(shr--get-media-pref): New function.
......
......@@ -64,6 +64,25 @@
:type '(choice (const :tag "Never" nil)
regexp))
(defcustom eww-form-checkbox-selected-symbol "[X]"
"Symbol used to represent a selected checkbox.
See also `eww-form-checkbox-symbol'."
:version "24.4"
:group 'eww
:type '(choice (const "[X]")
(const "☒") ; Unicode BALLOT BOX WITH X
(const "☑") ; Unicode BALLOT BOX WITH CHECK
string))
(defcustom eww-form-checkbox-symbol "[ ]"
"Symbol used to represent a checkbox.
See also `eww-form-checkbox-selected-symbol'."
:version "24.4"
:group 'eww
:type '(choice (const "[ ]")
(const "☐") ; Unicode BALLOT BOX
string))
(defface eww-form-submit
'((((type x w32 ns) (class color)) ; Like default mode line
:box (:line-width 2 :style released-button)
......@@ -614,8 +633,8 @@ appears in a <link> or <a> tag."
(defun eww-form-checkbox (cont)
(let ((start (point)))
(if (cdr (assq :checked cont))
(insert "[X]")
(insert "[ ]"))
(insert eww-form-checkbox-selected-symbol)
(insert eww-form-checkbox-symbol))
(add-face-text-property start (point) 'eww-form-checkbox)
(put-text-property start (point) 'eww-form
(list :eww-form eww-form
......@@ -849,9 +868,9 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
(if (plist-get input :checked)
(progn
(plist-put input :checked nil)
(eww-update-field "[ ]"))
(eww-update-field eww-form-checkbox-symbol))
(plist-put input :checked t)
(eww-update-field "[X]"))))
(eww-update-field eww-form-checkbox-selected-symbol))))
;; Radio button. Switch all other buttons off.
(let ((name (plist-get input :name)))
(save-excursion
......@@ -861,9 +880,9 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
(if (not (eq (cdr elem) input))
(progn
(plist-put input :checked nil)
(eww-update-field "[ ]"))
(eww-update-field eww-form-checkbox-symbol))
(plist-put input :checked t)
(eww-update-field "[X]")))))
(eww-update-field eww-form-checkbox-selected-symbol)))))
(forward-char 1)))))
(defun eww-inputs (form)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment