Mercurial > kallithea
comparison rhodecode/templates/files/files_source.html @ 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 | 5da1286ddd28 |
children | 59b7131c15b1 |
comparison
equal
deleted
inserted
replaced
968:aa550e290f26 | 969:6e070138d173 |
---|---|
40 ${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} | 40 ${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} |
41 %else: | 41 %else: |
42 ${_('File is to big to display')} ${h.link_to(_('show as raw'), | 42 ${_('File is to big to display')} ${h.link_to(_('show as raw'), |
43 h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))} | 43 h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))} |
44 %endif | 44 %endif |
45 | |
46 <script type="text/javascript"> | |
47 function highlight_lines(lines){ | |
48 for(pos in lines){ | |
49 console.log('L'+lines[pos]); | |
50 YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE'); | |
51 } | |
52 } | |
53 page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L'); | |
54 if (page_highlights.length == 2){ | |
55 highlight_ranges = page_highlights[1].split(","); | |
56 | |
57 var h_lines = []; | |
58 for (pos in highlight_ranges){ | |
59 var _range = highlight_ranges[pos].split('-'); | |
60 if(_range.length == 2){ | |
61 var start = parseInt(_range[0]); | |
62 var end = parseInt(_range[1]); | |
63 if (start < end){ | |
64 for(var i=start;i<=end;i++){ | |
65 h_lines.push(i); | |
66 } | |
67 } | |
68 } | |
69 else{ | |
70 h_lines.push(parseInt(highlight_ranges[pos])); | |
71 } | |
72 } | |
73 highlight_lines(h_lines); | |
74 } | |
75 </script> | |
45 </div> | 76 </div> |
46 </div> | 77 </div> |
47 | 78 |
48 <script type="text/javascript"> | 79 <script type="text/javascript"> |
49 YAHOO.util.Event.onDOMReady(function(){ | 80 YAHOO.util.Event.onDOMReady(function(){ |