-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkify-jquery.min.js
1 lines (1 loc) · 2.77 KB
/
linkify-jquery.min.js
1
"use strict";!function(e,t,n){var i=function(t,n){function i(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 r(e,t,n){for(var i=[],r=0;r<e.length;r++){var o=e[r],a=o.isLink&&s.resolve(t.validate,o.toString(),o.type);if(o.isLink&&a){var l=o.toHref(t.defaultProtocol),f=s.resolve(t.format,o.toString(),o.type),u=s.resolve(t.formatHref,l,o.type),c=s.resolve(t.attributes,l,o.type),y=s.resolve(t.tagName,l,o.type),d=s.resolve(t.linkClass,l,o.type),m=s.resolve(t.target,l,o.type),v=s.resolve(t.events,l,o.type),h=n.createElement(y);if(h.setAttribute("href",u),h.setAttribute("class",d),m&&h.setAttribute("target",m),c)for(var k in c)h.setAttribute(k,c[k]);if(v)for(var g in v)h.addEventListener?h.addEventListener(g,v[g]):h.attachEvent&&h.attachEvent("on"+g,v[g]);h.appendChild(n.createTextNode(f)),i.push(h)}else"nl"===o.type&&t.nl2br?i.push(n.createElement("br")):i.push(n.createTextNode(o.toString()))}return i}function o(e,t,n){if(!e||e.nodeType!==u)throw new Error("Cannot linkify "+e+" - Invalid DOM Node type");var a=t.ignoreTags;if("A"===e.tagName||s.contains(a,e.tagName))return e;for(var l=e.firstChild;l;){switch(l.nodeType){case u:o(l,t,n);break;case c:var y=l.nodeValue,d=f(y),m=r(d,t,n);i(e,l,m),l=m[m.length-1]}l=l.nextSibling}return e}function a(t,n){var i=arguments.length<=2||void 0===arguments[2]?null:arguments[2];try{i=i||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 n=s.normalize(n),o(t,n,i)}function l(t){function n(e){return e=a.normalize(e),this.each(function(){a.helper(this,e,i)})}var i=arguments.length<=1||void 0===arguments[1]?null:arguments[1];t.fn=t.fn||{};try{i=i||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 second argument to linkify/jquery");"function"!=typeof t.fn.linkify&&(t.fn.linkify=n,t(i).ready(function(){t("[data-linkify]").each(function(){var e=t(this),n=e.data(),i=n.linkify,r=n.linkifyNlbr,o={linkAttributes:n.linkifyAttributes,defaultProtocol:n.linkifyDefaultProtocol,events:n.linkifyEvents,format:n.linkifyFormat,formatHref:n.linkifyFormatHref,newLine:n.linkifyNewline,nl2br:!!r&&0!==r&&"false"!==r,tagName:n.linkifyTagname,target:n.linkifyTarget,linkClass:n.linkifyLinkclass,validate:n.linkifyValidate,ignoreTags:n.linkifyIgnoreTags},a="this"===i?e:e.find(i);a.linkify(o)})}))}var f=n.tokenize,s=n.options,u=1,c=3;a.helper=o,a.normalize=s.normalize;try{e.linkifyElement=a}catch(y){}return l}(n,t);"function"!=typeof n.fn.linkify&&i(n)}(window,linkify,jQuery);