Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ <h4>Character Sheet Dice Roller</h4>
</div>
</label>
</li>
<li class="list-group-item">
<label class="list-content" for="optionCopyForForum">
<h4>Copy Button in Dice Roller</h4>
<p>Currently Beta, only supports, Abilities, Saving Throws and Skills</p>
<div class="material-switch pull-right">
<input id="optionCopyForForum" name="optionCopyForForum" type="checkbox"/>
<label for="optionCopyForForum" class="label-default"></label>
</div>
</label>
</li>
<li class="list-group-item">
<label class="list-content" for="optionCharacterSheetSkillSorter">
<h4>Character Sheet Skill Sorter</h4>
Expand Down
3 changes: 3 additions & 0 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function save_settings() {
CharacterSheetSkillSorter:document.getElementById('optionCharacterSheetSkillSorter').checked,
CharacterSheetCustomThemeColor: document.getElementById('optionCharacterSheetCustomThemeColor').checked,
DiceRoller: document.getElementById('optionDiceRoller').checked,
CopyForForums: document.getElementById('optionCopyForForum').checked,
AsyncDiceRoller: document.getElementById('optionAsyncDiceRoller').checked,
Notes: document.getElementById('optionNotes').checked,
InitiativeTracker: document.getElementById('optionInitiativeTracker').checked,
Expand Down Expand Up @@ -85,6 +86,7 @@ function restore_settings() {
CharacterSheetSkillSorter: true,
CharacterSheetCustomThemeColor: true,
DiceRoller: true,
CopyForForums: true,
AsyncDiceRoller: true,
Notes: true,
InitiativeTracker: true,
Expand All @@ -104,6 +106,7 @@ function restore_settings() {
document.getElementById('optionGitHubToken').value = items.settings.GitHubToken;
document.getElementById('optionGitHubGistID').value = items.settings.GistID;
document.getElementById('optionCharacterSheetDiceRoller').checked = items.settings.CharacterSheetDiceRoller;
document.getElementById('optionCopyForForum').checked = items.settings.CopyForForums;
document.getElementById('optionCharacterSheetSkillSorter').checked = items.settings.CharacterSheetSkillSorter;
document.getElementById('optionCharacterSheetCustomThemeColor').checked = items.settings.CharacterSheetCustomThemeColor;
document.getElementById('optionDiceRoller').checked = items.settings.DiceRoller;
Expand Down
26 changes: 24 additions & 2 deletions scripts/toolbox.asyncdiceroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,36 @@
var dice = $(this).text().replace(/ /g,''),
title = 'Dice Roller';

$.modal(_this.roll(dice, title), title, [{
var buttons = [];
var roll = {
label: "Reroll",
className: '',
callback: function() {
$('.tb-modal .fullscreen-modal-content').html(_this.roll(dice, title));
return false;
}
},{ label: "Cancel" }]);
};
var copy = { label: "Copy",
className: '',
callback: function() {

navigator.clipboard.writeText("[roll]{0}[/roll]".format(dice)).then(
function() {
$('.tb-modal .fullscreen-modal-content').append('Copied to clipboard!');
},
function(err) {
$('.tb-modal .fullscreen-modal-content').append("Could not copy text.");
});

return false;
}
};
var cancel = { label: "Cancel" };
buttons.push(roll);
if(Toolbox.settings.options.CopyForForums && navigator.clipboard) buttons.push(copy);
buttons.push(cancel);

$.modal(_this.roll(dice, title), title, buttons);

$('.tb-modal').addClass('tb-modal-small');
});
Expand Down
1 change: 1 addition & 0 deletions scripts/toolbox.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
CharacterSheetSkillSorter: true,
CharacterSheetCustomThemeColor: true,
DiceRoller: true,
CopyForForums: true,
AsyncDiceRoller: true,
Notes: true,
InitiativeTracker: true,
Expand Down