Changeset - bc16d1d0869a
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2011-11-19 20:23:29
marcin@python-works.com
js cleanup
1 file changed with 20 insertions and 17 deletions:
0 comments (0 inline, 0 general)
rhodecode/templates/base/root.html
Show inline comments
 
@@ -44,107 +44,110 @@
 
            <script type="text/javascript" src="${h.url('/js/yui.flot.js')}"></script>
 
            <script type="text/javascript" src="${h.url('/js/rhodecode.js')}"></script>
 
           ## EXTRA FOR JS
 
           ${self.js_extra()}
 
        
 
            <script type="text/javascript">
 
            var base_url  = "${h.url('toggle_following')}";
 
            function onSuccess(target){
 
            var follow_base_url  = "${h.url('toggle_following')}";
 
            var stop_follow_text = "${_('Stop following this repository')}";
 
            var start_follow_text = "${_('Start following this repository')}"; 
 
            
 
            
 
            var onSuccessFollow = function(target){
 
                var f = YUD.get(target.id);
 
                var f_cnt = YUD.get('current_followers_count');
 
                
 
                if(f.getAttribute('class')=='follow'){
 
                    f.setAttribute('class','following');
 
                    f.setAttribute('title',"${_('Stop following this repository')}");
 
                    f.setAttribute('title',stop_follow_text);
 
                    
 
                    if(f_cnt){
 
                        var cnt = Number(f_cnt.innerHTML)+1;
 
                        f_cnt.innerHTML = cnt;
 
                    }
 
                }
 
                else{
 
                    f.setAttribute('class','follow');
 
                    f.setAttribute('title',"${_('Start following this repository')}");
 
                    f.setAttribute('title',start_follow_text);
 
                    if(f_cnt){
 
                        var cnt = Number(f_cnt.innerHTML)+1;
 
                        f_cnt.innerHTML = cnt;
 
                    }      
 
                }
 
            }
 
            
 
            function toggleFollowingUser(target,fallows_user_id,token,user_id){
 
            var toggleFollowingUser = function(target,fallows_user_id,token,user_id){
 
                args = 'follows_user_id='+fallows_user_id;
 
                args+= '&amp;auth_token='+token;
 
                if(user_id != undefined){
 
                    args+="&amp;user_id="+user_id;
 
                }
 
                YUC.asyncRequest('POST',base_url,{
 
                YUC.asyncRequest('POST',follow_base_url,{
 
                    success:function(o){
 
                        onSuccess(target);
 
                    	onSuccessFollow(target);
 
                    }
 
                },args);
 
                return false;
 
            }
 
            
 
            function toggleFollowingRepo(target,fallows_repo_id,token,user_id){
 
            var toggleFollowingRepo = function(target,fallows_repo_id,token,user_id){
 
            
 
                args = 'follows_repo_id='+fallows_repo_id;
 
                args+= '&amp;auth_token='+token;
 
                if(user_id != undefined){
 
                    args+="&amp;user_id="+user_id;
 
                }    
 
                YUC.asyncRequest('POST',base_url,{
 
                YUC.asyncRequest('POST',follow_base_url,{
 
                    success:function(o){
 
                        onSuccess(target);
 
                    	onSuccessFollow(target);
 
                    }
 
                },args); 
 
                return false;
 
            }
 
           YUE.onDOMReady(function(){
 
             tooltip_activate();
 
             show_more_event();               
 
               
 
             YUE.on('quick_login_link','click',function(e){
 
                 // make sure we don't redirect 
 
                 YUE.preventDefault(e);
 
                 
 
                 if(YUD.hasClass('quick_login_link','enabled')){
 
                     YUD.setStyle('quick_login','display','none');
 
                     YUD.removeClass('quick_login_link','enabled');
 
                 }
 
                 else{
 
                     YUD.setStyle('quick_login','display','');
 
                     YUD.addClass('quick_login_link','enabled');
 
                     YUD.get('username').focus();
 
                 }
 
                 //make sure we don't redirect 
 
                 YUE.preventDefault(e);
 
             });
 
               
 
            tooltip_activate();
 
            show_more_event();
 
            
 
            YUE.on(YUQ('.quick_repo_menu'),'click',function(e){
 
            	var menu = e.currentTarget.firstElementChild;
 
            	if(YUD.hasClass(menu,'hidden')){
 
            		YUD.addClass(e.currentTarget,'active');
 
            		YUD.removeClass(menu,'hidden');
 
            	}else{
 
            		YUD.removeClass(e.currentTarget,'active');
 
            		YUD.addClass(menu,'hidden');
 
            	}
 
            })
 
            
 
            YUE.on(window,'scroll',function(){
 
                if(YUD.getDocumentScrollTop() > 45){
 
                      YUD.addClass('header-inner','hover');
 
                }
 
                else{
 
                    YUD.removeClass('header-inner','hover');
 
                }
 
            }) 
 
           })   
 
            </script>
 
        </%def>
 
        <%def name="js_extra()">
 
        </%def>      
 
        <%def name="js_extra()"></%def>
 
        ${self.js()}
 
    </head>
 
    <body id="body">
 
        ${next.body()}
 
    </body>
 
</html>
 
\ No newline at end of file
0 comments (0 inline, 0 general)