[ Index ]

PHP Cross Reference of MyBB 1.8.37

title

Body

[close]

/admin/jscripts/ -> search.js (source)

   1  var SettingSearch = {
   2  
   3      error_unknown : "",
   4      
   5      init: function(settings_search, error_unknown)
   6      {
   7          this.error_unknown = error_unknown;
   8          
   9          $('#settings_search').on("submit", this.onSubmit);
  10          $('#search_results').css('display', 'none');
  11          
  12          $('#search').focusin(function() {
  13              if($('#search').val() == settings_search)
  14              {
  15                  $('#search').removeClass('search_default');
  16                  $('#search').val('');
  17              }
  18          });
  19          
  20          $('#search').focusout(function() {
  21              if($('#search').val() == "")
  22              {
  23                  $('#search').addClass('search_default');
  24                  $('#search').val(settings_search);
  25                  $("#search_results").css('display', "none");
  26                  $("#group_list").css('display', "");
  27              }
  28          });
  29      },
  30  
  31      onSubmit: function(e)
  32      {
  33          e.preventDefault();
  34          if($('#search').val() != "")
  35          {
  36              $.jGrowl(lang.searching, {theme:'jgrowl_process'});
  37              pars = "module=config-settings&action=change&ajax_search=1&search="+encodeURIComponent($('#search').val());
  38              $.ajax({
  39                  type: 'get',
  40                  url: "index.php",
  41                  data: pars,
  42                  complete: function (request, status)
  43                  {
  44                      try
  45                      {
  46                          var json = JSON.parse(request.responseText);
  47                          if(typeof json == 'object')
  48                          {
  49                              if(json.hasOwnProperty("errors"))
  50                              {
  51                                  $("div.jGrowl").jGrowl("close");
  52  
  53                                  $.each(json.errors, function(i, message)
  54                                  {
  55                                      $.jGrowl(lang.search_error + ' ' + message, {theme:'jgrowl_error'});
  56                                  });
  57                                  return false;
  58                              }
  59                          }
  60                      }
  61                      catch(error)
  62                      {
  63                          $('#search_results').css('display', '');
  64                          $('#group_list').css('display', 'none');
  65                          $('#search_results').html(request.responseText);
  66                          $.jGrowl(lang.search_done, {theme:'jgrowl_success'});
  67                          return false;
  68                      }
  69                  }
  70              });
  71          }
  72      },
  73  };


2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref