Content-Blocker
JavaScript types
ContentBlockerItem
ContentBlockerItem {
description: string;
hosts: string[];
id: string;
javaScriptGlobal: string;
javaScriptInitialization: string;
name: string;
providerId: string;
serviceId: string | null;
}
Content blocker information based on Content-Blocker-ID
window.BorlabsCookie.ContentBlocker.findByContentBlockerId(contentBlockerId: string): ContentBlockerItem | null
Dialog
Reopen dialog
There is no JavaScript API function to reopen the dialog.
Alternatively, the CSS class borlabs-cookie-open-dialog-preferences
can be used. This class can be assigned to any HTML element. Once this is done, Borlabs Cookie will register a click event for that element.
<span class="borlabs-cookie-open-dialog-preferences" data-borlabs-cookie-title="Lorem ipsum" ></span>
Consents
Provide consent for service
window.BorlabsCookie.Consents.addConsent(serviceId: string, serviceGroupId: string): boolean
Check consent for service
window.BorlabsCookie.Consents.hasConsent(serviceId: string, serviceGroupId?: string): boolean
Check consent for service group
window.BorlabsCookie.Consents.hasConsentForServiceGroup(serviceGroupId: string): boolean
Events
borlabs-cookie-after-init
The event is triggered after Borlabs Cookie has initialized all essential components. It occurs before a decision is made as to whether the dialog should be displayed or whether opt-in code should be executed or blocked code should be released.
window.addEventListener('borlabs-cookie-after-init', () => {});
borlabs-cookie-consent-saved
The event is triggered after a change has been made to the consents and the cookie has been reset. It is triggered before blocked codes are unblocked.
window.addEventListener('borlabs-cookie-consent-saved', () => {});
borlabs-cookie-handle-unblock
The event is triggered when blocked codes are unblocked.
window.addEventListener('borlabs-cookie-handle-unblock', () => {});
The borlabs-cookie-consent-saved
event also executes the unlocking routines that borlabs-cookie-handle-unblock
triggers.
The unlocking routines include the following functions, whereby the sequence of the functions mentioned corresponds to the actual execution sequence:
window.BorlabsCookie.Unblock.unblockServiceOptInCode();
window.BorlabsCookie.Unblock.unblockInlineCode('service-group');
window.BorlabsCookie.Unblock.unblockInlineCode('service');
window.BorlabsCookie.Unblock.unblockByContentBlockerServiceConsents();
Logs
Chronological logs
window.BorlabsCookie.Log.logsChronical
Logs by log level
window.BorlabsCookie.Log.logs
Providers
JavaScript types
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 information based on Content-Blocker-ID
window.BorlabsCookie.Providers.findByContentBlockerId(contentBlockerId: string): ProviderItem | null
Provider information based on IAB-TCF-Vendor-ID
window.BorlabsCookie.Providers.findByIabVendorId(iabVendorId: number): ProviderItem | null
Provider information based on Provider-ID
window.BorlabsCookie.Providers.findByProviderId(providerId: string): ProviderItem | null
Provider information based on Service-ID
window.BorlabsCookie.Providers.findByServiceId(serviceId: string): ProviderItem
Script-Blocker
Unblock by Script-Blocker-ID
window.BorlabsCookie.Unblock.unblockScriptBlockerId(scriptBlockerId: string): boolean
Services
JavaScript types
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 information based on Provider-ID
window.BorlabsCookie.Services.findByProviderId(providerId: string): ServiceList
Service information based on Service-ID
window.BorlabsCookie.Services.findByServiceId(serviceId: string): ServiceItem
Service information based on Service-Group-ID
window.BorlabsCookie.Services.findByServiceGroupId(serviceGroupId: string): ServiceList
Service Groups
JavaScript types
ServiceGroupItem
ServiceGroupItem {
description: string;
id: string;
name: string;
preSelected: boolean;
serviceIds: string[];
}
Service group information based on Service-Group-ID
window.BorlabsCookie.ServiceGroups.findByServiceGroupId(serviceGroupId: string): ServiceGroupItem
Style-Blocker
Unblock by Style-Blocker-ID
window.BorlabsCookie.Unblock.unblockStyleBlockerId(styleBlockerId: string): void
Tools
cloneObject
Clones an object in JavaScript without references.
window.BorlabsCookie.Tools.cloneObject(obj: any): any
inArray
JavaScript equivalent to PHP's in_array() method.
window.BorlabsCookie.Tools.inArray(needle: number | string, haystack: Array<number | string>)
onExist
This method is used to execute code that depends on external JavaScript that is loaded with a delay when unlocking. To avoid errors (race condition problem), there is this helper function that checks if the given obj
exists before executing the code that is passed as a function.
window.BorlabsCookie.Tools.onExist(obj: any, callback: Function): void