changeset 969:6e070138d173 beta

implemented #107 variable lines can be now highlighted
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 28 Jan 2011 14:45:30 +0100
parents aa550e290f26
children c5868406fdb0
files rhodecode/templates/files/files_source.html
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/templates/files/files_source.html	Fri Jan 28 12:23:16 2011 +0100
+++ b/rhodecode/templates/files/files_source.html	Fri Jan 28 14:45:30 2011 +0100
@@ -42,6 +42,37 @@
 			${_('File is to big to display')} ${h.link_to(_('show as raw'),
 			h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
 		%endif
+		
+       <script type="text/javascript">
+           function highlight_lines(lines){
+               for(pos in lines){
+                   console.log('L'+lines[pos]);
+                 YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE');                       
+               }              
+           }       
+           page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L');
+           if (page_highlights.length == 2){
+              highlight_ranges  = page_highlights[1].split(",");
+
+              var h_lines = [];
+              for (pos in highlight_ranges){
+                   var _range = highlight_ranges[pos].split('-');
+                   if(_range.length == 2){
+                       var start = parseInt(_range[0]);
+                       var end = parseInt(_range[1]);
+                       if (start < end){
+                           for(var i=start;i<=end;i++){
+                               h_lines.push(i);
+                           }
+                       } 
+                   }
+                   else{
+                       h_lines.push(parseInt(highlight_ranges[pos]));
+                   }
+             }
+           highlight_lines(h_lines);              
+           }
+       </script>		
 	</div>
 </div>