Actualización

This commit is contained in:
Xes
2025-04-10 11:37:29 +02:00
parent 4bfeadb360
commit 8969cc929d
39112 changed files with 975884 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
{
"name": "linkifyjs",
"main": "linkify.js",
"version": "2.1.9",
"authors": [
"SoapBox Innovations Inc. <dev@soapboxhq.com>"
],
"description": "Intelligent link recognition, made easy",
"keywords": [
"node",
"js",
"jquery",
"link",
"autolink",
"text",
"url",
"email",
"hashtag",
"hashtags",
"mention",
"mentions"
],
"license": "MIT",
"homepage": "http://soapbox.github.io/linkifyjs/",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": ">=1.7.0"
},
"_release": "2.1.9",
"_resolution": {
"type": "version",
"tag": "v2.1.9",
"commit": "2c5c717a1f867aa3f03bd8580a7b7c5f58aa664c"
},
"_source": "https://github.com/nfrasser/linkify-shim.git",
"_target": "^2.1.8",
"_originalSource": "linkifyjs"
}

View File

@@ -0,0 +1,21 @@
Linkify
=======
Shim repository for Linkify. All issues with this plugin should be directed to http://github.com/SoapBox/linkifyjs/
Package Managers
----------------
### [Bower](http://bower.io/)
```
bower install linkifyjs
```
### [NPM](https://npmjs.com/)
See the [main repository](https://github.com/SoapBox/linkifyjs/blob/master/README.md) for usage with Node.js/Browserify.
```
npm install linkifyjs
```

View File

@@ -0,0 +1,36 @@
{
"name": "linkifyjs",
"main": "linkify.js",
"version": "2.1.9",
"authors": [
"SoapBox Innovations Inc. <dev@soapboxhq.com>"
],
"description": "Intelligent link recognition, made easy",
"keywords": [
"node",
"js",
"jquery",
"link",
"autolink",
"text",
"url",
"email",
"hashtag",
"hashtags",
"mention",
"mentions"
],
"license": "MIT",
"homepage": "http://soapbox.github.io/linkifyjs/",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": ">=1.7.0"
}
}

View File

@@ -0,0 +1,207 @@
define('linkify-element', ['module', 'exports', './linkify'], function (module, exports, _linkify) {
'use strict';
try { try { Object.defineProperty(exports, "__esModule", {
value: true
}); } catch (e) { exports['__esModule'] = true; } } catch (e) { exports['__esModule'] = true; }
var linkify = _interopRequireWildcard(_linkify);
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
}
}
newObj['default'] = obj;
return newObj;
}
}
var tokenize = linkify.tokenize,
options = linkify.options;
var Options = options.Options;
var TEXT_TOKEN = linkify.parser.TOKENS.TEXT;
var HTML_NODE = 1,
TXT_NODE = 3;
/**
Given a parent element and child node that the parent contains, replaces
that child with the given array of new children
*/
function replaceChildWithChildren(parent, oldChild, newChildren) {
var lastNewChild = newChildren[newChildren.length - 1];
parent.replaceChild(lastNewChild, oldChild);
for (var i = newChildren.length - 2; i >= 0; i--) {
parent.insertBefore(newChildren[i], lastNewChild);
lastNewChild = newChildren[i];
}
}
/**
Given an array of MultiTokens, return an array of Nodes that are either
(a) Plain Text nodes (node type 3)
(b) Anchor tag nodes (usually, unless tag name is overridden in the options)
Takes the same options as linkifyElement and an optional doc element
(this should be passed in by linkifyElement)
*/
function tokensToNodes(tokens, opts, doc) {
var result = [];
for (var _iterator = tokens, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var token = _ref;
if (token.type === 'nl' && opts.nl2br) {
result.push(doc.createElement('br'));
continue;
} else if (!token.isLink || !opts.check(token)) {
result.push(doc.createTextNode(token.toString()));
continue;
}
var _opts$resolve = opts.resolve(token),
formatted = _opts$resolve.formatted,
formattedHref = _opts$resolve.formattedHref,
tagName = _opts$resolve.tagName,
className = _opts$resolve.className,
target = _opts$resolve.target,
events = _opts$resolve.events,
attributes = _opts$resolve.attributes;
// Build the link
var link = doc.createElement(tagName);
link.setAttribute('href', formattedHref);
if (className) {
link.setAttribute('class', className);
}
if (target) {
link.setAttribute('target', target);
}
// Build up additional attributes
if (attributes) {
for (var attr in attributes) {
link.setAttribute(attr, attributes[attr]);
}
}
if (events) {
for (var event in events) {
if (link.addEventListener) {
link.addEventListener(event, events[event]);
} else if (link.attachEvent) {
link.attachEvent('on' + event, events[event]);
}
}
}
link.appendChild(doc.createTextNode(formatted));
result.push(link);
}
return result;
}
// Requires document.createElement
function linkifyElementHelper(element, opts, doc) {
// Can the element be linkified?
if (!element || element.nodeType !== HTML_NODE) {
throw new Error('Cannot linkify ' + element + ' - Invalid DOM Node type');
}
var ignoreTags = opts.ignoreTags;
// Is this element already a link?
if (element.tagName === 'A' || options.contains(ignoreTags, element.tagName)) {
// No need to linkify
return element;
}
var childElement = element.firstChild;
while (childElement) {
var str = void 0,
tokens = void 0,
nodes = void 0;
switch (childElement.nodeType) {
case HTML_NODE:
linkifyElementHelper(childElement, opts, doc);
break;
case TXT_NODE:
{
str = childElement.nodeValue;
tokens = tokenize(str);
if (tokens.length === 0 || tokens.length === 1 && tokens[0] instanceof TEXT_TOKEN) {
// No node replacement required
break;
}
nodes = tokensToNodes(tokens, opts, doc);
// Swap out the current child for the set of nodes
replaceChildWithChildren(element, childElement, nodes);
// so that the correct sibling is selected next
childElement = nodes[nodes.length - 1];
break;
}
}
childElement = childElement.nextSibling;
}
return element;
}
function linkifyElement(element, opts) {
var doc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
try {
doc = doc || document || window && window.document || global && global.document;
} catch (e) {/* do nothing for now */}
if (!doc) {
throw new Error('Cannot find document implementation. ' + 'If you are in a non-browser environment like Node.js, ' + 'pass the document implementation as the third argument to linkifyElement.');
}
opts = new Options(opts);
return linkifyElementHelper(element, opts, doc);
}
// Maintain reference to the recursive helper to cache option-normalization
linkifyElement.helper = linkifyElementHelper;
linkifyElement.normalize = function (opts) {
return new Options(opts);
};
exports['default'] = linkifyElement;
module.exports = exports['default'];
});

View File

@@ -0,0 +1 @@
define("linkify-element",["module","exports","./linkify"],function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function a(e,t,n){var r=n[n.length-1];e.replaceChild(r,t);for(var a=n.length-2;a>=0;a--)e.insertBefore(n[a],r),r=n[a]}function i(e,t,n){for(var r=[],a=e,i=Array.isArray(a),o=0,a=i?a:a[Symbol.iterator]();;){var l;if(i){if(o>=a.length)break;l=a[o++]}else{if(o=a.next(),o.done)break;l=o.value}var s=l;if("nl"===s.type&&t.nl2br)r.push(n.createElement("br"));else if(s.isLink&&t.check(s)){var f=t.resolve(s),d=f.formatted,u=f.formattedHref,c=f.tagName,v=f.className,h=f.target,m=f.events,p=f.attributes,g=n.createElement(c);if(g.setAttribute("href",u),v&&g.setAttribute("class",v),h&&g.setAttribute("target",h),p)for(var b in p)g.setAttribute(b,p[b]);if(m)for(var y in m)g.addEventListener?g.addEventListener(y,m[y]):g.attachEvent&&g.attachEvent("on"+y,m[y]);g.appendChild(n.createTextNode(d)),r.push(g)}else r.push(n.createTextNode(s.toString()))}return r}function o(e,t,n){if(!e||e.nodeType!==h)throw new Error("Cannot linkify "+e+" - Invalid DOM Node type");var r=t.ignoreTags;if("A"===e.tagName||u.contains(r,e.tagName))return e;for(var l=e.firstChild;l;){var s=void 0,f=void 0,c=void 0;switch(l.nodeType){case h:o(l,t,n);break;case m:if(s=l.nodeValue,f=d(s),0===f.length||1===f.length&&f[0]instanceof v)break;c=i(f,t,n),a(e,l,c),l=c[c.length-1]}l=l.nextSibling}return e}function l(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{n=n||document||window&&window.document||global&&global.document}catch(r){}if(!n)throw new Error("Cannot find document implementation. If you are in a non-browser environment like Node.js, pass the document implementation as the third argument to linkifyElement.");return t=new c(t),o(e,t,n)}try{try{Object.defineProperty(t,"__esModule",{value:!0})}catch(s){t.__esModule=!0}}catch(s){t.__esModule=!0}var f=r(n),d=f.tokenize,u=f.options,c=u.Options,v=f.parser.TOKENS.TEXT,h=1,m=3;l.helper=o,l.normalize=function(e){return new c(e)},t["default"]=l,e.exports=t["default"]});

View File

@@ -0,0 +1,195 @@
'use strict';
;(function (window, linkify) {
var linkifyElement = function (linkify) {
'use strict';
/**
Linkify a HTML DOM node
*/
var tokenize = linkify.tokenize,
options = linkify.options;
var Options = options.Options;
var TEXT_TOKEN = linkify.parser.TOKENS.TEXT;
var HTML_NODE = 1;
var TXT_NODE = 3;
/**
Given a parent element and child node that the parent contains, replaces
that child with the given array of new children
*/
function replaceChildWithChildren(parent, oldChild, newChildren) {
var lastNewChild = newChildren[newChildren.length - 1];
parent.replaceChild(lastNewChild, oldChild);
for (var i = newChildren.length - 2; i >= 0; i--) {
parent.insertBefore(newChildren[i], lastNewChild);
lastNewChild = newChildren[i];
}
}
/**
Given an array of MultiTokens, return an array of Nodes that are either
(a) Plain Text nodes (node type 3)
(b) Anchor tag nodes (usually, unless tag name is overridden in the options)
Takes the same options as linkifyElement and an optional doc element
(this should be passed in by linkifyElement)
*/
function tokensToNodes(tokens, opts, doc) {
var result = [];
for (var _iterator = tokens, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var token = _ref;
if (token.type === 'nl' && opts.nl2br) {
result.push(doc.createElement('br'));
continue;
} else if (!token.isLink || !opts.check(token)) {
result.push(doc.createTextNode(token.toString()));
continue;
}
var _opts$resolve = opts.resolve(token),
formatted = _opts$resolve.formatted,
formattedHref = _opts$resolve.formattedHref,
tagName = _opts$resolve.tagName,
className = _opts$resolve.className,
target = _opts$resolve.target,
events = _opts$resolve.events,
attributes = _opts$resolve.attributes;
// Build the link
var link = doc.createElement(tagName);
link.setAttribute('href', formattedHref);
if (className) {
link.setAttribute('class', className);
}
if (target) {
link.setAttribute('target', target);
}
// Build up additional attributes
if (attributes) {
for (var attr in attributes) {
link.setAttribute(attr, attributes[attr]);
}
}
if (events) {
for (var event in events) {
if (link.addEventListener) {
link.addEventListener(event, events[event]);
} else if (link.attachEvent) {
link.attachEvent('on' + event, events[event]);
}
}
}
link.appendChild(doc.createTextNode(formatted));
result.push(link);
}
return result;
}
// Requires document.createElement
function linkifyElementHelper(element, opts, doc) {
// Can the element be linkified?
if (!element || element.nodeType !== HTML_NODE) {
throw new Error('Cannot linkify ' + element + ' - Invalid DOM Node type');
}
var ignoreTags = opts.ignoreTags;
// Is this element already a link?
if (element.tagName === 'A' || options.contains(ignoreTags, element.tagName)) {
// No need to linkify
return element;
}
var childElement = element.firstChild;
while (childElement) {
var str = void 0,
tokens = void 0,
nodes = void 0;
switch (childElement.nodeType) {
case HTML_NODE:
linkifyElementHelper(childElement, opts, doc);
break;
case TXT_NODE:
{
str = childElement.nodeValue;
tokens = tokenize(str);
if (tokens.length === 0 || tokens.length === 1 && tokens[0] instanceof TEXT_TOKEN) {
// No node replacement required
break;
}
nodes = tokensToNodes(tokens, opts, doc);
// Swap out the current child for the set of nodes
replaceChildWithChildren(element, childElement, nodes);
// so that the correct sibling is selected next
childElement = nodes[nodes.length - 1];
break;
}
}
childElement = childElement.nextSibling;
}
return element;
}
function linkifyElement(element, opts) {
var doc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
try {
doc = doc || document || window && window.document || global && global.document;
} catch (e) {/* do nothing for now */}
if (!doc) {
throw new Error('Cannot find document implementation. ' + 'If you are in a non-browser environment like Node.js, ' + 'pass the document implementation as the third argument to linkifyElement.');
}
opts = new Options(opts);
return linkifyElementHelper(element, opts, doc);
}
// Maintain reference to the recursive helper to cache option-normalization
linkifyElement.helper = linkifyElementHelper;
linkifyElement.normalize = function (opts) {
return new Options(opts);
};
return linkifyElement;
}(linkify);
window.linkifyElement = linkifyElement;
})(window, linkify);

