size 418230 |
@ -0,0 +1,36 @@ | |||
# Ownership Viewer | |||
(Formerly known as 'Permission Viewer') | |||
![](https://img.shields.io/badge/Maintainer-Malekal-green) | |||
[![](https://img.shields.io/badge/-Discord-blue)](https://discord.gg/Ee2cmeRsN3) | |||
![](https://img.shields.io/badge/Foundry-v10-informational) | |||
![GitHub Latest Version](https://img.shields.io/github/v/release/Malekal4699/fvtt-module-permission-viewer?sort=semver) | |||
![Forge Installs](https://img.shields.io/badge/dynamic/json?label=Forge%20Installs&query=package.installs&suffix=%25&url=https%3A%2F%2Fforge-vtt.com%2Fapi%2Fbazaar%2Fpackage%2Fpermission_viewer&colorB=4aa94a) | |||
![Latest Release Download Count](https://img.shields.io/github/downloads/Malekal4699/fvtt-module-permission-viewer/latest/module.zip) | |||
This Foundry VTT module displays colored diamonds/squares/circles to represent the players who have limited/observer/owner ownership of Documents (Actors, Journals, Items, Cards, Macros, etc..). | |||
It makes it very easy to see at a glance which journal, actor, item, etc. is shared with your players. The shapes are : | |||
* Diamond : Limited ownership | |||
* Square : Observer ownership | |||
* Circle : Full ownership | |||
The color of the dots represents the color of the player. In the case of a default ownership set for `All Players`, the shape will have the Blue/Yellow/Green/Red colors. | |||
![screenshot](./images/new_permissions_viewer.png) | |||
![screenshot](./images/player-list.png) | |||
# Known Issues | |||
Module compatibility issues: | |||
* smol-foundry: resizing Scenes to smaller values will cause PV icons to be offset. | |||
# Changelog | |||
`https://github.com/League-of-Foundry-Developers/fvtt-module-permission-viewer/CHANGELOG.md` | |||
# License | |||
This Foundry VTT module, writen by KaKaRoTo, is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). | |||
This work is licensed under Foundry Virtual Tabletop [EULA - Limited License Agreement for module development v 0.1.6](http://foundryvtt.com/pages/license.html). |
size 162239 |
size 251382 |
@ -0,0 +1,41 @@ | |||
{ | |||
"id": "permission_viewer", | |||
"title": "Ownership Viewer", | |||
"description": "Quickly see which entities (Journal entries, Actors, etc..) are visible to all players or visible to a specific player.", | |||
"version": "0.10.0", | |||
"library": "false", | |||
"manifestPlusVersion": "1.2.0", | |||
"allowBugReporter": true, | |||
"compatibility": { | |||
"minimum": 10, | |||
"verified": 10 | |||
}, | |||
"authors": [ | |||
{ | |||
"name": "Malekal", | |||
"site": "https://github.com/Malekal4699/fvtt-module-permission-viewer/", | |||
"discord": "Malekal#9985" | |||
}, | |||
{ | |||
"name": "Kakaroto" | |||
}, | |||
{ | |||
"name": "Dor", | |||
"discord": "dor#7514" | |||
} | |||
], | |||
"scripts": [ | |||
"./scripts/ownership_viewer.js" | |||
], | |||
"styles": [ | |||
"./styles/ownership_viewer.css" | |||
], | |||
"url": "https://github.com/Malekal4699/fvtt-module-permission-viewer", | |||
"manifest": "https://github.com/Malekal4699/fvtt-module-permission-viewer/releases/latest/download/module.json", | |||
"download": "https://github.com/Malekal4699/fvtt-module-permission-viewer/releases/download/0.10.0/module.zip", | |||
"bugs": "https://github.com/Malekal4699/fvtt-module-permission-viewer/issues", | |||
"changelog": "https://raw.githubusercontent.com/Malekal4699/fvtt-module-permission-viewer/master/CHANGELOG.md", | |||
"name": "permission_viewer", | |||
"minimumCoreVersion": 10, | |||
"compatibleCoreVersion": 10 | |||
} |
@ -0,0 +1,135 @@ | |||
class OwnershipViewer { | |||
// Creates and applies the OwnershipViewer div to each document in a directory - called when each directory renders. | |||
static directoryRendered(obj, html, data) { | |||
// If user isn't a GM, don't continue | |||
if (!game.user.isGM) return; | |||
// Get the current directory's right-click context options, then tore the ownership config option | |||
const contextOptions = obj._getEntryContextOptions(); | |||
const ownershipOption = contextOptions.find(e => e.name === 'OWNERSHIP.Configure') | |||
// Gather all documents in the current directory | |||
let collection = obj.constructor.collection; | |||
// Interate through each directory list item. | |||
for (let li of html.find("li.directory-item.document")) { | |||
// Match it to the corresponding document | |||
li = $(li) | |||
let document = collection.get(li.attr("data-document-id")) | |||
let users = [] | |||
// Iterate through each ownership definition on the document | |||
for (let id in document.ownership) { | |||
let ownership = document.ownership[id] | |||
// If the ownership definition isn't 'None'... | |||
if (ownership >= CONST.DOCUMENT_OWNERSHIP_LEVELS.LIMITED) { | |||
let bg_color = "transparent" | |||
// And if the ownership definition isn't 'All Players' (default) or a GM, set 'bg_color' to the user's color | |||
if (id != "default") { | |||
const user = game.users.get(id) | |||
if (user) { | |||
if (user.isGM) continue; | |||
bg_color = user.color; | |||
} else { | |||
continue; | |||
} | |||
} | |||
// Create the div for this ownership definition, with the appropriate class based on the ownership level | |||
let user_div = $('<div></div>') | |||
user_div.attr("data-user-id", id) | |||
if (ownership === CONST.DOCUMENT_OWNERSHIP_LEVELS.LIMITED) { | |||
user_div.addClass("ownership-viewer-limited") | |||
} else if (ownership === CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER) { | |||
user_div.addClass("ownership-viewer-observer") | |||
} else if (ownership === CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) { | |||
user_div.addClass("ownership-viewer-owner") | |||
} | |||
if (id == "default") { | |||
user_div.addClass("ownership-viewer-all") | |||
} else { | |||
user_div.addClass("ownership-viewer-user") | |||
} | |||
user_div.css({'background-color': bg_color}) | |||
// Store the resulting div and keep iterating through the other ownership definitions on the document | |||
users.push(user_div) | |||
} | |||
} | |||
let div = $('<div class="ownership-viewer"></div>') | |||
// Append the collection of divs to the document's list item, or add the 'none set' icon if empty | |||
if (ownershipOption) { | |||
if (users.length === 0) | |||
users.push($('<div><i class="fas fa-share-alt" style="color: white;"/></div>')) | |||
let a = $(`<a href="#"></a>`) | |||
div.append(a) | |||
a.append(...users) | |||
} else { | |||
div.append(...users) | |||
} | |||
li.append(div) | |||
} | |||
// Ensure any clicks on the OwnershipViewer div open the ownership config for that document | |||
if (ownershipOption) | |||
html.find(".ownership-viewer").click(event => { | |||
event.preventDefault(); | |||
event.stopPropagation(); | |||
let li = $(event.currentTarget).closest("li") | |||
if (li) | |||
ownershipOption.callback(li) | |||
}) | |||
} | |||
// Update the user color in OwnershipViewer divs if the user is edited | |||
static userUpdated(user) { | |||
for (let user_div of $(".ownership-viewer-user")) { | |||
let id = $(user_div).attr("data-user-id") | |||
if (id == user.id) { | |||
$(user_div).css('background-color', user.color) | |||
} | |||
} | |||
} | |||
// Makes the color assigned to each player clearer in the player list if they are inactive. | |||
static playerListRendered(){ | |||
console.log("Ownership Viewer | Player List"); | |||
let pvUsers = game.users.contents; | |||
let pvIdColor = []; | |||
for (let x of pvUsers){ | |||
let pvMyObject = {}; | |||
pvMyObject.id = x.id; | |||
pvMyObject.color = x.color; | |||
pvIdColor.push(pvMyObject); | |||
} | |||
let pvToReplace = "border: 1px solid #000000"; | |||
let pvReplacee = "border: 1px solid"; | |||
for (let i = 0; i < document.getElementById("player-list").children.length ; i++ ){ | |||
let pvString = document.getElementById("player-list").children[i].innerHTML; | |||
if (pvString.toString().search("inactive") > 0){ | |||
pvString = pvString.replace(pvToReplace, (pvReplacee + pvIdColor[i].color)); | |||
document.getElementById("player-list").children[i].innerHTML = pvString; | |||
} | |||
} | |||
} | |||
} | |||
Hooks.on('renderJournalDirectory', OwnershipViewer.directoryRendered) | |||
Hooks.on('renderSceneDirectory', OwnershipViewer.directoryRendered) | |||
Hooks.on('renderActorDirectory', OwnershipViewer.directoryRendered) | |||
Hooks.on('renderItemDirectory', OwnershipViewer.directoryRendered) | |||
Hooks.on('renderMacroDirectory', OwnershipViewer.directoryRendered) | |||
Hooks.on('renderRollTableDirectory', OwnershipViewer.directoryRendered) | |||
Hooks.on('renderCardsDirectory', OwnershipViewer.directoryRendered) | |||
Hooks.on('updateUser', OwnershipViewer.userUpdated) | |||
Hooks.on('renderPlayerList', OwnershipViewer.playerListRendered) |
@ -0,0 +1,49 @@ | |||
div.ownership-viewer { | |||
max-width: max-content; | |||
margin: auto 5px; | |||
line-height: initial; | |||
display: block ruby; | |||
} | |||
div.ownership-viewer > a { | |||
display:inline-flex; | |||
} | |||
.ownership-viewer-user { | |||
width: 10px; | |||
height: 10px; | |||
margin-left: 2px; | |||
margin-right: 2px; | |||
margin: auto 2px auto 2px; | |||
} | |||
.ownership-viewer-all { | |||
width: 0; | |||
height: 0; | |||
margin: auto 2px auto 2px; | |||
border-bottom: 7px solid red; | |||
border-top: 7px solid green; | |||
border-left: 7px solid yellow; | |||
border-right: 7px solid blue; | |||
} | |||
.ownership-viewer-limited { | |||
-webkit-transform-origin:50% 50%; | |||
-ms-transform-origin:50% 50%; | |||
transform-origin:50% 50%; | |||
-webkit-transform: rotate(45deg); | |||
-ms-transform: rotate(45deg); | |||
transform: rotate(45deg); | |||
} | |||
.ownership-viewer-observer { | |||
border-radius: 0; | |||
} | |||
.ownership-viewer-owner { | |||
border-radius: 50%; | |||
} |
@ -0,0 +1,21 @@ | |||
MIT License | |||
Copyright (c) 2020 Repository Owner | |||
Permission is hereby granted, free of charge, to any person obtaining a copy | |||
of this software and associated documentation files (the "Software"), to deal | |||
in the Software without restriction, including without limitation the rights | |||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
copies of the Software, and to permit persons to whom the Software is | |||
furnished to do so, subject to the following conditions: | |||
The above copyright notice and this permission notice shall be included in all | |||
copies or substantial portions of the Software. | |||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
SOFTWARE. |
@ -0,0 +1,21 @@ | |||
# Subfolder Indent | |||
A simple module that increases the size of the indent to subfolders | |||
## How to Use | |||
Install module, and activate. | |||
Goto configure settings to adjust indentation as desired. | |||
Default is 12 px | |||
## Preview | |||
*Without Module* | |||
![Without module active](/examples/example-off.jpg) | |||
*With Module Active* | |||
![With module active](/examples/example-on.jpg) | |||
*Settings Menu* | |||
![With module active](/examples/settings.jpg) |
size 42413 |
size 44753 |
size 32877 |
@ -0,0 +1,53 @@ | |||
{ | |||
"id": "subfolder-indent", | |||
"title": "Subfolder Indent", | |||
"description": "<p>A simple module that increases the size of the indent of subfolders</p>", | |||
"version": "1.0.7", | |||
"library": "false", | |||
"manifestPlusVersion": "1.2.0", | |||
"compatibility": { | |||
"minimum": 10, | |||
"verified": 11 | |||
}, | |||
"authors": [ | |||
{ | |||
"name": "Mushie", | |||
"discord": "Discord Mushie#6848" | |||
} | |||
], | |||
"media": [ | |||
{ | |||
"type": "cover", | |||
"url": "modules/subfolder-indent/examples/example-on.jpg" | |||
}, | |||
{ | |||
"type": "screenshot", | |||
"url": "modules/subfolder-indent/examples/example-off.jpg" | |||
}, | |||
{ | |||
"type": "screenshot", | |||
"url": "modules/subfolder-indent/examples/settings.jpg" | |||
} | |||
], | |||
"esmodules": [ | |||
"./scripts/settings.js" | |||
], | |||
"styles": [ | |||
"./styles/style.css" | |||
], | |||
"config": { | |||
"subfolder-indent": { | |||
"name": "Indent", | |||
"hint": "Set the amount to index each subfolder in pixels.", | |||
"scope": "world", | |||
"config": true, | |||
"default": 12, | |||
"type": "Number" | |||
} | |||
}, | |||
"url": "https://github.com/Mushie1/subfolder-indent", | |||
"manifest": "https://github.com/Mushie1/subfolder-indent/releases/latest/download/module.json", | |||
"download": "https://github.com/Mushie1/subfolder-indent/releases/download/1.0.7/module.zip", | |||
"license": "LICENSE", | |||
"readme": "README.md" | |||
} |
@ -0,0 +1,18 @@ | |||
Hooks.on('init', () => { | |||
game.settings.register('subfolder-indent', 'indent', { | |||
name: 'Indent', | |||
hint: 'Set the amount to index each subfolder in pixels.', | |||
scope: 'client', | |||
config: true, | |||
default: 12, | |||
type: Number, | |||
onChange: value => { | |||
document.documentElement.style.setProperty('--subfolder-indent', `${value}px`); | |||
} | |||
}); | |||
}); | |||
Hooks.on('ready', () => { | |||
const indent = game.settings.get('subfolder-indent', 'indent'); | |||
document.documentElement.style.setProperty('--subfolder-indent', `${indent}px`); | |||
}); |
@ -0,0 +1,9 @@ | |||
/* the first number changes the width of the indentation | |||
var(--subfolder-indent, 12px) -> is a variable in the modules settings in Foundry VTT, default is 12px*/ | |||
/*The rgba changes the colour of the sub folder - note this will get overwritten if the Folder is edited in game */ | |||
.subdirectory | |||
{ | |||
border-left: var(--subfolder-indent, 12px) solid rgba(255, 255, 255, 0.2); | |||
} |
size 418230 |
size 4075476 |
size 16754 |
size 16475705 |
size 67922 |
size 7819376 |
size 5253830 |
size 53567 |
size 9934 |