Skip to content

Commit

Permalink
Merge pull request cyruzzo#2364 from Azmoria/Add-temporary-message-fu…
Browse files Browse the repository at this point in the history
…nction;-Add-message-when-damage/heal-button-is-clicked-when-no-non-player-token-is-selected

Add temporary message function; Add message when damage/heal button is clicked when no non-player token is selected
  • Loading branch information
Azmoria authored Aug 7, 2024
2 parents 6bf4bf6 + b13f3dd commit 3eb9994
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CoreFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,15 @@ function add_issues_to_error_message(issues, errorMessage) {
}
}

function showTempMessage(messageString){
$('.abovevttTempMessage').remove();
let messageBox = $(`<div class='abovevttTempMessage'>${messageString}</div>`);
$('body').append(messageBox);
setTimeout(function(){
messageBox.fadeOut(1000, function() { $(this).remove(); });
}, 1000);

}
/** The string "THE DM" has been used in a lot of places.
* This prevents typos or case sensitivity in strings.
* @return {String} "THE DM" */
Expand Down
4 changes: 4 additions & 0 deletions MessageBroker.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ class MessageBroker {
else if(clicked.hasClass('heal')){
damage = -1*damage;
}
if($(`.tokenselected:not([data-id*='profile'])`).length == 0){
showTempMessage('No non-player tokens selected');
}

for(let i in window.CURRENTLY_SELECTED_TOKENS){

let id = window.CURRENTLY_SELECTED_TOKENS[i];
Expand Down
23 changes: 23 additions & 0 deletions abovevtt.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@ button#startScreenShare{
border: 0px;
border-radius: 5px;
}
.abovevttTempMessage{
display:block;
position:fixed;
width:400px;
bottom:10%;
left:50%;
font-size:20px;
transform: translateX(-50%);
pointer-events:none;
color:#fff;
text-shadow: 1px 1px 0px #000,
-1px -1px 0px #000,
-1px 1px 0px #000,
1px -1px 0px #000,
0px -1px 0px #000,
1px 0px 0px #000,
0px 1px 0px #000,
-1px 0px 0px #000;
z-index:10000000000;
text-align:center;
text-transform: uppercase;
font-weight:bold;
}
.percentageLoaded{
height: 10px;
position: absolute;
Expand Down

0 comments on commit 3eb9994

Please sign in to comment.