Sleazy Fork is available in English.
Main class of the Brazen framework
ეს სკრიპტი არ უნდა იყოს პირდაპირ დაინსტალირებული. ეს ბიბლიოთეკაა, სხვა სკრიპტებისთვის უნდა ჩართეთ მეტა-დირექტივაში // @require https://update.sleazyfork.org/scripts/416105/1847282/Brazen%20Framework%20-%20Framework.js.
Extend BrazenFramework to build a site userscript. The core owns init order, compliance hiding, filter registration, download queueing, and shared constants.
Greasy Fork: this script · Changelog: append the Changelog section from the matching changelog file when publishing · Sibling modules: see Utilities, View Layer, Configuration Manager, Item Attributes Resolver, optional Paginator / Subscriptions Loader.
Pass a single object to super({ ... }):
| Key | Purpose |
|---|---|
scriptPrefix |
Prefix for localStorage keys and default ledger storage key |
itemListSelectors |
jQuery selector(s) for lists observed for new tiles |
itemSelectors |
Tile selector inside each list |
itemNameSelector |
Title node for text filters; '' disables built-in name attribute |
itemLinkSelector |
Link used by Item Attributes Resolver for deep fetch |
itemDeepAnalysisSelector |
Root on detail page for deep attributes |
itemSelectionMethod |
'children' or 'find' — how tiles are collected |
itemWrapperResolver |
(item) => wrapper for show/hide and CSS classes |
tagSelectorGenerator |
Builds tag selectors for highlight filters |
requestDelay |
Throttle between deep attribute fetches (ms) |
downloadsDelay |
Pause between GM_download queue items (ms) |
doItemCompliance |
(item) => boolean — skip compliance for some tiles |
trackComplianceRules |
true enables per-rule hide diagnostics modal |
downloadDuplicateLedger |
Optional duplicate skip (v7.2.0+); see below |
init() runs only when _onValidateInit() is truthy (return false to skip entirely, e.g. small popup windows).
configurationManager.initialize()
→ register built-in item attributes
→ paginator.initialize() (if configured)
→ _onBeforeUIBuild[]
→ build #bv-ui (unless _disableUI)
→ _onAfterUIBuild[]
→ _validateCompliance(firstRun) + ChildObserver on lists
→ _onAfterInitialization[]
Hook arrays (push callbacks in the subclass constructor):
| Hook | Typical use |
|---|---|
_onValidateInit |
Abort init on wrong page or window size |
_onBeforeUIBuild |
Register filters, page-specific GM_addStyle, auto-download |
_onAfterUIBuild |
Patch DOM, attach userScript to panel, custom widgets |
_onAfterInitialization |
Late wiring after first compliance pass |
_onFirstHitBeforeCompliance |
Inject tags/attributes before filters run |
_onBeforeCompliance |
Per-item pre-filter |
_onFirstHitAfterCompliance |
Once per tile after first compliance |
_onAfterComplianceRun |
After a full list pass |
_onItemShow / _onItemHide |
Default adds compliance classes; override for special layout (e.g. table rows where the tile is nested inside <td>) |
Detect page type in your app (URL/DOM flags), then push hooks in the constructor before init().
The framework hides non-compliant tiles and records statistics (counts = items removed).
Register filters in the constructor:
this._addItemTagBlacklistFilter(ITEM_TAGS, /* ... */)
this._addItemComplianceFilter('My Flag', 'myAttribute') // derived from field type
this._addItemComplexComplianceFilter(key, validateFn, complyFn)
OPTION_DISABLE_COMPLIANCE_VALIDATION — master bypass (Disable All Filters).trackComplianceRules: true — enables _showComplianceRulesModal(); override _canRemoveComplianceRule / _removeComplianceRule for removable rows.Do not re-implement default show/hide unless the site wraps tiles unusually.
Requires @grant GM_download on the application script.
this._addDownload(mediaElement, folder, filename, removeMediaOnSuccess?)
downloadsDelay.removeMediaOnSuccess on pictures: captures URL from src, removes element immediately.Override _handleDownloadFailed / _handleDuplicateDownloadSkipped for site UX.
Optional constructor block for “already queued this save” without scanning disk:
downloadDuplicateLedger: {
storageKey: 'myapp-download-registry',
primaryField: 'postIds', // or 'paths', etc.
legacyIdFields: ['mediaKeys'], // migration merge on load
isValidId: (value) => /^\d+$/.test(String(value).trim()),
getDownloadId: (item) => QUERY_PARAMS.get('id') || null,
}
Also requires @grant GM_getValue and @grant GM_setValue.
| Behaviour | Detail |
|---|---|
| Enable flag | Skip Duplicate Downloads (OPTION_ENABLE_DOWNLOAD_DUPLICATE_LEDGER), registered automatically; default on |
| User tooltip | OPTION_ENABLE_DOWNLOAD_DUPLICATE_LEDGER_HELP — ledger remembers script storage, not disk |
| When on | _wrapDownloadTask skips before GM_download; conflictAction: 'overwrite' if file exists but ledger missed |
| When off | Normal downloads; stored ids kept; conflictAction: 'uniquify' (legacy) |
| UI | Mount createElement(OPTION_ENABLE_DOWNLOAD_DUPLICATE_LEDGER) on your downloads tab |
| Overrides | _getDownloadDuplicateLedgerId, _handleDuplicateDownloadSkipped, _handleDownloadFailed |
Never use uniquify as the primary duplicate strategy for ledger apps — duplicates should be skipped in the ledger, not renamed on disk.
Typical id strategies: numeric post id from the URL; full resolved save path (folder/filename); or another stable string your app can derive at enqueue time.
this._setupPaginator(() => IS_SEARCH_PAGE, { /* BrazenPaginator config */ })
this._setupSubscriptionLoader() // then configure loader in _onBeforeUIBuild
See Paginator, Subscriptions Loader.
Build this._userInterface as an array of nodes from this._uiGen (a BrazenViewLayer instance):
this._userInterface = [
this._uiGen.createTabsSection(['Filters', 'Downloads'], [
this._uiGen.createTabPanel('Filters', true).append([
this._configurationManager.createElement(FILTER_TAG_BLACKLIST),
]),
// ...
]),
]
Bottom section: statistics groups, page buttons, Apply/Save/Reset via _createSettingsFormActions().
Panel details: View Layer developer section on that listing.
When you ship a new framework version on Greasy Fork:
@version in the script header and publish.@require URLs if needed.Publish framework modules before apps that depend on new APIs.