You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdebindings/kjsembed/docs/examples/grepdialog/grepresults.js

37 lines
966 B

// 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,"&amp;");
line = line.replace( /"/g,"&quot;");
line = line.replace( /</g,"&lt;");
fields = line.match( /^([^:]+:)(\d+:)?(.*)/ );
s += build_row( fields[1], fields[2], fields[3] );
line = readLine();
}
s += '</table>';
text.text = s;
// Show dialog
dlg.exec();