View File

@@ -0,0 +1 @@
"use strict";!function(e,t){var n=function(t){function n(e,t,n){var r=n[n.length-1];e.replaceChild(r,t);for(var i=n.length-2;i>=0;i--)e.insertBefore(n[i],r),r=n[i]}function r(e,t,n){for(var r=[],i=e,a=Array.isArray(i),o=0,i=a?i:i[Symbol.iterator]();;){var l;if(a){if(o>=i.length)break;l=i[o++]}else{if(o=i.next(),o.done)break;l=o.value}var s=l;if("nl"===s.type&&t.nl2br)r.push(n.createElement("br"));else if(s.isLink&&t.check(s)){var f=t.resolve(s),c=f.formatted,d=f.formattedHref,u=f.tagName,v=f.className,h=f.target,m=f.events,g=f.attributes,p=n.createElement(u);if(p.setAttribute("href",d),v&&p.setAttribute("class",v),h&&p.setAttribute("target",h),g)for(var b in g)p.setAttribute(b,g[b]);if(m)for(var y in m)p.addEventListener?p.addEventListener(y,m[y]):p.attachEvent&&p.attachEvent("on"+y,m[y]);p.appendChild(n.createTextNode(c)),r.push(p)}else r.push(n.createTextNode(s.toString()))}return r}function i(e,t,a){if(!e||e.nodeType!==c)throw new Error("Cannot linkify "+e+" - Invalid DOM Node type");var s=t.ignoreTags;if("A"===e.tagName||l.contains(s,e.tagName))return e;for(var u=e.firstChild;u;){var v=void 0,h=void 0,m=void 0;switch(u.nodeType){case c:i(u,t,a);break;case d:if(v=u.nodeValue,h=o(v),0===h.length||1===h.length&&h[0]instanceof f)break;m=r(h,t,a),n(e,u,m),u=m[m.length-1]}u=u.nextSibling}return e}function a(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{r=r||document||e&&e.document||global&&global.document}catch(a){}if(!r)throw new Error("Cannot find document implementation. If you are in a non-browser environment like Node.js, pass the document implementation as the third argument to linkifyElement.");return n=new s(n),i(t,n,r)}var o=t.tokenize,l=t.options,s=l.Options,f=t.parser.TOKENS.TEXT,c=1,d=3;return a.helper=i,a.normalize=function(e){return new s(e)},a}(t);e.linkifyElement=n}(window,linkify);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,852 @@
"use strict";
;(function (window, linkify) {
var linkifyHtml = function (linkify) {
'use strict';
var HTML5NamedCharRefs = {
// We don't need the complete named character reference because linkifyHtml
// does not modify the escape sequences. We do need &nbsp; so that
// whitespace is parsed properly. Other types of whitespace should already
// be accounted for
nbsp: "\xA0"
};
function EntityParser(named) {
this.named = named;
}
var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/;
var CHARCODE = /^#([0-9]+)$/;
var NAMED = /^([A-Za-z0-9]+)$/;
EntityParser.prototype.parse = function (entity) {
if (!entity) {
return;
}
var matches = entity.match(HEXCHARCODE);
if (matches) {
return "&#x" + matches[1] + ";";
}
matches = entity.match(CHARCODE);
if (matches) {
return "&#" + matches[1] + ";";
}
matches = entity.match(NAMED);
if (matches) {
return this.named[matches[1]] || "&" + matches[1] + ";";
}
};
var WSP = /[\t\n\f ]/;
var ALPHA = /[A-Za-z]/;
var CRLF = /\r\n?/g;
function isSpace(char) {
return WSP.test(char);
}
function isAlpha(char) {
return ALPHA.test(char);
}
function preprocessInput(input) {
return input.replace(CRLF, "\n");
}
function EventedTokenizer(delegate, entityParser) {
this.delegate = delegate;
this.entityParser = entityParser;
this.state = null;
this.input = null;
this.index = -1;
this.line = -1;
this.column = -1;
this.tagLine = -1;
this.tagColumn = -1;
this.reset();
}
EventedTokenizer.prototype = {
reset: function reset() {
this.state = 'beforeData';
this.input = '';
this.index = 0;
this.line = 1;
this.column = 0;
this.tagLine = -1;
this.tagColumn = -1;
this.delegate.reset();
},
tokenize: function tokenize(input) {
this.reset();
this.tokenizePart(input);
this.tokenizeEOF();
},
tokenizePart: function tokenizePart(input) {
this.input += preprocessInput(input);
while (this.index < this.input.length) {
this.states[this.state].call(this);
}
},
tokenizeEOF: function tokenizeEOF() {
this.flushData();
},
flushData: function flushData() {
if (this.state === 'data') {
this.delegate.finishData();
this.state = 'beforeData';
}
},
peek: function peek() {
return this.input.charAt(this.index);
},
consume: function consume() {
var char = this.peek();
this.index++;
if (char === "\n") {
this.line++;
this.column = 0;
} else {
this.column++;
}
return char;
},
consumeCharRef: function consumeCharRef() {
var endIndex = this.input.indexOf(';', this.index);
if (endIndex === -1) {
return;
}
var entity = this.input.slice(this.index, endIndex);
var chars = this.entityParser.parse(entity);
if (chars) {
var count = entity.length;
// consume the entity chars
while (count) {
this.consume();
count--;
}
// consume the `;`
this.consume();
return chars;
}
},
markTagStart: function markTagStart() {
// these properties to be removed in next major bump
this.tagLine = this.line;
this.tagColumn = this.column;
if (this.delegate.tagOpen) {
this.delegate.tagOpen();
}
},
states: {
beforeData: function beforeData() {
var char = this.peek();
if (char === "<") {
this.state = 'tagOpen';
this.markTagStart();
this.consume();
} else {
this.state = 'data';
this.delegate.beginData();
}
},
data: function data() {
var char = this.peek();
if (char === "<") {
this.delegate.finishData();
this.state = 'tagOpen';
this.markTagStart();
this.consume();
} else if (char === "&") {
this.consume();
this.delegate.appendToData(this.consumeCharRef() || "&");
} else {
this.consume();
this.delegate.appendToData(char);
}
},
tagOpen: function tagOpen() {
var char = this.consume();
if (char === "!") {
this.state = 'markupDeclaration';
} else if (char === "/") {
this.state = 'endTagOpen';
} else if (isAlpha(char)) {
this.state = 'tagName';
this.delegate.beginStartTag();
this.delegate.appendToTagName(char.toLowerCase());
}
},
markupDeclaration: function markupDeclaration() {
var char = this.consume();
if (char === "-" && this.input.charAt(this.index) === "-") {
this.consume();
this.state = 'commentStart';
this.delegate.beginComment();
}
},
commentStart: function commentStart() {
var char = this.consume();
if (char === "-") {
this.state = 'commentStartDash';
} else if (char === ">") {
this.delegate.finishComment();
this.state = 'beforeData';
} else {
this.delegate.appendToCommentData(char);
this.state = 'comment';
}
},
commentStartDash: function commentStartDash() {
var char = this.consume();
if (char === "-") {
this.state = 'commentEnd';
} else if (char === ">") {
this.delegate.finishComment();
this.state = 'beforeData';
} else {
this.delegate.appendToCommentData("-");
this.state = 'comment';
}
},
comment: function comment() {
var char = this.consume();
if (char === "-") {
this.state = 'commentEndDash';
} else {
this.delegate.appendToCommentData(char);
}
},
commentEndDash: function commentEndDash() {
var char = this.consume();
if (char === "-") {
this.state = 'commentEnd';
} else {
this.delegate.appendToCommentData("-" + char);
this.state = 'comment';
}
},
commentEnd: function commentEnd() {
var char = this.consume();
if (char === ">") {
this.delegate.finishComment();
this.state = 'beforeData';
} else {
this.delegate.appendToCommentData("--" + char);
this.state = 'comment';
}
},
tagName: function tagName() {
var char = this.consume();
if (isSpace(char)) {
this.state = 'beforeAttributeName';
} else if (char === "/") {
this.state = 'selfClosingStartTag';
} else if (char === ">") {
this.delegate.finishTag();
this.state = 'beforeData';
} else {
this.delegate.appendToTagName(char);
}
},
beforeAttributeName: function beforeAttributeName() {
var char = this.peek();
if (isSpace(char)) {
this.consume();
return;
} else if (char === "/") {
this.state = 'selfClosingStartTag';
this.consume();
} else if (char === ">") {
this.consume();
this.delegate.finishTag();
this.state = 'beforeData';
} else {
this.state = 'attributeName';
this.delegate.beginAttribute();
this.consume();
this.delegate.appendToAttributeName(char);
}
},
attributeName: function attributeName() {
var char = this.peek();
if (isSpace(char)) {
this.state = 'afterAttributeName';
this.consume();
} else if (char === "/") {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.state = 'selfClosingStartTag';
} else if (char === "=") {
this.state = 'beforeAttributeValue';
this.consume();
} else if (char === ">") {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
this.state = 'beforeData';
} else {
this.consume();
this.delegate.appendToAttributeName(char);
}
},
afterAttributeName: function afterAttributeName() {
var char = this.peek();
if (isSpace(char)) {
this.consume();
return;
} else if (char === "/") {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.state = 'selfClosingStartTag';
} else if (char === "=") {
this.consume();
this.state = 'beforeAttributeValue';
} else if (char === ">") {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
this.state = 'beforeData';
} else {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.state = 'attributeName';
this.delegate.beginAttribute();
this.delegate.appendToAttributeName(char);
}
},
beforeAttributeValue: function beforeAttributeValue() {
var char = this.peek();
if (isSpace(char)) {
this.consume();
} else if (char === '"') {
this.state = 'attributeValueDoubleQuoted';
this.delegate.beginAttributeValue(true);
this.consume();
} else if (char === "'") {
this.state = 'attributeValueSingleQuoted';
this.delegate.beginAttributeValue(true);
this.consume();
} else if (char === ">") {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
this.state = 'beforeData';
} else {
this.state = 'attributeValueUnquoted';
this.delegate.beginAttributeValue(false);
this.consume();
this.delegate.appendToAttributeValue(char);
}
},
attributeValueDoubleQuoted: function attributeValueDoubleQuoted() {
var char = this.consume();
if (char === '"') {
this.delegate.finishAttributeValue();
this.state = 'afterAttributeValueQuoted';
} else if (char === "&") {
this.delegate.appendToAttributeValue(this.consumeCharRef('"') || "&");
} else {
this.delegate.appendToAttributeValue(char);
}
},
attributeValueSingleQuoted: function attributeValueSingleQuoted() {
var char = this.consume();
if (char === "'") {
this.delegate.finishAttributeValue();
this.state = 'afterAttributeValueQuoted';
} else if (char === "&") {
this.delegate.appendToAttributeValue(this.consumeCharRef("'") || "&");
} else {
this.delegate.appendToAttributeValue(char);
}
},
attributeValueUnquoted: function attributeValueUnquoted() {
var char = this.peek();
if (isSpace(char)) {
this.delegate.finishAttributeValue();
this.consume();
this.state = 'beforeAttributeName';
} else if (char === "&") {
this.consume();
this.delegate.appendToAttributeValue(this.consumeCharRef(">") || "&");
} else if (char === ">") {
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
this.state = 'beforeData';
} else {
this.consume();
this.delegate.appendToAttributeValue(char);
}
},
afterAttributeValueQuoted: function afterAttributeValueQuoted() {
var char = this.peek();
if (isSpace(char)) {
this.consume();
this.state = 'beforeAttributeName';
} else if (char === "/") {
this.consume();
this.state = 'selfClosingStartTag';
} else if (char === ">") {
this.consume();
this.delegate.finishTag();
this.state = 'beforeData';
} else {
this.state = 'beforeAttributeName';
}
},
selfClosingStartTag: function selfClosingStartTag() {
var char = this.peek();
if (char === ">") {
this.consume();
this.delegate.markTagAsSelfClosing();
this.delegate.finishTag();
this.state = 'beforeData';
} else {
this.state = 'beforeAttributeName';
}
},
endTagOpen: function endTagOpen() {
var char = this.consume();
if (isAlpha(char)) {
this.state = 'tagName';
this.delegate.beginEndTag();
this.delegate.appendToTagName(char.toLowerCase());
}
}
}
};
function Tokenizer(entityParser, options) {
this.token = null;
this.startLine = 1;
this.startColumn = 0;
this.options = options || {};
this.tokenizer = new EventedTokenizer(this, entityParser);
}
Tokenizer.prototype = {
tokenize: function tokenize(input) {
this.tokens = [];
this.tokenizer.tokenize(input);
return this.tokens;
},
tokenizePart: function tokenizePart(input) {
this.tokens = [];
this.tokenizer.tokenizePart(input);
return this.tokens;
},
tokenizeEOF: function tokenizeEOF() {
this.tokens = [];
this.tokenizer.tokenizeEOF();
return this.tokens[0];
},
reset: function reset() {
this.token = null;
this.startLine = 1;
this.startColumn = 0;
},
addLocInfo: function addLocInfo() {
if (this.options.loc) {
this.token.loc = {
start: {
line: this.startLine,
column: this.startColumn
},
end: {
line: this.tokenizer.line,
column: this.tokenizer.column
}
};
}
this.startLine = this.tokenizer.line;
this.startColumn = this.tokenizer.column;
},
// Data
beginData: function beginData() {
this.token = {
type: 'Chars',
chars: ''
};
this.tokens.push(this.token);
},
appendToData: function appendToData(char) {
this.token.chars += char;
},
finishData: function finishData() {
this.addLocInfo();
},
// Comment
beginComment: function beginComment() {
this.token = {
type: 'Comment',
chars: ''
};
this.tokens.push(this.token);
},
appendToCommentData: function appendToCommentData(char) {
this.token.chars += char;
},
finishComment: function finishComment() {
this.addLocInfo();
},
// Tags - basic
beginStartTag: function beginStartTag() {
this.token = {
type: 'StartTag',
tagName: '',
attributes: [],
selfClosing: false
};
this.tokens.push(this.token);
},
beginEndTag: function beginEndTag() {
this.token = {
type: 'EndTag',
tagName: ''
};
this.tokens.push(this.token);
},
finishTag: function finishTag() {
this.addLocInfo();
},
markTagAsSelfClosing: function markTagAsSelfClosing() {
this.token.selfClosing = true;
},
// Tags - name
appendToTagName: function appendToTagName(char) {
this.token.tagName += char;
},
// Tags - attributes
beginAttribute: function beginAttribute() {
this._currentAttribute = ["", "", null];
this.token.attributes.push(this._currentAttribute);
},
appendToAttributeName: function appendToAttributeName(char) {
this._currentAttribute[0] += char;
},
beginAttributeValue: function beginAttributeValue(isQuoted) {
this._currentAttribute[2] = isQuoted;
},
appendToAttributeValue: function appendToAttributeValue(char) {
this._currentAttribute[1] = this._currentAttribute[1] || "";
this._currentAttribute[1] += char;
},
finishAttributeValue: function finishAttributeValue() {}
};
function tokenize$1(input, options) {
var tokenizer = new Tokenizer(new EntityParser(HTML5NamedCharRefs), options);
return tokenizer.tokenize(input);
}
var HTML5Tokenizer = {
HTML5NamedCharRefs: HTML5NamedCharRefs,
EntityParser: EntityParser,
EventedTokenizer: EventedTokenizer,
Tokenizer: Tokenizer,
tokenize: tokenize$1
};
var options = linkify.options;
var Options = options.Options;
var StartTag = 'StartTag';
var EndTag = 'EndTag';
var Chars = 'Chars';
var Comment = 'Comment';
/**
`tokens` and `token` in this section refer to tokens generated by the HTML
parser.
*/
function linkifyHtml(str) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var tokens = HTML5Tokenizer.tokenize(str);
var linkifiedTokens = [];
var linkified = [];
var i;
opts = new Options(opts);
// Linkify the tokens given by the parser
for (i = 0; i < tokens.length; i++) {
var token = tokens[i];
if (token.type === StartTag) {
linkifiedTokens.push(token);
// Ignore all the contents of ignored tags
var tagName = token.tagName.toUpperCase();
var isIgnored = tagName === 'A' || options.contains(opts.ignoreTags, tagName);
if (!isIgnored) {
continue;
}
var preskipLen = linkifiedTokens.length;
skipTagTokens(tagName, tokens, ++i, linkifiedTokens);
i += linkifiedTokens.length - preskipLen - 1;
continue;
} else if (token.type !== Chars) {
// Skip this token, it's not important
linkifiedTokens.push(token);
continue;
}
// Valid text token, linkify it!
var linkifedChars = linkifyChars(token.chars, opts);
linkifiedTokens.push.apply(linkifiedTokens, linkifedChars);
}
// Convert the tokens back into a string
for (i = 0; i < linkifiedTokens.length; i++) {
var _token = linkifiedTokens[i];
switch (_token.type) {
case StartTag:
{
var link = '<' + _token.tagName;
if (_token.attributes.length > 0) {
var attrs = attrsToStrings(_token.attributes);
link += ' ' + attrs.join(' ');
}
link += '>';
linkified.push(link);
break;
}
case EndTag:
linkified.push("</" + _token.tagName + ">");
break;
case Chars:
linkified.push(escapeText(_token.chars));
break;
case Comment:
linkified.push("<!--" + escapeText(_token.chars) + "-->");
break;
}
}
return linkified.join('');
}
/**
`tokens` and `token` in this section referes to tokens returned by
`linkify.tokenize`. `linkified` will contain HTML Parser-style tokens
*/
function linkifyChars(str, opts) {
var tokens = linkify.tokenize(str);
var result = [];
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
if (token.type === 'nl' && opts.nl2br) {
result.push({
type: StartTag,
tagName: 'br',
attributes: [],
selfClosing: true
});
continue;
} else if (!token.isLink || !opts.check(token)) {
result.push({ type: Chars, chars: token.toString() });
continue;
}
var _opts$resolve = opts.resolve(token),
formatted = _opts$resolve.formatted,
formattedHref = _opts$resolve.formattedHref,
tagName = _opts$resolve.tagName,
className = _opts$resolve.className,
target = _opts$resolve.target,
attributes = _opts$resolve.attributes;
// Build up attributes
var attributeArray = [['href', formattedHref]];
if (className) {
attributeArray.push(['class', className]);
}
if (target) {
attributeArray.push(['target', target]);
}
for (var attr in attributes) {
attributeArray.push([attr, attributes[attr]]);
}
// Add the required tokens
result.push({
type: StartTag,
tagName: tagName,
attributes: attributeArray,
selfClosing: false
});
result.push({ type: Chars, chars: formatted });
result.push({ type: EndTag, tagName: tagName });
}
return result;
}
/**
Returns a list of tokens skipped until the closing tag of tagName.
* `tagName` is the closing tag which will prompt us to stop skipping
* `tokens` is the array of tokens generated by HTML5Tokenizer which
* `i` is the index immediately after the opening tag to skip
* `skippedTokens` is an array which skipped tokens are being pushed into
Caveats
* Assumes that i is the first token after the given opening tagName
* The closing tag will be skipped, but nothing after it
* Will track whether there is a nested tag of the same type
*/
function skipTagTokens(tagName, tokens, i, skippedTokens) {
// number of tokens of this type on the [fictional] stack
var stackCount = 1;
while (i < tokens.length && stackCount > 0) {
var token = tokens[i];
if (token.type === StartTag && token.tagName.toUpperCase() === tagName) {
// Nested tag of the same type, "add to stack"
stackCount++;
} else if (token.type === EndTag && token.tagName.toUpperCase() === tagName) {
// Closing tag
stackCount--;
}
skippedTokens.push(token);
i++;
}
// Note that if stackCount > 0 here, the HTML is probably invalid
return skippedTokens;
}
function escapeText(text) {
// Not required, HTML tokenizer ensures this occurs properly
return text;
}
function escapeAttr(attr) {
return attr.replace(/"/g, '&quot;');
}
function attrsToStrings(attrs) {
var attrStrs = [];
for (var i = 0; i < attrs.length; i++) {
var _attrs$i = attrs[i],
name = _attrs$i[0],
value = _attrs$i[1];
attrStrs.push(name + "=\"" + escapeAttr(value) + "\"");
}
return attrStrs;
}
return linkifyHtml;
}(linkify);
window.linkifyHtml = linkifyHtml;
})(window, linkify);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,325 @@
define('linkify-element', ['module', 'exports', './linkify'], function (module, exports, _linkify) {
'use strict';
try { try { Object.defineProperty(exports, "__esModule", {
value: true
}); } catch (e) { exports['__esModule'] = true; } } catch (e) { exports['__esModule'] = true; }
var linkify = _interopRequireWildcard(_linkify);
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
}
}
newObj['default'] = obj;
return newObj;
}
}
var tokenize = linkify.tokenize,
options = linkify.options;
var Options = options.Options;
var TEXT_TOKEN = linkify.parser.TOKENS.TEXT;
var HTML_NODE = 1,
TXT_NODE = 3;
/**
Given a parent element and child node that the parent contains, replaces
that child with the given array of new children
*/
function replaceChildWithChildren(parent, oldChild, newChildren) {
var lastNewChild = newChildren[newChildren.length - 1];
parent.replaceChild(lastNewChild, oldChild);
for (var i = newChildren.length - 2; i >= 0; i--) {
parent.insertBefore(newChildren[i], lastNewChild);
lastNewChild = newChildren[i];
}
}
/**
Given an array of MultiTokens, return an array of Nodes that are either
(a) Plain Text nodes (node type 3)
(b) Anchor tag nodes (usually, unless tag name is overridden in the options)
Takes the same options as linkifyElement and an optional doc element
(this should be passed in by linkifyElement)
*/
function tokensToNodes(tokens, opts, doc) {
var result = [];
for (var _iterator = tokens, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var token = _ref;
if (token.type === 'nl' && opts.nl2br) {
result.push(doc.createElement('br'));
continue;
} else if (!token.isLink || !opts.check(token)) {
result.push(doc.createTextNode(token.toString()));
continue;
}
var _opts$resolve = opts.resolve(token),
formatted = _opts$resolve.formatted,
formattedHref = _opts$resolve.formattedHref,
tagName = _opts$resolve.tagName,
className = _opts$resolve.className,
target = _opts$resolve.target,
events = _opts$resolve.events,
attributes = _opts$resolve.attributes;
// Build the link
var link = doc.createElement(tagName);
link.setAttribute('href', formattedHref);
if (className) {
link.setAttribute('class', className);
}
if (target) {
link.setAttribute('target', target);
}
// Build up additional attributes
if (attributes) {
for (var attr in attributes) {
link.setAttribute(attr, attributes[attr]);
}
}
if (events) {
for (var event in events) {
if (link.addEventListener) {
link.addEventListener(event, events[event]);
} else if (link.attachEvent) {
link.attachEvent('on' + event, events[event]);
}
}
}
link.appendChild(doc.createTextNode(formatted));
result.push(link);
}
return result;
}
// Requires document.createElement
function linkifyElementHelper(element, opts, doc) {
// Can the element be linkified?
if (!element || element.nodeType !== HTML_NODE) {
throw new Error('Cannot linkify ' + element + ' - Invalid DOM Node type');
}
var ignoreTags = opts.ignoreTags;
// Is this element already a link?
if (element.tagName === 'A' || options.contains(ignoreTags, element.tagName)) {
// No need to linkify
return element;
}
var childElement = element.firstChild;
while (childElement) {
var str = void 0,
tokens = void 0,
nodes = void 0;
switch (childElement.nodeType) {
case HTML_NODE:
linkifyElementHelper(childElement, opts, doc);
break;
case TXT_NODE:
{
str = childElement.nodeValue;
tokens = tokenize(str);
if (tokens.length === 0 || tokens.length === 1 && tokens[0] instanceof TEXT_TOKEN) {
// No node replacement required
break;
}
nodes = tokensToNodes(tokens, opts, doc);
// Swap out the current child for the set of nodes
replaceChildWithChildren(element, childElement, nodes);
// so that the correct sibling is selected next
childElement = nodes[nodes.length - 1];
break;
}
}
childElement = childElement.nextSibling;
}
return element;
}
function linkifyElement(element, opts) {
var doc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
try {
doc = doc || document || window && window.document || global && global.document;
} catch (e) {/* do nothing for now */}
if (!doc) {
throw new Error('Cannot find document implementation. ' + 'If you are in a non-browser environment like Node.js, ' + 'pass the document implementation as the third argument to linkifyElement.');
}
opts = new Options(opts);
return linkifyElementHelper(element, opts, doc);
}
// Maintain reference to the recursive helper to cache option-normalization
linkifyElement.helper = linkifyElementHelper;
linkifyElement.normalize = function (opts) {
return new Options(opts);
};
exports['default'] = linkifyElement;
module.exports = exports['default'];
});
define('linkify-jquery', ['module', 'exports', './linkify-element'], function (module, exports, _linkifyElement) {
'use strict';
try { try { Object.defineProperty(exports, "__esModule", {
value: true
}); } catch (e) { exports['__esModule'] = true; } } catch (e) { exports['__esModule'] = true; }
exports['default'] = apply;
var _linkifyElement2 = _interopRequireDefault(_linkifyElement);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
'default': obj
};
}
// Applies the plugin to jQuery
function apply($) {
var doc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
$.fn = $.fn || {};
try {
doc = doc || document || window && window.document || global && global.document;
} catch (e) {/* do nothing for now */}
if (!doc) {
throw new Error('Cannot find document implementation. ' + 'If you are in a non-browser environment like Node.js, ' + 'pass the document implementation as the second argument to linkify/jquery');
}
if (typeof $.fn.linkify === 'function') {
// Already applied
return;
}
function jqLinkify(opts) {
opts = _linkifyElement2['default'].normalize(opts);
return this.each(function () {
_linkifyElement2['default'].helper(this, opts, doc);
});
}
$.fn.linkify = jqLinkify;
$(doc).ready(function () {
$('[data-linkify]').each(function () {
var $this = $(this);
var data = $this.data();
var target = data.linkify;
var nl2br = data.linkifyNlbr;
var options = {
nl2br: !!nl2br && nl2br !== 0 && nl2br !== 'false'
};
if ('linkifyAttributes' in data) {
options.attributes = data.linkifyAttributes;
}
if ('linkifyDefaultProtocol' in data) {
options.defaultProtocol = data.linkifyDefaultProtocol;
}
if ('linkifyEvents' in data) {
options.events = data.linkifyEvents;
}
if ('linkifyFormat' in data) {
options.format = data.linkifyFormat;
}
if ('linkifyFormatHref' in data) {
options.formatHref = data.linkifyFormatHref;
}
if ('linkifyTagname' in data) {
options.tagName = data.linkifyTagname;
}
if ('linkifyTarget' in data) {
options.target = data.linkifyTarget;
}
if ('linkifyValidate' in data) {
options.validate = data.linkifyValidate;
}
if ('linkifyIgnoreTags' in data) {
options.ignoreTags = data.linkifyIgnoreTags;
}
if ('linkifyClassName' in data) {
options.className = data.linkifyClassName;
} else if ('linkifyLinkclass' in data) {
// linkClass is deprecated
options.className = data.linkifyLinkclass;
}
options = _linkifyElement2['default'].normalize(options);
var $target = target === 'this' ? $this : $this.find(target);
$target.linkify(options);
});
});
}
// Try assigning linkifyElement to the browser scope
try {
!undefined.define && (window.linkifyElement = _linkifyElement2['default']);
} catch (e) {/**/}
module.exports = exports['default'];
});
require(['jquery', 'linkify-jquery'], function ($, apply) {
if (typeof $.fn.linkify !== 'function') {
apply($);
}
});

