You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -120,7 +120,7 @@ Arsors.Cookie configuration is segmented into two sections: one for the global s
120
120
### Change Privacy Policy
121
121
There are three different types of privacy policies: `opt-in`, `opt-out` & `info`. All you have to change is the `type` property in `c`.
122
122
```js
123
-
var myCookie =newarsorsCookie({
123
+
var myCookie =newArsorsCookie({
124
124
c : {
125
125
type:'opt-in'
126
126
}
@@ -132,7 +132,7 @@ With dynamic allow the blocked content is displayed without reloading the page c
132
132
133
133
The cookie message itself can also allow content dynamically, but once a cookie is allowed in any way, dynamic loading is disabled for the cookie message. The reason for this is that already loaded JavaScript files cannot be reliably removed. So in this case the page will be reloaded completely. To disable the "allow dynamic loading" function you can use the following code.
134
134
```js
135
-
var myCookie =newarsorsCookie({
135
+
var myCookie =newArsorsCookie({
136
136
c : {
137
137
dynamicAllow:false
138
138
}
@@ -145,7 +145,7 @@ You can adjust the complete HTML markup as you like and work with template varia
145
145
#### Cookie Notice
146
146
Create your custom cookie notice HTML with nested template variables.
myCustomText:'This website uses cookies. Some of these cookies require your explicit consent. Please agree to the use of cookies in order to use all functions of the website. Detailed information on the use of cookies can be found in our {{learnMore}}. Here you can also revoke your consent to the use of cookies.',
@@ -165,7 +165,7 @@ As you can see we start with the required `html` property and insert the content
165
165
When the user accepts or denies the cookies the cookie notice disappears. If you want to provide the possibility to display the cookie notice again, you could use a floating button. You decide how you want to implement it.
166
166
Arsors.Cookie generates a Click EventHandler for the class `btn-toggleCookie` by default. Just add this class to a button anywhere you want **or** add it as template variable and include it to your custom cookie notice HTML. For example:
@@ -182,7 +182,7 @@ If you want to render only a single checkbox you can append the key of the cooki
182
182
### Cookie Lifetime
183
183
You can change the global cookie lifetime with the property `lifetime` in `c`. This property must be set as an integer. The integer will be counted as days.
184
184
```js
185
-
var myCookie =newarsorsCookie({
185
+
var myCookie =newArsorsCookie({
186
186
c : {
187
187
lifetime:365
188
188
}
@@ -192,7 +192,7 @@ var myCookie = new arsorsCookie({
192
192
### Global Error Message
193
193
If you don't set up a custom error message for a custom cookie the default global error message will appear. Here is an example of how you can change it:
194
194
```js
195
-
var myCookie =newarsorsCookie({
195
+
var myCookie =newArsorsCookie({
196
196
c : {
197
197
globalErrorMsg:'<div class="ac_error"><p>You must accept cookies to view this content. <a class="btn-allowCookie-all" href="#">Accept Cookies</a></p></div>'
198
198
}
@@ -209,7 +209,7 @@ If you want a checkbox to allow or deny each cookie then just [activate the chec
209
209
To initialize a new custom cookie just add a new object to the `e` property with the minimum of these three required values: `Class/ID Name` as object key (and as HTML Class or ID for the [custom error message](#custom-error-message)), `title` as the title of the cookie and `cookieName` for the name of the cookie that shall be created.
210
210
Please keep in mind that Arsors.Cookie has already one predefined cookie `.arsorsCookie_main`. The first cookie key **has** to be `.arsorsCookie_main` otherwise you will recieve an error. Of course you can overwrite all properties of the predefined cookie.
211
211
```js
212
-
var myCookie =newarsorsCookie({
212
+
var myCookie =newArsorsCookie({
213
213
e : {
214
214
'.arsorsCookie_main': { // this key is predefined and must exist
215
215
title:"Required",
@@ -230,7 +230,7 @@ var myCookie = new arsorsCookie({
230
230
### Event Handler
231
231
Every custom cookie can have its own Click EventHandler. It can be initialized by the property `btnClasses`. The property will create classes which you have to add to a HTML-Tag (such as button or a). You can also use the href-property, just place a # before the classname. See the examples below. That way you can place the button everywhere you want it in the frontend and enable the user to edit the custom cookie preferences afterwards. To allow or deny all cookies at a time there's a [predefined EventHandler](#predefined-click-eventHandler).
232
232
```js
233
-
var myCookie =newarsorsCookie({
233
+
var myCookie =newArsorsCookie({
234
234
e : {
235
235
'.arsorsCookie_main': { // this key is predefined and must exist
236
236
title:"Required",
@@ -249,7 +249,7 @@ Then you can add the following HTML where you want it:
249
249
### Blocking Scripts
250
250
Each custom cookie can block multiple JavaScript files. Therefore you need to reference these JavaScript files under the property `scripts` as an array. You can also add the same JavaScript file to multiple custom cookies. Arsors.Cookie will handle this and load the specific JavaScript file only once. The order in which you specify the scripts in the array also determines the order in which the scripts are loaded. When you initialize several cookies in a row the scripts will be loaded top to button.
251
251
```js
252
-
var myCookie =newarsorsCookie({
252
+
var myCookie =newArsorsCookie({
253
253
e : {
254
254
'.arsorsCookie_main': { // this key is predefined and must exist
255
255
title:"Required",
@@ -273,7 +273,7 @@ When you want to combine the property `script` and `scripts` it could happen tha
273
273
### Blocking iFrames or any Content
274
274
The key of each custom cookie object needs to initialize as an ID `#name` or as a class `.name`. Then Arsors.Cookie creates for you the specific ID or Class as blocking container. All you have to do is wrap an element with the ID or Class around the content you want to block and change the `src`-Attribute of the iFrames or Images to `data-src` or `data-ac-src`. When the container gets blocked the global error message or the custom cookie error message will appear instead.
275
275
```js
276
-
var myCookie =newarsorsCookie({
276
+
var myCookie =newArsorsCookie({
277
277
e : {
278
278
'.arsorsCookie_main': { // this key is predefined and must exist
279
279
title:"Required",
@@ -294,11 +294,11 @@ var myCookie = new arsorsCookie({
294
294
### Custom Error Message
295
295
When you [block iFrames or any content](#blocking-iframes-or-any-content) you can also show a custom error message. Each custom cookie can be provided with a custom error message. Just add the property `errorMsg`. If you also added the `btnClasses` ([Event Handler](#event-handler)) you can directly provide a link to accept the specific cookie in the custom error message.
296
296
```js
297
-
var myCookie =newarsorsCookie({
297
+
var myCookie =newArsorsCookie({
298
298
e : {
299
299
'.arsorsCookie_main': { // this key is predefined and must exist
errorMsg:'<div class="ac_error"><p>CUSTOM: You must accept cookies to view this content. <a class="btn-allowCookie" href="#">Accept Cookies</a></p></div>'
304
304
}
@@ -310,7 +310,7 @@ If you don't need a custom error message then just set the property `errorMsg` t
310
310
### Required
311
311
Using the [checkbox function](#checkbox-function) each custom cookie can be marked as `required`. Thus the user can't uncheck this one and only gets the two options to accept or deny all cookies.
312
312
```js
313
-
var myCookie =newarsorsCookie({
313
+
var myCookie =newArsorsCookie({
314
314
e : {
315
315
'.arsorsCookie_main': { // this key is predefined and must exist
316
316
title:"Required",
@@ -324,7 +324,7 @@ var myCookie = new arsorsCookie({
324
324
### forceUnchecked
325
325
Using the [checkbox function](#checkbox-function) each custom cookie can forced to be unchecked.
326
326
```js
327
-
var myCookie =newarsorsCookie({
327
+
var myCookie =newArsorsCookie({
328
328
e : {
329
329
'.arsorsCookie_custom': {
330
330
title:"Custom",
@@ -372,8 +372,8 @@ if (lang == "de") {
372
372
};
373
373
}
374
374
375
-
var mergeConfig =arsorsCookie.prototype.merge(true, globalConfig, langConfig);
376
-
var myCookie =newarsorsCookie(mergeConfig);
375
+
var mergeConfig =ArsorsCookie.prototype.merge(true, globalConfig, langConfig);
376
+
var myCookie =newArsorsCookie(mergeConfig);
377
377
```
378
378
**Other possibilities:** For Wordpress, Neos or any other content management system you could also use PHP to generate the JavaScript configuration with the appropriate texts in the desired language. You could also use i18n for the integration of the correct texts or you could write your own JavaScript function which returns the correct text via IDs. Be creative! There are lots of possibilities.
379
379
@@ -396,7 +396,7 @@ This function called `getTypeByCountryCode()` inside and return like `getTypeByC
396
396
```js
397
397
// setCountryCode()
398
398
// IF WE DON'T KNOW THE COUNTRY CODE WE HAVE TO USE A SERVICE
399
-
var locationType =arsorsCookie.prototype.setCountryCode(function() {
399
+
var locationType =ArsorsCookie.prototype.setCountryCode(function() {
400
400
// get content of api
401
401
var xmlhttp =newXMLHttpRequest();
402
402
var url ='http://api.ipinfodb.com/v3/ip-country/?format=json&key=KEY&ip=IP';
@@ -405,15 +405,15 @@ var locationType = arsorsCookie.prototype.setCountryCode(function() {
if (locationType !=false) var myCookie =newarsorsCookie(mergeConfig); // locationType != false prevent loading the cookie notice while searching for the country code by a external service
436
+
if (locationType !=false) var myCookie =newArsorsCookie(mergeConfig); // locationType != false prevent loading the cookie notice while searching for the country code by a external service
437
437
```
438
438
**Tip** Here is a wonderful list of services to get the the country code from IPs: https://stackoverflow.com/questions/391979/how-to-get-clients-ip-address-using-javascript
439
439
@@ -442,7 +442,7 @@ if (locationType != false) var myCookie = new arsorsCookie(mergeConfig); // loca
442
442
### getTypeByCountryCode()
443
443
If you know already the country code of your customer then you can use the `getTypeByCountryCode()` method. The method will return the `type` of the cookie notice behavior. Simply set the country code as parameter and Arsors.Cookie will return you the law of the country code.
444
444
```js
445
-
var locationType =arsorsCookie.prototype.getTypeByCountryCode("DE");
445
+
var locationType =ArsorsCookie.prototype.getTypeByCountryCode("DE");
446
446
```
447
447
**Tip** If Arsors.Cookie didn't reply the correct law of the country code you can customize the law settings by setting the `c.optInArray` and `c.optOutArray`.
448
448
```js
@@ -456,7 +456,7 @@ var locationType = arsorsCookie.prototype.getTypeByCountryCode("DE");
456
456
#### Example
457
457
```js
458
458
// getTypeByCountryCode()
459
-
var locationType =arsorsCookie.prototype.getTypeByCountryCode("DE");
459
+
var locationType =ArsorsCookie.prototype.getTypeByCountryCode("DE");
//if (locationType != false) var myCookie = new arsorsCookie(mergeConfig); // locationType != false prevent loading the cookie notice while searching for the country code by a external service
//if (locationType != false) var myCookie = new ArsorsCookie(mergeConfig); // locationType != false prevent loading the cookie notice while searching for the country code by a external service
0 commit comments