| 1 |
// $Id: relatedlinks.js,v 1.4.2.7 2008/05/08 17:25:33 karthik Exp $ |
// $Id: relatedlinks.js,v 1.4.2.8 2008/05/08 18:03:13 karthik Exp $ |
| 2 |
|
|
| 3 |
// Todo: Convert to prototype (or behaviour, I suppose) and promote reuse. |
// Todo: Convert to prototype (or behaviour, I suppose) and promote reuse. |
| 4 |
$(document).ready(function() { |
$(document).ready(function() { |
| 8 |
|
|
| 9 |
// Parse textarea for links and store them in a global array. |
// Parse textarea for links and store them in a global array. |
| 10 |
l = $(ta).val().split("\n"); |
l = $(ta).val().split("\n"); |
| 11 |
r = new RegExp('\w*([^\ \w]+)\ *(.*)$', 'i'); |
// We assume that the line is trimmed. |
| 12 |
|
r = new RegExp('([^\S]+)\ +(.*)$', 'i'); |
| 13 |
links = new Array(); |
links = new Array(); |
| 14 |
for (var i = 0; i < l.length; i++) { |
for (var i = 0; i < l.length; i++) { |
| 15 |
m = l[i].match(r); |
m = l[i].match(r); |