Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added rtl class to hashtags

  • Loading branch information...
commit 83fc3855f927f8763b4d2dd2561e91f723875066 1 parent 28af87b
@esten esten authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 twitter-text.js
View
4 twitter-text.js
@@ -105,6 +105,7 @@ if (typeof twttr === "undefined" || twttr === null) {
twttr.txt.regexen.spaces = regexSupplant("[" + UNICODE_SPACES.join("") + "]");
twttr.txt.regexen.invalid_chars_group = regexSupplant(INVALID_CHARS.join(""));
twttr.txt.regexen.punct = /\!'#%&'\(\)*\+,\\\-\.\/:;<=>\?@\[\]\^_{|}~\$/;
+ twttr.txt.regexen.rtl_chars = /[\u0600-\u06FF]|[\u0750-\u077F]|[\u0590-\u05FF]|[\uFE70-\uFEFF]/mg;
var nonLatinHashtagChars = [];
// Cyrillic
@@ -449,6 +450,9 @@ if (typeof twttr === "undefined" || twttr === null) {
attrs.href = options.hashtagUrlBase + hashtag;
attrs.title = "#" + hashtag;
attrs["class"] = options.hashtagClass;
+ if (hashtag[0].match(twttr.txt.regexen.rtl_chars)){
+ attrs["class"] += " rtl";
+ }
return twttr.txt.linkToTextWithSymbol(entity, hash, hashtag, attrs, options);
};
Please sign in to comment.
Something went wrong with that request. Please try again.