(function ($, Drupal) { Drupal.behaviors.geolocationNegotiation = { attach: function (context, settings) { // // Update language if user manually changed the langauge. // $('.language-list a').click(function(){ // localStorage.setItem('language', $(this).parent().data('language')) // }); // // if (drupalSettings.path.isFront && drupalSettings.path.pathPrefix === "") { // if (typeof drupalSettings.nfeComponents !== "undefined" && typeof drupalSettings.nfeComponents.api_url !== "undefined") { // // var langauge = localStorage.getItem('language'); // if (langauge == null) { // $.ajax({ // url: drupalSettings.nfeComponents.api_url + '?microtime=' + $.now() // }).done(function (data) { // // if (data.redirect_url) { // localStorage.setItem('language', data.language); // window.location.replace(data.redirect_url); // } // }); // } else { // if (langauge !== 'en'){ // window.location.replace('/' + langauge); // } // } // } // } } }; })(jQuery, Drupal);