diff options
| author | Rüdiger Sonderfeld | 2013-12-01 16:52:04 +0100 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2013-12-01 16:52:04 +0100 |
| commit | 4570dd161427cb1d52d847ab32ece0fd74765df7 (patch) | |
| tree | 82aae7cf185f4385e9b4a67c2d816df74b09491d | |
| parent | ad9a773c5057e0ddb9de5c582d36572dbcfd5d23 (diff) | |
| download | emacs-4570dd161427cb1d52d847ab32ece0fd74765df7.tar.gz emacs-4570dd161427cb1d52d847ab32ece0fd74765df7.zip | |
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'.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/net/eww.el | 31 |
2 files changed, 33 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a251f102590..9bdea147f43 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,13 @@ | |||
| 1 | 2013-12-01 Rüdiger Sonderfeld <ruediger@c-plusplus.de> | 1 | 2013-12-01 Rüdiger Sonderfeld <ruediger@c-plusplus.de> |
| 2 | 2 | ||
| 3 | * net/eww.el (eww-form-checkbox-selected-symbol): New | ||
| 4 | customizable variable. | ||
| 5 | (eww-form-checkbox-symbol): New customizable variable. | ||
| 6 | (eww-form-checkbox): Use `eww-form-checkbox-selected-symbol' and | ||
| 7 | `eww-form-checkbox-symbol'. | ||
| 8 | (eww-toggle-checkbox): Use `eww-form-checkbox-selected-symbol' and | ||
| 9 | `eww-form-checkbox-symbol'. | ||
| 10 | |||
| 3 | * net/shr.el (shr-prefer-media-type-alist): : New customizable | 11 | * net/shr.el (shr-prefer-media-type-alist): : New customizable |
| 4 | variable. | 12 | variable. |
| 5 | (shr--get-media-pref): New function. | 13 | (shr--get-media-pref): New function. |
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 467e204b978..d8c0010b4ce 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el | |||
| @@ -64,6 +64,25 @@ | |||
| 64 | :type '(choice (const :tag "Never" nil) | 64 | :type '(choice (const :tag "Never" nil) |
| 65 | regexp)) | 65 | regexp)) |
| 66 | 66 | ||
| 67 | (defcustom eww-form-checkbox-selected-symbol "[X]" | ||
| 68 | "Symbol used to represent a selected checkbox. | ||
| 69 | See also `eww-form-checkbox-symbol'." | ||
| 70 | :version "24.4" | ||
| 71 | :group 'eww | ||
| 72 | :type '(choice (const "[X]") | ||
| 73 | (const "☒") ; Unicode BALLOT BOX WITH X | ||
| 74 | (const "☑") ; Unicode BALLOT BOX WITH CHECK | ||
| 75 | string)) | ||
| 76 | |||
| 77 | (defcustom eww-form-checkbox-symbol "[ ]" | ||
| 78 | "Symbol used to represent a checkbox. | ||
| 79 | See also `eww-form-checkbox-selected-symbol'." | ||
| 80 | :version "24.4" | ||
| 81 | :group 'eww | ||
| 82 | :type '(choice (const "[ ]") | ||
| 83 | (const "☐") ; Unicode BALLOT BOX | ||
| 84 | string)) | ||
| 85 | |||
| 67 | (defface eww-form-submit | 86 | (defface eww-form-submit |
| 68 | '((((type x w32 ns) (class color)) ; Like default mode line | 87 | '((((type x w32 ns) (class color)) ; Like default mode line |
| 69 | :box (:line-width 2 :style released-button) | 88 | :box (:line-width 2 :style released-button) |
| @@ -614,8 +633,8 @@ appears in a <link> or <a> tag." | |||
| 614 | (defun eww-form-checkbox (cont) | 633 | (defun eww-form-checkbox (cont) |
| 615 | (let ((start (point))) | 634 | (let ((start (point))) |
| 616 | (if (cdr (assq :checked cont)) | 635 | (if (cdr (assq :checked cont)) |
| 617 | (insert "[X]") | 636 | (insert eww-form-checkbox-selected-symbol) |
| 618 | (insert "[ ]")) | 637 | (insert eww-form-checkbox-symbol)) |
| 619 | (add-face-text-property start (point) 'eww-form-checkbox) | 638 | (add-face-text-property start (point) 'eww-form-checkbox) |
| 620 | (put-text-property start (point) 'eww-form | 639 | (put-text-property start (point) 'eww-form |
| 621 | (list :eww-form eww-form | 640 | (list :eww-form eww-form |
| @@ -849,9 +868,9 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.") | |||
| 849 | (if (plist-get input :checked) | 868 | (if (plist-get input :checked) |
| 850 | (progn | 869 | (progn |
| 851 | (plist-put input :checked nil) | 870 | (plist-put input :checked nil) |
| 852 | (eww-update-field "[ ]")) | 871 | (eww-update-field eww-form-checkbox-symbol)) |
| 853 | (plist-put input :checked t) | 872 | (plist-put input :checked t) |
| 854 | (eww-update-field "[X]")))) | 873 | (eww-update-field eww-form-checkbox-selected-symbol)))) |
| 855 | ;; Radio button. Switch all other buttons off. | 874 | ;; Radio button. Switch all other buttons off. |
| 856 | (let ((name (plist-get input :name))) | 875 | (let ((name (plist-get input :name))) |
| 857 | (save-excursion | 876 | (save-excursion |
| @@ -861,9 +880,9 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.") | |||
| 861 | (if (not (eq (cdr elem) input)) | 880 | (if (not (eq (cdr elem) input)) |
| 862 | (progn | 881 | (progn |
| 863 | (plist-put input :checked nil) | 882 | (plist-put input :checked nil) |
| 864 | (eww-update-field "[ ]")) | 883 | (eww-update-field eww-form-checkbox-symbol)) |
| 865 | (plist-put input :checked t) | 884 | (plist-put input :checked t) |
| 866 | (eww-update-field "[X]"))))) | 885 | (eww-update-field eww-form-checkbox-selected-symbol))))) |
| 867 | (forward-char 1))))) | 886 | (forward-char 1))))) |
| 868 | 887 | ||
| 869 | (defun eww-inputs (form) | 888 | (defun eww-inputs (form) |