Show More
@@ -47,14 +47,18 b'' | |||||
47 | ${self.js_extra()} |
|
47 | ${self.js_extra()} | |
48 |
|
48 | |||
49 | <script type="text/javascript"> |
|
49 | <script type="text/javascript"> | |
50 | var base_url = "${h.url('toggle_following')}"; |
|
50 | var follow_base_url = "${h.url('toggle_following')}"; | |
51 | function onSuccess(target){ |
|
51 | var stop_follow_text = "${_('Stop following this repository')}"; | |
|
52 | var start_follow_text = "${_('Start following this repository')}"; | |||
|
53 | ||||
|
54 | ||||
|
55 | var onSuccessFollow = function(target){ | |||
52 | var f = YUD.get(target.id); |
|
56 | var f = YUD.get(target.id); | |
53 | var f_cnt = YUD.get('current_followers_count'); |
|
57 | var f_cnt = YUD.get('current_followers_count'); | |
54 |
|
58 | |||
55 | if(f.getAttribute('class')=='follow'){ |
|
59 | if(f.getAttribute('class')=='follow'){ | |
56 | f.setAttribute('class','following'); |
|
60 | f.setAttribute('class','following'); | |
57 |
f.setAttribute('title', |
|
61 | f.setAttribute('title',stop_follow_text); | |
58 |
|
62 | |||
59 | if(f_cnt){ |
|
63 | if(f_cnt){ | |
60 | var cnt = Number(f_cnt.innerHTML)+1; |
|
64 | var cnt = Number(f_cnt.innerHTML)+1; | |
@@ -63,7 +67,7 b'' | |||||
63 | } |
|
67 | } | |
64 | else{ |
|
68 | else{ | |
65 | f.setAttribute('class','follow'); |
|
69 | f.setAttribute('class','follow'); | |
66 |
f.setAttribute('title', |
|
70 | f.setAttribute('title',start_follow_text); | |
67 | if(f_cnt){ |
|
71 | if(f_cnt){ | |
68 | var cnt = Number(f_cnt.innerHTML)+1; |
|
72 | var cnt = Number(f_cnt.innerHTML)+1; | |
69 | f_cnt.innerHTML = cnt; |
|
73 | f_cnt.innerHTML = cnt; | |
@@ -71,37 +75,41 b'' | |||||
71 | } |
|
75 | } | |
72 | } |
|
76 | } | |
73 |
|
77 | |||
74 |
|
|
78 | var toggleFollowingUser = function(target,fallows_user_id,token,user_id){ | |
75 | args = 'follows_user_id='+fallows_user_id; |
|
79 | args = 'follows_user_id='+fallows_user_id; | |
76 | args+= '&auth_token='+token; |
|
80 | args+= '&auth_token='+token; | |
77 | if(user_id != undefined){ |
|
81 | if(user_id != undefined){ | |
78 | args+="&user_id="+user_id; |
|
82 | args+="&user_id="+user_id; | |
79 | } |
|
83 | } | |
80 | YUC.asyncRequest('POST',base_url,{ |
|
84 | YUC.asyncRequest('POST',follow_base_url,{ | |
81 | success:function(o){ |
|
85 | success:function(o){ | |
82 |
|
|
86 | onSuccessFollow(target); | |
83 | } |
|
87 | } | |
84 | },args); |
|
88 | },args); | |
85 | return false; |
|
89 | return false; | |
86 | } |
|
90 | } | |
87 |
|
91 | |||
88 |
|
|
92 | var toggleFollowingRepo = function(target,fallows_repo_id,token,user_id){ | |
89 |
|
93 | |||
90 | args = 'follows_repo_id='+fallows_repo_id; |
|
94 | args = 'follows_repo_id='+fallows_repo_id; | |
91 | args+= '&auth_token='+token; |
|
95 | args+= '&auth_token='+token; | |
92 | if(user_id != undefined){ |
|
96 | if(user_id != undefined){ | |
93 | args+="&user_id="+user_id; |
|
97 | args+="&user_id="+user_id; | |
94 | } |
|
98 | } | |
95 | YUC.asyncRequest('POST',base_url,{ |
|
99 | YUC.asyncRequest('POST',follow_base_url,{ | |
96 | success:function(o){ |
|
100 | success:function(o){ | |
97 |
|
|
101 | onSuccessFollow(target); | |
98 | } |
|
102 | } | |
99 | },args); |
|
103 | },args); | |
100 | return false; |
|
104 | return false; | |
101 | } |
|
105 | } | |
102 | YUE.onDOMReady(function(){ |
|
106 | YUE.onDOMReady(function(){ | |
103 |
|
107 | tooltip_activate(); | ||
|
108 | show_more_event(); | |||
|
109 | ||||
104 | YUE.on('quick_login_link','click',function(e){ |
|
110 | YUE.on('quick_login_link','click',function(e){ | |
|
111 | // make sure we don't redirect | |||
|
112 | YUE.preventDefault(e); | |||
105 |
|
113 | |||
106 | if(YUD.hasClass('quick_login_link','enabled')){ |
|
114 | if(YUD.hasClass('quick_login_link','enabled')){ | |
107 | YUD.setStyle('quick_login','display','none'); |
|
115 | YUD.setStyle('quick_login','display','none'); | |
@@ -112,13 +120,8 b'' | |||||
112 | YUD.addClass('quick_login_link','enabled'); |
|
120 | YUD.addClass('quick_login_link','enabled'); | |
113 | YUD.get('username').focus(); |
|
121 | YUD.get('username').focus(); | |
114 | } |
|
122 | } | |
115 | //make sure we don't redirect |
|
|||
116 | YUE.preventDefault(e); |
|
|||
117 | }); |
|
123 | }); | |
118 |
|
|
124 | ||
119 | tooltip_activate(); |
|
|||
120 | show_more_event(); |
|
|||
121 |
|
||||
122 | YUE.on(YUQ('.quick_repo_menu'),'click',function(e){ |
|
125 | YUE.on(YUQ('.quick_repo_menu'),'click',function(e){ | |
123 | var menu = e.currentTarget.firstElementChild; |
|
126 | var menu = e.currentTarget.firstElementChild; | |
124 | if(YUD.hasClass(menu,'hidden')){ |
|
127 | if(YUD.hasClass(menu,'hidden')){ | |
@@ -129,6 +132,7 b'' | |||||
129 | YUD.addClass(menu,'hidden'); |
|
132 | YUD.addClass(menu,'hidden'); | |
130 | } |
|
133 | } | |
131 | }) |
|
134 | }) | |
|
135 | ||||
132 | YUE.on(window,'scroll',function(){ |
|
136 | YUE.on(window,'scroll',function(){ | |
133 | if(YUD.getDocumentScrollTop() > 45){ |
|
137 | if(YUD.getDocumentScrollTop() > 45){ | |
134 | YUD.addClass('header-inner','hover'); |
|
138 | YUD.addClass('header-inner','hover'); | |
@@ -140,8 +144,7 b'' | |||||
140 | }) |
|
144 | }) | |
141 | </script> |
|
145 | </script> | |
142 | </%def> |
|
146 | </%def> | |
143 | <%def name="js_extra()"> |
|
147 | <%def name="js_extra()"></%def> | |
144 | </%def> |
|
|||
145 | ${self.js()} |
|
148 | ${self.js()} | |
146 | </head> |
|
149 | </head> | |
147 | <body id="body"> |
|
150 | <body id="body"> |
General Comments 0
You need to be logged in to leave comments.
Login now