Skip to content

Commit 0b47d8f

Browse files
committed
add soundcloud to comments and readme for mentions
1 parent b257809 commit 0b47d8f

File tree

6 files changed

+23
-18
lines changed

6 files changed

+23
-18
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ So, this utility attempts to handle everything. It:
1414
- Will properly handle URLs with query parameters or a named anchor (i.e. hash)
1515
- Will autolink email addresses.
1616
- Will autolink phone numbers.
17-
- Will autolink mentions (Twitter, Instagram).
17+
- Will autolink mentions (Twitter, Instagram, Soundcloud).
1818
- Will autolink hashtags.
1919
- Will properly handle HTML input. The utility will not change the `href`
2020
attribute inside anchor (<a>) tags (or any other tag/attribute),
@@ -29,8 +29,7 @@ Live Example: [http://gregjacobs.github.io/Autolinker.js/examples/live-example/]
2929

3030
## v1.0 released. Breaking Changes from 0.x -> 1.x
3131

32-
1. `twitter` option removed, replaced with `mention` (which accepts 'twitter'
33-
and 'instagram' values)
32+
1. `twitter` option removed, replaced with `mention` (which accepts 'twitter', 'instagram' and 'soundcloud' values)
3433
2. Matching mentions (previously the `twitter` option) now defaults to
3534
being turned off. Previously, Twitter handle matching was on by
3635
default.
@@ -147,7 +146,7 @@ providing an Object as the second parameter to [Autolinker.link()](http://gregja
147146
phone numbers. Defaults to `true`.<br /><br />
148147
- [mention](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-mention) : String<br />
149148
A string for the service name to have mentions (@username) auto-linked to. Supported
150-
values at this time are 'twitter', and 'instagram'. Pass `false` to skip
149+
values at this time are 'twitter', 'soundcloud' and 'instagram'. Pass `false` to skip
151150
auto-linking of mentions. Defaults to `false`.<br /><br />
152151
- [hashtag](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-hashtag) : Boolean/String<br />
153152
A string for the service name to have hashtags auto-linked to. Supported

dist/Autolinker.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@
5353
*
5454
* If the configuration options do not provide enough flexibility, a {@link #replaceFn}
5555
* may be provided to fully customize the output of Autolinker. This function is
56-
* called once for each URL/Email/Phone#/Hashtag/Mention (Twitter, Instagram)
56+
* called once for each URL/Email/Phone#/Hashtag/Mention (Twitter, Instagram, Soundcloud)
5757
* match that is encountered.
5858
*
5959
* For example:
6060
*
61-
* var input = "..."; // string with URLs, Email Addresses, Phone #s, Hashtags, and Mentions (Twitter, Instagram)
61+
* var input = "..."; // string with URLs, Email Addresses, Phone #s, Hashtags, and Mentions (Twitter, Instagram, Soundcloud)
6262
*
6363
* var linkedText = Autolinker.link( input, {
6464
* replaceFn : function( match ) {
@@ -318,6 +318,7 @@ Autolinker.prototype = {
318318
*
319319
* - 'twitter'
320320
* - 'instagram'
321+
* - 'soundcloud'
321322
*
322323
* Defaults to `false` to skip auto-linking of mentions.
323324
*/
@@ -444,7 +445,7 @@ Autolinker.prototype = {
444445
* - Phone links will have the CSS classes: "myLink myLink-phone"
445446
* - Hashtag links will have the CSS classes: "myLink myLink-hashtag"
446447
* - Mention links will have the CSS classes: "myLink myLink-mention myLink-[type]"
447-
* where [type] is either "instagram" or "twitter"
448+
* where [type] is either "instagram", "twitter" or "soundcloud"
448449
*/
449450

450451
/**
@@ -772,7 +773,7 @@ Autolinker.prototype = {
772773

773774
/**
774775
* Automatically links URLs, Email addresses, Phone numbers, Hashtags,
775-
* and Mentions (Twitter, Instagram) found in the given chunk of HTML. Does not link
776+
* and Mentions (Twitter, Instagram, Soundcloud) found in the given chunk of HTML. Does not link
776777
* URLs found within HTML tags.
777778
*
778779
* For instance, if given the text: `You should go to http://www.yahoo.com`,
@@ -2342,7 +2343,7 @@ Autolinker.htmlParser.TextNode = Autolinker.Util.extend( Autolinker.htmlParser.H
23422343
*
23432344
* For example:
23442345
*
2345-
* var input = "..."; // string with URLs, Email Addresses, and Mentions (Twitter, Instagram)
2346+
* var input = "..."; // string with URLs, Email Addresses, and Mentions (Twitter, Instagram, Soundcloud)
23462347
*
23472348
* var linkedText = Autolinker.link( input, {
23482349
* replaceFn : function( match ) {
@@ -2850,7 +2851,7 @@ Autolinker.match.Mention = Autolinker.Util.extend( Autolinker.match.Match, {
28502851

28512852
/**
28522853
* Returns the configured {@link #serviceName} to point the mention to.
2853-
* Ex: 'instagram', 'twitter'.
2854+
* Ex: 'instagram', 'twitter', 'soundcloud'.
28542855
*
28552856
* @return {String}
28562857
*/
@@ -2870,6 +2871,8 @@ Autolinker.match.Mention = Autolinker.Util.extend( Autolinker.match.Match, {
28702871
return 'https://twitter.com/' + this.mention;
28712872
case 'instagram' :
28722873
return 'https://instagram.com/' + this.mention;
2874+
case 'soundcloud' :
2875+
return 'https://soundcloud.com/' + this.mention;
28732876

28742877
default : // Shouldn't happen because Autolinker's constructor should block any invalid values, but just in case.
28752878
throw new Error( 'Unknown service name to point mention to: ', this.serviceName );

dist/Autolinker.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Autolinker.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
*
3636
* If the configuration options do not provide enough flexibility, a {@link #replaceFn}
3737
* may be provided to fully customize the output of Autolinker. This function is
38-
* called once for each URL/Email/Phone#/Hashtag/Mention (Twitter, Instagram)
38+
* called once for each URL/Email/Phone#/Hashtag/Mention (Twitter, Instagram, Soundcloud)
3939
* match that is encountered.
4040
*
4141
* For example:
4242
*
43-
* var input = "..."; // string with URLs, Email Addresses, Phone #s, Hashtags, and Mentions (Twitter, Instagram)
43+
* var input = "..."; // string with URLs, Email Addresses, Phone #s, Hashtags, and Mentions (Twitter, Instagram, Soundcloud)
4444
*
4545
* var linkedText = Autolinker.link( input, {
4646
* replaceFn : function( match ) {
@@ -300,6 +300,7 @@ Autolinker.prototype = {
300300
*
301301
* - 'twitter'
302302
* - 'instagram'
303+
* - 'soundcloud'
303304
*
304305
* Defaults to `false` to skip auto-linking of mentions.
305306
*/
@@ -426,7 +427,7 @@ Autolinker.prototype = {
426427
* - Phone links will have the CSS classes: "myLink myLink-phone"
427428
* - Hashtag links will have the CSS classes: "myLink myLink-hashtag"
428429
* - Mention links will have the CSS classes: "myLink myLink-mention myLink-[type]"
429-
* where [type] is either "instagram" or "twitter"
430+
* where [type] is either "instagram", "twitter" or "soundcloud"
430431
*/
431432

432433
/**
@@ -754,7 +755,7 @@ Autolinker.prototype = {
754755

755756
/**
756757
* Automatically links URLs, Email addresses, Phone numbers, Hashtags,
757-
* and Mentions (Twitter, Instagram) found in the given chunk of HTML. Does not link
758+
* and Mentions (Twitter, Instagram, Soundcloud) found in the given chunk of HTML. Does not link
758759
* URLs found within HTML tags.
759760
*
760761
* For instance, if given the text: `You should go to http://www.yahoo.com`,

src/match/Match.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* For example:
1010
*
11-
* var input = "..."; // string with URLs, Email Addresses, and Mentions (Twitter, Instagram)
11+
* var input = "..."; // string with URLs, Email Addresses, and Mentions (Twitter, Instagram, Soundcloud)
1212
*
1313
* var linkedText = Autolinker.link( input, {
1414
* replaceFn : function( match ) {

src/match/Mention.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Autolinker.match.Mention = Autolinker.Util.extend( Autolinker.match.Match, {
6363

6464
/**
6565
* Returns the configured {@link #serviceName} to point the mention to.
66-
* Ex: 'instagram', 'twitter'.
66+
* Ex: 'instagram', 'twitter', 'soundcloud'.
6767
*
6868
* @return {String}
6969
*/
@@ -83,6 +83,8 @@ Autolinker.match.Mention = Autolinker.Util.extend( Autolinker.match.Match, {
8383
return 'https://twitter.com/' + this.mention;
8484
case 'instagram' :
8585
return 'https://instagram.com/' + this.mention;
86+
case 'soundcloud' :
87+
return 'https://soundcloud.com/' + this.mention;
8688

8789
default : // Shouldn't happen because Autolinker's constructor should block any invalid values, but just in case.
8890
throw new Error( 'Unknown service name to point mention to: ', this.serviceName );

0 commit comments

Comments
 (0)