View File

@@ -0,0 +1 @@
define("linkify-element",["module","exports","./linkify"],function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function r(e,t,n){var i=n[n.length-1];e.replaceChild(i,t);for(var r=n.length-2;r>=0;r--)e.insertBefore(n[r],i),i=n[r]}function a(e,t,n){for(var i=[],r=e,a=Array.isArray(r),o=0,r=a?r:r[Symbol.iterator]();;){var l;if(a){if(o>=r.length)break;l=r[o++]}else{if(o=r.next(),o.done)break;l=o.value}var f=l;if("nl"===f.type&&t.nl2br)i.push(n.createElement("br"));else if(f.isLink&&t.check(f)){var s=t.resolve(f),u=s.formatted,d=s.formattedHref,c=s.tagName,y=s.className,m=s.target,k=s.events,h=s.attributes,v=n.createElement(c);if(v.setAttribute("href",d),y&&v.setAttribute("class",y),m&&v.setAttribute("target",m),h)for(var g in h)v.setAttribute(g,h[g]);if(k)for(var p in k)v.addEventListener?v.addEventListener(p,k[p]):v.attachEvent&&v.attachEvent("on"+p,k[p]);v.appendChild(n.createTextNode(u)),i.push(v)}else i.push(n.createTextNode(f.toString()))}return i}function o(e,t,n){if(!e||e.nodeType!==m)throw new Error("Cannot linkify "+e+" - Invalid DOM Node type");var i=t.ignoreTags;if("A"===e.tagName||d.contains(i,e.tagName))return e;for(var l=e.firstChild;l;){var f=void 0,s=void 0,c=void 0;switch(l.nodeType){case m:o(l,t,n);break;case k:if(f=l.nodeValue,s=u(f),0===s.length||1===s.length&&s[0]instanceof y)break;c=a(s,t,n),r(e,l,c),l=c[c.length-1]}l=l.nextSibling}return e}function l(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{n=n||document||window&&window.document||global&&global.document}catch(i){}if(!n)throw new Error("Cannot find document implementation. If you are in a non-browser environment like Node.js, pass the document implementation as the third argument to linkifyElement.");return t=new c(t),o(e,t,n)}try{try{Object.defineProperty(t,"__esModule",{value:!0})}catch(f){t.__esModule=!0}}catch(f){t.__esModule=!0}var s=i(n),u=s.tokenize,d=s.options,c=d.Options,y=s.parser.TOKENS.TEXT,m=1,k=3;l.helper=o,l.normalize=function(e){return new c(e)},t["default"]=l,e.exports=t["default"]}),define("linkify-jquery",["module","exports","./linkify-element"],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){function t(e){return e=o["default"].normalize(e),this.each(function(){o["default"].helper(this,e,n)})}var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.fn=e.fn||{};try{n=n||document||window&&window.document||global&&global.document}catch(i){}if(!n)throw new Error("Cannot find document implementation. If you are in a non-browser environment like Node.js, pass the document implementation as the second argument to linkify/jquery");"function"!=typeof e.fn.linkify&&(e.fn.linkify=t,e(n).ready(function(){e("[data-linkify]").each(function(){var t=e(this),n=t.data(),i=n.linkify,r=n.linkifyNlbr,a={nl2br:!!r&&0!==r&&"false"!==r};"linkifyAttributes"in n&&(a.attributes=n.linkifyAttributes),"linkifyDefaultProtocol"in n&&(a.defaultProtocol=n.linkifyDefaultProtocol),"linkifyEvents"in n&&(a.events=n.linkifyEvents),"linkifyFormat"in n&&(a.format=n.linkifyFormat),"linkifyFormatHref"in n&&(a.formatHref=n.linkifyFormatHref),"linkifyTagname"in n&&(a.tagName=n.linkifyTagname),"linkifyTarget"in n&&(a.target=n.linkifyTarget),"linkifyValidate"in n&&(a.validate=n.linkifyValidate),"linkifyIgnoreTags"in n&&(a.ignoreTags=n.linkifyIgnoreTags),"linkifyClassName"in n?a.className=n.linkifyClassName:"linkifyLinkclass"in n&&(a.className=n.linkifyLinkclass),a=o["default"].normalize(a);var l="this"===i?t:t.find(i);l.linkify(a)})}))}try{try{Object.defineProperty(t,"__esModule",{value:!0})}catch(a){t.__esModule=!0}}catch(a){t.__esModule=!0}t["default"]=r;var o=i(n);try{!(void 0).define&&(window.linkifyElement=o["default"])}catch(a){}e.exports=t["default"]}),require(["jquery","linkify-jquery"],function(e,t){"function"!=typeof e.fn.linkify&&t(e)});

