Added login shake,
This commit is contained in:
parent
527811a23e
commit
875da07456
2 changed files with 27 additions and 0 deletions
|
@ -25,6 +25,26 @@ class App.Controller extends Spine.Controller
|
|||
|
||||
@delay( a, delay )
|
||||
|
||||
shake: (element) ->
|
||||
|
||||
# this part is from wordpress 3, thanks to open source
|
||||
shakeMe = (element, position, positionEnd) ->
|
||||
positionStart = position.shift()
|
||||
element.css( 'left', positionStart + 'px' )
|
||||
if position.length > 0
|
||||
setTimeout( ->
|
||||
shakeMe( element, position, positionEnd )
|
||||
, positionEnd)
|
||||
else
|
||||
try
|
||||
element.css( 'position', 'static' )
|
||||
catch e
|
||||
|
||||
position = [ 15, 30, 15, 0, -15, -30, -15, 0 ]
|
||||
position = position.concat( position.concat( position ) )
|
||||
element.css( 'position', 'relative' )
|
||||
shakeMe( element, position, 20 )
|
||||
|
||||
isRole: (name) ->
|
||||
roles = @Session.get( 'roles' )
|
||||
return false if !roles
|
||||
|
|
|
@ -52,6 +52,7 @@ class Index extends App.Controller
|
|||
# scroll to top
|
||||
@scrollTo()
|
||||
|
||||
|
||||
login: (e) ->
|
||||
e.preventDefault()
|
||||
@formDisable(e)
|
||||
|
@ -103,4 +104,10 @@ class Index extends App.Controller
|
|||
username: @username
|
||||
)
|
||||
|
||||
# login shake
|
||||
@delay(
|
||||
=> @shake( @el.find('#login') ),
|
||||
1500
|
||||
)
|
||||
|
||||
App.Config.set( 'login', Index, 'Routes' )
|
||||
|
|
Loading…
Reference in a new issue