diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..247c2a6 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,34 @@ +## Changelog + +### Fork - + + +### v1.1.0 + +Added notifications for new messages in inactive tabs. +Fixed new messages showing up incorrectly. + +### v1.2.0 + +In Character messages without a scene attached will now show on the IC tab when toggled + +### v1.3.4 + +You can now automatically send In Character and Out of Character chat messages to Discord. There is one global module setting for OOC messages. IC messages can be per-scene via a Scene setting - if this is not found, it will fallback to a global IC webhook if configured in the Module Settings. + +Tabbed Chat now also properly integrates with https://github.com/sPOiDar/fvtt-module-hide-gm-rolls + +### v1.6.0 + +Thanks to David Zvekic: +* Now works properly with Vance's Resizable Sidebar. +* Flush now only deletes the messages from the active TAB, leaving the messages on other tabs clean. + +Thanks to mclemente: +* Polyglot messages should now correctly show / hide + +Other changes: +* Chat messages can now be changed to be global instead of per-scene +* Users can now use a setting to autonavigate to a new tab when a message comes in +* Swapping off then back on to the Chat tab should now correctly highlight the active tab +* Whispers can now be treated as In Character instead of OOC \ No newline at end of file diff --git a/README.md b/README.md index c2d9c15..1deeef3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![](https://img.shields.io/badge/Foundry-v0.6.2-informational) +![](https://img.shields.io/badge/Foundry-v0.7.9-informational) [![](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-%243-orange)](https://www.buymeacoffee.com/T2tZvWJ) @@ -8,25 +8,7 @@ Splits the Chatlog into In Character (per scene), Rolls (per scene), and Out of ![](./tabbed-chatlog.gif) +## Maintenance Mode - -## Changelog - -### David Zvekic Fork - --- Now works properly with Vance's Resizable Sidebar. --- Flush now only deletes the messages from the active TAB, leaving the messages on other tabs clean. - -### v1.1.0 - -Added notifications for new messages in inactive tabs. -Fixed new messages showing up incorrectly. - -### v1.2.0 - -In Character messages without a scene attached will now show on the IC tab when toggled - -### v1.3.4 - -You can now automatically send In Character and Out of Character chat messages to Discord. There is one global module setting for OOC messages. IC messages can be per-scene via a Scene setting - if this is not found, it will fallback to a global IC webhook if configured in the Module Settings. - -Tabbed Chat now also properly integrates with https://github.com/sPOiDar/fvtt-module-hide-gm-rolls +This repository is no longer receiving active attention. I view the Module to be in a stable and feature-complete state, and will be focusing my efforts on other modules. +PR's are welcome, and I'll try to investigate bugs and keep the module up to date with Foundry in a timely manner. \ No newline at end of file diff --git a/languages/cn.json b/languages/cn.json index 2ab55c1..0d2870d 100644 --- a/languages/cn.json +++ b/languages/cn.json @@ -16,6 +16,12 @@ "TC.SETTINGS.PerSceneName": "是否应按场景拆分“角色和角色”消息?", "TC.SETTINGS.PerSceneHint": "默认禁用", + "TC.SETTINGS.AutoNavigateName": "新消息应该自动交换到该选项卡吗?", + "TC.SETTINGS.AutoNavigateHint": "默认为错误的", + + "TC.SETTINGS.IcWhispersName": "交换低语以显示在“角色内聊天”中而不是OOC中?", + "TC.SETTINGS.IcWhispersHint": "默认为错误的", + "TC.TABS.IC": "角色", "TC.TABS.OOC": "超游", "TC.TABS.Rolls": "掷骰" diff --git a/languages/en.json b/languages/en.json index 2e44cb8..effac07 100644 --- a/languages/en.json +++ b/languages/en.json @@ -16,6 +16,12 @@ "TC.SETTINGS.PerSceneName": "Should In Character and Roll messages be split per Scene?", "TC.SETTINGS.PerSceneHint": "Defaults to True", + "TC.SETTINGS.AutoNavigateName": "Should new messages automatically swap to that tab?", + "TC.SETTINGS.AutoNavigateHint": "Defaults to False", + + "TC.SETTINGS.IcWhispersName": "Swap Whispers to show up in In Character chat instead of OOC?", + "TC.SETTINGS.IcWhispersHint": "Defaults to False", + "TC.TABS.IC": "In Character", "TC.TABS.OOC": "OOC", "TC.TABS.Rolls": "Rolls" diff --git a/languages/es.json b/languages/es.json index af0d58f..b38524a 100644 --- a/languages/es.json +++ b/languages/es.json @@ -19,6 +19,12 @@ "TC.SETTINGS.PerSceneName": "¿Deben dividirse los mensajes In Character y Roll por escena? ", "TC.SETTINGS.PerSceneHint": "Opción habilitada por defecto", + "TC.SETTINGS.AutoNavigateName": "¿Los mensajes nuevos deberían cambiar automáticamente a esa pestaña?", + "TC.SETTINGS.AutoNavigateHint": "Por defecto es falsa", + + "TC.SETTINGS.IcWhispersName": "¿Cambiar susurros para que aparezcan en el chat de personaje en lugar de OOC? ", + "TC.SETTINGS.IcWhispersHint": "Por defecto es falsa", + "TC.TABS.IC": "Personaje", "TC.TABS.OOC": "Jugador", "TC.TABS.Rolls": "Tiradas" diff --git a/languages/zh-tw.json b/languages/zh-tw.json index a295857..74cf74a 100644 --- a/languages/zh-tw.json +++ b/languages/zh-tw.json @@ -16,6 +16,12 @@ "TC.SETTINGS.PerSceneName": "是否应按场景拆分“角色和角色”消息?", "TC.SETTINGS.PerSceneHint": "默認禁用", + "TC.SETTINGS.AutoNavigateName": "新消息應該自動交換到該選項卡嗎?", + "TC.SETTINGS.AutoNavigateHint": "默认为错误的", + + "TC.SETTINGS.IcWhispersName": "交換低語以顯示在“角色內聊天”中而不是OOC中? ", + "TC.SETTINGS.IcWhispersHint": "默认为错误的", + "TC.TABS.IC": "角色", "TC.TABS.OOC": "超遊", "TC.TABS.Rolls": "擲骰" diff --git a/tabbed-chatlog.js b/tabbed-chatlog.js index e5f962d..d7abcb6 100644 --- a/tabbed-chatlog.js +++ b/tabbed-chatlog.js @@ -53,7 +53,7 @@ function isMessageTypeVisible(messageType) { case CHAT_MESSAGE_TYPES.EMOTE: return true; case CHAT_MESSAGE_TYPES.WHISPER: - return false; + return game.settings.get("tabbed-chatlog", "icWhispers"); case CHAT_MESSAGE_TYPES.ROLL: return false; } @@ -69,7 +69,7 @@ function isMessageTypeVisible(messageType) { case CHAT_MESSAGE_TYPES.EMOTE: return false; case CHAT_MESSAGE_TYPES.WHISPER: - return true; + return !game.settings.get("tabbed-chatlog", "icWhispers"); case CHAT_MESSAGE_TYPES.ROLL: return false; } @@ -114,7 +114,9 @@ Hooks.on("renderChatLog", async function (chatLog, html, user) { toPrepend += `${game.i18n.localize("TC.TABS.OOC")}`; html.prepend(toPrepend); - const tabs = new TabsV2({ + window.game.tabbedchat = {}; + + window.game.tabbedchat.tabs = new TabsV2({ navSelector: ".tabs", contentSelector: ".content", initial: "tab1", @@ -147,7 +149,11 @@ Hooks.on("renderChatLog", async function (chatLog, html, user) { $("#chat-log").scrollTop(9999999); } }); - tabs.bind(html[0]); + window.game.tabbedchat.tabs.bind(html[0]); + + $("[data-tab=\"chat\"]").click(() => { + setTimeout(() => $(".item." + currentTab).addClass("active"), 100); + }); }); Hooks.on("renderChatMessage", (chatMessage, html, data) => { @@ -162,7 +168,7 @@ Hooks.on("renderChatMessage", (chatMessage, html, data) => { if (data.message.speaker.scene != undefined && game.settings.get("tabbed-chatlog", "perScene")) { html.addClass("scenespecific"); html.addClass("scene" + data.message.speaker.scene); - if (data.message.speaker.scene != game.user.viewedScene) { + if (data.message.speaker.scene != game.user?.viewedScene) { sceneMatches = false; } } @@ -182,23 +188,20 @@ Hooks.on("renderChatMessage", (chatMessage, html, data) => { html.css("display", "list-item"); } else if (data.message.type == 5 && sceneMatches) { if (!html.hasClass('gm-roll-hidden')) { - if (game.dice3d && game.settings.get("dice-so-nice", "settings").enabled && game.settings.get("dice-so-nice", "enabled")) { - if (!game.settings.get("dice-so-nice", "immediatelyDisplayChatMessages")) return; - } html.css("display", "list-item"); } } else { html.css("display", "none"); } } else if (currentTab == "ic") { - if ((data.message.type == 2 || data.message.type == 3) && sceneMatches) { + if ((data.message.type == 2 || data.message.type == 3 || (data.message.type == 4 && game.settings.get("tabbed-chatlog", "icWhispers"))) && sceneMatches) { html.css("display", "list-item"); } else { html.css("cssText", "display: none !important;"); html.addClass("hardHide"); } } else if (currentTab == "ooc") { - if (data.message.type == 1 || data.message.type == 4) { + if (data.message.type == 1 || (data.message.type == 4 && !game.settings.get("tabbed-chatlog", "icWhispers"))) { html.css("display", "list-item"); } else { html.css("display", "none"); @@ -216,32 +219,52 @@ Hooks.on("createChatMessage", (chatMessage, content) => { var sceneMatches = true; if (chatMessage.data.speaker.scene) { - if (chatMessage.data.speaker.scene != game.user.viewedScene) { + if (chatMessage.data.speaker.scene != game.user?.viewedScene) { sceneMatches = false; } } if (chatMessage.data.type == 0) { if (currentTab != "rolls" && sceneMatches) { - setRollsNotifyProperties(); - $("#rollsNotification").show(); + if (game.settings.get("tabbed-chatlog", "autoNavigate")) { + window.game.tabbedchat.tabs.activate("rolls", {triggerCallback: true}); + } + else { + setRollsNotifyProperties(); + $("#rollsNotification").show(); + } } } else if (chatMessage.data.type == 5) { if (currentTab != "rolls" && sceneMatches && chatMessage.data.whisper.length == 0) { - setRollsNotifyProperties(); - $("#rollsNotification").show(); + if (game.settings.get("tabbed-chatlog", "autoNavigate")) { + window.game.tabbedchat.tabs.activate("rolls", {triggerCallback: true}); + } + else { + setRollsNotifyProperties(); + $("#rollsNotification").show(); + } } - } else if (chatMessage.data.type == 2 || chatMessage.data.type == 3) { + } else if (chatMessage.data.type == 2 || chatMessage.data.type == 3 || (chatMessage.data.type == 4 && game.settings.get("tabbed-chatlog", "icWhispers"))) { if (currentTab != "ic" && sceneMatches) { - setICNotifyProperties(); - $("#icNotification").show(); + if (game.settings.get("tabbed-chatlog", "autoNavigate")) { + window.game.tabbedchat.tabs.activate("ic", {triggerCallback: true}); + } + else { + setICNotifyProperties(); + $("#icNotification").show(); + } } } else { - if (salonEnabled && chatMessage.data.type == 4) return; + if (salonEnabled && chatMessage.data.type == 4 && !game.settings.get("tabbed-chatlog", "icWhispers")) return; if (currentTab != "ooc") { - setOOCNotifyProperties(); - $("#oocNotification").show(); + if (game.settings.get("tabbed-chatlog", "autoNavigate")) { + window.game.tabbedchat.tabs.activate("ooc", {triggerCallback: true}); + } + else { + setOOCNotifyProperties(); + $("#oocNotification").show(); + } } } }); @@ -440,7 +463,7 @@ Hooks.on('sidebarCollapse', (sidebar, collapsing) => { Hooks.on('ready', () => { - if (game.modules.get('narrator-tools')) { + if (game.modules.get('narrator-tools')?.active) { NarratorTools._msgtype = 2; } @@ -557,6 +580,24 @@ Hooks.on('init', () => { type: Boolean, }); + game.settings.register('tabbed-chatlog', 'icWhispers', { + name: game.i18n.localize("TC.SETTINGS.IcWhispersName"), + hint: game.i18n.localize("TC.SETTINGS.IcWhispersHint"), + scope: 'world', + config: true, + default: false, + type: Boolean, + }); + + game.settings.register('tabbed-chatlog', 'autoNavigate', { + name: game.i18n.localize("TC.SETTINGS.AutoNavigateName"), + hint: game.i18n.localize("TC.SETTINGS.AutoNavigateHint"), + scope: 'client', + config: true, + default: false, + type: Boolean, + }); + salonEnabled = game.data.modules.find(x => x.id == "salon")?.active; });