View File

@@ -0,0 +1,293 @@
'use strict';
;(function (window, linkify, $) {
var linkifyJquery = function (linkify) {
'use strict';
/**
Linkify a HTML DOM node
*/
var tokenize = linkify.tokenize,
options = linkify.options;
var Options = options.Options;
var TEXT_TOKEN = linkify.parser.TOKENS.TEXT;
var HTML_NODE = 1;
var TXT_NODE = 3;
/**
Given a parent element and child node that the parent contains, replaces
that child with the given array of new children
*/
function replaceChildWithChildren(parent, oldChild, newChildren) {
var lastNewChild = newChildren[newChildren.length - 1];
parent.replaceChild(lastNewChild, oldChild);
for (var i = newChildren.length - 2; i >= 0; i--) {
parent.insertBefore(newChildren[i], lastNewChild);
lastNewChild = newChildren[i];
}
}
/**
Given an array of MultiTokens, return an array of Nodes that are either
(a) Plain Text nodes (node type 3)
(b) Anchor tag nodes (usually, unless tag name is overridden in the options)
Takes the same options as linkifyElement and an optional doc element
(this should be passed in by linkifyElement)
*/
function tokensToNodes(tokens, opts, doc) {
var result = [];
for (var _iterator = tokens, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var token = _ref;
if (token.type === 'nl' && opts.nl2br) {
result.push(doc.createElement('br'));
continue;
} else if (!token.isLink || !opts.check(token)) {
result.push(doc.createTextNode(token.toString()));
continue;
}
var _opts$resolve = opts.resolve(token),
formatted = _opts$resolve.formatted,
formattedHref = _opts$resolve.formattedHref,
tagName = _opts$resolve.tagName,
className = _opts$resolve.className,
target = _opts$resolve.target,
events = _opts$resolve.events,
attributes = _opts$resolve.attributes;
// Build the link
var link = doc.createElement(tagName);
link.setAttribute('href', formattedHref);
if (className) {
link.setAttribute('class', className);
}
if (target) {
link.setAttribute('target', target);
}
// Build up additional attributes
if (attributes) {
for (var attr in attributes) {
link.setAttribute(attr, attributes[attr]);
}
}
if (events) {
for (var event in events) {
if (link.addEventListener) {
link.addEventListener(event, events[event]);
} else if (link.attachEvent) {
link.attachEvent('on' + event, events[event]);
}
}
}
link.appendChild(doc.createTextNode(formatted));
result.push(link);
}
return result;
}
// Requires document.createElement
function linkifyElementHelper(element, opts, doc) {
// Can the element be linkified?
if (!element || element.nodeType !== HTML_NODE) {
throw new Error('Cannot linkify ' + element + ' - Invalid DOM Node type');
}
var ignoreTags = opts.ignoreTags;
// Is this element already a link?
if (element.tagName === 'A' || options.contains(ignoreTags, element.tagName)) {
// No need to linkify
return element;
}
var childElement = element.firstChild;
while (childElement) {
var str = void 0,
tokens = void 0,
nodes = void 0;
switch (childElement.nodeType) {
case HTML_NODE:
linkifyElementHelper(childElement, opts, doc);
break;
case TXT_NODE:
{
str = childElement.nodeValue;
tokens = tokenize(str);
if (tokens.length === 0 || tokens.length === 1 && tokens[0] instanceof TEXT_TOKEN) {
// No node replacement required
break;
}
nodes = tokensToNodes(tokens, opts, doc);
// Swap out the current child for the set of nodes
replaceChildWithChildren(element, childElement, nodes);
// so that the correct sibling is selected next
childElement = nodes[nodes.length - 1];
break;
}
}
childElement = childElement.nextSibling;
}
return element;
}
function linkifyElement(element, opts) {
var doc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
try {
doc = doc || document || window && window.document || global && global.document;
} catch (e) {/* do nothing for now */}
if (!doc) {
throw new Error('Cannot find document implementation. ' + 'If you are in a non-browser environment like Node.js, ' + 'pass the document implementation as the third argument to linkifyElement.');
}
opts = new Options(opts);
return linkifyElementHelper(element, opts, doc);
}
// Maintain reference to the recursive helper to cache option-normalization
linkifyElement.helper = linkifyElementHelper;
linkifyElement.normalize = function (opts) {
return new Options(opts);
};
// Applies the plugin to jQuery
function apply($) {
var doc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
$.fn = $.fn || {};
try {
doc = doc || document || window && window.document || global && global.document;
} catch (e) {/* do nothing for now */}
if (!doc) {
throw new Error('Cannot find document implementation. ' + 'If you are in a non-browser environment like Node.js, ' + 'pass the document implementation as the second argument to linkify/jquery');
}
if (typeof $.fn.linkify === 'function') {
// Already applied
return;
}
function jqLinkify(opts) {
opts = linkifyElement.normalize(opts);
return this.each(function () {
linkifyElement.helper(this, opts, doc);
});
}
$.fn.linkify = jqLinkify;
$(doc).ready(function () {
$('[data-linkify]').each(function () {
var $this = $(this);
var data = $this.data();
var target = data.linkify;
var nl2br = data.linkifyNlbr;
var options = {
nl2br: !!nl2br && nl2br !== 0 && nl2br !== 'false'
};
if ('linkifyAttributes' in data) {
options.attributes = data.linkifyAttributes;
}
if ('linkifyDefaultProtocol' in data) {
options.defaultProtocol = data.linkifyDefaultProtocol;
}
if ('linkifyEvents' in data) {
options.events = data.linkifyEvents;
}
if ('linkifyFormat' in data) {
options.format = data.linkifyFormat;
}
if ('linkifyFormatHref' in data) {
options.formatHref = data.linkifyFormatHref;
}
if ('linkifyTagname' in data) {
options.tagName = data.linkifyTagname;
}
if ('linkifyTarget' in data) {
options.target = data.linkifyTarget;
}
if ('linkifyValidate' in data) {
options.validate = data.linkifyValidate;
}
if ('linkifyIgnoreTags' in data) {
options.ignoreTags = data.linkifyIgnoreTags;
}
if ('linkifyClassName' in data) {
options.className = data.linkifyClassName;
} else if ('linkifyLinkclass' in data) {
// linkClass is deprecated
options.className = data.linkifyLinkclass;
}
options = linkifyElement.normalize(options);
var $target = target === 'this' ? $this : $this.find(target);
$target.linkify(options);
});
});
}
// Try assigning linkifyElement to the browser scope
try {
!undefined.define && (window.linkifyElement = linkifyElement);
} catch (e) {/**/}
return apply;
}(linkify);
if (typeof $.fn.linkify !== 'function') {
linkifyJquery($);
}
})(window, linkify, jQuery);

