Skip to content

Commit

Permalink
chore: build
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGiddyLimit committed Nov 26, 2023
1 parent e11e78a commit 6c673b6
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 35 deletions.
2 changes: 1 addition & 1 deletion data/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,6 @@
{
"ver": "1.35.7",
"date": "2023-11-26",
"txt": "- Fixed crash/added warning when new UI is enabled (thanks @ Redweller)\n- Fixed polygon tool when new UI is disabled (thanks @ Redweller)"
"txt": "- Fixed crash/added warning when UI Redesign is enabled (thanks @ Redweller)\n- Fixed polygon tool when UI Redesign is disabled (thanks @ Redweller)"
}
]
2 changes: 1 addition & 1 deletion dist/betteR20-5etools.meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name betteR20-5etools
// @namespace https://5e.tools/
// @license MIT (https://opensource.org/licenses/MIT)
// @version 1.35.6
// @version 1.35.7
// @updateURL https://github.com/TheGiddyLimit/betterR20/raw/development/dist/betteR20-5etools.meta.js
// @downloadURL https://github.com/TheGiddyLimit/betterR20/raw/development/dist/betteR20-5etools.user.js
// @description Enhance your Roll20 experience
Expand Down
56 changes: 40 additions & 16 deletions dist/betteR20-5etools.user.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/betteR20-core.meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name betteR20-core
// @namespace https://5e.tools/
// @license MIT (https://opensource.org/licenses/MIT)
// @version 1.35.6
// @version 1.35.7
// @updateURL https://github.com/TheGiddyLimit/betterR20/raw/development/dist/betteR20-core.meta.js
// @downloadURL https://github.com/TheGiddyLimit/betterR20/raw/development/dist/betteR20-core.user.js
// @description Enhance your Roll20 experience
Expand Down
54 changes: 39 additions & 15 deletions dist/betteR20-core.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name betteR20-core
// @namespace https://5e.tools/
// @license MIT (https://opensource.org/licenses/MIT)
// @version 1.35.6
// @version 1.35.7
// @updateURL https://github.com/TheGiddyLimit/betterR20/raw/development/dist/betteR20-core.meta.js
// @downloadURL https://github.com/TheGiddyLimit/betterR20/raw/development/dist/betteR20-core.user.js
// @description Enhance your Roll20 experience
Expand Down Expand Up @@ -227,6 +227,10 @@ function baseUtil () {
} else {
d20plus.ut.showHardDickMessage(scriptName);
}
d20plus.isOptedInNewUI && !isStreamer && d20plus.ut.sendHackerChat(`
betteR20 does not support the new UI preview at this moment!
Using it will make some betteR20 functionality unavailable.
`);
$boringProgress
.before(`<span><span>&gt;</span>all systems operational</span>`)
.html("");
Expand Down Expand Up @@ -11943,6 +11947,9 @@ function d20plusEngine () {
};

d20plus.engine.swapTemplates = () => {
const oldToolbar = document.getElementById("floatingtoolbar");
d20plus.isOptedInNewUI = !oldToolbar;

d20plus.ut.log("Swapping templates...");
$("#tmpl_charactereditor").html($(d20plus.html.characterEditor).html());
$("#tmpl_handouteditor").html($(d20plus.html.handoutEditor).html());
Expand Down Expand Up @@ -12014,21 +12021,25 @@ function d20plusEngine () {
}).addTouch();
}

overwriteDraggables();
$(`#page-toolbar`).css("top", "calc(-90vh + 40px)");

const originalFn = d20.pagetoolbar.refreshPageListing;
// original function is debounced at 100ms, so debounce this at 110ms and hope for the best
const debouncedOverwrite = _.debounce(() => {
if (!d20plus.isOptedInNewUI) {
overwriteDraggables();
// fire an event for other parts of the script to listen for
const pageChangeEvt = new Event(`VePageChange`);
d20plus.ut.log("Firing page-change event");
document.dispatchEvent(pageChangeEvt);
}, 110);
d20.pagetoolbar.refreshPageListing = () => {
originalFn();
debouncedOverwrite();
$(`#page-toolbar`).css("top", "calc(-90vh + 40px)");

const originalFn = d20.pagetoolbar.refreshPageListing;
// original function is debounced at 100ms, so debounce this at 110ms and hope for the best
const debouncedOverwrite = _.debounce(() => {
overwriteDraggables();
// fire an event for other parts of the script to listen for
const pageChangeEvt = new Event(`VePageChange`);
d20plus.ut.log("Firing page-change event");
document.dispatchEvent(pageChangeEvt);
}, 110);
d20.pagetoolbar.refreshPageListing = () => {
originalFn();
debouncedOverwrite();
}
} else {
$(`#page-toolbar`).hide();
}

$(`body`).on("mouseup", "li.dl", (evt) => {
Expand Down Expand Up @@ -12655,6 +12666,18 @@ function d20plusEngine () {
d20.engine.frame_recorder._active = false;
}
};

d20plus.engine.fixPolygonTool = () => {
if (d20plus.isOptedInNewUI) return;
$("#editor-wrapper").on("pointerdown", x => { d20plus.engine.leftClicked = x.which === 1 });
$("#editor-wrapper").on("pointerup", x => { d20plus.engine.leftClicked = false });
d20plus.ut.injectCode(d20.engine, "finishCurrentPolygon", (finishDrawing, params) => {
if (!d20plus.engine.leftClicked) finishDrawing(...params);
});
d20plus.ut.injectCode(d20.engine, "finishPolygonReveal", (finishRevealing, params) => {
if (!d20plus.engine.leftClicked) finishRevealing(...params);
});
};
}

SCRIPT_EXTENSIONS.push(d20plusEngine);
Expand Down Expand Up @@ -22006,6 +22029,7 @@ const betteR20Core = function () {
d20plus.weather.addWeather();
d20plus.engine.repairPrototypeMethods();
d20plus.engine.disableFrameRecorder();
d20plus.engine.fixPolygonTool();
// d20plus.ut.fixSidebarLayout();
d20plus.chat.enhanceChat();

Expand Down
2 changes: 1 addition & 1 deletion dist/betteR20-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.35.6
1.35.7

0 comments on commit 6c673b6

Please sign in to comment.