Jump to content
Дизайн и модификация IPS Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Strategius

Окно входа без перезагрузки

Recommended Posts

Огромное спасибо, заработало!

Можете выложить полностью рабочий код? :)

Share this post


Link to post
Share on other sites
Можете выложить полностью рабочий код?

Добавить в шаблон inlineLogin после </form>

 

<script>
$$('#inline_login_form #login')[0].observe('submit', function(e){
   e.preventDefault();
   var form = this;
   var params = document.location.search.toQueryParams();
   new Ajax.Request(form.action, {
       method: 'post',
       parameters: this.serialize(true),
        onFailure: function( t )
       {
            if(params['module'] == 'global' && ['register', 'login'].indexOf(params['section']) != -1){
                       window.location = ipb.vars['board_url']+'/';
                   }
                   else{
                       window.location.reload();
                   }  
       },
       onSuccess: function(r) {
           var div = document.createElement('div');
           div.innerHTML = r.responseText;
           var script = div.select('script:contains("member_id")')[0];
           if(script){
               var toEval = script.innerHTML.replace('Loader.boot();', '');
               eval(toEval);
               if(ipb.vars['member_id']){
                   if(params['module'] == 'global' && ['register', 'login'].indexOf(params['section']) != -1){
                       window.location = ipb.vars['board_url']+'/';
                   }
                   else{
                       window.location.reload();
                   }
               }
               else{
                   var error = form.select('p.error.message')[0];
                   if(!error){
                       form.select('div.ipsForm fieldset')[0].insert({
                           before: '<p class="error message" style="margin-bottom:10px;"></p>'
                       });
                       error = form.select('p.error.message')[0];
                   }
                   var p = div.select('p.error.message')[0];
                   error.innerHTML = p ? p.innerHTML : 'Authentication error';
               }
           }
           else{
               window.location.href = form.action;
           }
       }
   });
   return false;
});
</script>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...