View File

@@ -0,0 +1 @@
"use strict";!function(e,n,t){var i=function(n){function t(e,n,t){var i=t[t.length-1];e.replaceChild(i,n);for(var a=t.length-2;a>=0;a--)e.insertBefore(t[a],i),i=t[a]}function i(e,n,t){for(var i=[],a=e,r=Array.isArray(a),o=0,a=r?a:a[Symbol.iterator]();;){var l;if(r){if(o>=a.length)break;l=a[o++]}else{if(o=a.next(),o.done)break;l=o.value}var f=l;if("nl"===f.type&&n.nl2br)i.push(t.createElement("br"));else if(f.isLink&&n.check(f)){var s=n.resolve(f),c=s.formatted,u=s.formattedHref,y=s.tagName,d=s.className,m=s.target,k=s.events,h=s.attributes,v=t.createElement(y);if(v.setAttribute("href",u),d&&v.setAttribute("class",d),m&&v.setAttribute("target",m),h)for(var g in h)v.setAttribute(g,h[g]);if(k)for(var b in k)v.addEventListener?v.addEventListener(b,k[b]):v.attachEvent&&v.attachEvent("on"+b,k[b]);v.appendChild(t.createTextNode(c)),i.push(v)}else i.push(t.createTextNode(f.toString()))}return i}function a(e,n,r){if(!e||e.nodeType!==u)throw new Error("Cannot linkify "+e+" - Invalid DOM Node type");var o=n.ignoreTags;if("A"===e.tagName||f.contains(o,e.tagName))return e;for(var s=e.firstChild;s;){var d=void 0,m=void 0,k=void 0;switch(s.nodeType){case u:a(s,n,r);break;case y:if(d=s.nodeValue,m=l(d),0===m.length||1===m.length&&m[0]instanceof c)break;k=i(m,n,r),t(e,s,k),s=k[k.length-1]}s=s.nextSibling}return e}function r(n,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{i=i||document||e&&e.document||global&&global.document}catch(r){}if(!i)throw new Error("Cannot find document implementation. If you are in a non-browser environment like Node.js, pass the document implementation as the third argument to linkifyElement.");return t=new s(t),a(n,t,i)}function o(n){function t(e){return e=r.normalize(e),this.each(function(){r.helper(this,e,i)})}var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n.fn=n.fn||{};try{i=i||document||e&&e.document||global&&global.document}catch(a){}if(!i)throw new Error("Cannot find document implementation. If you are in a non-browser environment like Node.js, pass the document implementation as the second argument to linkify/jquery");"function"!=typeof n.fn.linkify&&(n.fn.linkify=t,n(i).ready(function(){n("[data-linkify]").each(function(){var e=n(this),t=e.data(),i=t.linkify,a=t.linkifyNlbr,o={nl2br:!!a&&0!==a&&"false"!==a};"linkifyAttributes"in t&&(o.attributes=t.linkifyAttributes),"linkifyDefaultProtocol"in t&&(o.defaultProtocol=t.linkifyDefaultProtocol),"linkifyEvents"in t&&(o.events=t.linkifyEvents),"linkifyFormat"in t&&(o.format=t.linkifyFormat),"linkifyFormatHref"in t&&(o.formatHref=t.linkifyFormatHref),"linkifyTagname"in t&&(o.tagName=t.linkifyTagname),"linkifyTarget"in t&&(o.target=t.linkifyTarget),"linkifyValidate"in t&&(o.validate=t.linkifyValidate),"linkifyIgnoreTags"in t&&(o.ignoreTags=t.linkifyIgnoreTags),"linkifyClassName"in t?o.className=t.linkifyClassName:"linkifyLinkclass"in t&&(o.className=t.linkifyLinkclass),o=r.normalize(o);var l="this"===i?e:e.find(i);l.linkify(o)})}))}var l=n.tokenize,f=n.options,s=f.Options,c=n.parser.TOKENS.TEXT,u=1,y=3;r.helper=a,r.normalize=function(e){return new s(e)};try{!(void 0).define&&(e.linkifyElement=r)}catch(d){}return o}(n);"function"!=typeof t.fn.linkify&&i(t)}(window,linkify,jQuery);

View File

@@ -0,0 +1,36 @@
define('linkify/plugins/hashtag', ['module', 'exports'], function (module, exports) {
'use strict';
try { try { Object.defineProperty(exports, "__esModule", {
value: true
}); } catch (e) { exports['__esModule'] = true; } } catch (e) { exports['__esModule'] = true; }
exports['default'] = hashtag;
/**
Quick Hashtag parser plugin for linkify
*/
function hashtag(linkify) {
var TT = linkify.scanner.TOKENS; // Text tokens
var MultiToken = linkify.parser.TOKENS.Base; // Base Multi token class
var S_START = linkify.parser.start;
function HASHTAG(value) {
this.v = value;
}
linkify.inherits(MultiToken, HASHTAG, {
type: 'hashtag',
isLink: true
});
var S_HASH = S_START.jump(TT.POUND);
var S_HASHTAG = new linkify.parser.State(HASHTAG);
S_HASH.on(TT.DOMAIN, S_HASHTAG);
S_HASH.on(TT.TLD, S_HASHTAG);
S_HASH.on(TT.LOCALHOST, S_HASHTAG);
}
module.exports = exports['default'];
});
require(['linkify', 'linkify/plugins/hashtag'], function (linkify, hashtag) {
hashtag(linkify);
});

