angular-linkify
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -8,6 +8,2 @@ angular.module('linkify', []); | ||
function linkify (_str, type) { | ||
if (!_str) { | ||
return ''; | ||
} | ||
var _text = _str.replace( /(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+(?![^\s]*?")([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/ig, function(url) { | ||
@@ -23,2 +19,7 @@ var wrap = document.createElement('div'); | ||
// bugfix | ||
if (!_text) { | ||
return ""; | ||
} | ||
@@ -25,0 +26,0 @@ if (type === 'twitter') { |
/* | ||
angular-linkify - v0.3.0 - 3/27/2014 | ||
angular-linkify - v0.3.1 - 3/27/2014 | ||
Angular filter to linkify urls, "@" usernames, and hashtags. | ||
Copyright (c) 2014 ; Licensed | ||
*/ | ||
angular.module("linkify",[]),angular.module("linkify").filter("linkify",function(){"use strict";function linkify(_str,type){if(!_str)return"";var _text=_str.replace(/(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+(?![^\s]*?")([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/gi,function(url){var wrap=document.createElement("div"),anch=document.createElement("a");return anch.href=url,anch.target="_blank",anch.innerHTML=url,wrap.appendChild(anch),wrap.innerHTML});return"twitter"===type&&(_text=_text.replace(/(|\s)*@(\w+)/g,'$1<a href="https://twitter.com/$2" target="_blank">@$2</a>'),_text=_text.replace(/(^|\s)*#(\w+)/g,'$1<a href="https://twitter.com/search?q=%23$2" target="_blank">#$2</a>')),"github"===type&&(_text=_text.replace(/(|\s)*@(\w+)/g,'$1<a href="https://github.com/$2" target="_blank">@$2</a>')),_text}return function(text,type){return linkify(text,type)}}).factory("linkify",function($filter){"use strict";function _linkifyAsType(type){return function(str){return $filter("linkify")(str,type)}}return{twitter:_linkifyAsType("twitter"),github:_linkifyAsType("github"),normal:_linkifyAsType()}}).directive("linkify",function($filter,$timeout,linkify){"use strict";return{restrict:"A",link:function(scope,element,attrs){var type=attrs.linkify||"normal";$timeout(function(){element.html(linkify[type](element.html()))})}}}); | ||
angular.module("linkify",[]),angular.module("linkify").filter("linkify",function(){"use strict";function linkify(_str,type){var _text=_str.replace(/(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+(?![^\s]*?")([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/gi,function(url){var wrap=document.createElement("div"),anch=document.createElement("a");return anch.href=url,anch.target="_blank",anch.innerHTML=url,wrap.appendChild(anch),wrap.innerHTML});return _text?("twitter"===type&&(_text=_text.replace(/(|\s)*@(\w+)/g,'$1<a href="https://twitter.com/$2" target="_blank">@$2</a>'),_text=_text.replace(/(^|\s)*#(\w+)/g,'$1<a href="https://twitter.com/search?q=%23$2" target="_blank">#$2</a>')),"github"===type&&(_text=_text.replace(/(|\s)*@(\w+)/g,'$1<a href="https://github.com/$2" target="_blank">@$2</a>')),_text):""}return function(text,type){return linkify(text,type)}}).factory("linkify",function($filter){"use strict";function _linkifyAsType(type){return function(str){return $filter("linkify")(str,type)}}return{twitter:_linkifyAsType("twitter"),github:_linkifyAsType("github"),normal:_linkifyAsType()}}).directive("linkify",function($filter,$timeout,linkify){"use strict";return{restrict:"A",link:function(scope,element,attrs){var type=attrs.linkify||"normal";$timeout(function(){element.html(linkify[type](element.html()))})}}}); |
{ | ||
"name": "angular-linkify", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"main": "angular-linkify.js", | ||
@@ -5,0 +5,0 @@ "description": "Angular filter to linkify urls, \"@\" usernames, and hashtags.", |
{ | ||
"name": "angular-linkify", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Angular filter to linkify urls, \"@\" usernames, and hashtags.", | ||
@@ -5,0 +5,0 @@ "main": "angular-linkify.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7589
109