Add warning and hide option when injection fails (#315)

* Add warning and hide option when injection fails

* Update configPage.html

* Update configPage.html

---------

Co-authored-by: rlauu <46294892+rlauu@users.noreply.github.com>
This commit is contained in:
rlauuzo 2024-09-29 20:35:46 +02:00 committed by GitHub
parent 2ed22338e7
commit d2dc8daaed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 2 deletions

View File

@ -139,6 +139,11 @@ public class PluginConfiguration : BasePluginConfiguration
/// </summary> /// </summary>
public bool SkipButtonVisible { get; set; } = true; public bool SkipButtonVisible { get; set; } = true;
/// <summary>
/// Gets a value indicating whether to show the skip intro warning.
/// </summary>
public bool SkipButtonWarning { get => WarningManager.HasFlag(PluginWarning.UnableToAddSkipButton); }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether introductions should be automatically skipped. /// Gets or sets a value indicating whether introductions should be automatically skipped.
/// </summary> /// </summary>

View File

@ -416,7 +416,11 @@
<input id="ClientList" type="hidden" is="emby-input" /> <input id="ClientList" type="hidden" is="emby-input" />
</details> </details>
<div class="checkboxContainer checkboxContainer-withDescription"> <div id="warningMessage" style="color: #721c24; background-color: #f7cf1f; border: 1px solid #f5c6cb; border-radius: 4px; padding: 10px; margin-bottom: 10px;">
Failed to add skip button to web interface. See <a href="https://github.com/intro-skipper/intro-skipper/wiki/Troubleshooting#skip-button-is-not-visible" target="_blank" rel="noopener noreferrer">troubleshooting guide</a> for the most common issues.
</div>
<div id="SkipButtonContainer" class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label"> <label class="emby-checkbox-label">
<input id="SkipButtonVisible" type="checkbox" is="emby-checkbox" /> <input id="SkipButtonVisible" type="checkbox" is="emby-checkbox" />
<span>Show skip intro button</span> <span>Show skip intro button</span>
@ -429,7 +433,7 @@
</div> </div>
</div> </div>
<div class="checkboxContainer checkboxContainer-withDescription"> <div id="PersistContainer" class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label"> <label class="emby-checkbox-label">
<input id="PersistSkipButton" type="checkbox" is="emby-checkbox" /> <input id="PersistSkipButton" type="checkbox" is="emby-checkbox" />
<span>Display button for intro duration</span> <span>Display button for intro duration</span>
@ -1296,6 +1300,13 @@
document.querySelector("#" + field).checked = config[field]; document.querySelector("#" + field).checked = config[field];
} }
if (config["SkipButtonWarning"]) {
document.getElementById("SkipButtonContainer").style.display = 'none';
document.getElementById("PersistContainer").style.display = 'none';
} else {
document.getElementById("warningMessage").style.display = 'none';
}
populateLibraries(); populateLibraries();
selectAllLibrariesChanged(); selectAllLibrariesChanged();
autoSkipChanged(); autoSkipChanged();