View File

@@ -0,0 +1 @@
define("linkify/plugins/hashtag",["module","exports"],function(e,t){"use strict";function n(e){function t(e){this.v=e}var n=e.scanner.TOKENS,i=e.parser.TOKENS.Base,s=e.parser.start;e.inherits(i,t,{type:"hashtag",isLink:!0});var a=s.jump(n.POUND),r=new e.parser.State(t);a.on(n.DOMAIN,r),a.on(n.TLD,r),a.on(n.LOCALHOST,r)}try{try{Object.defineProperty(t,"__esModule",{value:!0})}catch(i){t.__esModule=!0}}catch(i){t.__esModule=!0}t["default"]=n,e.exports=t["default"]}),require(["linkify","linkify/plugins/hashtag"],function(e,t){t(e)});

View File

@@ -0,0 +1,37 @@
'use strict';
;(function (linkify) {
var plugin = function () {
'use strict';
/**
Quick Hashtag parser plugin for linkify
*/
function hashtag(linkify) {
var TT = linkify.scanner.TOKENS; // Text tokens
var MultiToken = linkify.parser.TOKENS.Base; // Base Multi token class
var S_START = linkify.parser.start;
function HASHTAG(value) {
this.v = value;
}
linkify.inherits(MultiToken, HASHTAG, {
type: 'hashtag',
isLink: true
});
var S_HASH = S_START.jump(TT.POUND);
var S_HASHTAG = new linkify.parser.State(HASHTAG);
S_HASH.on(TT.DOMAIN, S_HASHTAG);
S_HASH.on(TT.TLD, S_HASHTAG);
S_HASH.on(TT.LOCALHOST, S_HASHTAG);
}
return hashtag;
}();
plugin(linkify);
})(linkify);

View File

@@ -0,0 +1 @@
"use strict";!function(n){var r=function(){function n(n){function r(n){this.v=n}var t=n.scanner.TOKENS,a=n.parser.TOKENS.Base,i=n.parser.start;n.inherits(a,r,{type:"hashtag",isLink:!0});var s=i.jump(t.POUND),e=new n.parser.State(r);s.on(t.DOMAIN,e),s.on(t.TLD,e),s.on(t.LOCALHOST,e)}return n}();r(n)}(linkify);

View File

@@ -0,0 +1,77 @@
define('linkify/plugins/mention', ['module', 'exports'], function (module, exports) {
'use strict';
try { try { Object.defineProperty(exports, "__esModule", {
value: true
}); } catch (e) { exports['__esModule'] = true; } } catch (e) { exports['__esModule'] = true; }
exports['default'] = mention;
/**
Mention parser plugin for linkify
*/
function mention(linkify) {
var TT = linkify.scanner.TOKENS; // Text tokens
var _linkify$parser = linkify.parser,
MT = _linkify$parser.TOKENS,
State = _linkify$parser.State;
// Multi tokens, state
var MultiToken = MT.Base;
var S_START = linkify.parser.start;
var TT_DOMAIN = TT.DOMAIN;
var TT_LOCALHOST = TT.LOCALHOST;
var TT_NUM = TT.NUM;
var TT_SLASH = TT.SLASH;
var TT_TLD = TT.TLD;
var TT_UNDERSCORE = TT.UNDERSCORE;
var TT_DOT = TT.DOT;
var TT_AT = TT.AT;
function MENTION(value) {
this.v = value;
}
linkify.inherits(MultiToken, MENTION, {
type: 'mention',
isLink: true,
toHref: function toHref() {
return '/' + this.toString().substr(1);
}
});
var S_AT = S_START.jump(TT.AT); // @
var S_AT_SYMS = new State();
var S_MENTION = new State(MENTION);
var S_MENTION_DIVIDER = new State();
var S_MENTION_DIVIDER_SYMS = new State();
// @_,
S_AT.on(TT_UNDERSCORE, S_AT_SYMS);
// @_*
S_AT_SYMS.on(TT_UNDERSCORE, S_AT_SYMS).on(TT_DOT, S_AT_SYMS);
// Valid mention (not made up entirely of symbols)
S_AT.on(TT_DOMAIN, S_MENTION).on(TT_LOCALHOST, S_MENTION).on(TT_TLD, S_MENTION).on(TT_NUM, S_MENTION);
S_AT_SYMS.on(TT_DOMAIN, S_MENTION).on(TT_LOCALHOST, S_MENTION).on(TT_TLD, S_MENTION).on(TT_NUM, S_MENTION);
// More valid mentions
S_MENTION.on(TT_DOMAIN, S_MENTION).on(TT_LOCALHOST, S_MENTION).on(TT_TLD, S_MENTION).on(TT_NUM, S_MENTION).on(TT_UNDERSCORE, S_MENTION);
// Mention with a divider
S_MENTION.on(TT_SLASH, S_MENTION_DIVIDER).on(TT_DOT, S_MENTION_DIVIDER).on(TT_AT, S_MENTION_DIVIDER);
// Mention _ trailing stash plus syms
S_MENTION_DIVIDER.on(TT_UNDERSCORE, S_MENTION_DIVIDER_SYMS);
S_MENTION_DIVIDER_SYMS.on(TT_UNDERSCORE, S_MENTION_DIVIDER_SYMS);
// Once we get a word token, mentions can start up again
S_MENTION_DIVIDER.on(TT_DOMAIN, S_MENTION).on(TT_LOCALHOST, S_MENTION).on(TT_TLD, S_MENTION).on(TT_NUM, S_MENTION);
S_MENTION_DIVIDER_SYMS.on(TT_DOMAIN, S_MENTION).on(TT_LOCALHOST, S_MENTION).on(TT_TLD, S_MENTION).on(TT_NUM, S_MENTION);
}
module.exports = exports['default'];
});
require(['linkify', 'linkify/plugins/mention'], function (linkify, mention) {
mention(linkify);
});

View File

@@ -0,0 +1 @@
define("linkify/plugins/mention",["module","exports"],function(n,o){"use strict";function e(n){function o(n){this.v=n}var e=n.scanner.TOKENS,t=n.parser,i=t.TOKENS,r=t.State,s=i.Base,u=n.parser.start,a=e.DOMAIN,f=e.LOCALHOST,c=e.NUM,l=e.SLASH,p=e.TLD,d=e.UNDERSCORE,O=e.DOT,S=e.AT;n.inherits(s,o,{type:"mention",isLink:!0,toHref:function(){return"/"+this.toString().substr(1)}});var y=u.jump(e.AT),T=new r,_=new r(o),h=new r,m=new r;y.on(d,T),T.on(d,T).on(O,T),y.on(a,_).on(f,_).on(p,_).on(c,_),T.on(a,_).on(f,_).on(p,_).on(c,_),_.on(a,_).on(f,_).on(p,_).on(c,_).on(d,_),_.on(l,h).on(O,h).on(S,h),h.on(d,m),m.on(d,m),h.on(a,_).on(f,_).on(p,_).on(c,_),m.on(a,_).on(f,_).on(p,_).on(c,_)}try{try{Object.defineProperty(o,"__esModule",{value:!0})}catch(t){o.__esModule=!0}}catch(t){o.__esModule=!0}o["default"]=e,n.exports=o["default"]}),require(["linkify","linkify/plugins/mention"],function(n,o){o(n)});

View File

@@ -0,0 +1,78 @@
'use strict';
;(function (linkify) {
var plugin = function () {
'use strict';
/**
Mention parser plugin for linkify
*/
function mention(linkify) {
var TT = linkify.scanner.TOKENS; // Text tokens
var _linkify$parser = linkify.parser,
MT = _linkify$parser.TOKENS,
State = _linkify$parser.State; // Multi tokens, state
var MultiToken = MT.Base;
var S_START = linkify.parser.start;
var TT_DOMAIN = TT.DOMAIN;
var TT_LOCALHOST = TT.LOCALHOST;
var TT_NUM = TT.NUM;
var TT_SLASH = TT.SLASH;
var TT_TLD = TT.TLD;
var TT_UNDERSCORE = TT.UNDERSCORE;
var TT_DOT = TT.DOT;
var TT_AT = TT.AT;
function MENTION(value) {
this.v = value;
}
linkify.inherits(MultiToken, MENTION, {
type: 'mention',
isLink: true,
toHref: function toHref() {
return '/' + this.toString().substr(1);
}
});
var S_AT = S_START.jump(TT.AT); // @
var S_AT_SYMS = new State();
var S_MENTION = new State(MENTION);
var S_MENTION_DIVIDER = new State();
var S_MENTION_DIVIDER_SYMS = new State();
// @_,
S_AT.on(TT_UNDERSCORE, S_AT_SYMS);
// @_*
S_AT_SYMS.on(TT_UNDERSCORE, S_AT_SYMS).on(TT_DOT, S_AT_SYMS);
// Valid mention (not made up entirely of symbols)
S_AT.on(TT_DOMAIN, S_MENTION).on(TT_LOCALHOST, S_MENTION).on(TT_TLD, S_MENTION).on(TT_NUM, S_MENTION);
S_AT_SYMS.on(TT_DOMAIN, S_MENTION).on(TT_LOCALHOST, S_MENTION).on(TT_TLD, S_MENTION).on(TT_NUM, S_MENTION);
// More valid mentions
S_MENTION.on(TT_DOMAIN, S_MENTION).on(TT_LOCALHOST, S_MENTION).on(TT_TLD, S_MENTION).on(TT_NUM, S_MENTION).on(TT_UNDERSCORE, S_MENTION);
// Mention with a divider
S_MENTION.on(TT_SLASH, S_MENTION_DIVIDER).on(TT_DOT, S_MENTION_DIVIDER).on(TT_AT, S_MENTION_DIVIDER);
// Mention _ trailing stash plus syms
S_MENTION_DIVIDER.on(TT_UNDERSCORE, S_MENTION_DIVIDER_SYMS);
S_MENTION_DIVIDER_SYMS.on(TT_UNDERSCORE, S_MENTION_DIVIDER_SYMS);
// Once we get a word token, mentions can start up again
S_MENTION_DIVIDER.on(TT_DOMAIN, S_MENTION).on(TT_LOCALHOST, S_MENTION).on(TT_TLD, S_MENTION).on(TT_NUM, S_MENTION);
S_MENTION_DIVIDER_SYMS.on(TT_DOMAIN, S_MENTION).on(TT_LOCALHOST, S_MENTION).on(TT_TLD, S_MENTION).on(TT_NUM, S_MENTION);
}
return mention;
}();
plugin(linkify);
})(window.linkify);

View File

@@ -0,0 +1 @@
"use strict";!function(n){var o=function(){function n(n){function o(n){this.v=n}var t=n.scanner.TOKENS,r=n.parser,i=r.TOKENS,e=r.State,s=i.Base,u=n.parser.start,a=t.DOMAIN,S=t.LOCALHOST,c=t.NUM,f=t.SLASH,O=t.TLD,T=t.UNDERSCORE,w=t.DOT,A=t.AT;n.inherits(s,o,{type:"mention",isLink:!0,toHref:function(){return"/"+this.toString().substr(1)}});var L=u.jump(t.AT),N=new e,p=new e(o),v=new e,D=new e;L.on(T,N),N.on(T,N).on(w,N),L.on(a,p).on(S,p).on(O,p).on(c,p),N.on(a,p).on(S,p).on(O,p).on(c,p),p.on(a,p).on(S,p).on(O,p).on(c,p).on(T,p),p.on(f,v).on(w,v).on(A,v),v.on(T,D),D.on(T,D),v.on(a,p).on(S,p).on(O,p).on(c,p),D.on(a,p).on(S,p).on(O,p).on(c,p)}return n}();o(n)}(window.linkify);

