1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-28 23:37:41 +00:00
* Added: `/ffz reload` command to reload emote and badge data without reloading the page. (Note: Add-ons will need to update to add support for the command.)
* Changed: Improve monitor support for Current Monitor, specifically when a user has multiple monitors with the same name.
* Fixed: Track the loaded status of global FFZ badges when loading chat data.
* Fixed: The page scrolling incorrectly when using the FFZ emote menu in some situations.
This commit is contained in:
SirStendec 2023-04-24 15:09:21 -04:00
parent 9381c17e71
commit e6ad12c937
11 changed files with 219 additions and 18 deletions

View file

@ -45,6 +45,52 @@ export function generateUUID(input) {
}
export function sortScreens(screens) {
screens.sort((a,b) => {
if ( a.left < b.left ) return -1;
if ( a.left > b.left ) return 1;
if ( a.top < b.top ) return -1;
if ( a.top > b.top ) return 1;
return 0;
});
return screens;
}
export function matchScreen(screens, options) {
let match = undefined;
let mscore = 0;
for(let i = 0; i < screens.length; i++) {
const mon = screens[i];
if ( mon.label !== options.label )
continue;
let score = 1;
if ( options.left && options.left === mon.left )
score += 15;
if ( options.top && options.top === mon.top )
score += 15;
if ( options.width && options.width === mon.width )
score += 10;
if ( options.height && options.height === mon.height )
score += 10;
if ( options.index )
score -= Math.abs(options.index - i);
if ( score > mscore ) {
match = mon;
mscore = score;
}
}
return match;
}
export function has(object, key) {
return object ? HOP.call(object, key) : false;
}