line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::ProjectDocs::IndexPage; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
32
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
135
|
|
4
|
4
|
|
|
4
|
|
23
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
182
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.53'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
21
|
use Moose; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
27
|
|
9
|
|
|
|
|
|
|
with 'Pod::ProjectDocs::File', 'Pod::ProjectDocs::Template'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'default_name' => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => 'Str', |
14
|
|
|
|
|
|
|
default => 'index.html', |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'json' => ( |
18
|
|
|
|
|
|
|
is => 'rw', |
19
|
|
|
|
|
|
|
isa => 'Str', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'components' => ( |
23
|
|
|
|
|
|
|
is => 'rw', |
24
|
|
|
|
|
|
|
isa => 'HashRef', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has 'data' => ( |
28
|
|
|
|
|
|
|
is => 'ro', |
29
|
|
|
|
|
|
|
default => <<'DATA', |
30
|
|
|
|
|
|
|
<!DOCTYPE html> |
31
|
|
|
|
|
|
|
<html lang="[% lang %]" xml:lang="[% lang %]"> |
32
|
|
|
|
|
|
|
<head> |
33
|
|
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=[% charset %]" /> |
34
|
|
|
|
|
|
|
<title>[% title | html %]</title> |
35
|
|
|
|
|
|
|
<link rel="stylesheet" href="[% css_relative_url %]" type="text/css" /> |
36
|
|
|
|
|
|
|
<script type="text/javascript"> |
37
|
|
|
|
|
|
|
//<![CDATA[ |
38
|
|
|
|
|
|
|
var managers = [% json %]; |
39
|
|
|
|
|
|
|
function render(pattern) { |
40
|
|
|
|
|
|
|
var html = ''; |
41
|
|
|
|
|
|
|
for ( var i = 0; i < managers.length; i++ ) { |
42
|
|
|
|
|
|
|
var manager = managers[i]; |
43
|
|
|
|
|
|
|
var rows_html = get_rows_html(manager, pattern); |
44
|
|
|
|
|
|
|
var listbox = "<div class='box'><h2 class='t2'>" |
45
|
|
|
|
|
|
|
+ manager.desc |
46
|
|
|
|
|
|
|
+ "</h2><table width='100%'>" |
47
|
|
|
|
|
|
|
+ rows_html |
48
|
|
|
|
|
|
|
+ "</table></div>"; |
49
|
|
|
|
|
|
|
html += listbox; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
var list = document.getElementById('list'); |
52
|
|
|
|
|
|
|
list.innerHTML = html; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
function get_rows_html (manager, pattern) { |
55
|
|
|
|
|
|
|
var html = ''; |
56
|
|
|
|
|
|
|
var regexp = new RegExp( "(" + pattern + ")", "gi"); |
57
|
|
|
|
|
|
|
var seq = 0; |
58
|
|
|
|
|
|
|
for (var i = 0; i < manager.entries.length; i++) { |
59
|
|
|
|
|
|
|
var entry = manager.entries[i]; |
60
|
|
|
|
|
|
|
if ( entry.name.match(regexp) ) { |
61
|
|
|
|
|
|
|
var module_name = manager.entries[i].name; |
62
|
|
|
|
|
|
|
if(pattern != '' ) { |
63
|
|
|
|
|
|
|
var replace_text = "<span class='search_highlight'>$1</span>"; |
64
|
|
|
|
|
|
|
module_name = module_name.replace(regexp, replace_text); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
html += get_entry_html(entry, module_name, seq); |
67
|
|
|
|
|
|
|
seq++; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
return html; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
function get_entry_html (entry, name, i) { |
73
|
|
|
|
|
|
|
var row_class = ( i % 2 == 0 ) ? 'r' : 's'; |
74
|
|
|
|
|
|
|
var row_html = "<tr class='" |
75
|
|
|
|
|
|
|
+ row_class |
76
|
|
|
|
|
|
|
+ "'><td nowrap='nowrap'><a href='" |
77
|
|
|
|
|
|
|
+ entry.path |
78
|
|
|
|
|
|
|
+ "'>" |
79
|
|
|
|
|
|
|
+ name + "</a></td><td width='99%'><small>" |
80
|
|
|
|
|
|
|
+ (entry.title || '') |
81
|
|
|
|
|
|
|
+ "</small></td></tr>"; |
82
|
|
|
|
|
|
|
return row_html; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
//]]> |
85
|
|
|
|
|
|
|
</script> |
86
|
|
|
|
|
|
|
</head> |
87
|
|
|
|
|
|
|
<body onload="render('')"> |
88
|
|
|
|
|
|
|
<div class="box"> |
89
|
|
|
|
|
|
|
<h1 class="t1">[% title | html %]</h1> |
90
|
|
|
|
|
|
|
<table> |
91
|
|
|
|
|
|
|
<tr> |
92
|
|
|
|
|
|
|
<td class="label">Description</td> |
93
|
|
|
|
|
|
|
<td class="cell">[% desc | html_line_break %]</td> |
94
|
|
|
|
|
|
|
</tr> |
95
|
|
|
|
|
|
|
</table> |
96
|
|
|
|
|
|
|
</div> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
<div class="box"> |
99
|
|
|
|
|
|
|
<h2 class="t2">Search</h2> |
100
|
|
|
|
|
|
|
<table> |
101
|
|
|
|
|
|
|
<tr> |
102
|
|
|
|
|
|
|
<td class="cell"><input type="text" size="60" onkeyup="render(this.value)" /></td> |
103
|
|
|
|
|
|
|
</tr> |
104
|
|
|
|
|
|
|
</table> |
105
|
|
|
|
|
|
|
</div> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
<div id="list"></div> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
<div class="footer">generated by <a href="http://metacpan.org/module/Pod::ProjectDocs">Pod::ProjectDocs</a></div> |
110
|
|
|
|
|
|
|
</body> |
111
|
|
|
|
|
|
|
</html> |
112
|
|
|
|
|
|
|
DATA |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub _get_data { |
116
|
3
|
|
|
3
|
|
6
|
my $self = shift; |
117
|
|
|
|
|
|
|
my $params = { |
118
|
|
|
|
|
|
|
title => $self->config->title, |
119
|
|
|
|
|
|
|
desc => $self->config->desc, |
120
|
|
|
|
|
|
|
lang => $self->config->lang, |
121
|
|
|
|
|
|
|
json => $self->json, |
122
|
|
|
|
|
|
|
charset => 'UTF-8', |
123
|
3
|
|
|
|
|
116
|
css_relative_url => $self->components->{css}->relative_url($self), |
124
|
|
|
|
|
|
|
}; |
125
|
3
|
|
|
|
|
100
|
my $text = $self->process( $self, $self->data, $params ); |
126
|
3
|
|
|
|
|
25
|
return $text; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
4
|
|
|
4
|
|
26187
|
no Moose; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
46
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |