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