View File

@@ -0,0 +1,36 @@
define('linkify/plugins/ticket', ['module', 'exports'], function (module, exports) {
'use strict';
try { try { Object.defineProperty(exports, "__esModule", {
value: true
}); } catch (e) { exports['__esModule'] = true; } } catch (e) { exports['__esModule'] = true; }
exports['default'] = ticket;
/**
Ticket number detector
TODO: Add cross-repo style tickets? e.g., SoapBox/linkifyjs#42
Is that even feasible?
*/
function ticket(linkify) {
var TT = linkify.scanner.TOKENS; // Base Multi token class
var MultiToken = linkify.parser.TOKENS.Base;
var S_START = linkify.parser.start;
function TICKET(value) {
this.v = value;
}
linkify.inherits(MultiToken, TICKET, {
type: 'ticket',
isLink: true
});
var S_HASH = S_START.jump(TT.POUND);
var S_TICKET = new linkify.parser.State(TICKET);
S_HASH.on(TT.NUM, S_TICKET);
}
module.exports = exports['default'];
});
require(['linkify', 'linkify/plugins/ticket'], function (linkify, ticket) {
ticket(linkify);
});

View File

@@ -0,0 +1 @@
define("linkify/plugins/ticket",["module","exports"],function(e,t){"use strict";function i(e){function t(e){this.v=e}var i=e.scanner.TOKENS,n=e.parser.TOKENS.Base,r=e.parser.start;e.inherits(n,t,{type:"ticket",isLink:!0});var s=r.jump(i.POUND),u=new e.parser.State(t);s.on(i.NUM,u)}try{try{Object.defineProperty(t,"__esModule",{value:!0})}catch(n){t.__esModule=!0}}catch(n){t.__esModule=!0}t["default"]=i,e.exports=t["default"]}),require(["linkify","linkify/plugins/ticket"],function(e,t){t(e)});

View File

@@ -0,0 +1,37 @@
'use strict';
;(function (linkify) {
var plugin = function () {
'use strict';
/**
Ticket number detector
TODO: Add cross-repo style tickets? e.g., SoapBox/linkifyjs#42
Is that even feasible?
*/
function ticket(linkify) {
var TT = linkify.scanner.TOKENS; // Base Multi token class
var MultiToken = linkify.parser.TOKENS.Base;
var S_START = linkify.parser.start;
function TICKET(value) {
this.v = value;
}
linkify.inherits(MultiToken, TICKET, {
type: 'ticket',
isLink: true
});
var S_HASH = S_START.jump(TT.POUND);
var S_TICKET = new linkify.parser.State(TICKET);
S_HASH.on(TT.NUM, S_TICKET);
}
return ticket;
}();
plugin(linkify);
})(linkify);

View File

@@ -0,0 +1 @@
"use strict";!function(n){var t=function(){function n(n){function t(n){this.v=n}var r=n.scanner.TOKENS,i=n.parser.TOKENS.Base,e=n.parser.start;n.inherits(i,t,{type:"ticket",isLink:!0});var s=e.jump(r.POUND),a=new n.parser.State(t);s.on(r.NUM,a)}return n}();t(n)}(linkify);

View File

@@ -0,0 +1,60 @@
(function () {
if (typeof Object.freeze != 'function') {
Object.freeze = function (obj) { return obj; }
}
if (typeof Object.create != 'function') {
Object.create = (function() {
var Temp = function() {};
return function (prototype) {
if(prototype !== Object(prototype) && prototype !== null) {
throw TypeError('Argument must be an object or null');
}
if (prototype === null) {
throw Error('null [[Prototype]] not supported');
}
Temp.prototype = prototype;
var result = new Temp();
Temp.prototype = null;
return result;
};
})();
}
if (typeof Object.defineProperty != 'function') {
Object.defineProperty = function defineProperty(object, property, descriptor) {
if ('value' in descriptor) {
object[property] = descriptor.value;
}
return object;
};
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement, fromIndex) {
var k;
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
var len = o.length >>> 0;
if (len === 0) {
return -1;
}
var n = +fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
if (n >= len) {
return -1;
}
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
while (k < len) {
if (k in o && o[k] === searchElement) {
return k;
}
k++;
}
return -1;
};
}
})();

View File

@@ -0,0 +1 @@
!function(){"function"!=typeof Object.freeze&&(Object.freeze=function(t){return t}),"function"!=typeof Object.create&&(Object.create=function(){var t=function(){};return function(e){if(e!==Object(e)&&null!==e)throw TypeError("Argument must be an object or null");if(null===e)throw Error("null [[Prototype]] not supported");t.prototype=e;var r=new t;return t.prototype=null,r}}()),"function"!=typeof Object.defineProperty&&(Object.defineProperty=function(t,e,r){return"value"in r&&(t[e]=r.value),t}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){var r;if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),o=n.length>>>0;if(0===o)return-1;var u=+e||0;if(Math.abs(u)===1/0&&(u=0),u>=o)return-1;for(r=Math.max(u>=0?u:o-Math.abs(u),0);r<o;){if(r in n&&n[r]===t)return r;r++}return-1})}();

View File

@@ -0,0 +1,192 @@
define('linkify-react', ['module', 'exports', 'react', './linkify'], function (module, exports, _react, _linkify) {
'use strict';
try { try { Object.defineProperty(exports, "__esModule", {
value: true
}); } catch (e) { exports['__esModule'] = true; } } catch (e) { exports['__esModule'] = true; }
var _react2 = _interopRequireDefault(_react);
var linkify = _interopRequireWildcard(_linkify);
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
}
}
newObj['default'] = obj;
return newObj;
}
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
'default': obj
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var options = linkify.options;
var Options = options.Options;
// Given a string, converts to an array of valid React components
// (which may include strings)
function stringToElements(str, opts) {
var tokens = linkify.tokenize(str);
var elements = [];
var linkId = 0;
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
if (token.type === 'nl' && opts.nl2br) {
elements.push(_react2['default'].createElement('br', { key: 'linkified-' + ++linkId }));
continue;
} else if (!token.isLink || !opts.check(token)) {
// Regular text
elements.push(token.toString());
continue;
}
var _opts$resolve = opts.resolve(token),
formatted = _opts$resolve.formatted,
formattedHref = _opts$resolve.formattedHref,
tagName = _opts$resolve.tagName,
className = _opts$resolve.className,
target = _opts$resolve.target,
attributes = _opts$resolve.attributes;
var props = {
key: 'linkified-' + ++linkId,
href: formattedHref
};
if (className) {
props.className = className;
}
if (target) {
props.target = target;
}
// Build up additional attributes
// Support for events via attributes hash
if (attributes) {
for (var attr in attributes) {
props[attr] = attributes[attr];
}
}
elements.push(_react2['default'].createElement(tagName, props, formatted));
}
return elements;
}
// Recursively linkify the contents of the given React Element instance
function linkifyReactElement(element, opts) {
var elementId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
if (_react2['default'].Children.count(element.props.children) === 0) {
// No need to clone if the element had no children
return element;
}
var children = [];
_react2['default'].Children.forEach(element.props.children, function (child) {
if (typeof child === 'string') {
// ensure that we always generate unique element IDs for keys
elementId = elementId + 1;
children.push.apply(children, stringToElements(child, opts));
} else if (_react2['default'].isValidElement(child)) {
if (typeof child.type === 'string' && options.contains(opts.ignoreTags, child.type.toUpperCase())) {
// Don't linkify this element
children.push(child);
} else {
children.push(linkifyReactElement(child, opts, ++elementId));
}
} else {
// Unknown element type, just push
children.push(child);
}
});
// Set a default unique key, copy over remaining props
var newProps = { key: 'linkified-element-' + elementId };
for (var prop in element.props) {
newProps[prop] = element.props[prop];
}
return _react2['default'].cloneElement(element, newProps, children);
}
var Linkify = function (_React$Component) {
_inherits(Linkify, _React$Component);
function Linkify() {
_classCallCheck(this, Linkify);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
Linkify.prototype.render = function render() {
// Copy over all non-linkify-specific props
var newProps = { key: 'linkified-element-0' };
for (var prop in this.props) {
if (prop !== 'options' && prop !== 'tagName') {
newProps[prop] = this.props[prop];
}
}
var opts = new Options(this.props.options);
var tagName = this.props.tagName || 'span';
var element = _react2['default'].createElement(tagName, newProps);
return linkifyReactElement(element, opts, 0);
};
return Linkify;
}(_react2['default'].Component);
exports['default'] = Linkify;
module.exports = exports['default'];
});

View File

@@ -0,0 +1 @@
define("linkify-react",["module","exports","react","./linkify"],function(e,t,r,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,a:!1,b:!0,c:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){for(var r=d.tokenize(e),n=[],o=0,i=0;i<r.length;i++){var a=r[i];if("nl"===a.type&&t.nl2br)n.push(c["default"].createElement("br",{key:"linkified-"+ ++o}));else if(a.isLink&&t.check(a)){var s=t.resolve(a),f=s.formatted,l=s.formattedHref,p=s.tagName,u=s.className,h=s.target,y=s.attributes,v={key:"linkified-"+ ++o,href:l};if(u&&(v.className=u),h&&(v.target=h),y)for(var m in y)v[m]=y[m];n.push(c["default"].createElement(p,v,f))}else n.push(a.toString())}return n}function p(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0===c["default"].Children.count(e.props.children))return e;var n=[];c["default"].Children.forEach(e.props.children,function(e){"string"==typeof e?(r+=1,n.push.apply(n,l(e,t))):c["default"].isValidElement(e)?"string"==typeof e.type&&h.contains(t.ignoreTags,e.type.toUpperCase())?n.push(e):n.push(p(e,t,++r)):n.push(e)});var o={key:"linkified-element-"+r};for(var i in e.props)o[i]=e.props[i];return c["default"].cloneElement(e,o,n)}try{try{Object.defineProperty(t,"__esModule",{value:!0})}catch(u){t.__esModule=!0}}catch(u){t.__esModule=!0}var c=i(r),d=o(n),h=d.options,y=h.Options,v=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return f(t,e),t.prototype.render=function(){var e={key:"linkified-element-0"};for(var t in this.props)"options"!==t&&"tagName"!==t&&(e[t]=this.props[t]);var r=new y(this.props.options),n=this.props.tagName||"span",o=c["default"].createElement(n,e);return p(o,r,0)},t}(c["default"].Component);t["default"]=v,e.exports=t["default"]});

View File

