Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Merge pull request #35 from twitter/https
Browse files Browse the repository at this point in the history
Use HTTPS URLs to point at twitter domains.
  • Loading branch information
Keita Fujii committed Jan 31, 2012
2 parents 787d572 + 3eeb911 commit 742baa0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions test/tests.js
Expand Up @@ -10,7 +10,7 @@ test("twttr.txt.htmlEscape", function() {
["&<>\"", "&amp;&lt;&gt;&quot;"],
["<div>", "&lt;div&gt;"],
["a&b", "a&amp;b"],
["<a href=\"http://twitter.com\" target=\"_blank\">twitter & friends</a>", "&lt;a href=&quot;http://twitter.com&quot; target=&quot;_blank&quot;&gt;twitter &amp; friends&lt;/a&gt;"],
["<a href=\"https://twitter.com\" target=\"_blank\">twitter & friends</a>", "&lt;a href=&quot;https://twitter.com&quot; target=&quot;_blank&quot;&gt;twitter &amp; friends&lt;/a&gt;"],
["&amp;", "&amp;amp;"],
[undefined, undefined, "calling with undefined will return input"]
];
Expand Down Expand Up @@ -39,7 +39,7 @@ test("twttr.txt.autolink", function() {
ok(twttr.txt.autoLink("@tw", { at: "!" }).match(/!<a[^>]+>tw<\/a>/), "Override at");
ok(twttr.txt.autoLink("@tw", { preChunk: "<b>" }).match(/@<a[^>]+><b>tw<\/a>/), "Override preChunk");
ok(twttr.txt.autoLink("@tw", { postChunk: "</b>" }).match(/@<a[^>]+>tw<\/b><\/a>/), "Override postChunk");
ok(twttr.txt.autoLink("@tw", { usernameIncludeSymbol: true }) == "<a class=\"tweet-url username\" data-screen-name=\"tw\" href=\"http://twitter.com/tw\" rel=\"nofollow\">@tw</a>",
ok(twttr.txt.autoLink("@tw", { usernameIncludeSymbol: true }) == "<a class=\"tweet-url username\" data-screen-name=\"tw\" href=\"https://twitter.com/tw\" rel=\"nofollow\">@tw</a>",
"Include @ in the autolinked username");
ok(!twttr.txt.autoLink("foo http://example.com", { usernameClass: 'custom-user' }).match(/custom-user/), "Override usernameClass should not be applied to URL");

Expand All @@ -48,7 +48,7 @@ test("twttr.txt.autolink", function() {
ok(twttr.txt.autoLink("@tw/somelist", { at: "!" }).match(/!<a[^>]+>tw\/somelist<\/a>/), "Override list at");
ok(twttr.txt.autoLink("@tw/somelist", { preChunk: "<b>" }).match(/@<a[^>]+><b>tw\/somelist<\/a>/), "Override list preChunk");
ok(twttr.txt.autoLink("@tw/somelist", { postChunk: "</b>" }).match(/@<a[^>]+>tw\/somelist<\/b><\/a>/), "Override list postChunk");
ok(twttr.txt.autoLink("@tw/somelist", { usernameIncludeSymbol: true }) == "<a class=\"tweet-url list-slug\" href=\"http://twitter.com/tw/somelist\" rel=\"nofollow\">@tw/somelist</a>",
ok(twttr.txt.autoLink("@tw/somelist", { usernameIncludeSymbol: true }) == "<a class=\"tweet-url list-slug\" href=\"https://twitter.com/tw/somelist\" rel=\"nofollow\">@tw/somelist</a>",
"Include @ in the autolinked list");
ok(twttr.txt.autoLink("foo @tw/somelist", { listClass: 'custom-list' }).match(/custom-list/), "Override listClass");
ok(!twttr.txt.autoLink("foo @tw/somelist", { usernameClass: 'custom-user' }).match(/custom-user/), "Override usernameClass should not be applied to a List");
Expand Down
2 changes: 1 addition & 1 deletion test/twitter-text-conformance
Submodule twitter-text-conformance updated from 89a01e to 9ca1db
6 changes: 3 additions & 3 deletions twitter-text.js
Expand Up @@ -325,8 +325,8 @@ if (!window.twttr) {
options.urlClass = options.urlClass || DEFAULT_URL_CLASS;
options.listClass = options.listClass || DEFAULT_LIST_CLASS;
options.usernameClass = options.usernameClass || DEFAULT_USERNAME_CLASS;
options.usernameUrlBase = options.usernameUrlBase || "http://twitter.com/";
options.listUrlBase = options.listUrlBase || "http://twitter.com/";
options.usernameUrlBase = options.usernameUrlBase || "https://twitter.com/";
options.listUrlBase = options.listUrlBase || "https://twitter.com/";
if (!options.suppressNoFollow) {
var extraHtml = HTML_ATTR_NO_FOLLOW;
}
Expand Down Expand Up @@ -390,7 +390,7 @@ if (!window.twttr) {
options = clone(options || {});
options.urlClass = options.urlClass || DEFAULT_URL_CLASS;
options.hashtagClass = options.hashtagClass || DEFAULT_HASHTAG_CLASS;
options.hashtagUrlBase = options.hashtagUrlBase || "http://twitter.com/#!/search?q=%23";
options.hashtagUrlBase = options.hashtagUrlBase || "https://twitter.com/#!/search?q=%23";
if (!options.suppressNoFollow) {
var extraHtml = HTML_ATTR_NO_FOLLOW;
}
Expand Down

0 comments on commit 742baa0

Please sign in to comment.