Skip to content

Commit

Permalink
Update to v11
Browse files Browse the repository at this point in the history
  • Loading branch information
teroparvinen committed Jul 10, 2023
1 parent 66859b8 commit 55e52f2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion lang/en.json
Expand Up @@ -2,6 +2,6 @@
"scene-helpers": {
"setting-doubleclick": "Double click a scene in the navigation bar",
"setting-doubleclick-notes": "Open scene notes",
"setting-doubleclick-config": "Open scene onfiguration"
"setting-doubleclick-config": "Open scene configuration"
}
}
8 changes: 4 additions & 4 deletions module.json
Expand Up @@ -4,13 +4,13 @@
"description": "Small improvements to scene controls.",
"authors": [
{
"name": "Tero Parvinen (Whistler#3253)"
"name": "Tero Parvinen (tero.p)"
}
],
"version": "10.0",
"version": "11.0",
"compatibility": {
"minimum": 10,
"verified": 10
"minimum": 11,
"verified": 11
},
"relationships": {
"requires": [
Expand Down
47 changes: 24 additions & 23 deletions module/scene-helpers.js
Expand Up @@ -14,36 +14,37 @@ Hooks.on("init", () => {
});

Hooks.on("setup", () => {
libWrapper.register("scene-helpers", "SidebarDirectory.prototype._onClickDocumentName", onClickDocumentName, "MIXED");
libWrapper.register("scene-helpers", "SceneDirectory.prototype.activateListeners", onSceneDirectoryListeners, "MIXED");
libWrapper.register("scene-helpers", "SceneNavigation.prototype._onClickScene", onClickScene, "MIXED");
});

function onClickDocumentName(wrapped, event) {
const element = event.currentTarget;
const documentId = element.parentElement.dataset.documentId;
const document = this.constructor.collection.get(documentId);

if (document.documentName == "Scene" && document.testUserPermission(game.user, "LIMITED")) {
if ((event.ctrlKey || event.metaKey) && !event.altKey) {
document.activate();
} else if (!(event.ctrlKey || event.metaKey) && event.altKey) {
if (game.user.isGM) {
const sheet = document.sheet;
if (sheet.rendered) {
sheet.maximize();
sheet.bringToTop();
function onSceneDirectoryListeners(wrapped, html) {
html.find(".document.scene")
.click((event) => {
const element = event.currentTarget;
const documentId = element.dataset.documentId;
const document = this.constructor.collection.get(documentId);

if (document.testUserPermission(game.user, "LIMITED")) {
if ((event.ctrlKey || event.metaKey) && !event.altKey) {
document.activate();
} else if (!(event.ctrlKey || event.metaKey) && event.altKey) {
if (game.user.isGM) {
const sheet = document.sheet;
if (sheet.rendered) {
sheet.maximize();
sheet.bringToTop();
} else {
sheet.render(true);
}
}
} else {
sheet.render(true);
document.view();
}
}
} else {
document.view();
}
});

return true;
} else {
return wrapped(event);
}
wrapped(html);
}

function togglePin(event) {
Expand Down

0 comments on commit 55e52f2

Please sign in to comment.