diff options
Diffstat (limited to 'lisp/mastodon-tl.el')
| -rw-r--r-- | lisp/mastodon-tl.el | 23 | 
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 573c2fa..cf5d316 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -292,6 +292,7 @@ types of mastodon links and not just shr.el-generated ones.")      ;; keep new my-profile binding; shr 'O' doesn't work here anyway      (define-key map (kbd "O") #'mastodon-profile--my-profile)      (define-key map (kbd "C") #'mastodon-tl--copy-image-caption) +    (define-key map (kbd "C-c C-c") #'mastodon-tl--toggle-sensitive-image)      (define-key map (kbd "<C-return>") #'mastodon-tl--mpv-play-video-at-point)      (define-key map (kbd "<mouse-2>") #'mastodon-tl--click-image-or-video)      map) @@ -1215,6 +1216,28 @@ SENSITIVE is a flag from the item's JSON data."            (url-retrieve url #'mastodon-media--process-full-sized-image-response                          `(,url))))))) +(defvar mastodon-media--generic-broken-image-data) + +(defun mastodon-tl--toggle-sensitive-image () +  "Toggle dislay of sensitive image at point." +  (interactive) +  (let ((data (mastodon-tl--property 'image-data :no-move)) +        (inhibit-read-only t) +        (end (next-single-property-change (point) 'sensitive-state))) +    (if (equal 'hidden (mastodon-tl--property 'sensitive-state :no-move)) +        ;; display sensitive image: +        (add-text-properties (point) end +                             `(display ,data +                                       sensitive-state showing)) +      ;; hide sensitive image: +      (add-text-properties (point) end +                           `( sensitive-state hidden +                              display +                              ;; TODO: use an image placeholder +                              ,(create-image mastodon-media--generic-broken-image-data nil t) +                              ;; ,(mastodon-search--format-heading "    SENSITIVE") +                              ))))) +  ;; POLLS  | 
