Classes 1
Player_MediaclanbiteLets a player choose which part of their avatar and cover image is shown, and go back to the defaults.
Components 5
avatarclanbiteA player, team or group avatar with its shape, XP ring and rank badge.clipboardclanbiteclanbite.clipboard.copy( text ): copies text, with a fallback for browsers without the clipboard API.popupsclanbiteclanbite.popups.announce() / allowOpen(): the hooks clanbite.popup.toggled and clanbite.popup.shouldOpen for every popup.timeclanbiteRelative wording such as "5 minutes ago", filterable in one place (clanbite_human_time_ago).toastsclanbiteThe shared popup system: clanbite.toasts.show() in the browser.
Functions 14
clanbite_avatar_resolve_context()clanbiteComplete an avatar's arguments with who is looking and where it is shown.clanbite_component_missing_requirements()clanbiteRequired components that are not available for a component (an empty array when it is fine).clanbite_components_debug_information()clanbiteList the registered components in Tools → Site Health → Info, so support can see which extension provides what.clanbite_components_state()clanbiteWhere the registry keeps its state (one array for the request).clanbite_enqueue_component()clanbiteLoad a component's scripts and styles (and those of the components it requires).clanbite_get_component()clanbiteOne component definition.clanbite_get_components()clanbiteAll registered components (collects the registrations once, from init on, when every extension has added its hook).clanbite_has_component()clanbiteWhether a component can be used right now: registered, and every component it requires is available too.clanbite_human_time_ago()clanbiteA timestamp as relative wording ("5 minutes ago"), the same everywhere Clanbite shows one.clanbite_notifications_compact_html()clanbiteRemove the line breaks between tags in notification markup.clanbite_players_get_display_cover_zoom()clanbiteReturns how far the player zoomed into their cover image (1 shows the whole cover, up to 4).clanbite_register_component()clanbiteRegister a component: a piece of UI or behaviour (an avatar, reaction chips, an @mention picker) other extensions can use.clanbite_register_core_components()clanbiteRegister Clanbite core's own components.clanbite_render_component()clanbiteRender a component. Returns an empty string when it (or something it requires) is not available.
Hooks 16
clanbite_avatar_argsclanbiteFilters an avatar's arguments before it is built, in both render modes.clanbite_component_argsclanbiteFilters the arguments a component renders with, for every component.clanbite_component_args_{slug}clanbiteThis filter is documented in inc/components.php (clanbite_component_args).clanbite_component_availableclanbiteFilters whether a component is considered available (for example to switch one off for a site setting).clanbite_component_htmlclanbiteFilters a component's HTML, for every component.clanbite_componentsclanbiteFilters the registered components, for example to remove or swap one site-wide.clanbite_human_time_agoclanbiteFilters relative time wording shown by Clanbite and its extensions.clanbite_player_avatar_removedclanbiteFires after a player removed their avatar (the default avatar is shown again).clanbite_player_cover_removedclanbiteFires after a player removed their cover image (the default cover is shown again).clanbite_player_media_editor_configclanbiteFilters the data the avatar and cover editor popup works with (image addresses, positions, defaults and wording).clanbite_player_settings_success_dataclanbiteFilters the data sent back after player settings were saved (the page uses it to refresh previews).clanbite_players_get_display_cover_zoomclanbiteFilters the zoom of a player's cover image.clanbite_register_componentsclanbiteFires once when components are collected: call clanbite_register_component() here.clanbite.components.registeredclanbiteFires when a component registers its browser API.clanbite.playerMedia.dialogclanbiteFires when the avatar or cover popup opens, so add-ons can add their own controls to it.clanbite.playerMedia.maxZoomclanbiteFilters the largest zoom the avatar and cover editor offers.
Methods 13
Player_Media::add_success_data()clanbiteState of the media editor after a save, so the page can update its previews.Player_Media::bake_avatar()clanbiteCut the chosen square out of the original avatar and make it the avatar.Player_Media::clamp_focal()clanbiteClamp a focal coordinate to 0..1.Player_Media::clamp_zoom()clanbiteClamp a zoom to 1..MAX_ZOOM.Player_Media::crop_square()clanbiteThe square, in source pixels, that is shown for a focal point and zoom.Player_Media::editor_state()clanbiteEverything the position editor needs to know about a player's images.Player_Media::register_meta()clanbiteRegister the user meta this class stores.Player_Media::register_new_avatar_source()clanbiteCalled by the Players extension right after a new avatar file was stored: it is the original, so keep it and reset the position.Player_Media::register()clanbiteRegister hooks.Player_Media::remove_avatar()clanbiteRemove the player's avatar (original and cut-out) and go back to the default.Player_Media::remove_cover()clanbiteRemove the player's cover image and its position, and go back to the default.Player_Media::save_media_settings()clanbiteSave handler: remove flags, avatar position, cover zoom.Player_Media::version_avatar_url()clanbiteAdd the avatar's attachment ID to its address as ver, so a browser or cache never shows a previous cut-out of the same picture.