Skip to content

Commit

Permalink
Merge branch 'development' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Cohn committed Mar 24, 2016
2 parents 4ba4205 + 33e96b0 commit 6f8f589
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions url2link.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ _Url2link.prototype = {
}]
}
,"uname":{
"regex": /@[-a-z0-9]{3,}/
"regex": /@[A-Za-z0-9]{3,25}/
,"newtab": true
,"flags":"i"
,"actions":[function(match, host){
Expand All @@ -107,7 +107,7 @@ _Url2link.prototype = {
,"link": function(input){
var that = this;
var matches = new Array();
var out = new Array({"type":"text", "prefix":"", "val":input, "start":0});
var out = new Array({"type":"text", "val":input});

["email","url","uname"].forEach(function(type){
var newOut = new Array();
Expand All @@ -116,7 +116,7 @@ _Url2link.prototype = {
newOut = newOut.concat(digest(type, el.val, el.start));
else newOut = newOut.concat(el);
});
out = newOut;
out = fuseText(newOut);
});

function digest(t, text, start){
Expand Down Expand Up @@ -146,6 +146,18 @@ _Url2link.prototype = {
output.push(textobj(text.slice(prevIdx)));
return output;
}
function fuseText(inp){
if(!inp.length)return inp;
var outIdx = 0;
var out = new Array();
out.push(inp[0]);
for (var idx = 1; idx<inp.length; idx++){
if((inp[idx].type == "text") && (out[outIdx].type == "text") )
out[outIdx].val = out[outIdx].val.concat(inp[idx].val);
else out[++outIdx] = inp[idx];
}
return out;
}

function binarySearch(array, key) {
var lo = 0,
Expand Down
2 changes: 1 addition & 1 deletion utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ _Utils.prototype = {
});
}
,"setFrontUrl": function(url){
return url.replace(/((beta|m)\.)?freefeed.net\/(?=.+)/,
return url.replace(/((https?:\/\/)|beta\.|m\.|^)freefeed.net\/(?=.+)/,
gConfig.front.slice(8));
}
};
Expand Down

0 comments on commit 6f8f589

Please sign in to comment.