Skip to content

Commit

Permalink
Fix - issue with join button not being added to character sheet due t…
Browse files Browse the repository at this point in the history
…o class changes
  • Loading branch information
Azmoria committed Oct 31, 2024
1 parent 24a2c80 commit 51d6e5e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CharactersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ function observe_character_sheet_changes(documentToObserve) {

if((mutationTarget.hasClass('.ajs-ok:not(.ajs-hidden)') || mutationTarget.find('.ajs-ok:not(.ajs-hidden)').length>0) && $('.alertify ~ div.alertify:not(.ajs-hidden):last-of-type').length>0 && !['Beyond 20 Settings', 'Beyond 20 Quick Settings', 'Beyond20 Hotkey'].includes($('.alertify ~ div.alertify:not(.ajs-hidden):last-of-type .ajs-header').text())){
$('.alertify ~ div.alertify:not(.ajs-hidden):last-of-type .ajs-button.ajs-ok').click();
let gameLogButton = $("div.ct-character-header__group--game-log.ct-character-header__group--game-log-last")
let gameLogButton = $("div.ct-character-header__group--game-log.ct-character-header__group--game-log-last, [data-original-title='Game Log'] button")
if(gameLogButton.length == 0){
gameLogButton = $(`[d='M243.9 7.7c-12.4-7-27.6-6.9-39.9 .3L19.8 115.6C7.5 122.8 0 135.9 0 150.1V366.6c0 14.5 7.8 27.8 20.5 34.9l184 103c12.1 6.8 26.9 6.8 39.1 0l184-103c12.6-7.1 20.5-20.4 20.5-34.9V146.8c0-14.4-7.7-27.7-20.3-34.8L243.9 7.7zM71.8 140.8L224.2 51.7l152 86.2L223.8 228.2l-152-87.4zM48 182.4l152 87.4V447.1L48 361.9V182.4zM248 447.1V269.7l152-90.1V361.9L248 447.1z']`).closest('[role="button"]'); // this is a fall back to look for the gamelog svg icon and look for it's button.
}
Expand Down Expand Up @@ -1410,7 +1410,7 @@ function set_window_name_and_image(callback) {
* If AboveVTT is running, the button will be an exit button */
function inject_join_exit_abovevtt_button() {
if (!is_characters_page() || window.self != window.top) return; // wrong page, dude
if ($(".ddbc-campaign-summary").length === 0) return; // we don't have any campaign data
if ($(".ddbc-campaign-summary, [class*='styles_campaignSummary']").length === 0) return; // we don't have any campaign data
if ($("#avtt-character-join-button").length > 0) return; // we already injected a button

const desktopPosition = $(".ct-character-sheet-desktop > .ct-character-header-desktop > .ct-character-header-desktop__group--gap");
Expand Down
2 changes: 1 addition & 1 deletion CoreFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ async function harvest_game_id() {
}

if (is_characters_page()) {
const campaignSummaryButton = $(".ddbc-campaign-summary");
const campaignSummaryButton = $(".ddbc-campaign-summary, [class*='styles_campaignSummary']");
if (campaignSummaryButton.length > 0) {
if ($(".ct-campaign-pane__name-link").length === 0) {
campaignSummaryButton.click(); // campaign sidebar is closed. open it
Expand Down
8 changes: 4 additions & 4 deletions Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ function change_sidbar_tab(clickedTab, isCharacterSheetInfo = false) {
// This only happens when `is_character_page() == true` and the user clicked the gamelog tab.
// This is an important distinction, because we switch to the gamelog tab when the user clicks info on their character sheet that causes details to be displayed instead of the gamelog.
// Since the user clicked the tab, we need to show the gamelog instead of any detail info that was previously shown.
let gameLogButton = $("div.ct-character-header__group--game-log.ct-character-header__group--game-log-last")
let gameLogButton = $("div.ct-character-header__group--game-log.ct-character-header__group--game-log-last, [data-original-title='Game Log'] button")
if(gameLogButton.length == 0){
gameLogButton = $(`[d='M243.9 7.7c-12.4-7-27.6-6.9-39.9 .3L19.8 115.6C7.5 122.8 0 135.9 0 150.1V366.6c0 14.5 7.8 27.8 20.5 34.9l184 103c12.1 6.8 26.9 6.8 39.1 0l184-103c12.6-7.1 20.5-20.4 20.5-34.9V146.8c0-14.4-7.7-27.7-20.3-34.8L243.9 7.7zM71.8 140.8L224.2 51.7l152 86.2L223.8 228.2l-152-87.4zM48 182.4l152 87.4V447.1L48 361.9V182.4zM248 447.1V269.7l152-90.1V361.9L248 447.1z']`).closest('[role="button"]'); // this is a fall back to look for the gamelog svg icon and look for it's button.
}
Expand Down Expand Up @@ -1182,7 +1182,7 @@ function init_controls() {
$(".sidebar").css("height", "calc(100vh - 24px)");

$(".ct-sidebar__inner button[aria-label='Unlocked']").click(); // Click on the padlock icon // This is safe to call multiple times
let gameLogButton = $("div.ct-character-header__group--game-log.ct-character-header__group--game-log-last")
let gameLogButton = $("div.ct-character-header__group--game-log.ct-character-header__group--game-log-last, [data-original-title='Game Log'] button")
if(gameLogButton.length == 0){
gameLogButton = $(`[d='M243.9 7.7c-12.4-7-27.6-6.9-39.9 .3L19.8 115.6C7.5 122.8 0 135.9 0 150.1V366.6c0 14.5 7.8 27.8 20.5 34.9l184 103c12.1 6.8 26.9 6.8 39.1 0l184-103c12.6-7.1 20.5-20.4 20.5-34.9V146.8c0-14.4-7.7-27.7-20.3-34.8L243.9 7.7zM71.8 140.8L224.2 51.7l152 86.2L223.8 228.2l-152-87.4zM48 182.4l152 87.4V447.1L48 361.9V182.4zM248 447.1V269.7l152-90.1V361.9L248 447.1z']`).closest('[role="button"]'); // this is a fall back to look for the gamelog svg icon and look for it's button.
}
Expand Down Expand Up @@ -1994,7 +1994,7 @@ function init_character_page_sidebar() {
}

// Open the gamelog, and lock it open
let gameLogButton = $("div.ct-character-header__group--game-log.ct-character-header__group--game-log-last")
let gameLogButton = $("div.ct-character-header__group--game-log.ct-character-header__group--game-log-last, [data-original-title='Game Log'] button")
if(gameLogButton.length == 0){
gameLogButton = $(`[d='M243.9 7.7c-12.4-7-27.6-6.9-39.9 .3L19.8 115.6C7.5 122.8 0 135.9 0 150.1V366.6c0 14.5 7.8 27.8 20.5 34.9l184 103c12.1 6.8 26.9 6.8 39.1 0l184-103c12.6-7.1 20.5-20.4 20.5-34.9V146.8c0-14.4-7.7-27.7-20.3-34.8L243.9 7.7zM71.8 140.8L224.2 51.7l152 86.2L223.8 228.2l-152-87.4zM48 182.4l152 87.4V447.1L48 361.9V182.4zM248 447.1V269.7l152-90.1V361.9L248 447.1z']`).closest('[role="button"]'); // this is a fall back to look for the gamelog svg icon and look for it's button.
}
Expand Down Expand Up @@ -2076,7 +2076,7 @@ function init_character_page_sidebar() {
* Any time they do that, we need to react to those changes.
*/
function monitor_character_sidebar_changes() {
let gameLogButton = $("div.ct-character-header__group--game-log.ct-character-header__group--game-log-last")
let gameLogButton = $("div.ct-character-header__group--game-log.ct-character-header__group--game-log-last, [data-original-title='Game Log'] button")
if(gameLogButton.length == 0){
gameLogButton = $(`[d='M243.9 7.7c-12.4-7-27.6-6.9-39.9 .3L19.8 115.6C7.5 122.8 0 135.9 0 150.1V366.6c0 14.5 7.8 27.8 20.5 34.9l184 103c12.1 6.8 26.9 6.8 39.1 0l184-103c12.6-7.1 20.5-20.4 20.5-34.9V146.8c0-14.4-7.7-27.7-20.3-34.8L243.9 7.7zM71.8 140.8L224.2 51.7l152 86.2L223.8 228.2l-152-87.4zM48 182.4l152 87.4V447.1L48 361.9V182.4zM248 447.1V269.7l152-90.1V361.9L248 447.1z']`).closest('[role="button"]'); // this is a fall back to look for the gamelog svg icon and look for it's button.
}
Expand Down
2 changes: 1 addition & 1 deletion Startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ async function lock_character_gamelog_open() {
}

// Open the gamelog, and lock it open
let gameLogButton = $("[data-original-title='Game Log'] button");
let gameLogButton = $("div.ct-character-header__group--game-log.ct-character-header__group--game-log-last, [data-original-title='Game Log'] button");
if(gameLogButton.length == 0){
$(`[d='M243.9 7.7c-12.4-7-27.6-6.9-39.9 .3L19.8 115.6C7.5 122.8 0 135.9 0 150.1V366.6c0 14.5 7.8 27.8 20.5 34.9l184 103c12.1 6.8 26.9 6.8 39.1 0l184-103c12.6-7.1 20.5-20.4 20.5-34.9V146.8c0-14.4-7.7-27.7-20.3-34.8L243.9 7.7zM71.8 140.8L224.2 51.7l152 86.2L223.8 228.2l-152-87.4zM48 182.4l152 87.4V447.1L48 361.9V182.4zM248 447.1V269.7l152-90.1V361.9L248 447.1z']`).closest('[role="button"]'); // this is a fall back to look for the gamelog svg icon and look for it's button.
}
Expand Down

0 comments on commit 51d6e5e

Please sign in to comment.