mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-13 01:20:54 +00:00
4.76.0
* Added: Setting to control the priority of third-party emote providers. This lets you, as an example, prioritize emotes from 7TV over BetterTTV. Note that these priorities are still secondary to emote source priorities (personal emotes > channel emotes > global emotes). (Closes #1587) * Added: Setting to replace the native player 'Clip' button with a custom button that better fits the style of the other buttons. (Closes #1580) * Fixed: Highlighting messages from users with open viewer cards not working correctly with alternating background colors enabled. (Closes #1581) * Fixed: Various directory features not working correctly. (Closes #1588) * Fixed: Emotes unlocked with channel points appearing on FFZ emote cards with the source 'CHANNEL_POINTS'. * Fixed: The Experiments UI failing to load correctly if an experiment has no name. * Experiments: Preparing for a new PubSub experiment. * API Added: `emotes.setProvider(provider: string, data: {name: string, icon: string, description: string})` for registering an emote provider. This is used by the new setting to let users customize emote provider priorities. * API Added: All modules now have a `addon_manifest` property which will contain the add-on's manifest if the module belongs to an add-on.
This commit is contained in:
parent
6f8c20640f
commit
1d046fca2b
22 changed files with 622 additions and 894 deletions
|
@ -27,18 +27,67 @@
|
|||
type: 'ffz_injecting'
|
||||
});
|
||||
|
||||
// Set up the extension message bridge.
|
||||
window.addEventListener('message', evt => {
|
||||
if (evt.source !== window)
|
||||
// Set up a bridge for connections, since Firefox
|
||||
// doesn't support externally_connectable.
|
||||
const connections = new Map;
|
||||
|
||||
function handleConnect(id) {
|
||||
if ( connections.has(id) )
|
||||
return;
|
||||
|
||||
if (evt.data && evt.data.type === 'ffz_to_ext')
|
||||
browser.runtime.sendMessage(evt.data.data, resp => {
|
||||
if (resp?.type === 'ffz_to_page')
|
||||
window.postMessage(resp.data, '*');
|
||||
const port = browser.runtime.connect();
|
||||
connections.set(id, port);
|
||||
|
||||
port.onMessage.addListener(msg => {
|
||||
window.postMessage({
|
||||
type: 'ffz-con-message',
|
||||
id,
|
||||
payload: msg
|
||||
})
|
||||
});
|
||||
|
||||
port.onDisconnect.addListener(() => {
|
||||
connections.delete(id);
|
||||
window.postMessage({
|
||||
type: 'ffz-con-disconnect',
|
||||
id
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function handleDisconnect(id) {
|
||||
const port = connections.get(id);
|
||||
if ( port ) {
|
||||
connections.delete(id);
|
||||
port.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
function handleMessage(id, payload) {
|
||||
const port = connection.get(id);
|
||||
if ( port ) {
|
||||
port.postMessage(payload);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('message', evt => {
|
||||
if (evt.source !== window || ! evt.data )
|
||||
return;
|
||||
|
||||
const { type, id, payload } = evt.data;
|
||||
|
||||
if ( type === 'ffz-con-connect' )
|
||||
handleConnect(id);
|
||||
|
||||
else if ( type === 'ffz-con-message' )
|
||||
handleMessage(id, payload);
|
||||
|
||||
else if ( type === 'ffz-con-disconnect' )
|
||||
handleDisconnect(id);
|
||||
});
|
||||
|
||||
|
||||
// Let the extension send messages to the page directly.
|
||||
browser.runtime.onMessage.addListener((msg, sender) => {
|
||||
if (msg?.type === 'ffz_to_page')
|
||||
window.postMessage(msg.data, '*');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue