Brazen Framework - Framework

Main class of the Brazen user scripts framework

09.06.2026 itibariyledir. En son verisyonu görün.

Bu script direkt olarak kurulamaz. Başka scriptler için bir kütüphanedir ve meta yönergeleri içerir // @require https://update.sleazyfork.org/scripts/416105/1847278/Brazen%20Framework%20-%20Framework.js

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

Yazar
brazenvoid
Versiyon
7.2.1
Oluşturulma
14.11.2020
Güncellenme
09.06.2026
Boyut
46 KB
Lisans
GPL-3.0-only

Brazen Framework — Core (developer guide)

Extend BrazenFramework to build a site userscript. The core owns init order, compliance hiding, filter registration, download queueing, and shared constants.

Technical reference: BrazenFramework.spec.md · Patterns: pattern-specs/

Greasy Fork: 416105 · Current version: see @version in BrazenFramework.js.


Constructor config

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

Lifecycle

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. ehentai td.gl2e)

See page-detection-and-lifecycle.spec.md.


Compliance and filters

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 (rule34xxx tag blacklist).

Do not re-implement default show/hide unless the site wraps tiles unusually.

See item-attributes-and-compliance.spec.md.


Downloads

Requires @grant GM_download on the application script.

this._addDownload(mediaElement, folder, filename, removeMediaOnSuccess?)
  • Serial queue with downloadsDelay.
  • Sanitizes path segments; folder truncated to 120 chars.
  • removeMediaOnSuccess on pictures: captures URL from src, removes element immediately (see media-downloads.spec.md).

Override _handleDownloadFailed / _handleDuplicateDownloadSkipped for site UX.


Download duplicate ledger (v7.2.0+)

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.

References: rule34xxx (post id), ehentai (full save path).


Optional modules

this._setupPaginator(() => IS_SEARCH_PAGE, { /* BrazenPaginator config */ })
this._setupSubscriptionLoader()  // then configure loader in _onBeforeUIBuild

See BrazenPaginator.md, BrazenSubscriptionsLoader.md.


UI composition

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().

See ui-panel-composition.spec.md, BrazenViewLayer.md.


Publishing

Framework modules live in the base-scripts/ repo (v1.x). When you add breaking API changes:

  1. Bump the module version and publish to Greasy Fork.
  2. Bump dependent apps and their @require URLs if needed.
  3. Document breaking changes in the module’s .spec.md.

Apps in published-user-scripts/ are separate repos/projects.