Main class of the Brazen framework
This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.sleazyfork.org/scripts/416105/1847198/Brazen%20Framework%20-%20Framework.js
| Dependency | Required |
|---|---|
| BrazenUtilities.js | yes |
| BrazenViewLayer.js | yes |
| BrazenConfigurationManager.js | yes |
| BrazenItemAttributeResolver.js | yes (except legacy apps like xnxx) |
| BrazenPaginator.js | optional |
| BrazenSubscriptionsLoader.js | optional |
| jQuery | yes |
Load position: The core module — loads last among the framework modules, before the application script.
| Grants | none (apps may grant GM_addStyle, GM_download) |
Class: BrazenFramework (abstract — applications extend it)
Constants:
CLASS_COMPLIANT_ITEM, CLASS_NON_COMPLIANT_ITEMCONFIG_PAGINATOR_LIMIT ('Pagination Limit'), CONFIG_PAGINATOR_THRESHOLD ('Pagination Threshold')FILTER_DURATION_RANGE, FILTER_PERCENTAGE_RATING_RANGE, FILTER_SUBSCRIBED_VIDEOS, FILTER_TAG_BLACKLIST, FILTER_TEXT_BLACKLIST, FILTER_TEXT_SEARCH, FILTER_TEXT_SANITIZATION, FILTER_TEXT_WHITELIST, FILTER_UNRATEDOPTION_ENABLE_TEXT_BLACKLIST, OPTION_ENABLE_TAG_BLACKLIST, OPTION_ALWAYS_SHOW_SETTINGS_PANE, OPTION_DISABLE_COMPLIANCE_VALIDATIONITEM_NAME, ITEM_PROCESSED_ONCESTORE_SUBSCRIPTIONS ('Account Subscriptions')ICON_RECYCLEConstructor config keys: scriptPrefix, itemListSelectors, itemSelectors, itemNameSelector, itemLinkSelector, itemDeepAnalysisSelector, itemSelectionMethod, itemWrapperResolver, tagSelectorGenerator, isUserLoggedIn, requestDelay, downloadsDelay, doItemCompliance, trackComplianceRules
Filter helpers: _addItemBlacklistFilter, _addItemWhitelistFilter, _addItemTextSearchFilter, _addItemTextSanitizationFilter, _addItemTagBlacklistFilter, _addItemDurationRangeFilter, _addItemPercentageRatingRangeFilter, _addItemTagHighlights, _addSubscriptionsFilter, _addItemComplianceFilter, _addItemComplexComplianceFilter
Lifecycle — init() order (only if _onValidateInit() is truthy):
configurationManager.initialize() (loads localStorage, sets up cross-tab sync).processedOnce attribute, and name attribute only if itemNameSelector !== ''.paginator.initialize() if a paginator was set up._onBeforeUIBuild queue._disableUI: builds the panel (createSettingsSection().append(this._userInterface)), embeds it, runs _onAfterUIBuild, then updateInterface()._validateCompliance(true) — first compliance run._onAfterInitialization queue.Compliance pipeline:
_validateCompliance(firstRun) — on the first run, attaches a ChildObserver to each itemListSelectors node so items appended later (infinite scroll, AJAX) are complied automatically (fromObserver); integrates the paginator if present. Re-runs reset statistics first._complyItemsList(list, fromObserver) — selects items (children or find per itemSelectionMethod), fades them to opacity:0.75; on each item's first hit: sanitizes the name node (if enabled), resolves attributes, runs _onFirstHitBeforeCompliance; then _complyItem; then _onFirstHitAfterCompliance (once) and marks processedOnce. Ends with statistics.updateUI() + _onAfterComplianceRun._complyItem(item) — skips when doItemCompliance returns false or OPTION_DISABLE_COMPLIANCE_VALIDATION is on; runs the whitelist gate (_validateItemWhiteList), then _onBeforeCompliance, then walks _complianceFilters (validate → comply), short-circuiting on first failure, recording each result; comply callbacks may return {complies, rule?} when trackComplianceRules is enabled; finally shows/hides the item and clears opacity._getComplianceRuleReport() / _showComplianceRulesModal() — opt-in per-rule hide diagnostics (requires trackComplianceRules: true). Modal lists only rules that hid items on the current pass, grouped by filter. Override _canRemoveComplianceRule(filterKey, ruleLabel) / _removeComplianceRule(filterKey, ruleLabel) to show a Remove button per row (rule34xxx uses this for exact tag-blacklist lines).Behaviours provided automatically (don't re-implement):
_onItemShow/_onItemHide add/remove CLASS_COMPLIANT_ITEM/CLASS_NON_COMPLIANT_ITEM (via itemWrapperResolver) and show/hide. Override only for special wrapping (see ehentai's td.gl2e)._addItemComplianceFilter(key, action=null) — when action is omitted/an attribute-name string, the comply logic is derived from the config field type: checkboxes→includes, flag→boolean, radios→equality, range→Validator.isInRange; text/ruleset require an explicit callback. The enable check defaults to generateValidationCallback(key) (flag/radios/select→truthy, checkboxes/ruleset/text→length, number→>0, range→min>0||max>0)._statistics.record(key, complies) increments only when an item fails, and totals feed createStatisticsFormGroup(key) labels._addDownload truncates the folder to 120 chars, replaces illegal ‹›:"/\|?* chars with -, and uses GM_download with conflictAction:'uniquify'.Hooks: _onValidateInit, _onBeforeUIBuild, _onAfterUIBuild, _onAfterInitialization, _onFirstHitBeforeCompliance, _onBeforeCompliance, _onFirstHitAfterCompliance, _onAfterComplianceRun, _onItemHide (single fn), _onItemShow (queue), _canRemoveComplianceRule, _removeComplianceRule. (_onUIBuild, _onGetItemLists, _onGetItemName referenced by older apps.)
Optional setup: _setupPaginator(), _setupSubscriptionLoader(), download queue via _addDownload / GM_download
Shared framework for site search filters, settings UI, compliance hiding, statistics, and cross-tab config sync.