2 * (c) 2010 StatusNet, Inc.
7 * Find URL links from the source text that may be interesting.
10 * @return {Array} list of URLs
12 function findLinks(text)
14 // @fixme match this to core code
15 var re = /(?:^| )(https?:\/\/.+?\/.+?)(?= |$)/g;
18 while ((matches = re.exec(text)) !== null) {
19 links.push(matches[1]);
25 * Start looking up info for a link preview...
26 * May start async data loads.
31 function prepLinkPreview(id, url)
37 * Update the live preview section with links found in the given text.
38 * May start async data loads.
40 * @param {String} text: free-form input text
42 function previewLinks(text)
44 var links = findLinks(text);
45 for (var i = 0; i < links.length; i++) {
46 var id = 'link-preview-' + i;
47 prepLinkPreview(id, links[i]);
51 $('#notice_data-text').change(function() {
52 var text = $(this).val();