Commit e82dca54 authored by Govind Malu's avatar Govind Malu Committed by William Ranvaud
Browse files

Issue #3179794 by govind.maloo: Message repeating if ajax enabled page

parent 88f71006
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -4,14 +4,19 @@

  Drupal.behaviors.conditional_message = {
    attach: function (context, settings) {

      if (context !== document || settings.conditional_message === undefined) {
        return;
      }

      // Shorthand for the configurations.
      var config = Drupal.settings.conditional_message;
      var config = settings.conditional_message;
      // Build AJAX URL.
      var endpoint;
      if (config.server) {
        endpoint = location.protocol + '//' + config.server + '/conditional_message_data_output';
      } else {
        endpoint = Drupal.settings.basePath + 'conditional_message_data_output';
        endpoint = settings.basePath + 'conditional_message_data_output';
      }
      // AJAX loads
      $.ajax({
@@ -61,9 +66,9 @@
              check.path = true;
              var treatedPaths = response.paths.map(function (p) {
                if(p !== '<front>') {
                  return Drupal.settings.basePath + p;
                  return settings.basePath + p;
                } else {
                  return Drupal.settings.basePath;
                  return settings.basePath;
                }
              });
              if (treatedPaths.indexOf(window.location.pathname) < 0) {