Show More
@@ -1,38 +1,39 b'' | |||
|
1 | 1 | function addRefLinkMap() { |
|
2 | 2 | var postByNum = [], refMap = []; |
|
3 | 3 | |
|
4 | 4 | $('.post').each(function() { |
|
5 | 5 | var self = $(this); |
|
6 | 6 | |
|
7 | 7 | var postNum = self.attr('id'); |
|
8 | 8 | //add post by id |
|
9 | 9 | postByNum[postNum] = self; |
|
10 | 10 | //add ref link |
|
11 | 11 | self.find('p').children('a').each(function() { |
|
12 | 12 | if($(this).text().indexOf('>>') == 0) { |
|
13 | 13 | var refNum = $(this).text().match(/\d+/); |
|
14 | 14 | |
|
15 | 15 | if(postByNum[refNum]) { |
|
16 | 16 | if(!refMap[refNum]) |
|
17 | 17 | refMap[refNum] = []; |
|
18 | 18 | |
|
19 | 19 | //if !exist |
|
20 | 20 | if((',' + refMap[refNum].toString() + ',').indexOf(',' + postNum + ',') < 0) { |
|
21 | 21 | refMap[refNum].push(postNum); |
|
22 | 22 | }; |
|
23 | 23 | } |
|
24 | 24 | } |
|
25 | 25 | }); |
|
26 | 26 | }); |
|
27 | 27 | |
|
28 | 28 | var label_replies = gettext('Replies') + ':'; |
|
29 | 29 | for(var pNum in refMap) { |
|
30 | 30 | if(typeof refMap[pNum] === 'object') { |
|
31 | 31 | //append refmap panel |
|
32 | 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>')); | |
|
33 | $('#'+pNum+'').find('.message').after( | |
|
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