jonnybarnes.uk/public/assets/frontend/Autolinker.min.js

10 lines
31 KiB
JavaScript
Raw Normal View History

/*!
* Autolinker.js
Squashed commit of the following: commit bb79d80d284bf22ae17857b37630d3075635057e Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Mon Dec 5 11:06:53 2016 +0000 Update changelog regarding Makefile commit d74d0ac99da0b898d1a08ed270629bb00b492e34 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Dec 4 19:24:09 2016 +0000 make output commit 5c7ad5830ec881a5c22bd737cac1ec3430577eb3 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Dec 4 19:22:25 2016 +0000 Remove gulp commit 160947dcd346d3c0016a15fe3b64d6f194d33bfc Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Dec 4 19:10:57 2016 +0000 Updated fetch dependency commit 25b8f300d93c3e6e129c7ac6ab31e85c12cebc6a Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Dec 4 18:45:21 2016 +0000 Copy frontend assets into place commit 65b02a14e98215899efc4f5673953bdf23f4c942 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Dec 4 18:40:28 2016 +0000 Add the target file for `sass`, and set the scss files as the prerequisits commit 7442df5040ac1459d5f088690390ef043f968852 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Dec 2 21:44:19 2016 +0000 Makefile output so far commit 8580a61aa2fb6326b99f58cb2d0418a45d734054 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Dec 2 21:42:32 2016 +0000 Create sourcemaps during js uglification commit facdbbf81f4907ce394dcb5719b76451fd45e539 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Dec 2 21:40:48 2016 +0000 We can now uglify js files and compress all frontend assets commit 866c4fa0d70377f80061533989c4d8e6d00c818c Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Thu Dec 1 15:57:49 2016 +0000 A simple makefile
2016-12-05 11:07:22 +00:00
* 1.4.0
*
* Copyright(c) 2016 Gregory Jacobs <greg@greg-jacobs.com>
* MIT License
*
* https://github.com/gregjacobs/Autolinker.js
*/
Squashed commit of the following: commit bb79d80d284bf22ae17857b37630d3075635057e Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Mon Dec 5 11:06:53 2016 +0000 Update changelog regarding Makefile commit d74d0ac99da0b898d1a08ed270629bb00b492e34 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Dec 4 19:24:09 2016 +0000 make output commit 5c7ad5830ec881a5c22bd737cac1ec3430577eb3 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Dec 4 19:22:25 2016 +0000 Remove gulp commit 160947dcd346d3c0016a15fe3b64d6f194d33bfc Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Dec 4 19:10:57 2016 +0000 Updated fetch dependency commit 25b8f300d93c3e6e129c7ac6ab31e85c12cebc6a Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Dec 4 18:45:21 2016 +0000 Copy frontend assets into place commit 65b02a14e98215899efc4f5673953bdf23f4c942 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Sun Dec 4 18:40:28 2016 +0000 Add the target file for `sass`, and set the scss files as the prerequisits commit 7442df5040ac1459d5f088690390ef043f968852 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Dec 2 21:44:19 2016 +0000 Makefile output so far commit 8580a61aa2fb6326b99f58cb2d0418a45d734054 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Dec 2 21:42:32 2016 +0000 Create sourcemaps during js uglification commit facdbbf81f4907ce394dcb5719b76451fd45e539 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Dec 2 21:40:48 2016 +0000 We can now uglify js files and compress all frontend assets commit 866c4fa0d70377f80061533989c4d8e6d00c818c Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Thu Dec 1 15:57:49 2016 +0000 A simple makefile
2016-12-05 11:07:22 +00:00
!function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():t.Autolinker=e()}(this,function(){var t=function(e){e=e||{},this.version=t.version,this.urls=this.normalizeUrlsCfg(e.urls),this.email="boolean"!=typeof e.email||e.email,this.phone="boolean"!=typeof e.phone||e.phone,this.hashtag=e.hashtag||!1,this.mention=e.mention||!1,this.newWindow="boolean"!=typeof e.newWindow||e.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(e.stripPrefix),this.stripTrailingSlash="boolean"!=typeof e.stripTrailingSlash||e.stripTrailingSlash;var r=this.mention;if(r!==!1&&"twitter"!==r&&"instagram"!==r)throw new Error("invalid `mention` cfg - see docs");var a=this.hashtag;if(a!==!1&&"twitter"!==a&&"facebook"!==a&&"instagram"!==a)throw new Error("invalid `hashtag` cfg - see docs");this.truncate=this.normalizeTruncateCfg(e.truncate),this.className=e.className||"",this.replaceFn=e.replaceFn||null,this.context=e.context||this,this.htmlParser=null,this.matchers=null,this.tagBuilder=null};return t.link=function(e,r){var a=new t(r);return a.link(e)},t.parse=function(e,r){var a=new t(r);return a.parse(e)},t.version="1.4.0",t.prototype={constructor:t,normalizeUrlsCfg:function(t){return null==t&&(t=!0),"boolean"==typeof t?{schemeMatches:t,wwwMatches:t,tldMatches:t}:{schemeMatches:"boolean"!=typeof t.schemeMatches||t.schemeMatches,wwwMatches:"boolean"!=typeof t.wwwMatches||t.wwwMatches,tldMatches:"boolean"!=typeof t.tldMatches||t.tldMatches}},normalizeStripPrefixCfg:function(t){return null==t&&(t=!0),"boolean"==typeof t?{scheme:t,www:t}:{scheme:"boolean"!=typeof t.scheme||t.scheme,www:"boolean"!=typeof t.www||t.www}},normalizeTruncateCfg:function(e){return"number"==typeof e?{length:e,location:"end"}:t.Util.defaults(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})},parse:function(t){for(var e=this.getHtmlParser(),r=e.parse(t),a=0,n=[],i=0,s=r.length;i<s;i++){var o=r[i],c=o.getType();if("element"===c&&"a"===o.getTagName())o.isClosing()?a=Math.max(a-1,0):a++;else if("text"===c&&0===a){var h=this.parseText(o.getText(),o.getOffset());n.push.apply(n,h)}}return n=this.compactMatches(n),n=this.removeUnwantedMatches(n)},compactMatches:function(t){t.sort(function(t,e){return t.getOffset()-e.getOffset()});for(var e=0;e<t.length-1;e++)for(var r=t[e],a=r.getOffset()+r.getMatchedText().length;e+1<t.length&&t[e+1].getOffset()<=a;)t.splice(e+1,1);return t},removeUnwantedMatches:function(e){var r=t.Util.remove;return this.hashtag||r(e,function(t){return"hashtag"===t.getType()}),this.email||r(e,function(t){return"email"===t.getType()}),this.phone||r(e,function(t){return"phone"===t.getType()}),this.mention||r(e,function(t){return"mention"===t.getType()}),this.urls.schemeMatches||r(e,function(t){return"url"===t.getType()&&"scheme"===t.getUrlMatchType()}),this.urls.wwwMatches||r(e,function(t){return"url"===t.getType()&&"www"===t.getUrlMatchType()}),this.urls.tldMatches||r(e,function(t){return"url"===t.getType()&&"tld"===t.getUrlMatchType()}),e},parseText:function(t,e){e=e||0;for(var r=this.getMatchers(),a=[],n=0,i=r.length;n<i;n++){for(var s=r[n].parseMatches(t),o=0,c=s.length;o<c;o++)s[o].setOffset(e+s[o].getOffset());a.push.apply(a,s)}return a},link:function(t){if(!t)return"";for(var e=this.parse(t),r=[],a=0,n=0,i=e.length;n<i;n++){var s=e[n];r.push(t.substring(a,s.getOffset())),r.push(this.createMatchReturnVal(s)),a=s.getOffset()+s.getMatchedText().length}return r.push(t.substring(a)),r.join("")},createMatchReturnVal:function(e){var r;if(this.replaceFn&&(r=this.replaceFn.call(this.context,e)),"string"==typeof r)return r;if(r===!1)return e.getMatchedText();if(r instanceof t.HtmlTag)return r.toAnchorString();var a=e.buildTag();return a.toAnchorString()},getHtmlParser:function(){var e=this.htmlParser;return e||(e=this.htmlParser=new t.htmlParser.HtmlParser),e},getMatchers:function(){if(this.matchers)return this.matchers;var e=t.matcher,r=this.getTagBuilder(),a=[new e.Hashtag({tagBuilder:r,serviceName:this.hashtag}),new e.Email({tagBuilder:r}),new e.Phone({tagBuilder:r}),new e.Mention({tagBuilder:r,serviceName:t