Skip to content

Commit

Permalink
Build with instagram support for hashtags
Browse files Browse the repository at this point in the history
  • Loading branch information
gregjacobs committed Oct 18, 2015
1 parent 3c09a24 commit 8b1b68c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion dist/Autolinker.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ var Autolinker = function( cfg ) {

// Validate the value of the `hashtag` cfg.
var hashtag = this.hashtag;
if( hashtag !== false && hashtag !== 'twitter' && hashtag !== 'facebook' ) {
if( hashtag !== false && hashtag !== 'twitter' && hashtag !== 'facebook' && hashtag !== 'instagram' ) {
throw new Error( "invalid `hashtag` cfg - see docs" );
}
};
Expand Down Expand Up @@ -178,6 +178,7 @@ Autolinker.prototype = {
*
* - 'twitter'
* - 'facebook'
* - 'instagram'
*
* Pass `false` to skip auto-linking of hashtags.
*/
Expand Down Expand Up @@ -2510,6 +2511,8 @@ Autolinker.match.Hashtag = Autolinker.Util.extend( Autolinker.match.Match, {
return 'https://twitter.com/hashtag/' + hashtag;
case 'facebook' :
return 'https://www.facebook.com/hashtag/' + hashtag;
case 'instagram' :
return 'https://instagram.com/explore/tags/' + hashtag;

default : // Shouldn't happen because Autolinker's constructor should block any invalid values, but just in case.
throw new Error( 'Unknown service name to point hashtag to: ', serviceName );
Expand All @@ -2527,6 +2530,7 @@ Autolinker.match.Hashtag = Autolinker.Util.extend( Autolinker.match.Match, {
}

} );

/*global Autolinker */
/**
* @class Autolinker.match.Phone
Expand Down
Loading

0 comments on commit 8b1b68c

Please sign in to comment.