##// END OF EJS Templates
Added missing refmaps script.
neko259 -
r126:cf0891c7 default
parent child Browse files
Show More
@@ -0,0 +1,38 b''
1 function addRefLinkMap() {
2 var postByNum = [], refMap = [];
3
4 $('.post').each(function() {
5 var self = $(this);
6
7 var postNum = self.attr('id');
8 //add post by id
9 postByNum[postNum] = self;
10 //add ref link
11 self.find('p').children('a').each(function() {
12 if($(this).text().indexOf('>>') == 0) {
13 var refNum = $(this).text().match(/\d+/);
14
15 if(postByNum[refNum]) {
16 if(!refMap[refNum])
17 refMap[refNum] = [];
18
19 //if !exist
20 if((',' + refMap[refNum].toString() + ',').indexOf(',' + postNum + ',') < 0) {
21 refMap[refNum].push(postNum);
22 };
23 }
24 }
25 });
26 });
27
28 var label_replies = gettext('Replies') + ':';
29 for(var pNum in refMap) {
30 if(typeof refMap[pNum] === 'object') {
31 //append refmap panel
32 if(!$("#refmap_"+pNum).length) {
33 var data = label_replies + refMap[pNum].toString().replace(/(\d+)/g, ' <a href="/jump/$1/">>>$1</a>');
34 $('#'+pNum+'').find('.message').after($('<div class="refmap" id="refmap_'+pNum+'">'+data+'</div>'));
35 }
36 }
37 }
38 }
General Comments 0
You need to be logged in to leave comments. Login now