source: main/trunk/greenstone3/web/interfaces/default/cc/cookieconsent-gsinit.js@ 37732

Last change on this file since 37732 was 37732, checked in by davidb, 12 months ago

Updating to newer version, and then also including some changes that were beneficial in helping Safari an a Mac set the 'cc_concent' cookie

File size: 5.5 KB
Line 
1// @ts-nocheck
2
3/**
4 * Initialisation for the cookieconsent.js script, originally based on version 2.7.2.
5 * See https://github.com/orestbida/cookieconsent for customisation options.
6 * The translation strings that are referenced in this document via 'gs.text.ccm.XXX'
7 * can be found in the 'interface_default<_LANG>.properties' files, under 'WEB-INF/classes'.
8 */
9
10//alert("same_site = Strict");
11
12// obtain plugin
13var cc = initCookieConsent();
14
15// run plugin with your configuration
16cc.run({
17 current_lang: 'en',
18 autoclear_cookies: false, // default: false
19 page_scripts: true, // default: false
20 cookie_path: "/" + gs.xsltParams.cookie_path, // default: "/"
21
22 gui_options: {
23 consent_modal: {
24 layout: 'cloud', // box/cloud/bar
25 position: 'bottom left', // bottom/middle/top + left/right/center
26 transition: 'slide', // zoom/slide
27 swap_buttons: false // enable to invert buttons
28 },
29 settings_modal: {
30 layout: 'box', // box/bar
31 // position: 'left', // left/right - only valid with 'bar' layout
32 transition: 'slide' // zoom/slide
33 }
34 },
35
36 // mode: 'opt-in' // default: 'opt-in'; value: 'opt-in' or 'opt-out'
37 // delay: 0, // default: 0
38 // auto_language: null // default: null; could also be 'browser' or 'document'
39 // autorun: true, // default: true
40 // force_consent: false, // default: false
41 // hide_from_bots: false, // default: false
42 // remove_cookie_tables: false // default: false
43 // cookie_name: 'cc_cookie', // default: 'cc_cookie'
44 // cookie_expiration: 182, // default: 182 (days)
45 // cookie_necessary_only_expiration: 182 // default: disabled
46 // cookie_domain: location.hostname, // default: current domain
47 // // cookie_same_site: 'Lax', // default: 'Lax'
48 // cookie_same_site: 'Strict', // consider making 'Strict' if an https site ?!?! (GS3)
49 // use_rfc_cookie: false, // default: false
50 // revision: 0, // default: 0
51
52 onFirstAction: function(user_preferences, cookie){
53 // callback triggered only once
54 },
55
56 onAccept: function (cookie) {
57 // ...
58 },
59
60 onChange: function (cookie, changed_preferences) {
61 // ...
62 },
63
64 languages: {
65 'en': {
66 consent_modal: {
67 title: gs.text.ccm.Popup_Title,
68 description: gs.text.ccm.Popup_Description + ' <button type="button" data-cc="c-settings" class="cc-link">'
69 + gs.text.ccm.Popup_OpenAdvancedManager + '</button>',
70 primary_btn: {
71 text: gs.text.ccm.Popup_AcceptAllCookies,
72 role: 'accept_necessary' // 'accept_selected' or 'accept_all'
73 },
74 // secondary_btn: {
75 // text: gs.text.ccm.Popup_AcceptNecessaryCookies,
76 // role: 'accept_necessary' // 'settings' or 'accept_necessary'
77 // }
78 },
79 settings_modal: {
80 title: gs.text.ccm.Manager_Title,
81 save_settings_btn: gs.text.ccm.Manager_SaveSettingsButton,
82 accept_all_btn: gs.text.ccm.Manager_AcceptAllButton,
83 // reject_all_btn: ccm.Manager_AcceptNecessaryButton,
84 close_btn_label: gs.text.ccm.Manager_CloseButton,
85 cookie_table_headers: [
86 { name: gs.text.ccm.Manager.CookieTableHeaders_Name },
87 { provider: gs.text.ccm.Manager.CookieTableHeaders_Provider },
88 { expiration: gs.text.ccm.Manager.CookieTableHeaders_Expiration },
89 { description: gs.text.ccm.Manager.CookieTableHeaders_Description }
90 ],
91 blocks: [
92 {
93 description: gs.text.ccm.Manager_Description
94 },
95 {
96 title: gs.text.ccm.Manager.RequiredCookies_Title,
97 description: gs.text.ccm.Manager.RequiredCookies_Description,
98 toggle: {
99 value: 'required', // The cookie collection to toggle
100 enabled: true,
101 readonly: true
102 },
103 cookie_table: [
104 {
105 name: 'JSESSIONID',
106 provider: window.location.hostname,
107 expiration: gs.text.ccm.Manager.CookieTable_EndOfSessionExpiration,
108 description: gs.text.ccm.Manager.RequiredCookies.JSESSIONID_Description,
109 },
110 {
111 name: 'supportsXSLT',
112 provider: window.location.hostname,
113 expiration: gs.text.ccm.Manager.CookieTable_EndOfSessionExpiration,
114 description: gs.text.ccm.Manager.RequiredCookies.supportsXSLT_Description
115 }
116 ]
117 }
118 ]
119 }
120 }
121 }
122});
Note: See TracBrowser for help on using the repository browser.