From 7360d7fe314ed487ebddf84793ef8d0c7fbc64e6 Mon Sep 17 00:00:00 2001
From: Vali
Date: Tue, 18 Aug 2020 15:38:47 +0200
Subject: [PATCH] v1.1.0
---
CHANGELOG.md | 14 ++++
README.md | 2 +-
css/find-the-culprit.css | 51 ++++++++++++
js/find-the-culprit.js | 164 +++++++++++++++++++++------------------
module.json | 1 +
5 files changed, 156 insertions(+), 76 deletions(-)
create mode 100644 CHANGELOG.md
create mode 100644 css/find-the-culprit.css
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..b40f180
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,14 @@
+# v1.1.0
+
+- You may now select a list of modules to keep active.
+- Added statistics to each step:
+ - remaining modules in list
+ - remaining steps
+ - list of (in-)active modules
+- Fixed some bug where (at least sometimes) the wrong result was shown
+- Moved the "Find the culprit" button in module management to the bottom, right beside the "Save Module Settings" button.
+- Cleaned up the code a bit.
+
+# v1.0.0
+
+- Initial release
\ No newline at end of file
diff --git a/README.md b/README.md
index a6af9c3..ede50f6 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Find the culprit
- [![PayPal](https://img.shields.io/badge/Donate-PayPal-blue?style=for-the-badge)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FYZ294SP2JBGS&source=url)
+ [![PayPal](https://img.shields.io/badge/Donate-PayPal-blue?style=for-the-badge)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FYZ294SP2JBGS&source=url)
This module helps you debug compatibility issues of modules, by finding the module that is responsible for the issue, without having to manually activate and deactivate all your modules yourself. Just click the **Find the culprit** button in **Module Management** to start the process.
* You will be asked to select a module to keep active at all times. Choose the module that you want to debug.
diff --git a/css/find-the-culprit.css b/css/find-the-culprit.css
new file mode 100644
index 0000000..c9904f3
--- /dev/null
+++ b/css/find-the-culprit.css
@@ -0,0 +1,51 @@
+.ftc-module-list {
+
+
+ background: rgba(0,0,0,0.05);
+ border: 2px inset #6666;
+ border-radius: 0.5em;
+
+ padding: 0.5em;
+ list-style-type: disc;
+ max-height: 300px;
+ overflow-y: scroll;
+ padding: 0.5em;
+ list-style-type: none;
+}
+
+.ftc-module-list li {
+ display: flex;
+ align-items: center;
+}
+
+.ftc-module-list li input.ftc-checkbox {
+ margin-right: 0.5em;
+}
+
+.ftc-module-list li:not(:first-child) {
+ border-top: 1px dashed #6666;
+}
+
+.ftc-module-list i {
+ min-width: 1.5ch;
+}
+
+.ftc-active {
+ color: green;
+}
+
+.ftc-inactive {
+ color: red;
+}
+
+.ftc-submit-div {
+ display: flex;
+}
+
+.ftc-submit-div button {
+ flex: 1;
+}
+
+.ftc-submit-div button[type="submit"] {
+ flex: 2;
+}
\ No newline at end of file
diff --git a/js/find-the-culprit.js b/js/find-the-culprit.js
index 0418b66..3efe51f 100644
--- a/js/find-the-culprit.js
+++ b/js/find-the-culprit.js
@@ -14,9 +14,15 @@ Hooks.on('renderModuleManagement', onRenderModuleManagement)
function onRenderModuleManagement(app, html, options) {
const form = html[0].querySelector('form');
- const btn = form.insertBefore(document.createElement('button'), form.children[0]);
- btn.innerText = "Find the culprit!"
+ const submitBtn = form.querySelector('button[type="submit"]');
+ const btn = document.createElement('button');
+ btn.innerHTML = ' Find the culprit!';
btn.addEventListener('click', startDebugging);
+ const div = document.createElement('div');
+ div.classList.add('ftc-submit-div');
+ form.appendChild(div);
+ div.appendChild(btn);
+ div.appendChild(submitBtn);
}
function startDebugging(ev) {
@@ -25,17 +31,16 @@ function startDebugging(ev) {
let original = game.settings.get("core", ModuleManagement.CONFIG_SETTING);
let settings = {
original,
- current: Object.keys(original).filter(e => original[e] && e !== moduleName),
+ active: Object.keys(original).filter(e => original[e] && e !== moduleName),
step: 0
};
new Dialog({
title: 'Find the culprit',
- content: `
Choose a module to keep active:
-
+ content: `
Choose modules to keep active:
+
+ ${settings.active.map(e => ``).join("")}
+
After clicking start the page will refresh and you will be prompted to check whether your issue still exists. This will repeat multiple times until the culprit was found.
After the culprit was found you will be able to choose whether you want to reactivate all currently activated modules or not.
Don't worry if you accidently close one of the popups, just refresh the page manually and it will reappear.