Skip to content

Commit

Permalink
add support for v10's reveal secret button
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelad02 committed Sep 22, 2022
1 parent 7f6cee1 commit 70d163c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.1

- feature: add support for v10's "reveal secret" button

# 2.0

- update to be compatible with v10
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
[![Forge Installs](https://img.shields.io/badge/dynamic/json?label=Forge%20Installs&query=package.installs&suffix=%25&url=https%3A%2F%2Fforge-vtt.com%2Fapi%2Fbazaar%2Fpackage%2Fshow-secrets&colorB=4aa94a)](https://forge-vtt.com/bazaar#package=show-secrets)
![Supported Foundry Versions](https://img.shields.io/endpoint?url=https://foundryshields.com/version?url=https://github.com/kaelad02/show-secrets/releases/latest/download/module.json)

GMs, do you use secret blocks in item descriptions to keep some information a secret from your players? Of course you do. It's a great way to keep that information from prying eyes. Unfortunately, it also means when you use that feature/attack/spell the secret is hidden, even from you, in the chat message. This module will show you those secrets in the chat message.
Secret blocks are a great way for GMs to keep information hidden from players. In an item's description, for example, you might include some special information about an attack that you do not want your players to see so it doesn't ruin the surprise. Putting that information in a secret block is a great way to hide it from them. Unfortunately, it also means when you use that item, the secret is hidden from everyone in the chat message. This module will show you, the GM, those secrets in the chat message.

![dnd5e screenshot](screenshot1.png?raw=true)

Viewing the secret blocks does require that the user be an owner of the actor that generated the message.
**Note:** Viewing the secret blocks does require that the user be an owner of the actor that generated the message.

## Settings

Expand Down
Binary file modified screenshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ async function wrappedGetHTML(wrapped, ...args) {
// Flag expanded state of dice rolls
if ( this._rollExpanded ) html.find(".dice-tooltip").addClass("expanded");

// Add HTMLSecret to include new "reveal secret" button support
new HTMLSecret({
parentSelector: "div.message-content",
callbacks: {
content: (secret) => this.content,
update: (secret, content) => this.update({ content }),
},
}).bind(html[0]);

/**
* A hook event that fires for each ChatMessage which is rendered for addition to the ChatLog.
* This hook allows for final customization of the message HTML before it is added to the log.
Expand Down

0 comments on commit 70d163c

Please sign in to comment.