From 90e330bde86e595fc72c7e092f87411cd4dbf5f7 Mon Sep 17 00:00:00 2001 From: Cody Swendrowski Date: Fri, 21 Aug 2020 20:52:23 -0500 Subject: [PATCH] Swap to ajax --- module.json | 4 ++-- tabbed-chatlog.js | 39 +++++++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/module.json b/module.json index 0cafab8..b7c2f41 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "name": "tabbed-chatlog", "title": "Tabbed Chatlog", "description": "Splits the Chatlog into In Character (per scene), Rolls (per scene), and Out of Character (global).", - "version": "1.3.1", + "version": "1.3.2", "minimumCoreVersion": "0.6.2", "compatibleCoreVersion": "0.7.1", "author": "Cody Swendrowski ", @@ -24,5 +24,5 @@ ], "url": "https://github.com/cswendrowski/FoundryVTT-tabbed-chatlog", "manifest": "https://github.com/cswendrowski/FoundryVTT-tabbed-chatlog/releases/download/latest/module.json", - "download": "https://github.com/cswendrowski/FoundryVTT-tabbed-chatlog/releases/download/1.3.0/module.zip" + "download": "https://github.com/cswendrowski/FoundryVTT-tabbed-chatlog/releases/download/1.3.2/module.zip" } diff --git a/tabbed-chatlog.js b/tabbed-chatlog.js index a8f69a0..d5e66db 100644 --- a/tabbed-chatlog.js +++ b/tabbed-chatlog.js @@ -166,14 +166,17 @@ Hooks.on("createChatMessage", (chatMessage, content) => { img = game.data.addresses.remote + "/" + img; - fetch(webhook, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ - content: chatMessage.data.content, - username: actor.name, - avatar_url: img - }) + $.ajax({ + type: 'POST', + url: webhook, + data: JSON.stringify({ + content: chatMessage.data.content, + username: actor.name, + avatar_url: img + }), + success: function(data) {}, + contentType: "application/json", + dataType: 'json' }); } catch {} @@ -195,14 +198,18 @@ Hooks.on("createChatMessage", (chatMessage, content) => { let img = chatMessage.user.avatar; img = game.data.addresses.remote + "/" + img; - fetch(webhook, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ - content: chatMessage.data.content, - username: chatMessage.user.name, - avatar_url: img - }) + + $.ajax({ + type: 'POST', + url: webhook, + data: JSON.stringify({ + content: chatMessage.data.content, + username: chatMessage.user.name, + avatar_url: img + }), + success: function(data) {}, + contentType: "application/json", + dataType: 'json' }); } catch {}