ClarusDignus

wp_attempt_focus()

Jul 12th, 2014
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2. /*wp_attempt_focus()*/
  3. function wp_attempt_focus(){
  4. setTimeout( function(){ try{
  5. <?php if ( $user_login || $interim_login ) { ?>
  6. d = document.getElementById('user_pass');
  7. d.value = '';
  8. <?php } else { ?>
  9. d = document.getElementById('user_login');
  10. <?php if ( 'invalid_username' == $errors->get_error_code() ) { ?>
  11. if( d.value != '' )
  12. d.value = '';
  13. <?php
  14. }
  15. }?>
  16. d.focus();
  17. d.select();
  18. } catch(e){}
  19. }, 200);
  20. }
  21.  
  22. <?php if ( !$error ) { ?>
  23. wp_attempt_focus();
  24. <?php } ?>
  25. if(typeof wpOnload=='function')wpOnload();
  26. <?php if ( $interim_login ) { ?>
  27. (function(){
  28. try {
  29.     var i, links = document.getElementsByTagName('a');
  30.     for ( i in links ) {
  31.         if ( links[i].href )
  32.             links[i].target = '_blank';
  33.     }
  34. } catch(e){}
  35. }());
  36. <?php } ?>
  37. </script>
Advertisement
Add Comment
Please, Sign In to add comment