blob: 99a698cd84810b60b62d83a6578e005a367315a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Create the dialog
var dlg = Factory.loadui('grepresults.ui');
var text = dlg.child('results_text');
function build_row( file, line, text )
{
file = file.replace( /:$/, "" );
line = line.replace( /:$/, "" );
return '<tr bgcolor="#eeeeff">'
+'<td><b><font color="blue">'+file+'</font></b></td>'
+'<td align="center"><b><font color="red">'+line+'</font></b></td>'
+'<td>'+text+'</td></tr>';
}
var s = '<table cellspacing="2"><tr bgcolor="#cccccc">';
s += '<th><b>File</b></th>';
s += '<th align="center"><b>Line</b></th>';
s += '<th><b>Text</b></th></tr>';
var line = readLine();
while ( line != null ) {
line.replace( /&/g,"&");
line = line.replace( /"/g,""");
line = line.replace( /</g,"<");
fields = line.match( /^([^:]+:)(\d+:)?(.*)/ );
s += build_row( fields[1], fields[2], fields[3] );
line = readLine();
}
s += '</table>';
text.text = s;
// Show dialog
dlg.exec();
|