Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
tweetparser.js
Advanced tools
Readme
tweetParser.js Parse elements containing a tweets and turn URLS, @users & #hashtags into working urls
tweetParser is also available as a Django Template Filter
Parameters | Type | default | description |
---|---|---|---|
urlClass | String | tweet_link | css Class used for url in the tweet |
userClass | String | tweet_user | css Class used for @user profil url in the tweet |
hashtagClass | String | hashtag | css Class used for hashtags url in the tweet |
target | HTML attribute for anchor tags | _blank | target used for all generated |
searchWithHashtags | Boolean | true | generate hashtag link, if true : "twitter.com/hashtag/", if false : "twitter.com/search?q=" |
ParseUsers | Boolean | true | will parse @users if is set to true |
parseUrls | Boolean | true | will parse URLS if is set to true |
parseHashtags | Boolean | true | will parse hashtags if is set to true |
if you want to use bower just type :
bower install tweetparser.js
npm install --save-dev tweetparser.js
<script src="js/tweetParser.min.js"></script>
<p class="tweet">This is my awesome text only tweet ! #web #twitter @twitter http://www.twitter.com/ !!</p>
//basic usage
tweetParser('.tweet');
//With Default parameters
tweetParser('.tweet', {
urlClass : "tweet_link", //this is default
userClass : "tweet_user", //this is default
hashtagClass : "hashtag", //this is default
target : "_blank", //this is default
searchWithHashtags : true //this is default
parseUsers : true,
parseHashtags : true,
parseUrls : true
});
// Note that '.tweet' is your own CSS selector
<script src="path/to/jquery.min.js"></script>
<script src="path/to/tweetParser.js"></script>
and call tweetParser like in v1 :
$([SELECTOR]).tweetParser([PARAMETERS]);
you can customize your tweet with css classes used in parameters
v2.2.0
v2.1.3
v2.1.2
v2.1.1
v2.1.0
<!-- To use it with jQuery : add tweetParser.js and jquery.tweetParser.js -->
<script src="dist/tweetParser.js"></script>
<script src="dev/jquery.tweetParser.js"></script>
and call tweetParser like in v1 :
$([SELECTOR]).tweetParser([PARAMETERS]);
It is always easier to use it without jQuery just don't add jquery.tweetParser.js and :
tweetParser([SELECTOR], [PARAMETERS]);
v2.0.2
v2.0.1
v2.0.0
NB : For you, there is just some small changes in the syntax to call tweetParser.
use
tweetParser([SELECTOR], [PARAMETERS]);
instead of :
$([SELECTOR]).tweetParser([PARAMETERS]);
v1.3.1
v1.3.0
v1.2.1
v1.2.0
v1.1.0
searchWithHashtags parameter added
You can now choose where hashtags links will point to.
when searchWithHastags = true (default), tweetParser will generate the following link for each hashtags : "twitter.com/hashtag/THE_HASHTAG".
if you set it to false, the link will be : "twitter.com/search?q=THE_HASHTAG"
code optimisation, remove useless var.
v1.0.0
Initial Version
FAQs
Small javascript library that parse an element containing a tweet and turn URLS, @user & #hashtags into working urls
The npm package tweetparser.js receives a total of 0 weekly downloads. As such, tweetparser.js popularity was classified as not popular.
We found that tweetparser.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.