Skip to content

Commit

Permalink
closes #19 - support for user:NICK shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
osmisto committed May 7, 2011
1 parent e2d9cf9 commit 7cafe92
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion static/js/main.js
Expand Up @@ -65,7 +65,8 @@ var TextReplacer = {
w: 'http://www.openstreetmap.org/browse/way/%s',
r: 'http://www.openstreetmap.org/browse/relation/%s',
'#': 'javascript:SelectPiece(%s)',
'bug': 'https://github.com/Foxhind/MapCraft/issues/%s'
'bug': 'https://github.com/Foxhind/MapCraft/issues/%s',
'user:': 'http://openstreetmap.org/user/%s'
},

// Using template, replacment value and link text
Expand Down Expand Up @@ -118,6 +119,14 @@ var TextReplacer = {
return this.create_elem(this.shortcuts[m[1]], m[2], token);
}
}

// shortcut:<TEXT> -> url
if( (m = token.match(/^([a-z]+:)(\w+)$/)) != null) {
if (m[1] in this.shortcuts) {
return this.create_elem(this.shortcuts[m[1]], m[2], token);
}
}

// any other URL
if( (m = token.match(/^(?:https?|ftp):\/\/\S+$/)) != null) {
var data = this.search_in_shortcuts(m[0]);
Expand Down

0 comments on commit 7cafe92

Please sign in to comment.