1(($,Drupal, drupalSettings, once) => { 2 Drupal.behaviors.svg_theme_components_contentpass = { 3 attach: function attach(context) { 4 once('contentpass_js', 'body', context).forEach(() => { 5 6 !function() { 7 var cpBaseUrl = 'https://cp.' + drupalSettings.svg_theme_components_cp_didomi.host; 8 var cpController = cpBaseUrl + '/now.js'; 9 var cpPropertyId = drupalSettings.svg_theme_components_cp_didomi.didomi_property_id; 10 11 !function(C,o,n,t,e,P,a,s){C.CPObject=n,C[n]||(C[n]=function(){ 12 for(var i=arguments.length,c=new Array(i),r=0;r<i;r++)c[r]=arguments[r];var f=c[0],u=c[1],l=c[2];if(C[n].q||(C[n].q=[]), 13 e=Array.prototype.slice.call(arguments,0),!C[n].patched)if("fatal"===f&&u)C[n].le=u, 14 Array.prototype.forEach.call(C[n].q,(function(e){"error"===e[0]&&"function"==typeof e[1]&&e[1](u) 15 }));else if("error"===f&&"function"==typeof u)C[n].le&&u(C[n].le);else if("extension"===f&&u)l&&"function"==typeof l.init&&(l.init(), 16 l.initialized=!0);else if("authenticate"===f&&"function"==typeof u){try{ 17 P=-1===(o.cookie||"").indexOf("_cpauthhint=")&&!(C.localStorage||{})._cpuser&&-1===C.location.href.toLowerCase().indexOf("cpauthenticated") 18 }catch(e){P=!1}if(P){a={isLoggedIn:function(){return!1},hasValidSubscription:function(){return!1}} 19 ;var p=u,d=!1,h=function(e,i){d||(d=!0,p(e,i))};if(e[1]=h,"function"==typeof o.hasPrivateToken)try{ 20 o.hasPrivateToken(t||"https://my.contentpass.net").then((function(e){e||h(null,a)})).catch((function(){})) 21 }catch(e){}else h(null,a)}}C[n].q.push(e)});try{ 22 ((s=(o.cookie.split("_cpauthhint=")[1]||"").split(";")[0])?Number(s[1]):NaN)>0&&(o.body?o.body.classList.add("cpauthenticated"):o.addEventListener("DOMContentLoaded",(function(){ 23 o.body.classList.add("cpauthenticated")})))}catch(e){}C[n].l=+new Date,C[n].sv=6}(window,document,"cp"); 24
25 // Will activate Contentpass and initialize basic interfaces for 26 // communicating with Contentpass 27 cp('create', cpPropertyId, { 28 baseUrl: cpBaseUrl 29 }); 30 31 // Will render the layer provided by contentpass. 32 // If user gives full consent, the onFullConsent callback is fired. 33 // If user is logged into contentpass and has a valid subscription for the 34 // current website, no layer is displayed. 35 // Use the cp('authenticate') function below to react on further details 36 // regarding contentpass users. 37 cp('render', { 38 onFullConsent: function() { 39 console.log('[CP] onFullConsent'); 40 // load advertising 41 } 42 }); 43 44 // Will evaluate the user's login state regarding contentpass and whether 45 // user has a valid subscription. 46 // This call is optional as cp('render') above is also checking for the 47 // contentpass subscription state. 48 // Use this function for example to update your layout for contentpass users. 49 // We also provide CSS-based and cookie-based options for this case. 50 cp('authenticate', function (error, user) { 51 if (error) { 52 // Error handling depending on use case 53 return; 54 } 55 56 if (user.isLoggedIn() && user.hasValidSubscription()) { 57 // User has valid subscription 58 } else { 59 // User has no valid subscription 60 } 61 }); 62 }() 63 64 65 66 }); 67 } 68 }; 69}) (jQuery, Drupal, drupalSettings, once);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.