Backup of db before drupal security update
[yaffs-website] / web / core / misc / drupalSettingsLoader.js
1 /**
2  * @file
3  * Parse inline JSON and initialize the drupalSettings global object.
4  */
5
6 (function () {
7
8   'use strict';
9
10   // Use direct child elements to harden against XSS exploits when CSP is on.
11   var settingsElement = document.querySelector('head > script[type="application/json"][data-drupal-selector="drupal-settings-json"], body > script[type="application/json"][data-drupal-selector="drupal-settings-json"]');
12
13   /**
14    * Variable generated by Drupal with all the configuration created from PHP.
15    *
16    * @global
17    *
18    * @type {object}
19    */
20   window.drupalSettings = {};
21
22   if (settingsElement !== null) {
23     window.drupalSettings = JSON.parse(settingsElement.textContent);
24   }
25 })();