Content-Blocker
JavaScript-Typen
ContentBlockerItem
ContentBlockerItem {
description: string;
hosts: string[];
id: string;
javaScriptGlobal: string;
javaScriptInitialization: string;
name: string;
providerId: string;
serviceId: string | null;
}Content-Blocker-Informationen anhand der Content-Blocker-ID
window.BorlabsCookie.ContentBlocker.findByContentBlockerId(contentBlockerId: string): ContentBlockerItem | nullDialog
Dialog erneut aufrufen
Es gibt keine JavaScript-API-Funktion, um den Dialog erneut zu öffnen.
Als Alternative kann die CSS-Klasse borlabs-cookie-open-dialog-preferences verwendet werden. Diese Klasse kann jedem beliebigen HTML-Element zugewiesen werden. Sobald dies geschieht, registriert Borlabs Cookie ein Klick-Event für dieses Element.
<span class="borlabs-cookie-open-dialog-preferences" data-borlabs-cookie-title="Lorem ipsum" ></span>Einwilligungen
Einwilligung für Service geben
window.BorlabsCookie.Consents.addConsent(serviceId: string, serviceGroupId: string): booleanEinwilligung für Service prüfen
window.BorlabsCookie.Consents.hasConsent(serviceId: string, serviceGroupId?: string): booleanEinwilligung für Service-Gruppe prüfen
window.BorlabsCookie.Consents.hasConsentForServiceGroup(serviceGroupId: string): booleanEvents
borlabs-cookie-after-init
Das Event wird ausgelöst, nachdem Borlabs Cookie alle wesentlichen Komponenten initialisiert hat. Es erfolgt noch bevor entschieden wird, ob der Dialog angezeigt werden soll, oder ob Opt-in-Code ausgeführt bzw. blockierter Code freigegeben werden soll.
window.addEventListener('borlabs-cookie-after-init', () => {});borlabs-cookie-before-content-unblocked[{key}]
Das Event wird ausgeführt, bevor ein Content-Blocker entsperrt wird. Es enthält in detail den initiator, der entweder den Wert unblock-button oder accept-service-button besitzt. Ab Borlabs Cookie Version 3.4.
window.addEventListener('borlabs-cookie-before-content-unblocked[youtube-content-blocker]', function (e) {
console.log(`The clicked button (initiator) was: ${e.detail.initiator}`);
});borlabs-cookie-consent-saved
Das Event wird ausgelöst, nachdem eine Änderung an den Einwilligungen vorgenommen und das Cookie neu gesetzt wurde. Es wird vor der Entsperrung von blockierten Codes ausgelöst.
window.addEventListener('borlabs-cookie-consent-saved', () => {});borlabs-cookie-content-unblocked[{key}]
Das Event wird ausgeführt, nachdem ein Content-Blocker entsperrt wurde. In target befindet sich das entsperrte Element. Ab Borlabs Cookie Version 3.4.
window.addEventListener('borlabs-cookie-content-unblocked[youtube-content-blocker]', function (e) {
console.log("The content was unblocked", e.target);
});borlabs-cookie-dialog-closing
Das Event wird ausgelöst, kurz bevor der Dialog geschlossen wird. Ab Borlabs Cookie Version 3.4.
window.addEventListener('borlabs-cookie-dialog-closing', () => {});borlabs-cookie-dialog-opening
Das Event wird ausgelöst, kurz bevor der Dialog geöffnet wird. Ab Borlabs Cookie Version 3.4.
window.addEventListener('borlabs-cookie-dialog-opening', () => {});borlabs-cookie-handle-unblock
Das Event wird ausgelöst, wenn die Entsperrung von blockierten Codes erfolgt.
window.addEventListener('borlabs-cookie-handle-unblock', () => {});Das Event borlabs-cookie-consent-saved führt ebenfalls die Entsperrroutinen aus, die borlabs-cookie-handle-unblock auslöst.
Die Entsperrroutinen umfassen folgende Funktionen, wobei die Reihenfolge der genannten Funktionen der tatsächlichen Ausführungsreihenfolge entspricht:
window.BorlabsCookie.Unblock.unblockServiceOptInCode();
window.BorlabsCookie.Unblock.unblockInlineCode('service-group');
window.BorlabsCookie.Unblock.unblockInlineCode('service');
window.BorlabsCookie.Unblock.unblockByContentBlockerServiceConsents();Logs
Logs chronologisch
window.BorlabsCookie.Log.logsChronicalLogs nach Log-Level
window.BorlabsCookie.Log.logsProviders
JavaScript-Typen
ProviderItem
ProviderItem {
address: string;
contentBlockerIds: string[];
cookieUrl: string;
description: string;
iabVendorId: number | null;
id: string;
name: string;
optOutUrl: string;
partners: string;
privacyUrl: string;
serviceIds: string[];
}Provider-Informationen anhand der Content-Blocker-ID
window.BorlabsCookie.Providers.findByContentBlockerId(contentBlockerId: string): ProviderItem | nullProvider-Informationen anhand der IAB-TCF-Vendor-ID
window.BorlabsCookie.Providers.findByIabVendorId(iabVendorId: number): ProviderItem | nullProvider-Informationen anhand der Provider-ID
window.BorlabsCookie.Providers.findByProviderId(providerId: string): ProviderItem | nullProvider-Informationen anhand der Service-ID
window.BorlabsCookie.Providers.findByServiceId(serviceId: string): ProviderItemScript-Blocker
Entsperren via Script-Blocker-ID
window.BorlabsCookie.Unblock.unblockScriptBlockerId(scriptBlockerId: string): booleanServices
JavaScript-Typen
ServiceCookie
ServiceCookie {
description: string;
hostname: string;
lifetime: string;
name: string;
purpose: string;
type: string;
}ServiceItem
ServiceItem {
cookies: ServiceCookie[];
description: string;
hosts: ServiceHost[];
id: string;
name: string;
optInCode: string;
optOutCode: string;
options: ServiceOption[];
providerId: string;
serviceGroupId: string;
settings: Record<string, string>;
}ServiceList
ServiceList = Record<string, ServiceItem>ServiceOption
ServiceOption {
name: string;
type: string;
}Service-Informationen anhand der Provider-ID
window.BorlabsCookie.Services.findByProviderId(providerId: string): ServiceListService-Informationen anhand der Service-ID
window.BorlabsCookie.Services.findByServiceId(serviceId: string): ServiceItemService-Informationen anhand der Service-Gruppen-ID
window.BorlabsCookie.Services.findByServiceGroupId(serviceGroupId: string): ServiceListService-Gruppen
JavaScript-Typen
ServiceGroupItem
ServiceGroupItem {
description: string;
id: string;
name: string;
preSelected: boolean;
serviceIds: string[];
}Service-Gruppen-Informationen anhand der Service-Gruppen-ID
window.BorlabsCookie.ServiceGroups.findByServiceGroupId(serviceGroupId: string): ServiceGroupItemStyle-Blocker
Entsperren via Style-Blocker-ID
window.BorlabsCookie.Unblock.unblockStyleBlockerId(styleBlockerId: string): voidTools
cloneObject
Klont ein Objekt in JavaScript ohne Referenzen .
window.BorlabsCookie.Tools.cloneObject(obj: any): anyinArray
JavaScript-Äquivalent zu PHPs in_array()-Methode.
window.BorlabsCookie.Tools.inArray(needle: number | string, haystack: Array<number | string>)onExist
Die Methode dient dazu, Code auszuführen, der abhängig von externem JavaScript ist, das bei der Entsperrung verzögert geladen wird. Damit es nicht zu Fehlern kommt (Race Condition Problem), gibt es diese Hilfsfunktion, die prüft, ob das gegebene obj vorhanden ist, bevor es den Code ausführt, der in Form einer Funktion übergeben wird.
window.BorlabsCookie.Tools.onExist(obj: any, callback: Function): void