File tree 1 file changed +40
-0
lines changed
websites/code/studygolang/static/js 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ // 账号(登录/注册/忘记密码等)相关js功能
2
+ ( function ( ) {
3
+ SG . Register = function ( ) { }
4
+ SG . Register . prototype = new SG . Publisher ( ) ;
5
+
6
+ jQuery ( document ) . ready ( function ( $ ) {
7
+ // 同步提交
8
+ $ ( '.submit' ) . on ( 'click' , function ( evt ) {
9
+ evt . preventDefault ( ) ;
10
+ var $form = $ ( this ) . parents ( '.validate-form' ) ;
11
+ var validator = $form . validate ( ) ;
12
+ if ( ! validator . form ( ) ) {
13
+ return false ;
14
+ }
15
+
16
+ $form . submit ( ) ;
17
+ } ) ;
18
+
19
+ var origSrc = '' ;
20
+ $ ( '#captcha_img' ) . on ( 'click' , function ( evt ) {
21
+ evt . preventDefault ( ) ;
22
+
23
+ if ( origSrc == '' ) {
24
+ origSrc = $ ( this ) . attr ( "src" ) ;
25
+ }
26
+ $ ( this ) . attr ( "src" , origSrc + "?reload=" + ( new Date ( ) ) . getTime ( ) ) ;
27
+ } ) ;
28
+
29
+ // 异步提交
30
+ $ ( '#register-submit' ) . on ( 'click' , function ( evt ) {
31
+ evt . preventDefault ( ) ;
32
+ var validator = $ ( '.validate-form' ) . validate ( ) ;
33
+ if ( ! validator . form ( ) ) {
34
+ return false ;
35
+ }
36
+
37
+ new SG . Register ( ) . publish ( this ) ;
38
+ } ) ;
39
+ } ) ;
40
+ } ) . call ( this )
You can’t perform that action at this time.
0 commit comments