angular-linkify
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -15,3 +15,3 @@ angular.module('linkify', []); | ||
var anch = document.createElement('a'); | ||
anch.href = url; | ||
anch.href = url.replace(/&/g, '&'); | ||
anch.target = "_blank"; | ||
@@ -18,0 +18,0 @@ anch.innerHTML = url; |
/* | ||
angular-linkify - v1.2.0 - 3/5/2015 | ||
angular-linkify - v1.2.0 - 10/25/2016 | ||
Angular filter to linkify urls, "@" usernames, and hashtags. | ||
Copyright (c) 2015 ; Licensed | ||
Copyright (c) 2016 ; Licensed | ||
*/ | ||
angular.module("linkify",[]),angular.module("linkify").filter("linkify",function(){"use strict";function linkify(_str,type){if(_str){var _text=_str.replace(/(?:https?\:\/\/|www\.)+(?![^\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)*@([\u00C0-\u1FFF\w]+)/g,'$1<a href="https://twitter.com/$2" target="_blank">@$2</a>'),_text=_text.replace(/(^|\s)*#([\u00C0-\u1FFF\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",["$filter",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",["$filter","$timeout","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){if(_str){var _text=_str.replace(/(?:https?\:\/\/|www\.)+(?![^\s]*?")([\w.,@?!^=%&:\/~+#-]*[\w@?!^=%&\/~+#-])?/gi,function(url){var wrap=document.createElement("div"),anch=document.createElement("a");return anch.href=url.replace(/&/g,"&"),anch.target="_blank",anch.innerHTML=url,wrap.appendChild(anch),wrap.innerHTML});return _text?("twitter"===type&&(_text=_text.replace(/(|\s)*@([\u00C0-\u1FFF\w]+)/g,'$1<a href="https://twitter.com/$2" target="_blank">@$2</a>'),_text=_text.replace(/(^|\s)*#([\u00C0-\u1FFF\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",["$filter",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",["$filter","$timeout","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": "1.2.0", | ||
"version": "1.2.1", | ||
"main": "angular-linkify.js", | ||
@@ -14,2 +14,2 @@ "description": "Angular filter to linkify urls, \"@\" usernames, and hashtags.", | ||
] | ||
} | ||
} |
{ | ||
"name": "angular-linkify", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Angular filter to linkify urls, \"@\" usernames, and hashtags.", | ||
@@ -5,0 +5,0 @@ "main": "angular-linkify.js", |
@@ -7,6 +7,28 @@ # angular-linkify | ||
Install via either [bower](http://bower.io/), [npm](https://www.npmjs.com/), CDN (jsDelivr) or downloaded files: | ||
* `bower install angular-linkify --save` | ||
* `npm install angular-linkify --save` | ||
* use [CDN file](https://www.jsdelivr.com/projects/angular.linkify) | ||
* download [angular-linkify.zip](https://github.com/scottcorgan/angular-linkify/zipball/master) | ||
Include `angular-linkify.min.js` in your angular application | ||
```html | ||
<!-- when using bower --> | ||
<script src="bower_components/angular-linkify/angular-linkify.min.js"></script> | ||
<!-- when using npm --> | ||
<script src="node_modules/angular-linkify/angular-linkify.min.js"></script> | ||
<!-- when using cdn file --> | ||
<script src="//cdn.jsdelivr.net/angular.linkify/1.2.0/angular-linkify.min.js"></script> | ||
<!-- when using downloaded files --> | ||
<script src="angular-linkify.min.js"></script> | ||
``` | ||
bower install angular-linkify --save | ||
``` | ||
## Usage | ||
@@ -13,0 +35,0 @@ |
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
9324
113
77