WordPress.org

Make WordPress Core

Changeset 12817 for trunk/wp-login.php


Ignore:
Timestamp:
01/24/2010 06:16:17 AM (12 years ago)
Author:
markjaquith
Message:

Shake the JS weight away!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-login.php

    r12815 r12817  
    4646    add_action( 'login_head', 'noindex' );
    4747
    48     // Print scripts
    49     add_action( 'login_head', 'wp_print_scripts' );
    50 
    5148    if ( empty($wp_error) )
    5249        $wp_error = new WP_Error();
     
    5653    $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );
    5754
    58     if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) ) {
    59         wp_enqueue_script( 'jquery-ui-effects' );
     55    if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
    6056        add_action( 'login_head', 'wp_shake_js', 12 );
    61     }
    6257
    6358    ?>
     
    121116    }
    122117} // End of login_header()
    123 
    124118function wp_shake_js() {
    125119?>
    126120<script type="text/javascript">
    127 jQuery( document ).ready(function(){
    128     jQuery( '#h1' ).focus();
    129     jQuery( '#loginform, #registerform, #lostpasswordform' ).effect('shake', {times: 3}, 40, function(){try{wp_attempt_focus();} catch(e){}});
    130 });
     121addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
     122function s(id,pos){g(id).left=pos+'px';}
     123function g(id){return document.getElementById(id).style;}
     124function shake(id,a,d){c=a.shift();s(id,c);if(a.length>0){setTimeout(function(){shake(id,a,d);},d);}else{try{wp_attempt_focus();}catch(e){}}}
     125addLoadEvent(function(){ var p=new Array(15,30,15,0,-15,-30,-15,0);p=p.concat(p.concat(p));var i=document.forms[0].id;g(i).position='relative';shake(i,p,20);});
    131126</script>
    132127<?php
     
    411406<script type="text/javascript">
    412407try{document.getElementById('user_login').focus();}catch(e){}
     408if(typeof wpOnload=='function')wpOnload();
    413409</script>
    414410</body>
     
    486482<script type="text/javascript">
    487483try{document.getElementById('user_login').focus();}catch(e){}
     484if(typeof wpOnload=='function')wpOnload();
    488485</script>
    489486</body>
     
    629626wp_attempt_focus();
    630627<?php } ?>
     628if(typeof wpOnload=='function')wpOnload();
    631629</script>
    632630</body>
Note: See TracChangeset for help on using the changeset viewer.