Mercurial > kallithea
comparison rhodecode/public/js/rhodecode.js @ 3001:37c7abd34d44 beta
implements #636, lazy loading of history and authors to speed up page responsiveness.
- loading full history is not always needed, and it's very heavy operation. Now this is lazy loaded
when clicking on button
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 13 Nov 2012 22:26:06 +0100 |
parents | 95f03f8f5f9a |
children | 5d580e9bc730 |
comparison
equal
deleted
inserted
replaced
3000:4034eb731b33 | 3001:37c7abd34d44 |
---|---|
949 else{ | 949 else{ |
950 return getIdentNode(n.parentNode); | 950 return getIdentNode(n.parentNode); |
951 } | 951 } |
952 }; | 952 }; |
953 | 953 |
954 var getSelectionLink = function(selection_link_label) { | 954 var getSelectionLink = function(e) { |
955 return function(){ | 955 |
956 //get selection from start/to nodes | 956 //get selection from start/to nodes |
957 if (typeof window.getSelection != "undefined") { | 957 if (typeof window.getSelection != "undefined") { |
958 s = window.getSelection(); | 958 s = window.getSelection(); |
959 | 959 |
960 from = getIdentNode(s.anchorNode); | 960 from = getIdentNode(s.anchorNode); |
961 till = getIdentNode(s.focusNode); | 961 till = getIdentNode(s.focusNode); |
962 | |
963 f_int = parseInt(from.id.replace('L','')); | |
964 t_int = parseInt(till.id.replace('L','')); | |
965 | |
966 if (f_int > t_int){ | |
967 //highlight from bottom | |
968 offset = -35; | |
969 ranges = [t_int,f_int]; | |
970 | |
971 } | |
972 else{ | |
973 //highligth from top | |
974 offset = 35; | |
975 ranges = [f_int,t_int]; | |
976 } | |
977 | |
978 if (ranges[0] != ranges[1]){ | |
979 if(YUD.get('linktt') == null){ | |
980 hl_div = document.createElement('div'); | |
981 hl_div.id = 'linktt'; | |
982 } | |
983 anchor = '#L'+ranges[0]+'-'+ranges[1]; | |
984 hl_div.innerHTML = ''; | |
985 l = document.createElement('a'); | |
986 l.href = location.href.substring(0,location.href.indexOf('#'))+anchor; | |
987 l.innerHTML = _TM['Selection link']; | |
988 hl_div.appendChild(l); | |
962 | 989 |
963 f_int = parseInt(from.id.replace('L','')); | 990 YUD.get('body').appendChild(hl_div); |
964 t_int = parseInt(till.id.replace('L','')); | |
965 | 991 |
966 if (f_int > t_int){ | 992 xy = YUD.getXY(till.id); |
967 //highlight from bottom | |
968 offset = -35; | |
969 ranges = [t_int,f_int]; | |
970 | |
971 } | |
972 else{ | |
973 //highligth from top | |
974 offset = 35; | |
975 ranges = [f_int,t_int]; | |
976 } | |
977 | 993 |
978 if (ranges[0] != ranges[1]){ | 994 YUD.addClass('linktt','yui-tt'); |
979 if(YUD.get('linktt') == null){ | 995 YUD.setStyle('linktt','top',xy[1]+offset+'px'); |
980 hl_div = document.createElement('div'); | 996 YUD.setStyle('linktt','left',xy[0]+'px'); |
981 hl_div.id = 'linktt'; | 997 YUD.setStyle('linktt','visibility','visible'); |
982 } | 998 } |
983 anchor = '#L'+ranges[0]+'-'+ranges[1]; | 999 else{ |
984 hl_div.innerHTML = ''; | 1000 YUD.setStyle('linktt','visibility','hidden'); |
985 l = document.createElement('a'); | |
986 l.href = location.href.substring(0,location.href.indexOf('#'))+anchor; | |
987 l.innerHTML = selection_link_label; | |
988 hl_div.appendChild(l); | |
989 | |
990 YUD.get('body').appendChild(hl_div); | |
991 | |
992 xy = YUD.getXY(till.id); | |
993 | |
994 YUD.addClass('linktt','yui-tt'); | |
995 YUD.setStyle('linktt','top',xy[1]+offset+'px'); | |
996 YUD.setStyle('linktt','left',xy[0]+'px'); | |
997 YUD.setStyle('linktt','visibility','visible'); | |
998 } | |
999 else{ | |
1000 YUD.setStyle('linktt','visibility','hidden'); | |
1001 } | |
1002 } | 1001 } |
1003 } | 1002 } |
1004 }; | 1003 }; |
1005 | 1004 |
1006 var deleteNotification = function(url, notification_id,callbacks){ | 1005 var deleteNotification = function(url, notification_id,callbacks){ |