@@ -0,0 +1,144 @@
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
;(function (window, React, linkify) {
var linkifyReact = function (React, linkify) {
'use strict';
React = 'default' in React ? React['default'] : React;
var options = linkify.options;
var Options = options.Options;
// Given a string, converts to an array of valid React components
// (which may include strings)
function stringToElements(str, opts) {
var tokens = linkify.tokenize(str);
var elements = [];
var linkId = 0;
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
if (token.type === 'nl' && opts.nl2br) {
elements.push(React.createElement('br', { key: 'linkified-' + ++linkId }));
continue;
} else if (!token.isLink || !opts.check(token)) {
// Regular text
elements.push(token.toString());
continue;
}
var _opts$resolve = opts.resolve(token),
formatted = _opts$resolve.formatted,
formattedHref = _opts$resolve.formattedHref,
tagName = _opts$resolve.tagName,
className = _opts$resolve.className,
target = _opts$resolve.target,
attributes = _opts$resolve.attributes;
var props = {
key: 'linkified-' + ++linkId,
href: formattedHref
};
if (className) {
props.className = className;
}
if (target) {
props.target = target;
}
// Build up additional attributes
// Support for events via attributes hash
if (attributes) {
for (var attr in attributes) {
props[attr] = attributes[attr];
}
}
elements.push(React.createElement(tagName, props, formatted));
}
return elements;
}
// Recursively linkify the contents of the given React Element instance
function linkifyReactElement(element, opts) {
var elementId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
if (React.Children.count(element.props.children) === 0) {
// No need to clone if the element had no children
return element;
}
var children = [];
React.Children.forEach(element.props.children, function (child) {
if (typeof child === 'string') {
// ensure that we always generate unique element IDs for keys
elementId = elementId + 1;
children.push.apply(children, stringToElements(child, opts));
} else if (React.isValidElement(child)) {
if (typeof child.type === 'string' && options.contains(opts.ignoreTags, child.type.toUpperCase())) {
// Don't linkify this element
children.push(child);
} else {
children.push(linkifyReactElement(child, opts, ++elementId));
}
} else {
// Unknown element type, just push
children.push(child);
}
});
// Set a default unique key, copy over remaining props
var newProps = { key: 'linkified-element-' + elementId };
for (var prop in element.props) {
newProps[prop] = element.props[prop];
}
return React.cloneElement(element, newProps, children);
}
var Linkify = function (_React$Component) {
_inherits(Linkify, _React$Component);
function Linkify() {
_classCallCheck(this, Linkify);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
Linkify.prototype.render = function render() {
// Copy over all non-linkify-specific props
var newProps = { key: 'linkified-element-0' };
for (var prop in this.props) {
if (prop !== 'options' && prop !== 'tagName') {
newProps[prop] = this.props[prop];
}
}
var opts = new Options(this.props.options);
var tagName = this.props.tagName || 'span';
var element = React.createElement(tagName, newProps);
return linkifyReactElement(element, opts, 0);
};
return Linkify;
}(React.Component);
return Linkify;
}(React, linkify);
window.Linkify = window.LinkifyReact = linkifyReact;
})(window, React, linkify);

View File

@@ -0,0 +1 @@
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,a:!1,b:!0,c:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}!function(e,t,n){var r=function(e,t){function n(n,r){for(var i=t.tokenize(n),o=[],s=0,a=0;a<i.length;a++){var p=i[a];if("nl"===p.type&&r.nl2br)o.push(e.createElement("br",{key:"linkified-"+ ++s}));else if(p.isLink&&r.check(p)){var c=r.resolve(p),f=c.formatted,l=c.formattedHref,u=c.tagName,h=c.className,y=c.target,d=c.attributes,k={key:"linkified-"+ ++s,href:l};if(h&&(k.className=h),y&&(k.target=y),d)for(var m in d)k[m]=d[m];o.push(e.createElement(u,k,f))}else o.push(p.toString())}return o}function r(t,o){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0===e.Children.count(t.props.children))return t;var a=[];e.Children.forEach(t.props.children,function(t){"string"==typeof t?(s+=1,a.push.apply(a,n(t,o))):e.isValidElement(t)?"string"==typeof t.type&&i.contains(o.ignoreTags,t.type.toUpperCase())?a.push(t):a.push(r(t,o,++s)):a.push(t)});var p={key:"linkified-element-"+s};for(var c in t.props)p[c]=t.props[c];return e.cloneElement(t,p,a)}e="default"in e?e["default"]:e;var i=t.options,o=i.Options,s=function(t){function n(){return _classCallCheck(this,n),_possibleConstructorReturn(this,t.apply(this,arguments))}return _inherits(n,t),n.prototype.render=function(){var t={key:"linkified-element-0"};for(var n in this.props)"options"!==n&&"tagName"!==n&&(t[n]=this.props[n]);var i=new o(this.props.options),s=this.props.tagName||"span",a=e.createElement(s,t);return r(a,i,0)},n}(e.Component);return s}(t,n);e.Linkify=e.LinkifyReact=r}(window,React,linkify);

View File

@@ -0,0 +1,123 @@
define('linkify-string', ['module', 'exports', './linkify'], function (module, exports, _linkify) {
'use strict';
try { try { Object.defineProperty(exports, "__esModule", {
value: true
}); } catch (e) { exports['__esModule'] = true; } } catch (e) { exports['__esModule'] = true; }
var linkify = _interopRequireWildcard(_linkify);
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
}
}
newObj['default'] = obj;
return newObj;
}
}
var tokenize = linkify.tokenize,
options = linkify.options;
var Options = options.Options;
function escapeText(text) {
return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
function escapeAttr(href) {
return href.replace(/"/g, '&quot;');
}
function attributesToString(attributes) {
if (!attributes) {
return '';
}
var result = [];
for (var attr in attributes) {
var val = attributes[attr] + '';
result.push(attr + '="' + escapeAttr(val) + '"');
}
return result.join(' ');
}
function linkifyStr(str) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
opts = new Options(opts);
var tokens = tokenize(str);
var result = [];
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
if (token.type === 'nl' && opts.nl2br) {
result.push('<br>\n');
continue;
} else if (!token.isLink || !opts.check(token)) {
result.push(escapeText(token.toString()));
continue;
}
var _opts$resolve = opts.resolve(token),
formatted = _opts$resolve.formatted,
formattedHref = _opts$resolve.formattedHref,
tagName = _opts$resolve.tagName,
className = _opts$resolve.className,
target = _opts$resolve.target,
attributes = _opts$resolve.attributes;
var link = '<' + tagName + ' href="' + escapeAttr(formattedHref) + '"';
if (className) {
link += ' class="' + escapeAttr(className) + '"';
}
if (target) {
link += ' target="' + escapeAttr(target) + '"';
}
if (attributes) {
link += ' ' + attributesToString(attributes);
}
link += '>' + escapeText(formatted) + '</' + tagName + '>';
result.push(link);
}
return result.join('');
}
if (!String.prototype.linkify) {
try {
Object.defineProperty(String.prototype, 'linkify', {
set: function set() {},
get: function get() {
return function linkify(opts) {
return linkifyStr(this, opts);
};
}
});
} catch (e) {
// IE 8 doesn't like Object.defineProperty on non-DOM objects
if (!String.prototype.linkify) {
String.prototype.linkify = function (opts) {
return linkifyStr(this, opts);
};
}
}
}
exports['default'] = linkifyStr;
module.exports = exports['default'];
});

View File

@@ -0,0 +1 @@
define("linkify-string",["module","exports","./linkify"],function(t,e,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e["default"]=t,e}function i(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function o(t){return t.replace(/"/g,"&quot;")}function u(t){if(!t)return"";var e=[];for(var r in t){var n=t[r]+"";e.push(r+'="'+o(n)+'"')}return e.join(" ")}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=new s(e);for(var r=c(t),n=[],a=0;a<r.length;a++){var f=r[a];if("nl"===f.type&&e.nl2br)n.push("<br>\n");else if(f.isLink&&e.check(f)){var l=e.resolve(f),p=l.formatted,y=l.formattedHref,g=l.tagName,d=l.className,h=l.target,v=l.attributes,k="<"+g+' href="'+o(y)+'"';d&&(k+=' class="'+o(d)+'"'),h&&(k+=' target="'+o(h)+'"'),v&&(k+=" "+u(v)),k+=">"+i(p)+"</"+g+">",n.push(k)}else n.push(i(f.toString()))}return n.join("")}try{try{Object.defineProperty(e,"__esModule",{value:!0})}catch(f){e.__esModule=!0}}catch(f){e.__esModule=!0}var l=n(r),c=l.tokenize,p=l.options,s=p.Options;if(!String.prototype.linkify)try{Object.defineProperty(String.prototype,"linkify",{a:function(){},get:function(){return function(t){return a(this,t)}}})}catch(f){String.prototype.linkify||(String.prototype.linkify=function(t){return a(this,t)})}e["default"]=a,t.exports=e["default"]});

View File

@@ -0,0 +1,109 @@
'use strict';
;(function (window, linkify) {
var linkifyString = function (linkify) {
'use strict';
/**
Convert strings of text into linkable HTML text
*/
var tokenize = linkify.tokenize,
options = linkify.options;
var Options = options.Options;
function escapeText(text) {
return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
function escapeAttr(href) {
return href.replace(/"/g, '&quot;');
}
function attributesToString(attributes) {
if (!attributes) {
return '';
}
var result = [];
for (var attr in attributes) {
var val = attributes[attr] + '';
result.push(attr + '="' + escapeAttr(val) + '"');
}
return result.join(' ');
}
function linkifyStr(str) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
opts = new Options(opts);
var tokens = tokenize(str);
var result = [];
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
if (token.type === 'nl' && opts.nl2br) {
result.push('<br>\n');
continue;
} else if (!token.isLink || !opts.check(token)) {
result.push(escapeText(token.toString()));
continue;
}
var _opts$resolve = opts.resolve(token),
formatted = _opts$resolve.formatted,
formattedHref = _opts$resolve.formattedHref,
tagName = _opts$resolve.tagName,
className = _opts$resolve.className,
target = _opts$resolve.target,
attributes = _opts$resolve.attributes;
var link = '<' + tagName + ' href="' + escapeAttr(formattedHref) + '"';
if (className) {
link += ' class="' + escapeAttr(className) + '"';
}
if (target) {
link += ' target="' + escapeAttr(target) + '"';
}
if (attributes) {
link += ' ' + attributesToString(attributes);
}
link += '>' + escapeText(formatted) + '</' + tagName + '>';
result.push(link);
}
return result.join('');
}
if (!String.prototype.linkify) {
try {
Object.defineProperty(String.prototype, 'linkify', {
set: function set() {},
get: function get() {
return function linkify$$1(opts) {
return linkifyStr(this, opts);
};
}
});
} catch (e) {
// IE 8 doesn't like Object.defineProperty on non-DOM objects
if (!String.prototype.linkify) {
String.prototype.linkify = function (opts) {
return linkifyStr(this, opts);
};
}
}
}
return linkifyStr;
}(linkify);
window.linkifyStr = linkifyString;
})(window, linkify);

View File

@@ -0,0 +1 @@
"use strict";!function(t,r){var n=function(t){function r(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n(t){return t.replace(/"/g,"&quot;")}function e(t){if(!t)return"";var r=[];for(var e in t){var i=t[e]+"";r.push(e+'="'+n(i)+'"')}return r.join(" ")}function i(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i=new a(i);for(var f=o(t),u=[],c=0;c<f.length;c++){var p=f[c];if("nl"===p.type&&i.nl2br)u.push("<br>\n");else if(p.isLink&&i.check(p)){var l=i.resolve(p),s=l.formatted,g=l.formattedHref,y=l.tagName,h=l.className,v=l.target,k=l.attributes,S="<"+y+' href="'+n(g)+'"';h&&(S+=' class="'+n(h)+'"'),v&&(S+=' target="'+n(v)+'"'),k&&(S+=" "+e(k)),S+=">"+r(s)+"</"+y+">",u.push(S)}else u.push(r(p.toString()))}return u.join("")}var o=t.tokenize,f=t.options,a=f.Options;if(!String.prototype.linkify)try{Object.defineProperty(String.prototype,"linkify",{a:function(){},get:function(){return function(t){return i(this,t)}}})}catch(u){String.prototype.linkify||(String.prototype.linkify=function(t){return i(this,t)})}return i}(r);t.linkifyStr=n}(window,linkify);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
web/assets/linkifyjs/linkify.min.js vendored Normal file

File diff suppressed because one or more lines are too long