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